2012-11-09 11:45:53

by Tushar Behera

[permalink] [raw]
Subject: [PATCH 0/8] Fix coding style in sdhci.c

Documents/CodingStyle Chapter 3 recommends usage of braces for both
if and else statements if any of the branches contains multiple
statements.

Cleaning up drivers/mmc/host/sdhci.c for all these occurrences.

Tushar Behera (8):
mmc: sdhci: fix coding style in sdhci_calc_timeout
mmc: sdhci: fix coding style in sdhci_set_transfer_mode
mmc: sdhci: fix coding style in sdhci_finish_data
mmc: sdhci: fix coding style in sdhci_set_clock
mmc: sdhci: fix coding style in sdhci_do_set_ios
mmc: sdhci: fix coding style in sdhci_execute_tuning
mmc: sdhci: fix coding style in sdhci_data_irq
mmc: sdhci: fix coding style in sdhci_add_host

drivers/mmc/host/sdhci.c | 58 +++++++++++++++++++++++++--------------------
1 files changed, 32 insertions(+), 26 deletions(-)

--
1.7.4.1


2012-11-09 11:45:59

by Tushar Behera

[permalink] [raw]
Subject: [PATCH 1/8] mmc: sdhci: fix coding style in sdhci_calc_timeout

Signed-off-by: Tushar Behera <[email protected]>
---
drivers/mmc/host/sdhci.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index c7851c0..2ff2b9e 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -667,9 +667,9 @@ static u8 sdhci_calc_timeout(struct sdhci_host *host, struct mmc_command *cmd)
return 0xE;

/* timeout in us */
- if (!data)
+ if (!data) {
target_timeout = cmd->cmd_timeout_ms * 1000;
- else {
+ } else {
target_timeout = data->timeout_ns / 1000;
if (host->clock)
target_timeout += data->timeout_clks / host->clock;
--
1.7.4.1

2012-11-09 11:46:07

by Tushar Behera

[permalink] [raw]
Subject: [PATCH 3/8] mmc: sdhci: fix coding style in sdhci_finish_data

Signed-off-by: Tushar Behera <[email protected]>
---
drivers/mmc/host/sdhci.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 2d3d76e..73bb41f 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -924,9 +924,9 @@ static void sdhci_finish_data(struct sdhci_host *host)
host->data = NULL;

if (host->flags & SDHCI_REQ_USE_DMA) {
- if (host->flags & SDHCI_USE_ADMA)
+ if (host->flags & SDHCI_USE_ADMA) {
sdhci_adma_table_post(host, data);
- else {
+ } else {
dma_unmap_sg(mmc_dev(host->mmc), data->sg,
data->sg_len, (data->flags & MMC_DATA_READ) ?
DMA_FROM_DEVICE : DMA_TO_DEVICE);
@@ -964,8 +964,9 @@ static void sdhci_finish_data(struct sdhci_host *host)
}

sdhci_send_command(host, data->stop);
- } else
+ } else {
tasklet_schedule(&host->finish_tasklet);
+ }
}

static void sdhci_send_command(struct sdhci_host *host, struct mmc_command *cmd)
--
1.7.4.1

2012-11-09 11:46:17

by Tushar Behera

[permalink] [raw]
Subject: [PATCH 6/8] mmc: sdhci: fix coding style in sdhci_execute_tuning

Signed-off-by: Tushar Behera <[email protected]>
---
drivers/mmc/host/sdhci.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index b947155..4bed582 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1792,9 +1792,9 @@ static int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode)
requires_tuning_nonuhs = true;

