Skip to contentSkip to conversation

Staging: emxx_udc: Fix do not add new typedefs

PATCH Superseded Haneen Mohammed 2 participants 2 messages Feb 19, 2015 Staging

v1 of 10 Superseded Latest is v10 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: emxx_udc: Fix do not add new typedefs

This patch fixes "do not add new typedefs" warning generated by checkpatch.pl.

---
 drivers/staging/emxx_udc/emxx_udc.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/staging/emxx_udc/emxx_udc.h +4 -4
index ee1b80d..debad46 100644
@@ -475,7 +475,7 @@
 /*===========================================================================*/
 /* Struct */
 /*------- T_EP_REGS */
-typedef struct _T_EP_REGS {
+struct _T_EP_REGS {
 	u32 EP_CONTROL;			/* EP Control */
 	u32 EP_STATUS;			/* EP Status */
 	u32 EP_INT_ENA;			/* EP Interrupt Enable */
@@ -487,7 +487,7 @@ typedef struct _T_EP_REGS {
 } T_EP_REGS, *PT_EP_REGS;
 
 /*------- T_EP_DCR */
-typedef struct _T_EP_DCR {
+struct _T_EP_DCR {
 	u32 EP_DCR1;			/* EP_DCR1 */
 	u32 EP_DCR2;			/* EP_DCR2 */
 	u32 EP_TADR;			/* EP_TADR */
@@ -495,7 +495,7 @@ typedef struct _T_EP_DCR {
 } T_EP_DCR, *PT_EP_DCR;
 
 /*------- Function Registers */
-typedef struct _T_FC_REGS {
+struct _T_FC_REGS {
 	u32 USB_CONTROL;		/* (0x0000) USB Control */
 	u32 USB_STATUS;			/* (0x0004) USB Status */
 	u32 USB_ADDRESS;		/* (0x0008) USB Address */
@@ -636,7 +636,7 @@ struct nbu2ss_udc {
 };
 
 /* USB register access structure */
-typedef volatile union {
+volatile union {
 	struct {
 		unsigned char	DATA[4];
 	} byte;
Signature · 1 line
1.9.1
#1 lore raw
Quoted 22 lines · Haneen Mohammed

This patch fixes "do not add new typedefs" warning generated by checkpatch.pl.

---
 drivers/staging/emxx_udc/emxx_udc.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/staging/emxx_udc/emxx_udc.h +1 -1
index ee1b80d..debad46 100644
@@ -475,7 +475,7 @@
 /*===========================================================================*/
 /* Struct */
 /*------- T_EP_REGS */
-typedef struct _T_EP_REGS {
+struct _T_EP_REGS {
 	u32 EP_CONTROL;			/* EP Control */
 	u32 EP_STATUS;			/* EP Status */
 	u32 EP_INT_ENA;			/* EP Interrupt Enable */

drivers/staging/emxx_udc/emxx_udc.h typedef struct _T_EP_REGS { · line 487

Quoted 1 line
drivers/staging/emxx_udc/emxx_udc.h +0 -0
@@ -487,7 +487,7 @@ typedef struct _T_EP_REGS {
 } T_EP_REGS, *PT_EP_REGS;

This is not correct. There are two syntaxes:

typedef type new_type_name;
type variable;

You have shifted the code from the first to the second. That is, in the old code, T_EP_REGS, is the name of a type, and one might write

T_EP_REGS x;

to declare a new variable x, and in the new code T_EP_REGS is the name of a variable of type struct _T_EP_REGS.

The compiler should catch this problem. You can't compile a .h file, but try compiling a .c file that uses the types.

julia

Quoted 35 lines
drivers/staging/emxx_udc/emxx_udc.h +3 -3
 /*------- T_EP_DCR */
-typedef struct _T_EP_DCR {
+struct _T_EP_DCR {
 	u32 EP_DCR1;			/* EP_DCR1 */
 	u32 EP_DCR2;			/* EP_DCR2 */
 	u32 EP_TADR;			/* EP_TADR */
@@ -495,7 +495,7 @@ typedef struct _T_EP_DCR {
 } T_EP_DCR, *PT_EP_DCR;
 
 /*------- Function Registers */
-typedef struct _T_FC_REGS {
+struct _T_FC_REGS {
 	u32 USB_CONTROL;		/* (0x0000) USB Control */
 	u32 USB_STATUS;			/* (0x0004) USB Status */
 	u32 USB_ADDRESS;		/* (0x0008) USB Address */
@@ -636,7 +636,7 @@ struct nbu2ss_udc {
 };
 
 /* USB register access structure */
-typedef volatile union {
+volatile union {
 	struct {
 		unsigned char	DATA[4];
 	} byte;
Signature · 8 lines
1.9.1

-- 
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/1424379303-4408-1-git-send-email-hamohammed.sa%40gmail.com.
For more options, visit https://groups.google.com/d/optout.