[PATCH 05/14] mmc: bcm2835: Avoid separate init statement

Stefan Wahren stefan.wahren at i2se.com
Sat Jan 7 04:51:05 PST 2017


Signed-off-by: Stefan Wahren <stefan.wahren at i2se.com>
---
 drivers/mmc/host/bcm2835.c |   16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/drivers/mmc/host/bcm2835.c b/drivers/mmc/host/bcm2835.c
index d87116f..ac64b69 100644
--- a/drivers/mmc/host/bcm2835.c
+++ b/drivers/mmc/host/bcm2835.c
@@ -926,11 +926,9 @@ static void bcm2835_finish_command(struct bcm2835_host *host,
 
 static void bcm2835_timeout(unsigned long data)
 {
-	struct bcm2835_host *host;
+	struct bcm2835_host *host = (struct bcm2835_host *)data;
 	unsigned long flags;
 
-	host = (struct bcm2835_host *)data;
-
 	spin_lock_irqsave(&host->lock, flags);
 
 	if (host->mrq) {
@@ -1172,12 +1170,10 @@ void bcm2835_set_clock(struct bcm2835_host *host, unsigned int clock)
 static void bcm2835_request(struct mmc_host *mmc,
 			    struct mmc_request *mrq)
 {
-	struct bcm2835_host *host;
+	struct bcm2835_host *host = mmc_priv(mmc);
 	unsigned long flags;
 	u32 edm, fsm;
 
-	host = mmc_priv(mmc);
-
 	/* Reset the error statuses in case this is a retry */
 	if (mrq->sbc)
 		mrq->sbc->error = 0;
@@ -1297,13 +1293,11 @@ static void bcm2835_cmd_wait_work(struct work_struct *work)
 
 static void bcm2835_tasklet_finish(unsigned long param)
 {
-	struct bcm2835_host *host;
+	struct bcm2835_host *host = (struct bcm2835_host *)param;
 	unsigned long flags;
 	struct mmc_request *mrq;
 	struct dma_chan *terminate_chan = NULL;
 
-	host = (struct bcm2835_host *)param;
-
 	spin_lock_irqsave(&host->lock, flags);
 
 	/* If this tasklet gets rescheduled while running, it will
@@ -1341,13 +1335,11 @@ static void bcm2835_tasklet_finish(unsigned long param)
 
 int bcm2835_add_host(struct bcm2835_host *host)
 {
-	struct mmc_host *mmc;
+	struct mmc_host *mmc = host->mmc;
 	struct dma_slave_config cfg;
 	char pio_limit_string[20];
 	int ret;
 
-	mmc = host->mmc;
-
 	bcm2835_reset_internal(host);
 
 	mmc->f_max = host->max_clk;
-- 
1.7.9.5




More information about the linux-rpi-kernel mailing list