It's cleaner to have ifdef's consolidated in one specific
area. This change pulls adds one ifdef which will swap
out of the function with a stub function if the ifdef is
false.
Signed-off-by: Daniel Walker <dwalker@codeaurora.org>
---
drivers/mmc/host/msm_sdcc.c | 24 +++++++++++++-----------
1 files changed, 13 insertions(+), 11 deletions(-)
diff --git a/drivers/mmc/host/msm_sdcc.c b/drivers/mmc/host/msm_sdcc.c
index 1290d14..d6ac82c 100644
--- a/drivers/mmc/host/msm_sdcc.c
+++ b/drivers/mmc/host/msm_sdcc.c
@@ -61,7 +61,7 @@ static unsigned int msmsdcc_sdioirq;
#define PIO_SPINMAX 30
#define CMD_SPINMAX 20
-
+#ifdef BUSCLK_PWRSAVE
static inline void
msmsdcc_disable_clocks(struct msmsdcc_host *host, int deferr)
{
@@ -83,6 +83,10 @@ msmsdcc_disable_clocks(struct msmsdcc_host *host, int deferr)
}
}
}
+#else
+static inline void
+msmsdcc_disable_clocks(struct msmsdcc_host *host, int deferr) { }
+#endif
static inline int
msmsdcc_enable_clocks(struct msmsdcc_host *host)
@@ -139,9 +143,8 @@ msmsdcc_request_end(struct msmsdcc_host *host, struct mmc_request *mrq)
if (mrq->cmd->error == -ETIMEDOUT)
mdelay(5);
-#if BUSCLK_PWRSAVE
msmsdcc_disable_clocks(host, 1);
-#endif
+
/*
* Need to drop the host lock here; mmc_request_done may call
* back into the driver...
@@ -259,9 +262,9 @@ msmsdcc_dma_complete_func(struct msm_dmov_cmd *cmd,
mrq->data->bytes_xfered = host->curr.data_xfered;
spin_unlock_irqrestore(&host->lock, flags);
-#if BUSCLK_PWRSAVE
+
msmsdcc_disable_clocks(host, 1);
-#endif
+
mmc_request_done(host->mmc, mrq);
return;
} else
@@ -930,9 +933,9 @@ msmsdcc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
host->pwr = pwr;
msmsdcc_writel(host, pwr, MMCIPOWER);
}
-#if BUSCLK_PWRSAVE
+
msmsdcc_disable_clocks(host, 1);
-#endif
+
spin_unlock_irqrestore(&host->lock, flags);
}
@@ -1256,9 +1259,8 @@ msmsdcc_probe(struct platform_device *pdev)
if (host->timer.function)
...Many variables in this MMC driver are used like bools but
have int types. It's better to use the actual bool type for
readability and optimization. This converts all these types
of variables to actual the bool type.
Signed-off-by: Daniel Walker <dwalker@codeaurora.org>
---
drivers/mmc/host/msm_sdcc.c | 28 ++++++++++++++--------------
drivers/mmc/host/msm_sdcc.h | 10 +++++-----
2 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/drivers/mmc/host/msm_sdcc.c b/drivers/mmc/host/msm_sdcc.c
index d6ac82c..01bb684 100644
--- a/drivers/mmc/host/msm_sdcc.c
+++ b/drivers/mmc/host/msm_sdcc.c
@@ -79,7 +79,7 @@ msmsdcc_disable_clocks(struct msmsdcc_host *host, int deferr)
if (host->clks_on) {
clk_disable(host->clk);
clk_disable(host->pclk);
- host->clks_on = 0;
+ host->clks_on = false;
}
}
}
@@ -106,7 +106,7 @@ msmsdcc_enable_clocks(struct msmsdcc_host *host)
}
udelay(1 + ((3 * USEC_PER_SEC) /
(host->clk_rate ? host->clk_rate : msmsdcc_fmin)));
- host->clks_on = 1;
+ host->clks_on = true;
}
return 0;
}
@@ -158,7 +158,7 @@ static void
msmsdcc_stop_data(struct msmsdcc_host *host)
{
host->curr.data = NULL;
- host->curr.got_dataend = host->curr.got_datablkend = 0;
+ host->curr.got_dataend = host->curr.got_datablkend = false;
}
uint32_t msmsdcc_fifo_addr(struct msmsdcc_host *host)
@@ -188,7 +188,7 @@ msmsdcc_dma_exec_func(struct msm_dmov_cmd *cmd)
(u32) host->cmd_cmd->arg,
(u32) host->cmd_c);
}
- host->dma.active = 1;
+ host->dma.active = true;
}
static void
@@ -203,7 +203,7 @@ msmsdcc_dma_complete_func(struct msm_dmov_cmd *cmd,
struct mmc_request *mrq;
spin_lock_irqsave(&host->lock, flags);
- host->dma.active = 0;
+ host->dma.active = false;
mrq = host->curr.mrq;
BUG_ON(!mrq);
@@ -243,7 +243,7 @@ msmsdcc_dma_complete_func(struct msm_dmov_cmd *cmd,
}
host->dma.sg = NULL;
- host->dma.busy = 0;
+ host->dma.busy = false;
if ...The function msmsdcc_disable_clocks needs to be called with the host lock held. Signed-off-by: Daniel Walker <dwalker@codeaurora.org> --- drivers/mmc/host/msm_sdcc.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/host/msm_sdcc.c b/drivers/mmc/host/msm_sdcc.c index 01bb684..c64a659 100644 --- a/drivers/mmc/host/msm_sdcc.c +++ b/drivers/mmc/host/msm_sdcc.c @@ -261,10 +261,10 @@ msmsdcc_dma_complete_func(struct msm_dmov_cmd *cmd, host->curr.cmd = NULL; mrq->data->bytes_xfered = host->curr.data_xfered; - spin_unlock_irqrestore(&host->lock, flags); - msmsdcc_disable_clocks(host, 1); + spin_unlock_irqrestore(&host->lock, flags); + mmc_request_done(host->mmc, mrq); return; } else -- 1.7.0.4 -- Sent by a consultant of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum. --
A couple lines have non-tab spacing infront of them. Just replace
them with tabs.
Signed-off-by: Daniel Walker <dwalker@codeaurora.org>
---
drivers/mmc/host/msm_sdcc.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/mmc/host/msm_sdcc.c b/drivers/mmc/host/msm_sdcc.c
index c64a659..3f333b1 100644
--- a/drivers/mmc/host/msm_sdcc.c
+++ b/drivers/mmc/host/msm_sdcc.c
@@ -168,8 +168,8 @@ uint32_t msmsdcc_fifo_addr(struct msmsdcc_host *host)
static inline void
msmsdcc_start_command_exec(struct msmsdcc_host *host, u32 arg, u32 c) {
- msmsdcc_writel(host, arg, MMCIARGUMENT);
- msmsdcc_writel(host, c, MMCICOMMAND);
+ msmsdcc_writel(host, arg, MMCIARGUMENT);
+ msmsdcc_writel(host, c, MMCICOMMAND);
}
static void
@@ -305,7 +305,7 @@ static int msmsdcc_config_dma(struct msmsdcc_host *host, struct mmc_data *data)
host->dma.sg = data->sg;
host->dma.num_ents = data->sg_len;
- BUG_ON(host->dma.num_ents > NR_SG); /* Prevent memory corruption */
+ BUG_ON(host->dma.num_ents > NR_SG); /* Prevent memory corruption */
nc = host->dma.nc;
--
1.7.0.4
--
Sent by a consultant of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
--
Strange spacing and formatting fixes.
Signed-off-by: Daniel Walker <dwalker@codeaurora.org>
---
drivers/mmc/host/msm_sdcc.c | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/mmc/host/msm_sdcc.c b/drivers/mmc/host/msm_sdcc.c
index 3f333b1..c5d1d6a 100644
--- a/drivers/mmc/host/msm_sdcc.c
+++ b/drivers/mmc/host/msm_sdcc.c
@@ -339,12 +339,12 @@ static int msmsdcc_config_dma(struct msmsdcc_host *host, struct mmc_data *data)
for (i = 0; i < host->dma.num_ents; i++) {
box->cmd = CMD_MODE_BOX;
- /* Initialize sg dma address */
- sg->dma_address = page_to_dma(mmc_dev(host->mmc), sg_page(sg))
- + sg->offset;
+ /* Initialize sg dma address */
+ sg->dma_address = page_to_dma(mmc_dev(host->mmc), sg_page(sg))
+ + sg->offset;
- if (i == (host->dma.num_ents - 1))
- box->cmd |= CMD_LC;
+ if (i == (host->dma.num_ents - 1))
+ box->cmd |= CMD_LC;
rows = (sg_dma_len(sg) % MCI_FIFOSIZE) ?
(sg_dma_len(sg) / MCI_FIFOSIZE) + 1 :
(sg_dma_len(sg) / MCI_FIFOSIZE) ;
@@ -479,7 +479,7 @@ msmsdcc_start_data(struct msmsdcc_host *host, struct mmc_data *data,
clks = (unsigned long long)data->timeout_ns * host->clk_rate;
do_div(clks, NSEC_PER_SEC);
- timeout = data->timeout_clks + (unsigned int)clks*2 ;
+ timeout = data->timeout_clks + (unsigned int)clks*2;
if (datactrl & MCI_DPSM_DMAENABLE) {
/* Save parameters for the exec function */
@@ -563,7 +563,7 @@ msmsdcc_pio_read(struct msmsdcc_host *host, char *buffer, unsigned int remain)
ptr++;
count += sizeof(uint32_t);
- remain -= sizeof(uint32_t);
+ remain -= sizeof(uint32_t);
if (remain == 0)
break;
}
--
1.7.0.4
--
Sent by a consultant of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
--
It also changes the define from #if checks to #ifdef which changes how it would be used. I this feature even used? It looks like some kind debug feature. David --
True, but it's defined in the code. So you have to comment the line out Yeah it's used, it's default on.. Daniel -- Sent by an consultant of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum. --
What I meant was "is there any reason to be able to turn this off." It looks like something that would be used during development, and doesn't need to be disabled once the driver works. David -- Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum. --
I have no idea. I'm just doing a clean up here .. It's on, it's got a config to turn it off, as far as I know it's used and useful. Daniel -- Sent by an consultant of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum. --
