Commit f01b72d0 authored by Srinivas Kandagatla's avatar Srinivas Kandagatla Committed by Ulf Hansson

mmc: pwrseq_emmc: add to_pwrseq_emmc() macro

This patch adds to_pwrseq_emmc() macro to make the code more readable.
Signed-off-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent 5b96fea7
...@@ -25,6 +25,8 @@ struct mmc_pwrseq_emmc { ...@@ -25,6 +25,8 @@ struct mmc_pwrseq_emmc {
struct gpio_desc *reset_gpio; struct gpio_desc *reset_gpio;
}; };
#define to_pwrseq_emmc(p) container_of(p, struct mmc_pwrseq_emmc, pwrseq)
static void __mmc_pwrseq_emmc_reset(struct mmc_pwrseq_emmc *pwrseq) static void __mmc_pwrseq_emmc_reset(struct mmc_pwrseq_emmc *pwrseq)
{ {
gpiod_set_value(pwrseq->reset_gpio, 1); gpiod_set_value(pwrseq->reset_gpio, 1);
...@@ -35,16 +37,14 @@ static void __mmc_pwrseq_emmc_reset(struct mmc_pwrseq_emmc *pwrseq) ...@@ -35,16 +37,14 @@ static void __mmc_pwrseq_emmc_reset(struct mmc_pwrseq_emmc *pwrseq)
static void mmc_pwrseq_emmc_reset(struct mmc_host *host) static void mmc_pwrseq_emmc_reset(struct mmc_host *host)
{ {
struct mmc_pwrseq_emmc *pwrseq = container_of(host->pwrseq, struct mmc_pwrseq_emmc *pwrseq = to_pwrseq_emmc(host->pwrseq);
struct mmc_pwrseq_emmc, pwrseq);
__mmc_pwrseq_emmc_reset(pwrseq); __mmc_pwrseq_emmc_reset(pwrseq);
} }
static void mmc_pwrseq_emmc_free(struct mmc_host *host) static void mmc_pwrseq_emmc_free(struct mmc_host *host)
{ {
struct mmc_pwrseq_emmc *pwrseq = container_of(host->pwrseq, struct mmc_pwrseq_emmc *pwrseq = to_pwrseq_emmc(host->pwrseq);
struct mmc_pwrseq_emmc, pwrseq);
unregister_restart_handler(&pwrseq->reset_nb); unregister_restart_handler(&pwrseq->reset_nb);
gpiod_put(pwrseq->reset_gpio); gpiod_put(pwrseq->reset_gpio);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment