diff options
Diffstat (limited to 'drivers/usb/media')
-rw-r--r-- | drivers/usb/media/ibmcam.c | 2 | ||||
-rw-r--r-- | drivers/usb/media/sn9c102_core.c | 23 | ||||
-rw-r--r-- | drivers/usb/media/w9968cf.c | 2 |
3 files changed, 12 insertions, 15 deletions
diff --git a/drivers/usb/media/ibmcam.c b/drivers/usb/media/ibmcam.c index ba41fc7b95c2..a42c22294124 100644 --- a/drivers/usb/media/ibmcam.c +++ b/drivers/usb/media/ibmcam.c | |||
@@ -3457,7 +3457,7 @@ static void ibmcam_model3_setup_after_video_if(struct uvd *uvd) | |||
3457 | if(init_model3_input) { | 3457 | if(init_model3_input) { |
3458 | if (debug > 0) | 3458 | if (debug > 0) |
3459 | info("Setting input to RCA."); | 3459 | info("Setting input to RCA."); |
3460 | for (i=0; i < (sizeof(initData)/sizeof(initData[0])); i++) { | 3460 | for (i=0; i < ARRAY_SIZE(initData); i++) { |
3461 | ibmcam_veio(uvd, initData[i].req, initData[i].value, initData[i].index); | 3461 | ibmcam_veio(uvd, initData[i].req, initData[i].value, initData[i].index); |
3462 | } | 3462 | } |
3463 | } | 3463 | } |
diff --git a/drivers/usb/media/sn9c102_core.c b/drivers/usb/media/sn9c102_core.c index 08723459da86..8d1a1c357d5a 100644 --- a/drivers/usb/media/sn9c102_core.c +++ b/drivers/usb/media/sn9c102_core.c | |||
@@ -1316,7 +1316,7 @@ static int sn9c102_init(struct sn9c102_device* cam) | |||
1316 | struct v4l2_control ctrl; | 1316 | struct v4l2_control ctrl; |
1317 | struct v4l2_queryctrl *qctrl; | 1317 | struct v4l2_queryctrl *qctrl; |
1318 | struct v4l2_rect* rect; | 1318 | struct v4l2_rect* rect; |
1319 | u8 i = 0, n = 0; | 1319 | u8 i = 0; |
1320 | int err = 0; | 1320 | int err = 0; |
1321 | 1321 | ||
1322 | if (!(cam->state & DEV_INITIALIZED)) { | 1322 | if (!(cam->state & DEV_INITIALIZED)) { |
@@ -1352,7 +1352,7 @@ static int sn9c102_init(struct sn9c102_device* cam) | |||
1352 | return err; | 1352 | return err; |
1353 | 1353 | ||
1354 | if (s->pix_format.pixelformat == V4L2_PIX_FMT_SN9C10X) | 1354 | if (s->pix_format.pixelformat == V4L2_PIX_FMT_SN9C10X) |
1355 | DBG(3, "Compressed video format is active, quality %d", | 1355 | DBG(3, "Compressed video format is active, quality %d", |
1356 | cam->compression.quality) | 1356 | cam->compression.quality) |
1357 | else | 1357 | else |
1358 | DBG(3, "Uncompressed video format is active") | 1358 | DBG(3, "Uncompressed video format is active") |
@@ -1364,9 +1364,8 @@ static int sn9c102_init(struct sn9c102_device* cam) | |||
1364 | } | 1364 | } |
1365 | 1365 | ||
1366 | if (s->set_ctrl) { | 1366 | if (s->set_ctrl) { |
1367 | n = sizeof(s->qctrl) / sizeof(s->qctrl[0]); | 1367 | for (i = 0; i < ARRAY_SIZE(s->qctrl); i++) |
1368 | for (i = 0; i < n; i++) | 1368 | if (s->qctrl[i].id != 0 && |
1369 | if (s->qctrl[i].id != 0 && | ||
1370 | !(s->qctrl[i].flags & V4L2_CTRL_FLAG_DISABLED)) { | 1369 | !(s->qctrl[i].flags & V4L2_CTRL_FLAG_DISABLED)) { |
1371 | ctrl.id = s->qctrl[i].id; | 1370 | ctrl.id = s->qctrl[i].id; |
1372 | ctrl.value = qctrl[i].default_value; | 1371 | ctrl.value = qctrl[i].default_value; |
@@ -1388,7 +1387,7 @@ static int sn9c102_init(struct sn9c102_device* cam) | |||
1388 | init_waitqueue_head(&cam->wait_stream); | 1387 | init_waitqueue_head(&cam->wait_stream); |
1389 | cam->nreadbuffers = 2; | 1388 | cam->nreadbuffers = 2; |
1390 | memcpy(s->_qctrl, s->qctrl, sizeof(s->qctrl)); | 1389 | memcpy(s->_qctrl, s->qctrl, sizeof(s->qctrl)); |
1391 | memcpy(&(s->_rect), &(s->cropcap.defrect), | 1390 | memcpy(&(s->_rect), &(s->cropcap.defrect), |
1392 | sizeof(struct v4l2_rect)); | 1391 | sizeof(struct v4l2_rect)); |
1393 | cam->state |= DEV_INITIALIZED; | 1392 | cam->state |= DEV_INITIALIZED; |
1394 | } | 1393 | } |
@@ -1810,13 +1809,12 @@ static int sn9c102_ioctl_v4l2(struct inode* inode, struct file* filp, | |||
1810 | { | 1809 | { |
1811 | struct sn9c102_sensor* s = cam->sensor; | 1810 | struct sn9c102_sensor* s = cam->sensor; |
1812 | struct v4l2_queryctrl qc; | 1811 | struct v4l2_queryctrl qc; |
1813 | u8 i, n; | 1812 | u8 i; |
1814 | 1813 | ||
1815 | if (copy_from_user(&qc, arg, sizeof(qc))) | 1814 | if (copy_from_user(&qc, arg, sizeof(qc))) |
1816 | return -EFAULT; | 1815 | return -EFAULT; |
1817 | 1816 | ||
1818 | n = sizeof(s->qctrl) / sizeof(s->qctrl[0]); | 1817 | for (i = 0; i < ARRAY_SIZE(s->qctrl); i++) |
1819 | for (i = 0; i < n; i++) | ||
1820 | if (qc.id && qc.id == s->qctrl[i].id) { | 1818 | if (qc.id && qc.id == s->qctrl[i].id) { |
1821 | memcpy(&qc, &(s->qctrl[i]), sizeof(qc)); | 1819 | memcpy(&qc, &(s->qctrl[i]), sizeof(qc)); |
1822 | if (copy_to_user(arg, &qc, sizeof(qc))) | 1820 | if (copy_to_user(arg, &qc, sizeof(qc))) |
@@ -1852,7 +1850,7 @@ static int sn9c102_ioctl_v4l2(struct inode* inode, struct file* filp, | |||
1852 | { | 1850 | { |
1853 | struct sn9c102_sensor* s = cam->sensor; | 1851 | struct sn9c102_sensor* s = cam->sensor; |
1854 | struct v4l2_control ctrl; | 1852 | struct v4l2_control ctrl; |
1855 | u8 i, n; | 1853 | u8 i; |
1856 | int err = 0; | 1854 | int err = 0; |
1857 | 1855 | ||
1858 | if (!s->set_ctrl) | 1856 | if (!s->set_ctrl) |
@@ -1861,8 +1859,7 @@ static int sn9c102_ioctl_v4l2(struct inode* inode, struct file* filp, | |||
1861 | if (copy_from_user(&ctrl, arg, sizeof(ctrl))) | 1859 | if (copy_from_user(&ctrl, arg, sizeof(ctrl))) |
1862 | return -EFAULT; | 1860 | return -EFAULT; |
1863 | 1861 | ||
1864 | n = sizeof(s->qctrl) / sizeof(s->qctrl[0]); | 1862 | for (i = 0; i < ARRAY_SIZE(s->qctrl); i++) |
1865 | for (i = 0; i < n; i++) | ||
1866 | if (ctrl.id == s->qctrl[i].id) { | 1863 | if (ctrl.id == s->qctrl[i].id) { |
1867 | if (ctrl.value < s->qctrl[i].minimum || | 1864 | if (ctrl.value < s->qctrl[i].minimum || |
1868 | ctrl.value > s->qctrl[i].maximum) | 1865 | ctrl.value > s->qctrl[i].maximum) |
@@ -2544,7 +2541,7 @@ sn9c102_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) | |||
2544 | unsigned int i, n; | 2541 | unsigned int i, n; |
2545 | int err = 0, r; | 2542 | int err = 0, r; |
2546 | 2543 | ||
2547 | n = sizeof(sn9c102_id_table)/sizeof(sn9c102_id_table[0]); | 2544 | n = ARRAY_SIZE(sn9c102_id_table); |
2548 | for (i = 0; i < n-1; i++) | 2545 | for (i = 0; i < n-1; i++) |
2549 | if (le16_to_cpu(udev->descriptor.idVendor) == | 2546 | if (le16_to_cpu(udev->descriptor.idVendor) == |
2550 | sn9c102_id_table[i].idVendor && | 2547 | sn9c102_id_table[i].idVendor && |
diff --git a/drivers/usb/media/w9968cf.c b/drivers/usb/media/w9968cf.c index 52b90d50febb..8d6a1ff6595f 100644 --- a/drivers/usb/media/w9968cf.c +++ b/drivers/usb/media/w9968cf.c | |||
@@ -2958,7 +2958,7 @@ static int w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, | |||
2958 | }; | 2958 | }; |
2959 | 2959 | ||
2960 | #define V4L1_IOCTL(cmd) \ | 2960 | #define V4L1_IOCTL(cmd) \ |
2961 | ((_IOC_NR((cmd)) < sizeof(v4l1_ioctls)/sizeof(char*)) ? \ | 2961 | ((_IOC_NR((cmd)) < ARRAY_SIZE(v4l1_ioctls)) ? \ |
2962 | v4l1_ioctls[_IOC_NR((cmd))] : "?") | 2962 | v4l1_ioctls[_IOC_NR((cmd))] : "?") |
2963 | 2963 | ||
2964 | cam = (struct w9968cf_device*)video_get_drvdata(video_devdata(filp)); | 2964 | cam = (struct w9968cf_device*)video_get_drvdata(video_devdata(filp)); |