mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-15 16:24:13 +08:00
0f12a0ce4c
The alloc() and free() hooks required each pwrseq implementation to set host->pwrseq themselves. This is error-prone and could be done at a higher level if alloc() was changed to return a pointer to a struct mmc_pwrseq instead of an error code. This patch performs this change and moves the burden of maintaining host->pwrseq from the power sequence hooks to the pwrseq code. Signed-off-by: Alexandre Courbot <acourbot@nvidia.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
46 lines
1.2 KiB
C
46 lines
1.2 KiB
C
/*
|
|
* Copyright (C) 2014 Linaro Ltd
|
|
*
|
|
* Author: Ulf Hansson <ulf.hansson@linaro.org>
|
|
*
|
|
* License terms: GNU General Public License (GPL) version 2
|
|
*/
|
|
#ifndef _MMC_CORE_PWRSEQ_H
|
|
#define _MMC_CORE_PWRSEQ_H
|
|
|
|
struct mmc_pwrseq_ops {
|
|
void (*pre_power_on)(struct mmc_host *host);
|
|
void (*post_power_on)(struct mmc_host *host);
|
|
void (*power_off)(struct mmc_host *host);
|
|
void (*free)(struct mmc_host *host);
|
|
};
|
|
|
|
struct mmc_pwrseq {
|
|
struct mmc_pwrseq_ops *ops;
|
|
};
|
|
|
|
#ifdef CONFIG_OF
|
|
|
|
int mmc_pwrseq_alloc(struct mmc_host *host);
|
|
void mmc_pwrseq_pre_power_on(struct mmc_host *host);
|
|
void mmc_pwrseq_post_power_on(struct mmc_host *host);
|
|
void mmc_pwrseq_power_off(struct mmc_host *host);
|
|
void mmc_pwrseq_free(struct mmc_host *host);
|
|
|
|
struct mmc_pwrseq *mmc_pwrseq_simple_alloc(struct mmc_host *host,
|
|
struct device *dev);
|
|
struct mmc_pwrseq *mmc_pwrseq_emmc_alloc(struct mmc_host *host,
|
|
struct device *dev);
|
|
|
|
#else
|
|
|
|
static inline int mmc_pwrseq_alloc(struct mmc_host *host) { return 0; }
|
|
static inline void mmc_pwrseq_pre_power_on(struct mmc_host *host) {}
|
|
static inline void mmc_pwrseq_post_power_on(struct mmc_host *host) {}
|
|
static inline void mmc_pwrseq_power_off(struct mmc_host *host) {}
|
|
static inline void mmc_pwrseq_free(struct mmc_host *host) {}
|
|
|
|
#endif
|
|
|
|
#endif
|