Skip to contentSkip to conversation

Remove #if 0 blocks and fix macros

PATCH Superseded Nishad Kamdar 2 participants 6 messages Oct 1, 2018 – Oct 3, 2018

Subsystems (2)

v5 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v5 cover Remove #if 0 blocks and fix macros

This patchset removes #if 0 blocks and removes single statement macros.

Changes in v5:
- Split the patch in three different patches.
- The first patch removes #if 0 blocks.
- The second one removes msdc_irq_restore() macro.
- The third one removes other unused macros.
Changes in v4:
- Removed #if 0 code blocks and usages of functions defined in the #if 0 blocks in dbg.c and dbg.h
Changes in v3:
- Remove the #if 0 code blocks and usages of the functions defined in the #if 0 code block.
- Delete msdc_irq_restore() and replace its usage directly with call to the function being called by the macro.
Changes in v2:
- Convert msdc_gate_clk() and msdc_ungate_clk() to inline functions.
- Delete msdc_irq_restore(), msdc_vcore_on(), msdc_vcore_off(), msdc_vdd_on() and msdc_vdd_off() and replace their usages directly with calls to the function being called by these macros.

Nishad Kamdar (3):
staging: mt7621-mmc: Remove #if 0 blocks
staging: mt7621-mmc: Remove single statement macro msdc_irq_restore()
staging: mt7621-mmc: Remove unused single statement macros

 drivers/staging/mt7621-mmc/dbg.c |  21 +--
 drivers/staging/mt7621-mmc/dbg.h |  14 --
 drivers/staging/mt7621-mmc/sd.c  | 304 +------------------------------
 3 files changed, 2 insertions(+), 337 deletions(-)
Signature · 1 line
2.17.1
#1 lore raw

PATCH v5 1/3 staging: mt7621-mmc: Remove #if 0 blocks

This patch removes #if 0 code blocks and usages of functions defined in the #if 0 blocks.

---
 drivers/staging/mt7621-mmc/dbg.c |  21 +--
 drivers/staging/mt7621-mmc/dbg.h |  14 --
 drivers/staging/mt7621-mmc/sd.c  | 269 -------------------------------
 3 files changed, 1 insertion(+), 303 deletions(-)
drivers/staging/mt7621-mmc/dbg.c +1 -20
index 4fe4d2fd111e..2bafb3bd026e 100644
@@ -66,23 +66,6 @@ u32 sdio_pro_enable;   /* make sure gpt is enabled */
 u32 sdio_pro_time;     /* no more than 30s */
 struct sdio_profile sdio_perfomance = {0};
 
