Skip to contentSkip to conversation

Staging: sm750fb: remove typedefs in ddk750_chip.h

PATCH Superseded Muraru Mihaela 2 participants 4 messages Oct 4, 2016 – Oct 5, 2016

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: sm750fb: remove typedefs in ddk750_chip.h

This patch fixes the checkpatch.pl warning: "WARNING: do not add new typedefs" by removing the typedefs and changing the files where it was used.

---
 drivers/staging/sm750fb/ddk750_chip.c |  8 ++++----
 drivers/staging/sm750fb/ddk750_chip.h | 16 +++++++---------
 drivers/staging/sm750fb/ddk750_mode.c |  4 ++--
 drivers/staging/sm750fb/sm750_hw.c    |  2 +-
 4 files changed, 14 insertions(+), 16 deletions(-)
drivers/staging/sm750fb/ddk750_chip.c +4 -4
index 3a0afe1..bfe2f1a 100644
@@ -56,7 +56,7 @@ static unsigned int get_mxclk_freq(void)
  */
 static void setChipClock(unsigned int frequency)
 {
-	pll_value_t pll;
+	struct pll_value_t pll;
 	unsigned int ulActualMxClk;
 
 	/* Cheok_0509: For SM750LE, the chip clock is fixed. Nothing to set. */
@@ -208,7 +208,7 @@ unsigned int ddk750_getVMSize(void)
 	return data;
 }
 
