staging: vc04_services: Remove typedef struct
Subsystems (2)
PATCH 1/1 staging: vc04_services: Remove typedef struct
This patch removes typedef from struct and renames it from "typdedef struc vchiq_2835_state_struct" to "struct vchiq_2835_state" as per kernel coding standards.
--- .../vc04_services/interface/vchiq_arm/vchiq_2835_arm.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +8 -8
@@ -59,10 +59,10 @@#define BELL0 0x00#define BELL2 0x08 -typedef struct vchiq_2835_state_struct { +struct vchiq_2835_state {int inited;VCHIQ_ARM_STATE_T arm_state; -}VCHIQ_2835_ARM_STATE_T ; +};struct vchiq_pagelist_info {PAGELIST_T *pagelist;
@@ -206,12 +206,12 @@ vchiq_platform_init_state(VCHIQ_STATE_T *state) {VCHIQ_STATUS_T status =VCHIQ_SUCCESS ; - state->platform_state =kzalloc (sizeof (VCHIQ_2835_ARM_STATE_T ),GFP_KERNEL ); - ((VCHIQ_2835_ARM_STATE_T *)state->platform_state)->inited =1 ; - status =vchiq_arm_init_state (state, &((VCHIQ_2835_ARM_STATE_T *)state->platform_state)->arm_state); + state->platform_state =kzalloc (sizeof (struct vchiq_2835_state ),GFP_KERNEL ); + ((struct vchiq_2835_state *)state->platform_state)->inited =1 ; + status =vchiq_arm_init_state (state, &((struct vchiq_2835_state *)state->platform_state)->arm_state);if (status !=VCHIQ_SUCCESS ) { - ((VCHIQ_2835_ARM_STATE_T *)state->platform_state)->inited =0 ; + ((struct vchiq_2835_state *)state->platform_state)->inited =0 ; }return status; }
@@ -219,11 +219,11 @@ vchiq_platform_init_state(VCHIQ_STATE_T *state)VCHIQ_ARM_STATE_T *vchiq_platform_get_arm_state (VCHIQ_STATE_T *state) { -if (!((VCHIQ_2835_ARM_STATE_T *)state->platform_state)->inited) +if (!((struct vchiq_2835_state *)state->platform_state)->inited) {BUG (); } -return &((VCHIQ_2835_ARM_STATE_T *)state->platform_state)->arm_state; +return &((struct vchiq_2835_state *)state->platform_state)->arm_state; }void
Signature · 1 line
2.7.4
Quoted 1 line · Mihaela Muraru
This patch removes typedef from struct and renames it from "typdedef struc
vchiq_2835_state_struct" to "structvchiq_2835_state" as per kernel coding standards.
The log message should fit within at most 70-some characters per line.
Otherwise, this code seems to have a lot of cleanup potential. Besides all the typedefs, you can also try to get rid of the pervasive casts and to use more kernel-standard return values. It looks like the inited field could have type bool and true/false values too. These would all be other patches of course.
julia
Quoted 64 lines
Signed-off-by Mihaela Muraru <[email protected]>--- .../vc04_services/interface/vchiq_arm/vchiq_2835_arm.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +8
-9@@ -59,10 +59,10 @@#define BELL0 0x00#define BELL2 0x08 -typedef struct vchiq_2835_state_struct { +struct vchiq_2835_state {int inited;VCHIQ_ARM_STATE_T arm_state; -}VCHIQ_2835_ARM_STATE_T ; +};struct vchiq_pagelist_info {PAGELIST_T *pagelist;@@ -206,12 +206,12 @@ vchiq_platform_init_state(VCHIQ_STATE_T *state) {VCHIQ_STATUS_T status =VCHIQ_SUCCESS ; - state->platform_state =kzalloc (sizeof (VCHIQ_2835_ARM_STATE_T ),GFP_KERNEL ); - ((VCHIQ_2835_ARM_STATE_T *)state->platform_state)->inited =1 ; - status =vchiq_arm_init_state (state, &((VCHIQ_2835_ARM_STATE_T *)state->platform_state)->arm_state); + state->platform_state =kzalloc (sizeof (struct vchiq_2835_state ),GFP_KERNEL ); + ((struct vchiq_2835_state *)state->platform_state)->inited =1 ; + status =vchiq_arm_init_state (state, &((struct vchiq_2835_state *)state->platform_state)->arm_state);if (status !=VCHIQ_SUCCESS ) { - ((VCHIQ_2835_ARM_STATE_T *)state->platform_state)->inited =0 ; + ((struct vchiq_2835_state *)state->platform_state)->inited =0 ; }return status; }@@ -219,11 +219,11 @@ vchiq_platform_init_state(VCHIQ_STATE_T *state)VCHIQ_ARM_STATE_T *vchiq_platform_get_arm_state (VCHIQ_STATE_T *state) { -if (!((VCHIQ_2835_ARM_STATE_T *)state->platform_state)->inited) +if (!((struct vchiq_2835_state *)state->platform_state)->inited) {BUG (); } -return &((VCHIQ_2835_ARM_STATE_T *)state->platform_state)->arm_state; +return &((struct vchiq_2835_state *)state->platform_state)->arm_state; }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/20170928110230.GA11755%40ubuntu.
For more options, visit https://groups.google.com/d/optout.
Quoted 8 lines · Julia Lawall
Quoted 1 line · Mihaela Muraru
This patch removes typedef from struct and renames it from "typdedef struc
vchiq_2835_state_struct" to "structvchiq_2835_state" as per kernel coding standards.The log message should fit within at most 70-some characters per line.
Quoted 8 lines
Otherwise, this code seems to have a lot of cleanup potential. Besides all the typedefs, you can also try to get rid of the pervasive casts and to use more kernel-standard return values. It looks like the inited field could have type bool and true/false values too. These would all be other patches of course.
julia
Thank you for your help
I will work on it :)
Mihaela
Quoted 63 lines
Quoted 63 lines
Signed-off-by Mihaela Muraru <[email protected]>--- .../vc04_services/interface/vchiq_arm/vchiq_2835_arm.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +8
-9@@ -59,10 +59,10 @@#define BELL0 0x00#define BELL2 0x08 -typedef struct vchiq_2835_state_struct { +struct vchiq_2835_state {int inited;VCHIQ_ARM_STATE_T arm_state; -}VCHIQ_2835_ARM_STATE_T ; +};struct vchiq_pagelist_info {PAGELIST_T *pagelist;@@ -206,12 +206,12 @@ vchiq_platform_init_state(VCHIQ_STATE_T *state) {VCHIQ_STATUS_T status =VCHIQ_SUCCESS ; - state->platform_state =kzalloc (sizeof (VCHIQ_2835_ARM_STATE_T ),GFP_KERNEL ); - ((VCHIQ_2835_ARM_STATE_T *)state->platform_state)->inited =1 ; - status =vchiq_arm_init_state (state, &((VCHIQ_2835_ARM_STATE_T *)state->platform_state)->arm_state); + state->platform_state =kzalloc (sizeof (struct vchiq_2835_state ),GFP_KERNEL ); + ((struct vchiq_2835_state *)state->platform_state)->inited =1 ; + status =vchiq_arm_init_state (state, &((struct vchiq_2835_state *)state->platform_state)->arm_state);if (status !=VCHIQ_SUCCESS ) { - ((VCHIQ_2835_ARM_STATE_T *)state->platform_state)->inited =0 ; + ((struct vchiq_2835_state *)state->platform_state)->inited =0 ; }return status; }@@ -219,11 +219,11 @@ vchiq_platform_init_state(VCHIQ_STATE_T *state)VCHIQ_ARM_STATE_T *vchiq_platform_get_arm_state (VCHIQ_STATE_T *state) { -if (!((VCHIQ_2835_ARM_STATE_T *)state->platform_state)->inited) +if (!((struct vchiq_2835_state *)state->platform_state)->inited) {BUG (); } -return &((VCHIQ_2835_ARM_STATE_T *)state->platform_state)->arm_state; +return &((struct vchiq_2835_state *)state->platform_state)->arm_state; }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/20170928110230.GA11755%40ubuntu.
For more options, visit https://groups.google.com/d/optout.