-#if 0 /* --- chhung */
-void msdc_init_gpt(void)
-{
-	GPT_CONFIG config;
-
-	config.num  = GPT6;
-	config.mode = GPT_FREE_RUN;
-	config.clkSrc = GPT_CLK_SRC_SYS;
-	config.clkDiv = GPT_CLK_DIV_1;   /* 13MHz GPT6 */
-
-	if (GPT_Config(config) == FALSE)
-		return;
-
-	GPT_Start(GPT6);
-}
-#endif /* end of --- */
-
 u32 msdc_time_calc(u32 old_L32, u32 old_H32, u32 new_L32, u32 new_H32)
 {
 	u32 ret = 0;
@@ -268,10 +251,8 @@ static ssize_t msdc_debug_proc_write(struct file *file,
 		}
 	} else if (cmd == SD_TOOL_SDIO_PROFILE) {
 		if (p1 == 1) { /* enable profile */
-			if (gpt_enable == 0) {
-				// msdc_init_gpt(); /* --- by chhung */
+			if (gpt_enable == 0)
 				gpt_enable = 1;
-			}
 			sdio_pro_enable = 1;
 			if (p2 == 0)
 				p2 = 1;
drivers/staging/mt7621-mmc/dbg.h +0 -14
index 4ab9f10dccc2..2a044c375910 100644
@@ -91,23 +91,9 @@ enum msdc_dbg {
 
 extern unsigned int sd_debug_zone[4];
 #define TAG "msdc"
-#if 0 /* +++ chhung */
-#define BUG_ON(x) \
-do { \
-	if (x) { \
-		printk("[BUG] %s LINE:%d FILE:%s\n", #x, __LINE__, __FILE__); \
-		while (1)						\
-			;						\
-	} \
-} while (0)
-#endif /* end of +++ */
 
 void msdc_debug_proc_init(void);
 
-#if 0 /* --- chhung */
-void msdc_init_gpt(void);
-extern void GPT_GetCounter64(UINT32 *cntL32, UINT32 *cntH32);
-#endif /* end of --- */
 u32 msdc_time_calc(u32 old_L32, u32 old_H32, u32 new_L32, u32 new_H32);
 void msdc_performance(u32 opcode, u32 sizes, u32 bRx, u32 ticks);
 
drivers/staging/mt7621-mmc/sd.c +0 -269

381 lines not on this page · raw message

Signature · 1 line
2.17.1
#4 lore raw

PATCH v5 2/3 staging: mt7621-mmc: Remove single statement macro msdc_irq_restore()

In reply to Nishad Kamdar

This patch removes the macro msdc_irq_restore() and replaces its usage with call to the function called in the macro definition. Issue found by checkpatch.

---
 drivers/staging/mt7621-mmc/sd.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/staging/mt7621-mmc/sd.c +1 -6
index c88b82488464..29e75804db67 100644
@@ -144,11 +144,6 @@ static void msdc_clr_fifo(struct msdc_host *host)
 		sdr_clr_bits(host->base + MSDC_INTEN, val);	\
 	} while (0)
 
-#define msdc_irq_restore(val) \
-	do {					\
-		sdr_set_bits(host->base + MSDC_INTEN, val);	\
-	} while (0)
-
 /* clock source for host: global */
 #if defined(CONFIG_SOC_MT7620)
 static u32 hclks[] = {48000000}; /* +/- by chhung */
@@ -299,7 +294,7 @@ static void msdc_set_mclk(struct msdc_host *host, int ddr, unsigned int hz)
 	host->mclk = hz;
 	msdc_set_timeout(host, host->timeout_ns, host->timeout_clks); // need?
 
-	msdc_irq_restore(flags);
+	sdr_set_bits(host->base + MSDC_INTEN, flags);
 }
 
 /* Fix me. when need to abort */
Signature · 1 line
2.17.1
#5 lore raw

PATCH v5 3/3 staging: mt7621-mmc: Remove unused single statement macros

In reply to Nishad Kamdar

This patch removes unused single statement macros in sd.c

---
 drivers/staging/mt7621-mmc/sd.c | 28 ----------------------------
 1 file changed, 28 deletions(-)
drivers/staging/mt7621-mmc/sd.c +0 -28
index 29e75804db67..d42765c54155 100644
@@ -151,32 +151,6 @@ static u32 hclks[] = {48000000}; /* +/- by chhung */
 static u32 hclks[] = {50000000}; /* +/- by chhung */
 #endif
 
-//============================================
-// the power for msdc host controller: global
-//    always keep the VMC on.
-//============================================
-#define msdc_vcore_on(host) \
-	do {								\
-		(void)hwPowerOn(MT65XX_POWER_LDO_VMC, VOL_3300, "SD");	\
-	} while (0)
-#define msdc_vcore_off(host) \
-	do {								\
-		(void)hwPowerDown(MT65XX_POWER_LDO_VMC, "SD");		\
-	} while (0)
-
-//====================================
-// 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)
-#define msdc_vdd_off(host) \
-	do {							\
-		(void)hwPowerDown(MT65XX_POWER_LDO_VMCH, "SD"); \
-	} while (0)
-
 #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)
 
@@ -1469,7 +1443,6 @@ static void msdc_enable_cd_irq(struct msdc_host *host, int enable)
 		 * shouldn't be turned off. Here adds a reference count to keep
 		 * the core power alive.
 		 */
-		//msdc_vcore_on(host); //did in msdc_init_hw()
 
 		if (hw->config_gpio_pin) /* NULL */
 			hw->config_gpio_pin(MSDC_CD_PIN, GPIO_PULL_UP);
@@ -1492,7 +1465,6 @@ static void msdc_enable_cd_irq(struct msdc_host *host, int enable)
 		/* Here decreases a reference count to core power since card
 		 * detection circuit is shutdown.
 		 */
-		//msdc_vcore_off(host);
 	}
 }
 
Signature · 1 line
2.17.1
#2 lore raw

Re: [PATCH v5 1/3] staging: mt7621-mmc: Remove #if 0 blocks

In reply to Nishad Kamdar
Quoted 9 lines · Nishad Kamdar

This patch removes #if 0 code blocks and usages of functions defined in the #if 0 blocks.

---
 drivers/staging/mt7621-mmc/dbg.c |  21 +--
 drivers/staging/mt7621-mmc/dbg.h |  14 --
 drivers/staging/mt7621-mmc/sd.c  | 269 -------------------------------
 3 files changed, 1 insertion(+), 303 deletions(-)

This patch did not apply :(

#3 lore raw

Re: [PATCH v5 1/3] staging: mt7621-mmc: Remove #if 0 blocks

Quoted 4 lines · Greg Kroah-Hartman
Quoted 3 lines · Nishad Kamdar

This patch removes #if 0 code blocks and usages of functions defined in the #if 0 blocks.

Quoted 8 lines
Quoted 6 lines
---
 drivers/staging/mt7621-mmc/dbg.c |  21 +--
 drivers/staging/mt7621-mmc/dbg.h |  14 --
 drivers/staging/mt7621-mmc/sd.c  | 269 -------------------------------
 3 files changed, 1 insertion(+), 303 deletions(-)

This patch did not apply :(

Oh, do you mean it gave conflicts while applying?
I'll check and resubmit it in that case.

Thanks for the review.

regards,
Nishad