Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1312105

[RFC PATCH 2/3] mmc: pwrseq_emmc: add to_pwrseq_emmc() macro

From Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Newsgroups linux.kernel
Subject [RFC PATCH 2/3] mmc: pwrseq_emmc: add to_pwrseq_emmc() macro
Date 2016-01-19 12:00 +0100
Message-ID <qSCb0-6Bn-5@gated-at.bofh.it> (permalink)
References <qSCb0-6Bn-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


This patch adds to_pwrseq_emmc() macro to make the code more readable.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 drivers/mmc/core/pwrseq_emmc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/core/pwrseq_emmc.c b/drivers/mmc/core/pwrseq_emmc.c
index ad4f94e..7978fb7 100644
--- a/drivers/mmc/core/pwrseq_emmc.c
+++ b/drivers/mmc/core/pwrseq_emmc.c
@@ -25,6 +25,8 @@ struct mmc_pwrseq_emmc {
 	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)
 {
 	gpiod_set_value(pwrseq->reset_gpio, 1);
@@ -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)
 {
-	struct mmc_pwrseq_emmc *pwrseq = container_of(host->pwrseq,
-					struct mmc_pwrseq_emmc, pwrseq);
+	struct mmc_pwrseq_emmc *pwrseq =  to_pwrseq_emmc(host->pwrseq);
 
 	__mmc_pwrseq_emmc_reset(pwrseq);
 }
 
 static void mmc_pwrseq_emmc_free(struct mmc_host *host)
 {
-	struct mmc_pwrseq_emmc *pwrseq = container_of(host->pwrseq,
-					struct mmc_pwrseq_emmc, pwrseq);
+	struct mmc_pwrseq_emmc *pwrseq =  to_pwrseq_emmc(host->pwrseq);
 
 	unregister_restart_handler(&pwrseq->reset_nb);
 	gpiod_put(pwrseq->reset_gpio);
-- 
1.9.1

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC PATCH 0/3] mmc: pwrseq: convert to proper driver Srinivas Kandagatla <srinivas.kandagatla@linaro.org> - 2016-01-19 12:00 +0100
  [RFC PATCH 2/3] mmc: pwrseq_emmc: add to_pwrseq_emmc() macro Srinivas Kandagatla <srinivas.kandagatla@linaro.org> - 2016-01-19 12:00 +0100
  [RFC PATCH 1/3] mmc: pwrseq_simple: add to_pwrseq_simple() macro Srinivas Kandagatla <srinivas.kandagatla@linaro.org> - 2016-01-19 12:00 +0100
  [RFC PATCH 3/3] mmc: pwrseq: convert to proper platform device Srinivas Kandagatla <srinivas.kandagatla@linaro.org> - 2016-01-19 12:00 +0100
    Re: [RFC PATCH 3/3] mmc: pwrseq: convert to proper platform device Ulf Hansson <ulf.hansson@linaro.org> - 2016-01-19 14:10 +0100
      Re: [RFC PATCH 3/3] mmc: pwrseq: convert to proper platform device Srinivas Kandagatla <srinivas.kandagatla@linaro.org> - 2016-01-19 15:10 +0100

csiph-web