if (((ctrl & SDHCI_CTRL_UHS_MASK) == SDHCI_CTRL_UHS_SDR104) ||
- requires_tuning_nonuhs)
+ requires_tuning_nonuhs) {
ctrl |= SDHCI_CTRL_EXEC_TUNING;
- else {
+ } else {
spin_unlock(&host->lock);
enable_irq(host->irq);
sdhci_runtime_pm_put(host);
--
1.7.4.1

2012-11-09 11:46:22

by Tushar Behera

[permalink] [raw]
Subject: [PATCH 7/8] mmc: sdhci: fix coding style in sdhci_data_irq

Signed-off-by: Tushar Behera <[email protected]>
---
drivers/mmc/host/sdhci.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 4bed582..47cac71 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -2286,9 +2286,9 @@ static void sdhci_data_irq(struct sdhci_host *host, u32 intmask)
host->data->error = -EIO;
}

- if (host->data->error)
+ if (host->data->error) {
sdhci_finish_data(host);
- else {
+ } else {
if (intmask & (SDHCI_INT_DATA_AVAIL | SDHCI_INT_SPACE_AVAIL))
sdhci_transfer_pio(host);

--
1.7.4.1

2012-11-09 11:46:24

by Tushar Behera

[permalink] [raw]
Subject: [PATCH 8/8] mmc: sdhci: fix coding style in sdhci_add_host

Signed-off-by: Tushar Behera <[email protected]>
---
drivers/mmc/host/sdhci.c | 20 ++++++++++++--------
1 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 47cac71..5cddb74 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -2786,16 +2786,18 @@ int sdhci_add_host(struct sdhci_host *host)
*/
mmc->ops = &sdhci_ops;
mmc->f_max = host->max_clk;
- if (host->ops->get_min_clock)
+ if (host->ops->get_min_clock) {
mmc->f_min = host->ops->get_min_clock(host);
- else if (host->version >= SDHCI_SPEC_300) {
+ } else if (host->version >= SDHCI_SPEC_300) {
if (host->clk_mul) {
mmc->f_min = (host->max_clk * host->clk_mul) / 1024;
mmc->f_max = host->max_clk * host->clk_mul;
- } else
+ } else {
mmc->f_min = host->max_clk / SDHCI_MAX_DIV_SPEC_300;
- } else
+ }
+ } else {
mmc->f_min = host->max_clk / SDHCI_MAX_DIV_SPEC_200;
+ }

host->timeout_clk =
(caps[0] & SDHCI_TIMEOUT_CLK_MASK) >> SDHCI_TIMEOUT_CLK_SHIFT;
@@ -2860,12 +2862,13 @@ int sdhci_add_host(struct sdhci_host *host)
mmc_hostname(mmc));
host->vqmmc = NULL;
}
- }
- else if (regulator_is_supported_voltage(host->vqmmc, 1800000, 1800000))
+ } else if (regulator_is_supported_voltage(host->vqmmc,
+ 1800000, 1800000)) {
regulator_enable(host->vqmmc);
- else
+ } else {
caps[1] &= ~(SDHCI_SUPPORT_SDR104 | SDHCI_SUPPORT_SDR50 |
SDHCI_SUPPORT_DDR50);
+ }

/* Any UHS-I mode in caps implies SDR12 and SDR25 support. */
if (caps[1] & (SDHCI_SUPPORT_SDR104 | SDHCI_SUPPORT_SDR50 |
@@ -2921,8 +2924,9 @@ int sdhci_add_host(struct sdhci_host *host)
mmc_hostname(mmc));
host->vmmc = NULL;
}
- } else
+ } else {
regulator_enable(host->vmmc);
+ }

