From e40d14a89760632238f67c1f96c852652a137f2d Mon Sep 17 00:00:00 2001 From: Jérémy Lefaure Date: Sun, 1 Oct 2017 15:30:41 -0400 Subject: media: use ARRAY_SIZE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Using the ARRAY_SIZE macro improves the readability of the code. Also, it is not always useful to use a variable to store this constant calculated at compile time. Found with Coccinelle with the following semantic patch: @r depends on (org || report)@ type T; T[] E; position p; @@ ( (sizeof(E)@p /sizeof(*E)) | (sizeof(E)@p /sizeof(E[...])) | (sizeof(E)@p /sizeof(T)) ) Signed-off-by: Jérémy Lefaure Reviewed-by: Michael Ira Krufky Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/pci/saa7146/hexium_gemini.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/media/pci/saa7146/hexium_gemini.c') diff --git a/drivers/media/pci/saa7146/hexium_gemini.c b/drivers/media/pci/saa7146/hexium_gemini.c index d31a2d4494d1..39357eddee32 100644 --- a/drivers/media/pci/saa7146/hexium_gemini.c +++ b/drivers/media/pci/saa7146/hexium_gemini.c @@ -27,6 +27,7 @@ #include #include +#include static int debug; module_param(debug, int, 0); @@ -388,7 +389,7 @@ static struct saa7146_ext_vv vv_data = { .inputs = HEXIUM_INPUTS, .capabilities = 0, .stds = &hexium_standards[0], - .num_stds = sizeof(hexium_standards) / sizeof(struct saa7146_standard), + .num_stds = ARRAY_SIZE(hexium_standards), .std_callback = &std_callback, }; -- cgit