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 <[email protected]>
---
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)
pr_info("%s: Polling status mode enabled\n", mmc_hostname(mmc));
-#if BUSCLK_PWRSAVE
msmsdcc_disable_clocks(host, 1);
-#endif
+
return 0;
cmd_irq_free:
free_irq(cmd_irqres->start, host);
@@ -1333,9 +1335,9 @@ msmsdcc_resume(struct platform_device *dev)
mmc_resume_host(mmc);
if (host->stat_irq)
enable_irq(host->stat_irq);
-#if BUSCLK_PWRSAVE
+
msmsdcc_disable_clocks(host, 1);
-#endif
+
}
return 0;
}
--
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.
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 <[email protected]>
---
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 ((host->curr.got_dataend && host->curr.got_datablkend)
|| mrq->data->error) {
@@ -452,8 +452,8 @@ msmsdcc_start_data(struct msmsdcc_host *host, struct mmc_data *data,
host->curr.xfer_size = data->blksz * data->blocks;
host->curr.xfer_remain = host->curr.xfer_size;
host->curr.data_xfered = 0;
- host->curr.got_dataend = 0;
- host->curr.got_datablkend = 0;
+ host->curr.got_dataend = false;
+ host->curr.got_datablkend = false;
memset(&host->pio, 0, sizeof(host->pio));
@@ -490,7 +490,7 @@ msmsdcc_start_data(struct msmsdcc_host *host, struct mmc_data *data,
host->dma.hdr.execute_func = msmsdcc_dma_exec_func;
host->dma.hdr.data = (void *)host;
- host->dma.busy = 1;
+ host->dma.busy = true;
if (cmd) {
msmsdcc_start_command_deferred(host, cmd, &c);
@@ -749,10 +749,10 @@ msmsdcc_handle_irq_data(struct msmsdcc_host *host, u32 status,
/* Check for data done */
if (!host->curr.got_dataend && (status & MCI_DATAEND))
- host->curr.got_dataend = 1;
+ host->curr.got_dataend = true;
if (!host->curr.got_datablkend && (status & MCI_DATABLOCKEND))
- host->curr.got_datablkend = 1;
+ host->curr.got_datablkend = true;
/*
* If DMA is still in progress, we complete via the completion handler
@@ -789,7 +789,7 @@ msmsdcc_irq(int irq, void *dev_id)
void __iomem *base = host->base;
u32 status;
int ret = 0;
- int cardint = 0;
+ bool cardint = false;
spin_lock(&host->lock);
@@ -808,7 +808,7 @@ msmsdcc_irq(int irq, void *dev_id)
msmsdcc_handle_irq_data(host, status, base);
if (status & MCI_SDIOINTOPER) {
- cardint = 1;
+ cardint = true;
status &= ~MCI_SDIOINTOPER;
}
ret = 1;
@@ -1107,7 +1107,7 @@ msmsdcc_probe(struct platform_device *pdev)
host->mmc = mmc;
host->curr.cmd = NULL;
- host->cmdpoll = 1;
+ host->cmdpoll = true;
host->base = ioremap(memres->start, PAGE_SIZE);
if (!host->base) {
diff --git a/drivers/mmc/host/msm_sdcc.h b/drivers/mmc/host/msm_sdcc.h
index ff2b0f7..57db07f 100644
--- a/drivers/mmc/host/msm_sdcc.h
+++ b/drivers/mmc/host/msm_sdcc.h
@@ -170,8 +170,8 @@ struct msmsdcc_dma_data {
int channel;
struct msmsdcc_host *host;
- int busy; /* Set if DM is busy */
- int active;
+ bool busy; /* Set if DM is busy */
+ bool active;
};
struct msmsdcc_pio_data {
@@ -187,8 +187,8 @@ struct msmsdcc_curr_req {
unsigned int xfer_size; /* Total data size */
unsigned int xfer_remain; /* Bytes remaining to send */
unsigned int data_xfered; /* Bytes acked by BLKEND irq */
- int got_dataend;
- int got_datablkend;
+ bool got_dataend;
+ bool got_datablkend;
int user_pages;
};
@@ -232,7 +232,7 @@ struct msmsdcc_host {
struct msmsdcc_dma_data dma;
struct msmsdcc_pio_data pio;
- int cmdpoll;
+ bool cmdpoll;
struct msmsdcc_stats stats;
/* Command parameters */
--
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 <[email protected]>
---
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.
The function msmsdcc_disable_clocks needs to be called with
the host lock held.
Signed-off-by: Daniel Walker <[email protected]>
---
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.
Strange spacing and formatting fixes.
Signed-off-by: Daniel Walker <[email protected]>
---
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.
On Mon, Dec 20, 2010 at 03:16:47PM -0800, Daniel Walker wrote:
> 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.
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
On Mon, 2010-12-20 at 15:35 -0800, David Brown wrote:
> On Mon, Dec 20, 2010 at 03:16:47PM -0800, Daniel Walker wrote:
>
> > 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.
>
> It also changes the define from #if checks to #ifdef which changes how
> it would be used.
True, but it's defined in the code. So you have to comment the line out
now instead of change it to "0" ..
> I this feature even used? It looks like some kind debug feature.
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.
On Mon, Dec 20, 2010 at 03:39:10PM -0800, Daniel Walker wrote:
> > I this feature even used? It looks like some kind debug feature.
>
> Yeah it's used, it's default on..
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.
On Mon, 2010-12-20 at 15:42 -0800, David Brown wrote:
> On Mon, Dec 20, 2010 at 03:39:10PM -0800, Daniel Walker wrote:
> > > I this feature even used? It looks like some kind debug feature.
> >
> > Yeah it's used, it's default on..
>
> 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.
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.