Skip to contentSkip to conversation

Staging: sm750fb: remove typedefs in ddk750_chip.h

PATCH In review Mihaela Muraru 2 participants 2 messages Oct 5, 2016

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

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

This patch fixes the checkpatch.pl warning: "WARNING: do not add new typedefs". Hiding a variables of type 'struct' is not always a good idea,because when we passing them as parameters we tempt to forget that in this proces we work with stack memory and allocatting struct on stack is something that we should manage carefuly.

---
Changes in v2:
- add more details on description.
- delete '_t' from the name of the structs.

---
 drivers/staging/sm750fb/ddk750_chip.c |  8 ++++----
 drivers/staging/sm750fb/ddk750_chip.h | 10 +++++-----
 drivers/staging/sm750fb/ddk750_mode.c |  4 ++--
 drivers/staging/sm750fb/sm750_hw.c    |  2 +-
 4 files changed, 12 insertions(+), 12 deletions(-)
drivers/staging/sm750fb/ddk750_chip.c +4 -4
index bfe2f1a..ac39f4e 100644
@@ -56,7 +56,7 @@ static unsigned int get_mxclk_freq(void)
  */
 static void setChipClock(unsigned int frequency)
 {
-	struct pll_value_t pll;
+	struct pll_value 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(struct initchip_param_t *pInitParam)
+int ddk750_initHw(struct initchip_param *pInitParam)
 {
 	unsigned int reg;
 
@@ -307,7 +307,7 @@ int ddk750_initHw(struct initchip_param_t *pInitParam)
  * M = {1,...,255}
  * N = {2,...,15}
  */
-unsigned int calcPllValue(unsigned int request_orig, struct pll_value_t *pll)
+unsigned int calcPllValue(unsigned int request_orig, struct pll_value *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, struct pll_value_t *pll)
 	return ret;
 }
 
-unsigned int formatPllReg(struct pll_value_t *pPLL)
+unsigned int formatPllReg(struct pll_value *pPLL)
 {
 #ifndef VALIDATION_CHIP
 	unsigned int POD = pPLL->POD;
drivers/staging/sm750fb/ddk750_chip.h +5 -5
index be4ba11..3cd398f 100644
@@ -25,7 +25,7 @@ typedef enum _clock_type_t {
 }
 clock_type_t;
 
-struct pll_value_t {
+struct pll_value {
 	clock_type_t clockType;
 	unsigned long inputFreq; /* Input clock frequency to the PLL */
 
@@ -37,7 +37,7 @@ struct pll_value_t {
 };
 
 /* input struct to initChipParam() function */
-struct initchip_param_t {
+struct initchip_param {
 	unsigned short powerMode;    /* Use power mode 0 or 1 */
 	unsigned short chipClock;    /**
 				      * Speed of main chip clock in MHz unit
@@ -68,10 +68,10 @@ struct initchip_param_t {
 };
 
 logical_chip_type_t sm750_get_chip_type(void);
-unsigned int calcPllValue(unsigned int request, struct pll_value_t *pll);
-unsigned int formatPllReg(struct pll_value_t *pPLL);
+unsigned int calcPllValue(unsigned int request, struct pll_value *pll);
+unsigned int formatPllReg(struct pll_value *pPLL);
 void ddk750_set_mmio(void __iomem *, unsigned short, char);
 unsigned int ddk750_getVMSize(void);
-int ddk750_initHw(struct initchip_param_t *);
+int ddk750_initHw(struct initchip_param *);
 
 #endif
drivers/staging/sm750fb/ddk750_mode.c +2 -2
index f28eb07..c1f8987 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, struct pll_value_t *pll)
+static int programModeRegisters(mode_parameter_t *pModeParam, struct pll_value *pll)
 {
 	int ret = 0;
 	int cnt = 0;
@@ -202,7 +202,7 @@ static int programModeRegisters(mode_parameter_t *pModeParam, struct pll_value_t
 
 int ddk750_setModeTiming(mode_parameter_t *parm, clock_type_t clock)
 {
-	struct pll_value_t pll;
+	struct pll_value pll;
 	unsigned int uiActualPixelClk;
 
 	pll.inputFreq = DEFAULT_INPUT_CLOCK;
drivers/staging/sm750fb/sm750_hw.c +1 -1
index b253ba0..74a97b4 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((struct initchip_param_t *)&sm750_dev->initParm);
+	ddk750_initHw((struct initchip_param *)&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 5 lines · Mihaela Muraru

This patch fixes the checkpatch.pl warning: "WARNING: do not add new typedefs". Hiding a variables of type 'struct' is not always a good idea,because when we passing them as parameters we tempt to forget that in this proces we work with stack memory and allocatting struct on stack is something that we should manage carefuly.

I think that this patch is against your previous patch. It should be against Greg's tree,

julia

Quoted 135 lines

---
Changes in v2:
- add more details on description.
- delete '_t' from the name of the structs.

---
 drivers/staging/sm750fb/ddk750_chip.c |  8 ++++----
 drivers/staging/sm750fb/ddk750_chip.h | 10 +++++-----
 drivers/staging/sm750fb/ddk750_mode.c |  4 ++--
 drivers/staging/sm750fb/sm750_hw.c    |  2 +-
 4 files changed, 12 insertions(+), 12 deletions(-)
drivers/staging/sm750fb/ddk750_chip.c +4 -4
index bfe2f1a..ac39f4e 100644
@@ -56,7 +56,7 @@ static unsigned int get_mxclk_freq(void)
  */
 static void setChipClock(unsigned int frequency)
 {
-	struct pll_value_t pll;
+	struct pll_value 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(struct initchip_param_t *pInitParam)
+int ddk750_initHw(struct initchip_param *pInitParam)
 {
 	unsigned int reg;
 
@@ -307,7 +307,7 @@ int ddk750_initHw(struct initchip_param_t *pInitParam)
  * M = {1,...,255}
  * N = {2,...,15}
  */
-unsigned int calcPllValue(unsigned int request_orig, struct pll_value_t *pll)
+unsigned int calcPllValue(unsigned int request_orig, struct pll_value *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, struct pll_value_t *pll)
 	return ret;
 }
 
-unsigned int formatPllReg(struct pll_value_t *pPLL)
+unsigned int formatPllReg(struct pll_value *pPLL)
 {
 #ifndef VALIDATION_CHIP
 	unsigned int POD = pPLL->POD;
drivers/staging/sm750fb/ddk750_chip.h +5 -5
index be4ba11..3cd398f 100644
@@ -25,7 +25,7 @@ typedef enum _clock_type_t {
 }
 clock_type_t;
 
-struct pll_value_t {
+struct pll_value {
 	clock_type_t clockType;
 	unsigned long inputFreq; /* Input clock frequency to the PLL */
 
@@ -37,7 +37,7 @@ struct pll_value_t {
 };
 
 /* input struct to initChipParam() function */
-struct initchip_param_t {
+struct initchip_param {
 	unsigned short powerMode;    /* Use power mode 0 or 1 */
 	unsigned short chipClock;    /**
 				      * Speed of main chip clock in MHz unit
@@ -68,10 +68,10 @@ struct initchip_param_t {
 };
 
 logical_chip_type_t sm750_get_chip_type(void);
-unsigned int calcPllValue(unsigned int request, struct pll_value_t *pll);
-unsigned int formatPllReg(struct pll_value_t *pPLL);
+unsigned int calcPllValue(unsigned int request, struct pll_value *pll);
+unsigned int formatPllReg(struct pll_value *pPLL);
 void ddk750_set_mmio(void __iomem *, unsigned short, char);
 unsigned int ddk750_getVMSize(void);
-int ddk750_initHw(struct initchip_param_t *);
+int ddk750_initHw(struct initchip_param *);
 
 #endif
drivers/staging/sm750fb/ddk750_mode.c +2 -2
index f28eb07..c1f8987 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, struct pll_value_t *pll)
+static int programModeRegisters(mode_parameter_t *pModeParam, struct pll_value *pll)
 {
 	int ret = 0;
 	int cnt = 0;
@@ -202,7 +202,7 @@ static int programModeRegisters(mode_parameter_t *pModeParam, struct pll_value_t
 
 int ddk750_setModeTiming(mode_parameter_t *parm, clock_type_t clock)
 {
-	struct pll_value_t pll;
+	struct pll_value pll;
 	unsigned int uiActualPixelClk;
 
 	pll.inputFreq = DEFAULT_INPUT_CLOCK;
drivers/staging/sm750fb/sm750_hw.c +1 -2
index b253ba0..74a97b4 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((struct initchip_param_t *)&sm750_dev->initParm);
+	ddk750_initHw((struct initchip_param *)&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/20161005204541.GA17653%40domino-MS-16Y1.
For more options, visit https://groups.google.com/d/optout.