[PATCH 07/14] mmc: bcm2835: Use local ptr to make code more compact
Stefan Wahren
stefan.wahren at i2se.com
Sat Jan 7 04:51:07 PST 2017
Signed-off-by: Stefan Wahren <stefan.wahren at i2se.com>
---
drivers/mmc/host/bcm2835.c | 37 +++++++++++++++++++------------------
1 file changed, 19 insertions(+), 18 deletions(-)
diff --git a/drivers/mmc/host/bcm2835.c b/drivers/mmc/host/bcm2835.c
index b8ef0b3..142f929 100644
--- a/drivers/mmc/host/bcm2835.c
+++ b/drivers/mmc/host/bcm2835.c
@@ -201,18 +201,19 @@ static void bcm2835_dumpcmd(struct bcm2835_host *host,
static void bcm2835_dumpregs(struct bcm2835_host *host)
{
+ struct mmc_request *mrq = host->mrq;
struct device *dev = &host->pdev->dev;
- if (host->mrq) {
- bcm2835_dumpcmd(host, host->mrq->sbc, "sbc");
- bcm2835_dumpcmd(host, host->mrq->cmd, "cmd");
- if (host->mrq->data) {
+ if (mrq) {
+ bcm2835_dumpcmd(host, mrq->sbc, "sbc");
+ bcm2835_dumpcmd(host, mrq->cmd, "cmd");
+ if (mrq->data) {
dev_dbg(dev, "data blocks %x blksz %x - err %d\n",
- host->mrq->data->blocks,
- host->mrq->data->blksz,
- host->mrq->data->error);
+ mrq->data->blocks,
+ mrq->data->blksz,
+ mrq->data->error);
}
- bcm2835_dumpcmd(host, host->mrq->stop, "stop");
+ bcm2835_dumpcmd(host, mrq->stop, "stop");
}
dev_dbg(dev, "=========== REGISTER DUMP ===========\n");
@@ -768,6 +769,7 @@ static void bcm2835_finish_command(struct bcm2835_host *host,
unsigned long *irq_flags)
{
struct device *dev = &host->pdev->dev;
+ struct mmc_command *cmd = host->cmd;
u32 sdcmd;
u32 retries;
@@ -862,26 +864,25 @@ static void bcm2835_finish_command(struct bcm2835_host *host,
}
}
- if (host->cmd->flags & MMC_RSP_PRESENT) {
- if (host->cmd->flags & MMC_RSP_136) {
+ if (cmd->flags & MMC_RSP_PRESENT) {
+ if (cmd->flags & MMC_RSP_136) {
int i;
for (i = 0; i < 4; i++) {
- host->cmd->resp[3 - i] =
+ cmd->resp[3 - i] =
readl(host->ioaddr + SDRSP0 + i * 4);
}
dev_dbg(dev, "finish_command %08x %08x %08x %08x\n",
- host->cmd->resp[0], host->cmd->resp[1],
- host->cmd->resp[2], host->cmd->resp[3]);
+ cmd->resp[0], cmd->resp[1],
+ cmd->resp[2], cmd->resp[3]);
} else {
- host->cmd->resp[0] = readl(host->ioaddr + SDRSP0);
- dev_dbg(dev, "finish_command %08x\n",
- host->cmd->resp[0]);
+ cmd->resp[0] = readl(host->ioaddr + SDRSP0);
+ dev_dbg(dev, "finish_command %08x\n", cmd->resp[0]);
}
}
- if (host->cmd == host->mrq->sbc) {
+ if (cmd == host->mrq->sbc) {
/* Finished CMD23, now send actual command. */
host->cmd = NULL;
if (bcm2835_send_command(host, host->mrq->cmd)) {
@@ -894,7 +895,7 @@ static void bcm2835_finish_command(struct bcm2835_host *host,
if (!host->use_busy)
bcm2835_finish_command(host, NULL);
}
- } else if (host->cmd == host->mrq->stop) {
+ } else if (cmd == host->mrq->stop) {
/* Finished CMD12 */
tasklet_schedule(&host->finish_tasklet);
} else {
--
1.7.9.5
More information about the linux-rpi-kernel
mailing list