summaryrefslogtreecommitdiffstats
path: root/drivers/media/usb/dvb-usb/cxusb.c
diff options
context:
space:
mode:
authorJérémy Lefaure <jeremy.lefaure@lse.epita.fr>2017-10-01 15:30:41 -0400
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2017-12-08 10:11:00 -0500
commite40d14a89760632238f67c1f96c852652a137f2d (patch)
tree3c9a1c7729242a9725254a1ffe3e6a5de40da63d /drivers/media/usb/dvb-usb/cxusb.c
parent37d5efb01910752d8d3846a2c4db0528c1dfa137 (diff)
downloadlinux-stable-e40d14a89760632238f67c1f96c852652a137f2d.tar.gz
linux-stable-e40d14a89760632238f67c1f96c852652a137f2d.tar.bz2
linux-stable-e40d14a89760632238f67c1f96c852652a137f2d.zip
media: use ARRAY_SIZE
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 <jeremy.lefaure@lse.epita.fr> Reviewed-by: Michael Ira Krufky <mkrufky@linuxtv.org> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/usb/dvb-usb/cxusb.c')
-rw-r--r--drivers/media/usb/dvb-usb/cxusb.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/media/usb/dvb-usb/cxusb.c b/drivers/media/usb/dvb-usb/cxusb.c
index 247dc164dd63..7109fc7ab74d 100644
--- a/drivers/media/usb/dvb-usb/cxusb.c
+++ b/drivers/media/usb/dvb-usb/cxusb.c
@@ -26,6 +26,7 @@
#include <media/tuner.h>
#include <linux/vmalloc.h>
#include <linux/slab.h>
+#include <linux/kernel.h>
#include "cxusb.h"
@@ -304,7 +305,7 @@ static int cxusb_aver_power_ctrl(struct dvb_usb_device *d, int onoff)
0x0e, 0x2, 0x47, 0x88,
};
msleep(20);
- for (i = 0; i < sizeof(bufs)/sizeof(u8); i += 4/sizeof(u8)) {
+ for (i = 0; i < ARRAY_SIZE(bufs); i += 4 / sizeof(u8)) {
ret = cxusb_ctrl_msg(d, CMD_I2C_WRITE,
bufs+i, 4, &buf, 1);
if (ret)