All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] staging: vc04_services: vchiq_arm: Use ARRAY_SIZE macro
@ 2016-10-16 13:30 sayli karnik
  2016-10-17  7:34 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 4+ messages in thread
From: sayli karnik @ 2016-10-16 13:30 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: Greg Kroah-Hartman

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)
)

Signed-off-by: sayli karnik <karniksayli1995@gmail.com>
---
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(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
index 5ec7c96..7fee140 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -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);
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-10-17 16:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-16 13:30 [PATCH v2] staging: vc04_services: vchiq_arm: Use ARRAY_SIZE macro sayli karnik
2016-10-17  7:34 ` Greg Kroah-Hartman
2016-10-17 15:12   ` sayli karnik
2016-10-17 16:19     ` Greg Kroah-Hartman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.