staging: vc04_services: vchiq_arm: Use ARRAY_SIZE macro
Subsystems (2)
PATCH v2 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)
)
---
Changes in v2:
Adjusted the changed part in one line
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +1 -2
@@ -190,8 +190,7 @@ 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
Greg Kroah-Hartman
maintainerQuoted 31 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]>---
Changes in v2:
Adjusted the changed part in one linedrivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 3 +-- 1 file changed, 1 insertion(+), 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 193
Quoted 6 lines
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +1
-2@@ -190,8 +190,7 @@ 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 ));
How were you able to test build this change? The code is currently broken in the build unless you add a number of external patches at the moment :(
thanks,
greg k-h
Quoted 35 lines · Greg Kroah-Hartman
Quoted 34 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]>---
Changes in v2:
Adjusted the changed part in one linedrivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +0
-0@@ -190,8 +190,7 @@ static const char *const ioctl_names[] = { "CLOSE_DELIVERED" };
Quoted 8 lines
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c static const char *const ioctl_names[] = { · line 193
Quoted 3 lines
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +1
-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 ));How were you able to test build this change? The code is currently broken in the build unless you add a number of external patches at the moment :(
Yes it is broken.
Also there isn't a Makefile in drivers/staging/vc04_services/interface/vchiq_arm/ to build it.
thanks,
sayli
Quoted 3 lines
thanks,
greg k-h
Greg Kroah-Hartman
maintainerQuoted 45 lines · sayli karnik
Quoted 35 lines · Greg Kroah-Hartman
Quoted 34 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]>---
Changes in v2:
Adjusted the changed part in one linedrivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +0
-0@@ -190,8 +190,7 @@ static const char *const ioctl_names[] = { "CLOSE_DELIVERED" };Quoted 8 lines
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c static const char *const ioctl_names[] = { · line 193
Quoted 3 lines
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +1
-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 ));How were you able to test build this change? The code is currently broken in the build unless you add a number of external patches at the moment :(
Quoted 3 lines
Yes it is broken.
Also there isn't aMakefileindrivers/staging/vc04_services/interface/vchiq_arm/to build it.
That's ok, the Makefile a few directories up from that is the one that builds it.
I'm going to hold off applying this patch until you can test-build it.
thanks,
greg k-h