staging: vc04_services: vchiq_arm: Use ARRAY_SIZE macro
Subsystems (2)
PATCH 1/1 staging: vc04_services: vchiq_arm: Use ARRAY_SIZE macro
This patch uses ARRAY_SIZE macro instead of division of two sizeofs to find array size. Done using coccinelle.
@@
type T;
T[] E;
@@
(
- (sizeof(E)/sizeof(*E))
+ ARRAY_SIZE(E)
|
- (sizeof(E)/sizeof(E[...]))
+ ARRAY_SIZE(E)
|
- (sizeof(E)/sizeof(T))
+ ARRAY_SIZE(E)
)
--- drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +2 -2
@@ -190,8 +190,8 @@ static const char *const ioctl_names[] = {"CLOSE_DELIVERED" }; -vchiq_static_assert ((sizeof (ioctl_names)/sizeof (ioctl_names[0 ])) == - (VCHIQ_IOC_MAX +1 )); +vchiq_static_assert (ARRAY_SIZE (ioctl_names) == + (VCHIQ_IOC_MAX +1 ));static void dump_phys_mem (void *virt_addr,uint32_t num_bytes);
Signature · 1 line
2.7.4
Quoted 27 lines · sayli karnik
This patch uses
ARRAY_SIZEmacro instead of division of two sizeofs to find array size. Done using coccinelle.
@@
type T;
T[] E;
@@
(
- (sizeof(E)/sizeof(*E))
+ARRAY_SIZE(E)
|
- (sizeof(E)/sizeof(E[...]))
+ARRAY_SIZE(E)
|
- (sizeof(E)/sizeof(T))
+ARRAY_SIZE(E)
)Signed-off-by sayli karnik <[email protected]>--- drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +0
-0
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c static const char *const ioctl_names[] = { · line 194
Quoted 7 lines
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +2
-2@@ -190,8 +190,8 @@ static const char *const ioctl_names[] = {"CLOSE_DELIVERED" }; -vchiq_static_assert ((sizeof (ioctl_names)/sizeof (ioctl_names[0 ])) == - (VCHIQ_IOC_MAX +1 )); +vchiq_static_assert (ARRAY_SIZE (ioctl_names) == + (VCHIQ_IOC_MAX +1 ));
Doesn't this code all fit on one line?
julia
Quoted 13 lines
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +0
-1static void dump_phys_mem (void *virt_addr,uint32_t num_bytes); --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/20161016071531.GA15510%40sayli-HP-15-Notebook-PC.
For more options, visit https://groups.google.com/d/optout.
Quoted 34 lines · Julia Lawall
Quoted 30 lines · sayli karnik
This patch uses
ARRAY_SIZEmacro instead of division of two sizeofs to find array size. Done using coccinelle.
@@
type T;
T[] E;
@@
(
- (sizeof(E)/sizeof(*E))
+ARRAY_SIZE(E)
|
- (sizeof(E)/sizeof(E[...]))
+ARRAY_SIZE(E)
|
- (sizeof(E)/sizeof(T))
+ARRAY_SIZE(E)
)Signed-off-by sayli karnik <[email protected]>--- drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +0
-0@@ -190,8 +190,8 @@ static const char *const ioctl_names[] = { "CLOSE_DELIVERED" };
Quoted 7 lines
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c static const char *const ioctl_names[] = { · line 194
Quoted 4 lines
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +2
-2-vchiq_static_assert ((sizeof (ioctl_names)/sizeof (ioctl_names[0 ])) == - (VCHIQ_IOC_MAX +1 )); +vchiq_static_assert (ARRAY_SIZE (ioctl_names) == + (VCHIQ_IOC_MAX +1 ));Doesn't this code all fit on one line?
yes it does.
thanks,
sayli
Quoted 15 lines
julia
Quoted 13 lines
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +0
-1static void dump_phys_mem (void *virt_addr,uint32_t num_bytes); --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/20161016071531.GA15510%40sayli-HP-15-Notebook-PC.
For more options, visit https://groups.google.com/d/optout.