staging: mt7621-mmc: Remove do {} while (0) loop for single statement macro
Subsystems (2)
PATCH 1/1 staging: mt7621-mmc: Remove do {} while (0) loop for single statement macro
This patch removes do {} while (0) loop for single statement macros. Issue found by checkpatch.
--- drivers/staging/mt7621-mmc/sd.c | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-)
drivers/staging/mt7621-mmc/sd.c +7 -21
@@ -104,14 +104,10 @@ static int cd_active_low = 1;/* gate means clock power down */ static int g_clk_gate =0 ;#define msdc_gate_clock (id) \ - do { \ - g_clk_gate &= ~(1 << ((id) + PERI_MSDC0_PDN)); \ - } while (0) + (g_clk_gate &= ~(1 << ((id) + PERI_MSDC0_PDN)))/* not like power down register. 1 means clock on. */ #define msdc_ungate_clock (id) \ - do { \ - g_clk_gate |= 1 << ((id) + PERI_MSDC0_PDN); \ - } while (0) + (g_clk_gate |= 1 << ((id) + PERI_MSDC0_PDN))// do we need sync object or not void msdc_clk_status (int *status)
@@ -170,9 +166,7 @@ static void msdc_clr_fifo(struct msdc_host *host) } while (0)#define msdc_irq_restore (val) \ - do { \ - sdr_set_bits(host->base + MSDC_INTEN, val); \ - } while (0) + (sdr_set_bits(host->base + MSDC_INTEN, val))/* clock source for host: global */ #if defined(CONFIG_SOC_MT7620 )
@@ -186,26 +180,18 @@ static u32 hclks[] = {50000000}; /* +/- by chhung */// always keep the VMC on. //============================================ #define msdc_vcore_on (host) \ - do { \ - (void)hwPowerOn(MT65XX_POWER_LDO_VMC, VOL_3300, "SD"); \ - } while (0) + ((void)hwPowerOn(MT65XX_POWER_LDO_VMC, VOL_3300, "SD"))#define msdc_vcore_off (host) \ - do { \ - (void)hwPowerDown(MT65XX_POWER_LDO_VMC, "SD"); \ - } while (0) + ((void)hwPowerDown(MT65XX_POWER_LDO_VMC, "SD"))//==================================== // the vdd output for card: global // always keep the VMCH on. //==================================== #define msdc_vdd_on (host) \ - do { \ - (void)hwPowerOn(MT65XX_POWER_LDO_VMCH, VOL_3300, "SD"); \ - } while (0) + ((void)hwPowerOn(MT65XX_POWER_LDO_VMCH, VOL_3300, "SD"))#define msdc_vdd_off (host) \ - do { \ - (void)hwPowerDown(MT65XX_POWER_LDO_VMCH, "SD"); \ - } while (0) + ((void)hwPowerDown(MT65XX_POWER_LDO_VMCH, "SD"))#define sdc_is_busy () (readl(host->base + SDC_STS) & SDC_STS_SDCBUSY)#define sdc_is_cmd_busy () (readl(host->base + SDC_STS) & SDC_STS_CMDBUSY)
Signature · 1 line
2.17.1
Quoted 2 lines · Nishad Kamdar
This patch removes do {} while (0) loop for single statement macros. Issue found by checkpatch.
Some or all of this code is not used and should be deleted instead.
Quoted 68 lines
Signed-off-by Nishad Kamdar <[email protected]>--- drivers/staging/mt7621-mmc/sd.c | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-)drivers/staging/mt7621-mmc/sd.c +7
-21@@ -104,14 +104,10 @@ static int cd_active_low = 1;/* gate means clock power down */ static int g_clk_gate =0 ;#define msdc_gate_clock (id) \ - do { \ - g_clk_gate &= ~(1 << ((id) + PERI_MSDC0_PDN)); \ - } while (0) + (g_clk_gate &= ~(1 << ((id) + PERI_MSDC0_PDN)))/* not like power down register. 1 means clock on. */ #define msdc_ungate_clock (id) \ - do { \ - g_clk_gate |= 1 << ((id) + PERI_MSDC0_PDN); \ - } while (0) + (g_clk_gate |= 1 << ((id) + PERI_MSDC0_PDN))// do we need sync object or not void msdc_clk_status (int *status)@@ -170,9 +166,7 @@ static void msdc_clr_fifo(struct msdc_host *host) } while (0)#define msdc_irq_restore (val) \ - do { \ - sdr_set_bits(host->base + MSDC_INTEN, val); \ - } while (0) + (sdr_set_bits(host->base + MSDC_INTEN, val))/* clock source for host: global */ #if defined(CONFIG_SOC_MT7620 )@@ -186,26 +180,18 @@ static u32 hclks[] = {50000000}; /* +/- by chhung */// always keep the VMC on. //============================================ #define msdc_vcore_on (host) \ - do { \ - (void)hwPowerOn(MT65XX_POWER_LDO_VMC, VOL_3300, "SD"); \ - } while (0) + ((void)hwPowerOn(MT65XX_POWER_LDO_VMC, VOL_3300, "SD"))#define msdc_vcore_off (host) \ - do { \ - (void)hwPowerDown(MT65XX_POWER_LDO_VMC, "SD"); \ - } while (0) + ((void)hwPowerDown(MT65XX_POWER_LDO_VMC, "SD"))//==================================== // the vdd output for card: global // always keep the VMCH on. //==================================== #define msdc_vdd_on (host) \ - do { \ - (void)hwPowerOn(MT65XX_POWER_LDO_VMCH, VOL_3300, "SD"); \ - } while (0) + ((void)hwPowerOn(MT65XX_POWER_LDO_VMCH, VOL_3300, "SD"))#define msdc_vdd_off (host) \ - do { \ - (void)hwPowerDown(MT65XX_POWER_LDO_VMCH, "SD"); \ - } while (0) + ((void)hwPowerDown(MT65XX_POWER_LDO_VMCH, "SD"))#define sdc_is_busy () (readl(host->base + SDC_STS) & SDC_STS_SDCBUSY)#define sdc_is_cmd_busy () (readl(host->base + SDC_STS) & SDC_STS_CMDBUSY)
Greg Kroah-Hartman
maintainerQuoted 13 lines · Nishad Kamdar
This patch removes do {} while (0) loop for single statement macros. Issue found by checkpatch.
Signed-off-by Nishad Kamdar <[email protected]>--- drivers/staging/mt7621-mmc/sd.c | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-)drivers/staging/mt7621-mmc/sd.c +0
-0
drivers/staging/mt7621-mmc/sd.c static int cd_active_low = 1; · line 107
Quoted 7 lines
drivers/staging/mt7621-mmc/sd.c +1
-3@@ -104,14 +104,10 @@ static int cd_active_low = 1;/* gate means clock power down */ static int g_clk_gate =0 ;#define msdc_gate_clock (id) \ - do { \ - g_clk_gate &= ~(1 << ((id) + PERI_MSDC0_PDN)); \ - } while (0) + (g_clk_gate &= ~(1 << ((id) + PERI_MSDC0_PDN)))
This should become an inline function, right?
drivers/staging/mt7621-mmc/sd.c static int cd_active_low = 1; · line 110
Quoted 6 lines
drivers/staging/mt7621-mmc/sd.c +1
-3/* not like power down register. 1 means clock on. */ #define msdc_ungate_clock (id) \ - do { \ - g_clk_gate |= 1 << ((id) + PERI_MSDC0_PDN); \ - } while (0) + (g_clk_gate |= 1 << ((id) + PERI_MSDC0_PDN))
Same here.
drivers/staging/mt7621-mmc/sd.c static void msdc_clr_fifo(struct msdc_host *host) · line 169
Quoted 11 lines
drivers/staging/mt7621-mmc/sd.c +1
-3// do we need sync object or not void msdc_clk_status (int *status)@@ -170,9 +166,7 @@ static void msdc_clr_fifo(struct msdc_host *host) }while (0 ) #define msdc_irq_restore(val) \ - do { \ - sdr_set_bits(host->base + MSDC_INTEN, val); \ - } while (0) + (sdr_set_bits (host->base +MSDC_INTEN , val))
Just call the one function where this is used and delete this #define.
Same type of changes for the rest of these as well.
thanks,
greg k-h
Quoted 48 lines · Greg Kroah-Hartman
Quoted 13 lines · Nishad Kamdar
This patch removes do {} while (0) loop for single statement macros. Issue found by checkpatch.
Signed-off-by Nishad Kamdar <[email protected]>--- drivers/staging/mt7621-mmc/sd.c | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-)drivers/staging/mt7621-mmc/sd.c +0
-0drivers/staging/mt7621-mmc/sd.c static int cd_active_low = 1; · line 107
Quoted 7 lines
drivers/staging/mt7621-mmc/sd.c +1
-3@@ -104,14 +104,10 @@ static int cd_active_low = 1;/* gate means clock power down */ static int g_clk_gate =0 ;#define msdc_gate_clock (id) \ - do { \ - g_clk_gate &= ~(1 << ((id) + PERI_MSDC0_PDN)); \ - } while (0) + (g_clk_gate &= ~(1 << ((id) + PERI_MSDC0_PDN)))This should become an inline function, right?
drivers/staging/mt7621-mmc/sd.c static int cd_active_low = 1; · line 110
Quoted 6 lines
drivers/staging/mt7621-mmc/sd.c +1
-3/* not like power down register. 1 means clock on. */ #define msdc_ungate_clock (id) \ - do { \ - g_clk_gate |= 1 << ((id) + PERI_MSDC0_PDN); \ - } while (0) + (g_clk_gate |= 1 << ((id) + PERI_MSDC0_PDN))Same here.
drivers/staging/mt7621-mmc/sd.c static void msdc_clr_fifo(struct msdc_host *host) · line 169
Quoted 11 lines
drivers/staging/mt7621-mmc/sd.c +1
-3// do we need sync object or not void msdc_clk_status (int *status)@@ -170,9 +166,7 @@ static void msdc_clr_fifo(struct msdc_host *host) }while (0 ) #define msdc_irq_restore(val) \ - do { \ - sdr_set_bits(host->base + MSDC_INTEN, val); \ - } while (0) + (sdr_set_bits (host->base +MSDC_INTEN , val))Just call the one function where this is used and delete this #define.
Quoted 5 lines
Same type of changes for the rest of these as well.
thanks,
greg k-h
Ok. I'll do that.
Thanks for the review.
regards,
nishad