#ifdef CONFIG_REGULATOR
if (host->vmmc) {
--
1.7.4.1

2012-11-09 11:46:14

by Tushar Behera

[permalink] [raw]
Subject: [PATCH 5/8] mmc: sdhci: fix coding style in sdhci_do_set_ios

Signed-off-by: Tushar Behera <[email protected]>
---
drivers/mmc/host/sdhci.c | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 28da461..b947155 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1386,9 +1386,9 @@ static void sdhci_do_set_ios(struct sdhci_host *host, struct mmc_ios *ios)
* or if it requires special setup code, you should implement that in
* platform_8bit_width().
*/
- if (host->ops->platform_8bit_width)
+ if (host->ops->platform_8bit_width) {
host->ops->platform_8bit_width(host, ios->bus_width);
- else {
+ } else {
ctrl = sdhci_readb(host, SDHCI_HOST_CONTROL);
if (ios->bus_width == MMC_BUS_WIDTH_8) {
ctrl &= ~SDHCI_CTRL_4BITBUS;
@@ -1467,9 +1467,9 @@ static void sdhci_do_set_ios(struct sdhci_host *host, struct mmc_ios *ios)
clk &= ~SDHCI_CLOCK_CARD_EN;
sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL);

- if (host->ops->set_uhs_signaling)
+ if (host->ops->set_uhs_signaling) {
host->ops->set_uhs_signaling(host, ios->timing);
- else {
+ } else {
ctrl_2 = sdhci_readw(host, SDHCI_HOST_CONTROL2);
/* Select Bus Speed Mode for host */
ctrl_2 &= ~SDHCI_CTRL_UHS_MASK;
@@ -1492,8 +1492,9 @@ static void sdhci_do_set_ios(struct sdhci_host *host, struct mmc_ios *ios)
clock = host->clock;
host->clock = 0;
sdhci_set_clock(host, clock);
- } else
+ } else {
sdhci_writeb(host, ctrl, SDHCI_HOST_CONTROL);
+ }

/*
* Some (ENE) controllers go apeshit on some ios operation,
--
1.7.4.1

2012-11-09 11:47:33

by Tushar Behera

[permalink] [raw]
Subject: [PATCH 4/8] mmc: sdhci: fix coding style in sdhci_set_clock

Signed-off-by: Tushar Behera <[email protected]>
---
drivers/mmc/host/sdhci.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 73bb41f..28da461 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1138,9 +1138,9 @@ static void sdhci_set_clock(struct sdhci_host *host, unsigned int clock)
}
} else {
/* Version 3.00 divisors must be a multiple of 2. */
- if (host->max_clk <= clock)
+ if (host->max_clk <= clock) {
div = 1;
- else {
+ } else {
for (div = 2; div < SDHCI_MAX_DIV_SPEC_300;
div += 2) {
if ((host->max_clk / div) <= clock)
--
1.7.4.1

2012-11-09 11:47:53

by Tushar Behera

[permalink] [raw]
Subject: [PATCH 2/8] mmc: sdhci: fix coding style in sdhci_set_transfer_mode

Signed-off-by: Tushar Behera <[email protected]>
---
drivers/mmc/host/sdhci.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 2ff2b9e..2d3d76e 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -898,9 +898,9 @@ static void sdhci_set_transfer_mode(struct sdhci_host *host,
* If we are sending CMD23, CMD12 never gets sent
* on successful completion (so no Auto-CMD12).
*/
- if (!host->mrq->sbc && (host->flags & SDHCI_AUTO_CMD12))
+ if (!host->mrq->sbc && (host->flags & SDHCI_AUTO_CMD12)) {
mode |= SDHCI_TRNS_AUTO_CMD12;
- else if (host->mrq->sbc && (host->flags & SDHCI_AUTO_CMD23)) {
+ } else if (host->mrq->sbc && (host->flags & SDHCI_AUTO_CMD23)) {
mode |= SDHCI_TRNS_AUTO_CMD23;
sdhci_writel(host, host->mrq->sbc->arg, SDHCI_ARGUMENT2);
}
--
1.7.4.1

2012-11-12 02:24:45

by Jaehoon Chung

[permalink] [raw]
Subject: Re: [PATCH 0/8] Fix coding style in sdhci.c

Hi Tushar,

Could you make one patch? Why do you separate patches?

Best Regards,
Jaehoon Chung

On 11/09/2012 08:39 PM, Tushar Behera wrote:
> Documents/CodingStyle Chapter 3 recommends usage of braces for both
> if and else statements if any of the branches contains multiple
> statements.
>
> Cleaning up drivers/mmc/host/sdhci.c for all these occurrences.
>
> Tushar Behera (8):
> mmc: sdhci: fix coding style in sdhci_calc_timeout
> mmc: sdhci: fix coding style in sdhci_set_transfer_mode
> mmc: sdhci: fix coding style in sdhci_finish_data
> mmc: sdhci: fix coding style in sdhci_set_clock
> mmc: sdhci: fix coding style in sdhci_do_set_ios
> mmc: sdhci: fix coding style in sdhci_execute_tuning
> mmc: sdhci: fix coding style in sdhci_data_irq
> mmc: sdhci: fix coding style in sdhci_add_host
>
> drivers/mmc/host/sdhci.c | 58 +++++++++++++++++++++++++--------------------
> 1 files changed, 32 insertions(+), 26 deletions(-)
>

2012-11-12 04:37:43

by Tushar Behera

[permalink] [raw]
Subject: Re: [PATCH 0/8] Fix coding style in sdhci.c

On 11/12/2012 07:54 AM, Jaehoon Chung wrote:
> Hi Tushar,
>
> Could you make one patch? Why do you separate patches?
>

Yes, I can do that. I did split it specifically so that we could drop
any patches if required.

I will wait for a word from Chris regarding what he prefers.


> Best Regards,
> Jaehoon Chung
>
> On 11/09/2012 08:39 PM, Tushar Behera wrote:
>> Documents/CodingStyle Chapter 3 recommends usage of braces for both
>> if and else statements if any of the branches contains multiple
>> statements.
>>
>> Cleaning up drivers/mmc/host/sdhci.c for all these occurrences.
>>
>> Tushar Behera (8):
>> mmc: sdhci: fix coding style in sdhci_calc_timeout
>> mmc: sdhci: fix coding style in sdhci_set_transfer_mode
>> mmc: sdhci: fix coding style in sdhci_finish_data
>> mmc: sdhci: fix coding style in sdhci_set_clock
>> mmc: sdhci: fix coding style in sdhci_do_set_ios
>> mmc: sdhci: fix coding style in sdhci_execute_tuning
>> mmc: sdhci: fix coding style in sdhci_data_irq
>> mmc: sdhci: fix coding style in sdhci_add_host
>>
>> drivers/mmc/host/sdhci.c | 58 +++++++++++++++++++++++++--------------------
>> 1 files changed, 32 insertions(+), 26 deletions(-)
>>
>


--
Tushar Behera

2012-11-12 07:12:38

by Chris Ball

[permalink] [raw]
Subject: Re: [PATCH 0/8] Fix coding style in sdhci.c

Hi,

On Sun, Nov 11 2012, Tushar Behera wrote:
> Yes, I can do that. I did split it specifically so that we could drop
> any patches if required.
>
> I will wait for a word from Chris regarding what he prefers.

I would want to merge one patch, but I'm afraid I don't generally want
to merge changes like these. sdhci.c is one of the most modified files
in drivers/mmc, so a change like this can create merge conflicts that
require many people to update their work, and that's not worth it.

Thanks,

- Chris.
--
Chris Ball <[email protected]> <http://printf.net/>
One Laptop Per Child

2012-11-12 07:36:34

by Tushar Behera

[permalink] [raw]
Subject: Re: [PATCH 0/8] Fix coding style in sdhci.c

On 11/12/2012 12:42 PM, Chris Ball wrote:
> Hi,
>
> On Sun, Nov 11 2012, Tushar Behera wrote:
>> Yes, I can do that. I did split it specifically so that we could drop
>> any patches if required.
>>
>> I will wait for a word from Chris regarding what he prefers.
>
> I would want to merge one patch, but I'm afraid I don't generally want
> to merge changes like these. sdhci.c is one of the most modified files
> in drivers/mmc, so a change like this can create merge conflicts that
> require many people to update their work, and that's not worth it.
>
> Thanks,
>
> - Chris.
>
Thanks for the information.

--
Tushar Behera

2012-11-12 07:54:37

by Joe Perches

[permalink] [raw]
Subject: Re: [PATCH 0/8] Fix coding style in sdhci.c

On Mon, 2012-11-12 at 02:12 -0500, Chris Ball wrote:
> Hi,
>
> On Sun, Nov 11 2012, Tushar Behera wrote:
> > Yes, I can do that. I did split it specifically so that we could drop
> > any patches if required.
> >
> > I will wait for a word from Chris regarding what he prefers.
>
> I would want to merge one patch, but I'm afraid I don't generally want
> to merge changes like these. sdhci.c is one of the most modified files
> in drivers/mmc, so a change like this can create merge conflicts that
> require many people to update their work, and that's not worth it.

I think brace style isn't important enough too.

I suggested this awhile ago, but it went nowhere.

https://lkml.org/lkml/2011/8/11/425