staging: vc04_services: Replace typedef with struct
Subsystems (2)
PATCH 1/1 staging: vc04_services: Replace typedef with struct
Using typedef for a structure type and upper case struct names is not suggested in Linux kernel coding style guidelines. Removed occurences of typedefs and converted struct names to lowercase. Used grep to ensure that all occurences have been removed. The module compiles without any warnings or errors.
Script 1:
@r1@
type T;
@@
typedef struct { ... } T;
@script:python c1@
T2;
T << r1.T;
@@
if T[-2:] =="_T":
coccinelle.T2 = T[:-2].lower();
print T
else:
coccinelle.T2=T.lower();
@r2@
type r1.T;
identifier c1.T2;
@@
-typedef
struct
+ T2
{ ... }
-T
;
@r3@
type r1.T;
identifier c1.T2;
@@
- T
+ struct T2
Script 2:
@@
typedef VCHIQ_SHARED_MEM_INFO_T;
@@
(
- VCHIQ_SHARED_MEM_INFO_T
+ struct vchiq_shared_mem_info
)
--- drivers/staging/vc04_services/interface/vchiq_arm/vchiq_memdrv.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_memdrv.h +3 -3
@@ -41,7 +41,7 @@/* ---- Constants and Types ---------------------------------------------- */ -typedef struct { +struct vchiq_shared_mem_info {void *arm_shared_mem_virt;dma_addr_t arm_shared_mem_phys;size_t arm_shared_mem_size;
@@ -49,13 +49,13 @@ typedef struct {void *vc_shared_mem_virt;dma_addr_t vc_shared_mem_phys;size_t vc_shared_mem_size; -}VCHIQ_SHARED_MEM_INFO_T ; +};/* ---- Variable Externs ------------------------------------------------- */ /* ---- Function Prototypes ---------------------------------------------- */ -void vchiq_get_shared_mem_info (VCHIQ_SHARED_MEM_INFO_T *info); +void vchiq_get_shared_mem_info (struct vchiq_shared_mem_info *info);VCHIQ_STATUS_T vchiq_memdrv_initialise (void );
Signature · 1 line
2.7.4
Quoted 5 lines · Gargi Sharma
Using typedef for a structure type and upper case struct names is not suggested in Linux kernel coding style guidelines. Removed occurences of typedefs and converted struct names to lowercase. Used grep to ensure that all occurences have been removed. The module compiles without any warnings or errors.
Actually, the bcm people have requested not to be CCd on patches. I'm leaving them on this one, though, because they might have some useful input.
It's always suspicious when you change a type name and it only affects a header file. And in this case, it only affects a function prototype. I don't see any definition of the function. Can the whole thing (type and prototype) go away?
julia
Quoted 89 lines
Script 1:
@r1@
type T;
@@typedef struct { ... } T;
@script:python c1@
T2;
T << r1.T;
@@
if T[-2:] =="_T":
coccinelle.T2 = T[:-2].lower();
print T
else:
coccinelle.T2=T.lower();@r2@
type r1.T;
identifier c1.T2;
@@
-typedef
struct
+ T2
{ ... }
-T
;@r3@
type r1.T;
identifier c1.T2;
@@
- T
+ struct T2Script 2:
@@
typedefVCHIQ_SHARED_MEM_INFO_T;
@@(
-VCHIQ_SHARED_MEM_INFO_T
+ structvchiq_shared_mem_info
)Signed-off-by Gargi Sharma <[email protected]>--- drivers/staging/vc04_services/interface/vchiq_arm/vchiq_memdrv.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/staging/vc04_services/interface/vchiq_arm/vchiq_memdrv.h +3
-4@@ -41,7 +41,7 @@/* ---- Constants and Types ---------------------------------------------- */ -typedef struct { +struct vchiq_shared_mem_info {void *arm_shared_mem_virt;dma_addr_t arm_shared_mem_phys;size_t arm_shared_mem_size;@@ -49,13 +49,13 @@ typedef struct {void *vc_shared_mem_virt;dma_addr_t vc_shared_mem_phys;size_t vc_shared_mem_size; -}VCHIQ_SHARED_MEM_INFO_T ; +};/* ---- Variable Externs ------------------------------------------------- */ /* ---- Function Prototypes ---------------------------------------------- */ -void vchiq_get_shared_mem_info (VCHIQ_SHARED_MEM_INFO_T *info); +void vchiq_get_shared_mem_info (struct vchiq_shared_mem_info *info);VCHIQ_STATUS_T vchiq_memdrv_initialise (void ); --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/1489310493-22530-1-git-send-email-gs051095%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Quoted 8 lines · Julia Lawall
Quoted 5 lines · Gargi Sharma
Using typedef for a structure type and upper case struct names is not suggested in Linux kernel coding style guidelines. Removed occurences of typedefs and converted struct names to lowercase. Used grep to ensure that all occurences have been removed. The module compiles without any warnings or errors.
Quoted 8 lines
Actually, the bcm people have requested not to be CCd on patches. I'm leaving them on this one, though, because they might have some useful input.
It's always suspicious when you change a type name and it only affects a header file. And in this case, it only affects a function prototype. I don't see any definition of the function. Can the whole thing (type and prototype) go away?
It's dead even in the downstream tree, so let's kill it.
Quoted 14 lines · Eric Anholt
Quoted 12 lines · Julia Lawall
Quoted 5 lines · Gargi Sharma
Using typedef for a structure type and upper case struct names is not suggested in Linux kernel coding style guidelines. Removed occurences of typedefs and converted struct names to lowercase. Used grep to ensure that all occurences have been removed. The module compiles without any warnings or errors.
Actually, the bcm people have requested not to be CCd on patches. I'm leaving them on this one, though, because they might have some useful input.
Quoted 6 lines
Quoted 4 lines
It's always suspicious when you change a type name and it only affects a header file. And in this case, it only affects a function prototype. I don't see any definition of the function. Can the whole thing (type and prototype) go away?
It's dead even in the downstream tree, so let's kill it.
Thanks for the feedback.
julia
Greg KH
maintainerQuoted 71 lines · Gargi Sharma
Using typedef for a structure type and upper case struct names is not suggested in Linux kernel coding style guidelines. Removed occurences of typedefs and converted struct names to lowercase. Used grep to ensure that all occurences have been removed. The module compiles without any warnings or errors.
Script 1:
@r1@
type T;
@@typedef struct { ... } T;
@script:python c1@
T2;
T << r1.T;
@@
if T[-2:] =="_T":
coccinelle.T2 = T[:-2].lower();
print T
else:
coccinelle.T2=T.lower();@r2@
type r1.T;
identifier c1.T2;
@@
-typedef
struct
+ T2
{ ... }
-T
;@r3@
type r1.T;
identifier c1.T2;
@@
- T
+ struct T2Script 2:
@@
typedefVCHIQ_SHARED_MEM_INFO_T;
@@(
-VCHIQ_SHARED_MEM_INFO_T
+ structvchiq_shared_mem_info
)Signed-off-by Gargi Sharma <[email protected]>--- drivers/staging/vc04_services/interface/vchiq_arm/vchiq_memdrv.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/staging/vc04_services/interface/vchiq_arm/vchiq_memdrv.h +1
-1@@ -41,7 +41,7 @@/* ---- Constants and Types ---------------------------------------------- */ -typedef struct { +struct vchiq_shared_mem_info {void *arm_shared_mem_virt;dma_addr_t arm_shared_mem_phys;size_t arm_shared_mem_size;@@ -49,13 +49,13 @@ typedef struct {void *vc_shared_mem_virt;dma_addr_t vc_shared_mem_phys;
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_memdrv.h typedef struct { · line 58
Quoted 10 lines
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_memdrv.h +2
-2size_t vc_shared_mem_size; -}VCHIQ_SHARED_MEM_INFO_T ; +};/* ---- Variable Externs ------------------------------------------------- */ /* ---- Function Prototypes ---------------------------------------------- */ -void vchiq_get_shared_mem_info (VCHIQ_SHARED_MEM_INFO_T *info); +void vchiq_get_shared_mem_info (struct vchiq_shared_mem_info *info);
This is a prototype for a function that is not even in the kernel, it should just be removed.
thanks,
greg k-h