mmc: msm: consolidate ifdefs for BUSCLK_PWRSAVE
Subsystems (2)
PATCH 1/5 mmc: msm: consolidate ifdefs for BUSCLK_PWRSAVE
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.
--- drivers/mmc/host/msm_sdcc.c | 24 +++++++++++++----------- 1 files changed, 13 insertions(+), 11 deletions(-)
drivers/mmc/host/msm_sdcc.c +13 -11
@@ -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 ; }
Signature · 5 lines
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.
PATCH 2/5 mmc: msm: convert int bools to actual bool type
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.
--- drivers/mmc/host/msm_sdcc.c | 28 ++++++++++++++-------------- drivers/mmc/host/msm_sdcc.h | 10 +++++----- 2 files changed, 19 insertions(+), 19 deletions(-)
drivers/mmc/host/msm_sdcc.c +14 -14
@@ -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) {
drivers/mmc/host/msm_sdcc.h +5 -5
@@ -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 */
Signature · 5 lines
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.
PATCH 3/5 mmc: msm: fix msmsdcc_disable_clocks spinlock protection
In reply to Daniel WalkerThe function msmsdcc_disable_clocks needs to be called with the host lock held.
--- drivers/mmc/host/msm_sdcc.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/mmc/host/msm_sdcc.c +2 -2
@@ -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
Signature · 5 lines
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.
PATCH 4/5 mmc: msm: fix non-tab spacing
In reply to Daniel WalkerA couple lines have non-tab spacing infront of them. Just replace them with tabs.
--- drivers/mmc/host/msm_sdcc.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/mmc/host/msm_sdcc.c +3 -3
@@ -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;
Signature · 5 lines
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.
PATCH 5/5 mmc: msm: fix weird spacing
In reply to Daniel WalkerStrange spacing and formatting fixes.
--- drivers/mmc/host/msm_sdcc.c | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-)
drivers/mmc/host/msm_sdcc.c +7 -7
@@ -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 ; }
Signature · 5 lines
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.
Quoted 4 lines · Daniel Walker
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
Quoted 9 lines · David Brown
Quoted 4 lines · Daniel Walker
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" ..
Quoted 1 line
I this feature even used? It looks like some kind debug feature.
Yeah it's used, it's default on..
Daniel
Signature · 3 lines
Sent by an consultant of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
Quoted 3 lines · Daniel Walker
Quoted 1 line
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
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
Quoted 8 lines · David Brown
Quoted 3 lines · Daniel Walker
Quoted 1 line
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
Signature · 3 lines
Sent by an consultant of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.