Skip to contentSkip to conversation

staging: sm750fb: Remove dead VALIDATION_CHIP preprocessor blocks

PATCH In review Mohit Mishra 3 participants 4 messages Jul 25 – Jul 28

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 staging: sm750fb: Remove dead VALIDATION_CHIP preprocessor blocks

The macro VALIDATION_CHIP is not defined anywhere in the kernel source tree. Hence, '#ifdef VALIDATION_CHIP' blocks are dead code, and '#ifndef VALIDATION_CHIP' blocks are always active.

Remove the dead conditional blocks, keeping only the active paths, and clean up the unused macro definitions.

This addresses the first task in the drivers/staging/sm750fb/TODO list:
"- refine the code and remove unused code".

---
 drivers/staging/sm750fb/ddk750_chip.c  |  4 --
 drivers/staging/sm750fb/ddk750_power.c | 11 +----
 drivers/staging/sm750fb/ddk750_reg.h   | 60 ++++++--------------------
 3 files changed, 14 insertions(+), 61 deletions(-)
drivers/staging/sm750fb/ddk750_chip.c +0 -4
index aa78d0bc1d87..1b3d1467ddf0 100644
@@ -360,9 +360,7 @@ unsigned int sm750_calc_pll_value(unsigned int request_orig,
 
 unsigned int sm750_format_pll_reg(struct pll_value *p_PLL)
 {
-#ifndef VALIDATION_CHIP
 	unsigned int POD = p_PLL->POD;
-#endif
 	unsigned int OD = p_PLL->OD;
 	unsigned int M = p_PLL->M;
 	unsigned int N = p_PLL->N;
@@ -374,9 +372,7 @@ unsigned int sm750_format_pll_reg(struct pll_value *p_PLL)
 	 * applied to any PLL in the calling function.
 	 */
 	return PLL_CTRL_POWER |
-#ifndef VALIDATION_CHIP
 		((POD << PLL_CTRL_POD_SHIFT) & PLL_CTRL_POD_MASK) |
-#endif
 		((OD << PLL_CTRL_OD_SHIFT) & PLL_CTRL_OD_MASK) |
 		((N << PLL_CTRL_N_SHIFT) & PLL_CTRL_N_MASK) |
 		((M << PLL_CTRL_M_SHIFT) & PLL_CTRL_M_MASK);
drivers/staging/sm750fb/ddk750_power.c +2 -9
index eaba3bc2e01a..36fde3bcf1b7 100644
@@ -56,17 +56,10 @@ void sm750_set_power_mode(unsigned int mode)
 	}
 
 	/* Set up other fields in Power Control Register */
-	if (mode == POWER_MODE_CTRL_MODE_SLEEP) {
+	if (mode == POWER_MODE_CTRL_MODE_SLEEP)
 		ctrl &= ~POWER_MODE_CTRL_OSC_INPUT;
-#ifdef VALIDATION_CHIP
-		ctrl &= ~POWER_MODE_CTRL_336CLK;
-#endif
-	} else {
+	else
 		ctrl |= POWER_MODE_CTRL_OSC_INPUT;
-#ifdef VALIDATION_CHIP
-		ctrl |= POWER_MODE_CTRL_336CLK;
-#endif
-	}
 
 	/* Program new power mode. */
 	poke32(POWER_MODE_CTRL, ctrl);
drivers/staging/sm750fb/ddk750_reg.h +12 -48

128 lines not on this page · raw message

Signature · 1 line
2.43.0
#1 lore raw

PATCH v2 2/2 staging: sm750fb: Remove unused function sm750_enable_dma

The function sm750_enable_dma is defined in ddk750_power.c and declared in ddk750_power.h, but it is not called anywhere in the driver.

Remove the unused definition and declaration.

This addresses the first task in the drivers/staging/sm750fb/TODO list:
"- refine the code and remove unused code".

---
v2: Remove double blank line flagged by checkpatch -f (Dan Carpenter).

 drivers/staging/sm750fb/ddk750_power.c | 14 --------------
 drivers/staging/sm750fb/ddk750_power.h |  5 -----
 2 files changed, 19 deletions(-)
drivers/staging/sm750fb/ddk750_power.c +0 -14
index 36fde3bcf1b7..59ded1163052 100644
@@ -89,20 +89,6 @@ void sm750_enable_2d_engine(unsigned int enable)
 	sm750_set_current_gate(gate);
 }
 
-void sm750_enable_dma(unsigned int enable)
-{
-	u32 gate;
-
-	/* Enable DMA Gate */
-	gate = peek32(CURRENT_GATE);
-	if (enable)
-		gate |= CURRENT_GATE_DMA;
-	else
-		gate &= ~CURRENT_GATE_DMA;
-
-	sm750_set_current_gate(gate);
-}
-
 /*
  * This function enable/disable the GPIO Engine
  */
drivers/staging/sm750fb/ddk750_power.h +0 -5
index 1c4f054d7276..0c4ab2120385 100644
@@ -23,11 +23,6 @@ void sm750_set_current_gate(unsigned int gate);
  */
 void sm750_enable_2d_engine(unsigned int enable);
 
-/*
- * This function enable/disable the DMA Engine
- */
-void sm750_enable_dma(unsigned int enable);
-
 /*
  * This function enable/disable the GPIO Engine
  */
Signature · 1 line
2.43.0
Reviewed-by on v2 1/2
#2 lore raw
In reply to Mohit Mishra
Quoted 4 lines · Mohit Mishra

The macro VALIDATION_CHIP is not defined anywhere in the kernel source tree. Hence, '#ifdef VALIDATION_CHIP' blocks are dead code, and '#ifndef VALIDATION_CHIP' blocks are always active.

Quoted 8 lines

Remove the dead conditional blocks, keeping only the active paths, and clean up the unused macro definitions.

This addresses the first task in the drivers/staging/sm750fb/TODO list:
"- refine the code and remove unused code".

---

regards,
dan carpenter

#3 lore raw
In reply to Mohit Mishra

drivers/staging/sm750fb/ddk750_reg.h line 1025

Quoted 7 lines · Mohit Mishra
drivers/staging/sm750fb/ddk750_reg.h +0 -2
@@ -1020,9 +994,7 @@
 #define CRT_DISPLAY_CTRL_CRTSELECT                    BIT(25)
 #define CRT_DISPLAY_CTRL_RGBBIT                       BIT(24)
 
-#ifndef VALIDATION_CHIP
     #define CRT_DISPLAY_CTRL_CENTERING                BIT(24)
-#endif

The indentation makes no sense here now, right?

drivers/staging/sm750fb/ddk750_reg.h line 1126

Quoted 10 lines
drivers/staging/sm750fb/ddk750_reg.h +0 -2
 #define CRT_DISPLAY_CTRL_LOCK_TIMING                  BIT(23)
 #define CRT_DISPLAY_CTRL_EXPANSION                    BIT(22)
 #define CRT_DISPLAY_CTRL_VERTICAL_MODE                BIT(21)
@@ -1121,22 +1093,17 @@
 
 /* This vertical expansion below start at 0x080240 ~ 0x080264 */
 #define CRT_VERTICAL_EXPANSION                        0x080240
-#ifndef VALIDATION_CHIP
     #define CRT_VERTICAL_CENTERING_VALUE_MASK         (0xff << 24)
-#endif

Same here :(

And elsewhere in this patch.

Always look at the end result of your change please.

thanks,

greg k-h