-int ddk750_initHw(initchip_param_t *pInitParam)
+int ddk750_initHw(struct initchip_param_t *pInitParam)
 {
 	unsigned int reg;
 
@@ -307,7 +307,7 @@ int ddk750_initHw(initchip_param_t *pInitParam)
  * M = {1,...,255}
  * N = {2,...,15}
  */
-unsigned int calcPllValue(unsigned int request_orig, pll_value_t *pll)
+unsigned int calcPllValue(unsigned int request_orig, struct pll_value_t *pll)
 {
 	/* as sm750 register definition,
 	 * N located in 2,15 and M located in 1,255
@@ -375,7 +375,7 @@ unsigned int calcPllValue(unsigned int request_orig, pll_value_t *pll)
 	return ret;
 }
 
-unsigned int formatPllReg(pll_value_t *pPLL)
+unsigned int formatPllReg(struct pll_value_t *pPLL)
 {
 #ifndef VALIDATION_CHIP
 	unsigned int POD = pPLL->POD;
drivers/staging/sm750fb/ddk750_chip.h +7 -9
index 14357fd..be4ba11 100644
@@ -25,7 +25,7 @@ typedef enum _clock_type_t {
 }
 clock_type_t;
 
-typedef struct _pll_value_t {
+struct pll_value_t {
 	clock_type_t clockType;
 	unsigned long inputFreq; /* Input clock frequency to the PLL */
 
@@ -34,11 +34,10 @@ typedef struct _pll_value_t {
 	unsigned long N;
 	unsigned long OD;
 	unsigned long POD;
-}
-pll_value_t;
+};
 
 /* input struct to initChipParam() function */
-typedef struct _initchip_param_t {
+struct initchip_param_t {
 	unsigned short powerMode;    /* Use power mode 0 or 1 */
 	unsigned short chipClock;    /**
 				      * Speed of main chip clock in MHz unit
@@ -66,14 +65,13 @@ typedef struct _initchip_param_t {
 				      */
 
 	/* More initialization parameter can be added if needed */
-}
-initchip_param_t;
+};
 
 logical_chip_type_t sm750_get_chip_type(void);
-unsigned int calcPllValue(unsigned int request, pll_value_t *pll);
-unsigned int formatPllReg(pll_value_t *pPLL);
+unsigned int calcPllValue(unsigned int request, struct pll_value_t *pll);
+unsigned int formatPllReg(struct pll_value_t *pPLL);
 void ddk750_set_mmio(void __iomem *, unsigned short, char);
 unsigned int ddk750_getVMSize(void);
-int ddk750_initHw(initchip_param_t *);
+int ddk750_initHw(struct initchip_param_t *);
 
 #endif
drivers/staging/sm750fb/ddk750_mode.c +2 -2
index b767c7d..f28eb07 100644
@@ -73,7 +73,7 @@ static unsigned long displayControlAdjust_SM750LE(mode_parameter_t *pModeParam,
 
 
 /* only timing related registers will be  programed */
-static int programModeRegisters(mode_parameter_t *pModeParam, pll_value_t *pll)
+static int programModeRegisters(mode_parameter_t *pModeParam, struct pll_value_t *pll)
 {
 	int ret = 0;
 	int cnt = 0;
@@ -202,7 +202,7 @@ static int programModeRegisters(mode_parameter_t *pModeParam, pll_value_t *pll)
 
 int ddk750_setModeTiming(mode_parameter_t *parm, clock_type_t clock)
 {
-	pll_value_t pll;
+	struct pll_value_t pll;
 	unsigned int uiActualPixelClk;
 
 	pll.inputFreq = DEFAULT_INPUT_CLOCK;
drivers/staging/sm750fb/sm750_hw.c +1 -1
index 7dd208c..b253ba0 100644
@@ -100,7 +100,7 @@ int hw_sm750_inithw(struct sm750_dev *sm750_dev, struct pci_dev *pdev)
 	if (parm->master_clk == 0)
 		parm->master_clk = parm->chip_clk / 3;
 
-	ddk750_initHw((initchip_param_t *)&sm750_dev->initParm);
+	ddk750_initHw((struct initchip_param_t *)&sm750_dev->initParm);
 	/* for sm718, open pci burst */
 	if (sm750_dev->devid == 0x718) {
 		POKE32(SYSTEM_CTRL,
Signature · 1 line
2.7.4
#1 lore raw
Quoted 3 lines · Muraru Mihaela

This patch fixes the checkpatch.pl warning: "WARNING: do not add new typedefs" by removing the typedefs and changing the files where it was used.

This is a nice problem to work on. I would suggest to make the commit message a bit more specific by saying which types you are converting. It would help orient the reader when looking at the subsequent code.

Also, it would be good to change the type name. The _t suggests a typedef. So you can remove that in each case.

Be sure that you have a .o file for each .c file that you modify. And check with grep to be double sure that you have adjusted all references to this type in the Linux kernel. Whether a particular line of code is compiled depends on configuration options, so there is a small chance that you could accidentally miss one occurrence, and that occurrence would be one that is under some #ifdefs that are not compatible with your configuration.

julia

Quoted 140 lines
---
 drivers/staging/sm750fb/ddk750_chip.c |  8 ++++----
 drivers/staging/sm750fb/ddk750_chip.h | 16 +++++++---------
 drivers/staging/sm750fb/ddk750_mode.c |  4 ++--
 drivers/staging/sm750fb/sm750_hw.c    |  2 +-
 4 files changed, 14 insertions(+), 16 deletions(-)
drivers/staging/sm750fb/ddk750_chip.c +4 -4
index 3a0afe1..bfe2f1a 100644
@@ -56,7 +56,7 @@ static unsigned int get_mxclk_freq(void)
  */
 static void setChipClock(unsigned int frequency)
 {
-	pll_value_t pll;
+	struct pll_value_t pll;
 	unsigned int ulActualMxClk;
 
 	/* Cheok_0509: For SM750LE, the chip clock is fixed. Nothing to set. */
@@ -208,7 +208,7 @@ unsigned int ddk750_getVMSize(void)
 	return data;
 }
 
-int ddk750_initHw(initchip_param_t *pInitParam)
+int ddk750_initHw(struct initchip_param_t *pInitParam)
 {
 	unsigned int reg;
 
@@ -307,7 +307,7 @@ int ddk750_initHw(initchip_param_t *pInitParam)
  * M = {1,...,255}
  * N = {2,...,15}
  */
-unsigned int calcPllValue(unsigned int request_orig, pll_value_t *pll)
+unsigned int calcPllValue(unsigned int request_orig, struct pll_value_t *pll)
 {
 	/* as sm750 register definition,
 	 * N located in 2,15 and M located in 1,255
@@ -375,7 +375,7 @@ unsigned int calcPllValue(unsigned int request_orig, pll_value_t *pll)
 	return ret;
 }
 
-unsigned int formatPllReg(pll_value_t *pPLL)
+unsigned int formatPllReg(struct pll_value_t *pPLL)
 {
 #ifndef VALIDATION_CHIP
 	unsigned int POD = pPLL->POD;
drivers/staging/sm750fb/ddk750_chip.h +7 -9
index 14357fd..be4ba11 100644
@@ -25,7 +25,7 @@ typedef enum _clock_type_t {
 }
 clock_type_t;
 
-typedef struct _pll_value_t {
+struct pll_value_t {
 	clock_type_t clockType;
 	unsigned long inputFreq; /* Input clock frequency to the PLL */
 
@@ -34,11 +34,10 @@ typedef struct _pll_value_t {
 	unsigned long N;
 	unsigned long OD;
 	unsigned long POD;
-}
-pll_value_t;
+};
 
 /* input struct to initChipParam() function */
-typedef struct _initchip_param_t {
+struct initchip_param_t {
 	unsigned short powerMode;    /* Use power mode 0 or 1 */
 	unsigned short chipClock;    /**
 				      * Speed of main chip clock in MHz unit
@@ -66,14 +65,13 @@ typedef struct _initchip_param_t {
 				      */
 
 	/* More initialization parameter can be added if needed */
-}
-initchip_param_t;
+};
 
 logical_chip_type_t sm750_get_chip_type(void);
-unsigned int calcPllValue(unsigned int request, pll_value_t *pll);
-unsigned int formatPllReg(pll_value_t *pPLL);
+unsigned int calcPllValue(unsigned int request, struct pll_value_t *pll);
+unsigned int formatPllReg(struct pll_value_t *pPLL);
 void ddk750_set_mmio(void __iomem *, unsigned short, char);
 unsigned int ddk750_getVMSize(void);
-int ddk750_initHw(initchip_param_t *);
+int ddk750_initHw(struct initchip_param_t *);
 
 #endif
drivers/staging/sm750fb/ddk750_mode.c +2 -2
index b767c7d..f28eb07 100644
@@ -73,7 +73,7 @@ static unsigned long displayControlAdjust_SM750LE(mode_parameter_t *pModeParam,
 
 
 /* only timing related registers will be  programed */
-static int programModeRegisters(mode_parameter_t *pModeParam, pll_value_t *pll)
+static int programModeRegisters(mode_parameter_t *pModeParam, struct pll_value_t *pll)
 {
 	int ret = 0;
 	int cnt = 0;
@@ -202,7 +202,7 @@ static int programModeRegisters(mode_parameter_t *pModeParam, pll_value_t *pll)
 
 int ddk750_setModeTiming(mode_parameter_t *parm, clock_type_t clock)
 {
-	pll_value_t pll;
+	struct pll_value_t pll;
 	unsigned int uiActualPixelClk;
 
 	pll.inputFreq = DEFAULT_INPUT_CLOCK;
drivers/staging/sm750fb/sm750_hw.c +1 -2
index 7dd208c..b253ba0 100644
@@ -100,7 +100,7 @@ int hw_sm750_inithw(struct sm750_dev *sm750_dev, struct pci_dev *pdev)
 	if (parm->master_clk == 0)
 		parm->master_clk = parm->chip_clk / 3;
 
-	ddk750_initHw((initchip_param_t *)&sm750_dev->initParm);
+	ddk750_initHw((struct initchip_param_t *)&sm750_dev->initParm);
 	/* for sm718, open pci burst */
 	if (sm750_dev->devid == 0x718) {
 		POKE32(SYSTEM_CTRL,
--

2.7.4

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20161004225439.GA10563%40domino-MS-16Y1.
For more options, visit https://groups.google.com/d/optout.

#2 lore raw
Quoted 23 lines · Julia Lawall
Quoted 3 lines · Muraru Mihaela

This patch fixes the checkpatch.pl warning: "WARNING: do not add new typedefs" by removing the typedefs and changing the files where it was used.

This is a nice problem to work on. I would suggest to make the commit message a bit more specific by saying which types you are converting. It would help orient the reader when looking at the subsequent code.

Also, it would be good to change the type name. The _t suggests a typedef. So you can remove that in each case.

Be sure that you have a .o file for each .c file that you modify. And check with grep to be double sure that you have adjusted all references to this type in the Linux kernel. Whether a particular line of code is compiled depends on configuration options, so there is a small chance that you could accidentally miss one occurrence, and that occurrence would be one that is under some #ifdefs that are not compatible with your configuration.

Quoted 1 line

julia

Thank you Julia, I will resend the patch v2 and I'll make the changes suggested by you.

mihaela

Quoted 140 lines
Quoted 140 lines
---
 drivers/staging/sm750fb/ddk750_chip.c |  8 ++++----
 drivers/staging/sm750fb/ddk750_chip.h | 16 +++++++---------
 drivers/staging/sm750fb/ddk750_mode.c |  4 ++--
 drivers/staging/sm750fb/sm750_hw.c    |  2 +-
 4 files changed, 14 insertions(+), 16 deletions(-)
drivers/staging/sm750fb/ddk750_chip.c +4 -4
index 3a0afe1..bfe2f1a 100644
@@ -56,7 +56,7 @@ static unsigned int get_mxclk_freq(void)
  */
 static void setChipClock(unsigned int frequency)
 {
-	pll_value_t pll;
+	struct pll_value_t pll;
 	unsigned int ulActualMxClk;
 
 	/* Cheok_0509: For SM750LE, the chip clock is fixed. Nothing to set. */
@@ -208,7 +208,7 @@ unsigned int ddk750_getVMSize(void)
 	return data;
 }
 
-int ddk750_initHw(initchip_param_t *pInitParam)
+int ddk750_initHw(struct initchip_param_t *pInitParam)
 {
 	unsigned int reg;
 
@@ -307,7 +307,7 @@ int ddk750_initHw(initchip_param_t *pInitParam)
  * M = {1,...,255}
  * N = {2,...,15}
  */
-unsigned int calcPllValue(unsigned int request_orig, pll_value_t *pll)
+unsigned int calcPllValue(unsigned int request_orig, struct pll_value_t *pll)
 {
 	/* as sm750 register definition,
 	 * N located in 2,15 and M located in 1,255
@@ -375,7 +375,7 @@ unsigned int calcPllValue(unsigned int request_orig, pll_value_t *pll)
 	return ret;
 }
 
-unsigned int formatPllReg(pll_value_t *pPLL)
+unsigned int formatPllReg(struct pll_value_t *pPLL)
 {
 #ifndef VALIDATION_CHIP
 	unsigned int POD = pPLL->POD;
drivers/staging/sm750fb/ddk750_chip.h +7 -9
index 14357fd..be4ba11 100644
@@ -25,7 +25,7 @@ typedef enum _clock_type_t {
 }
 clock_type_t;
 
-typedef struct _pll_value_t {
+struct pll_value_t {
 	clock_type_t clockType;
 	unsigned long inputFreq; /* Input clock frequency to the PLL */
 
@@ -34,11 +34,10 @@ typedef struct _pll_value_t {
 	unsigned long N;
 	unsigned long OD;
 	unsigned long POD;
-}
-pll_value_t;
+};
 
 /* input struct to initChipParam() function */
-typedef struct _initchip_param_t {
+struct initchip_param_t {
 	unsigned short powerMode;    /* Use power mode 0 or 1 */
 	unsigned short chipClock;    /**
 				      * Speed of main chip clock in MHz unit
@@ -66,14 +65,13 @@ typedef struct _initchip_param_t {
 				      */
 
 	/* More initialization parameter can be added if needed */
-}
-initchip_param_t;
+};
 
 logical_chip_type_t sm750_get_chip_type(void);
-unsigned int calcPllValue(unsigned int request, pll_value_t *pll);
-unsigned int formatPllReg(pll_value_t *pPLL);
+unsigned int calcPllValue(unsigned int request, struct pll_value_t *pll);
+unsigned int formatPllReg(struct pll_value_t *pPLL);
 void ddk750_set_mmio(void __iomem *, unsigned short, char);
 unsigned int ddk750_getVMSize(void);
-int ddk750_initHw(initchip_param_t *);
+int ddk750_initHw(struct initchip_param_t *);
 
 #endif
drivers/staging/sm750fb/ddk750_mode.c +2 -2
index b767c7d..f28eb07 100644
@@ -73,7 +73,7 @@ static unsigned long displayControlAdjust_SM750LE(mode_parameter_t *pModeParam,
 
 
 /* only timing related registers will be  programed */
-static int programModeRegisters(mode_parameter_t *pModeParam, pll_value_t *pll)
+static int programModeRegisters(mode_parameter_t *pModeParam, struct pll_value_t *pll)
 {
 	int ret = 0;
 	int cnt = 0;
@@ -202,7 +202,7 @@ static int programModeRegisters(mode_parameter_t *pModeParam, pll_value_t *pll)
 
 int ddk750_setModeTiming(mode_parameter_t *parm, clock_type_t clock)
 {
-	pll_value_t pll;
+	struct pll_value_t pll;
 	unsigned int uiActualPixelClk;
 
 	pll.inputFreq = DEFAULT_INPUT_CLOCK;
drivers/staging/sm750fb/sm750_hw.c +1 -2
index 7dd208c..b253ba0 100644
@@ -100,7 +100,7 @@ int hw_sm750_inithw(struct sm750_dev *sm750_dev, struct pci_dev *pdev)
 	if (parm->master_clk == 0)
 		parm->master_clk = parm->chip_clk / 3;
 
-	ddk750_initHw((initchip_param_t *)&sm750_dev->initParm);
+	ddk750_initHw((struct initchip_param_t *)&sm750_dev->initParm);
 	/* for sm718, open pci burst */
 	if (sm750_dev->devid == 0x718) {
 		POKE32(SYSTEM_CTRL,
--

2.7.4

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20161004225439.GA10563%40domino-MS-16Y1.
For more options, visit https://groups.google.com/d/optout.

#3 lore raw
In reply to Muraru Mihaela
Quoted 5 lines · Muraru Mihaela

This patch fixes the checkpatch.pl warning: "WARNING: do not add new typedefs" by removing the typedefs and changing the files where it was used.

Do you have your name inverted here? The order doesn't match that of your email address.

julia

Quoted 138 lines
---
 drivers/staging/sm750fb/ddk750_chip.c |  8 ++++----
 drivers/staging/sm750fb/ddk750_chip.h | 16 +++++++---------
 drivers/staging/sm750fb/ddk750_mode.c |  4 ++--
 drivers/staging/sm750fb/sm750_hw.c    |  2 +-
 4 files changed, 14 insertions(+), 16 deletions(-)
drivers/staging/sm750fb/ddk750_chip.c +4 -4
index 3a0afe1..bfe2f1a 100644
@@ -56,7 +56,7 @@ static unsigned int get_mxclk_freq(void)
  */
 static void setChipClock(unsigned int frequency)
 {
-	pll_value_t pll;
+	struct pll_value_t pll;
 	unsigned int ulActualMxClk;
 
 	/* Cheok_0509: For SM750LE, the chip clock is fixed. Nothing to set. */
@@ -208,7 +208,7 @@ unsigned int ddk750_getVMSize(void)
 	return data;
 }
 
-int ddk750_initHw(initchip_param_t *pInitParam)
+int ddk750_initHw(struct initchip_param_t *pInitParam)
 {
 	unsigned int reg;
 
@@ -307,7 +307,7 @@ int ddk750_initHw(initchip_param_t *pInitParam)
  * M = {1,...,255}
  * N = {2,...,15}
  */
-unsigned int calcPllValue(unsigned int request_orig, pll_value_t *pll)
+unsigned int calcPllValue(unsigned int request_orig, struct pll_value_t *pll)
 {
 	/* as sm750 register definition,
 	 * N located in 2,15 and M located in 1,255
@@ -375,7 +375,7 @@ unsigned int calcPllValue(unsigned int request_orig, pll_value_t *pll)
 	return ret;
 }
 
-unsigned int formatPllReg(pll_value_t *pPLL)
+unsigned int formatPllReg(struct pll_value_t *pPLL)
 {
 #ifndef VALIDATION_CHIP
 	unsigned int POD = pPLL->POD;
drivers/staging/sm750fb/ddk750_chip.h +7 -9
index 14357fd..be4ba11 100644
@@ -25,7 +25,7 @@ typedef enum _clock_type_t {
 }
 clock_type_t;
 
-typedef struct _pll_value_t {
+struct pll_value_t {
 	clock_type_t clockType;
 	unsigned long inputFreq; /* Input clock frequency to the PLL */
 
@@ -34,11 +34,10 @@ typedef struct _pll_value_t {
 	unsigned long N;
 	unsigned long OD;
 	unsigned long POD;
-}
-pll_value_t;
+};
 
 /* input struct to initChipParam() function */
-typedef struct _initchip_param_t {
+struct initchip_param_t {
 	unsigned short powerMode;    /* Use power mode 0 or 1 */
 	unsigned short chipClock;    /**
 				      * Speed of main chip clock in MHz unit
@@ -66,14 +65,13 @@ typedef struct _initchip_param_t {
 				      */
 
 	/* More initialization parameter can be added if needed */
-}
-initchip_param_t;
+};
 
 logical_chip_type_t sm750_get_chip_type(void);
-unsigned int calcPllValue(unsigned int request, pll_value_t *pll);
-unsigned int formatPllReg(pll_value_t *pPLL);
+unsigned int calcPllValue(unsigned int request, struct pll_value_t *pll);
+unsigned int formatPllReg(struct pll_value_t *pPLL);
 void ddk750_set_mmio(void __iomem *, unsigned short, char);
 unsigned int ddk750_getVMSize(void);
-int ddk750_initHw(initchip_param_t *);
+int ddk750_initHw(struct initchip_param_t *);
 
 #endif
drivers/staging/sm750fb/ddk750_mode.c +2 -2
index b767c7d..f28eb07 100644
@@ -73,7 +73,7 @@ static unsigned long displayControlAdjust_SM750LE(mode_parameter_t *pModeParam,
 
 
 /* only timing related registers will be  programed */
-static int programModeRegisters(mode_parameter_t *pModeParam, pll_value_t *pll)
+static int programModeRegisters(mode_parameter_t *pModeParam, struct pll_value_t *pll)
 {
 	int ret = 0;
 	int cnt = 0;
@@ -202,7 +202,7 @@ static int programModeRegisters(mode_parameter_t *pModeParam, pll_value_t *pll)
 
 int ddk750_setModeTiming(mode_parameter_t *parm, clock_type_t clock)
 {
-	pll_value_t pll;
+	struct pll_value_t pll;
 	unsigned int uiActualPixelClk;
 
 	pll.inputFreq = DEFAULT_INPUT_CLOCK;
drivers/staging/sm750fb/sm750_hw.c +1 -2
index 7dd208c..b253ba0 100644
@@ -100,7 +100,7 @@ int hw_sm750_inithw(struct sm750_dev *sm750_dev, struct pci_dev *pdev)
 	if (parm->master_clk == 0)
 		parm->master_clk = parm->chip_clk / 3;
 
-	ddk750_initHw((initchip_param_t *)&sm750_dev->initParm);
+	ddk750_initHw((struct initchip_param_t *)&sm750_dev->initParm);
 	/* for sm718, open pci burst */
 	if (sm750_dev->devid == 0x718) {
 		POKE32(SYSTEM_CTRL,
--

2.7.4

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20161004225439.GA10563%40domino-MS-16Y1.
For more options, visit https://groups.google.com/d/optout.