diff options
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/gadget/dummy_hcd.c | 2 | ||||
-rw-r--r-- | drivers/usb/input/aiptek.c | 4 | ||||
-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 | ||||
-rw-r--r-- | drivers/usb/net/zd1201.c | 8 | ||||
-rw-r--r-- | drivers/usb/serial/io_edgeport.c | 2 | ||||
-rw-r--r-- | drivers/usb/serial/io_edgeport.h | 3 | ||||
-rw-r--r-- | drivers/usb/serial/safe_serial.c | 2 | ||||
-rw-r--r-- | drivers/usb/serial/ti_usb_3410_5052.c | 7 | ||||
-rw-r--r-- | drivers/usb/storage/sddr09.c | 4 |
11 files changed, 24 insertions, 35 deletions
diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c index ce0d4b412dfe..9734cb76dd6c 100644 --- a/drivers/usb/gadget/dummy_hcd.c +++ b/drivers/usb/gadget/dummy_hcd.c | |||
@@ -138,7 +138,7 @@ static const char *const ep_name [] = { | |||
138 | /* or like sa1100: two fixed function endpoints */ | 138 | /* or like sa1100: two fixed function endpoints */ |
139 | "ep1out-bulk", "ep2in-bulk", | 139 | "ep1out-bulk", "ep2in-bulk", |
140 | }; | 140 | }; |
141 | #define DUMMY_ENDPOINTS (sizeof(ep_name)/sizeof(char *)) | 141 | #define DUMMY_ENDPOINTS ARRAY_SIZE(ep_name) |
142 | 142 | ||
143 | /*-------------------------------------------------------------------------*/ | 143 | /*-------------------------------------------------------------------------*/ |
144 | 144 | ||
diff --git a/drivers/usb/input/aiptek.c b/drivers/usb/input/aiptek.c index 87ae08c99bc4..a6693b0d1c4c 100644 --- a/drivers/usb/input/aiptek.c +++ b/drivers/usb/input/aiptek.c | |||
@@ -2093,7 +2093,7 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id) | |||
2093 | /* Programming the tablet macro keys needs to be done with a for loop | 2093 | /* Programming the tablet macro keys needs to be done with a for loop |
2094 | * as the keycodes are discontiguous. | 2094 | * as the keycodes are discontiguous. |
2095 | */ | 2095 | */ |
2096 | for (i = 0; i < sizeof(macroKeyEvents) / sizeof(macroKeyEvents[0]); ++i) | 2096 | for (i = 0; i < ARRAY_SIZE(macroKeyEvents); ++i) |
2097 | set_bit(macroKeyEvents[i], inputdev->keybit); | 2097 | set_bit(macroKeyEvents[i], inputdev->keybit); |
2098 | 2098 | ||
2099 | /* | 2099 | /* |
@@ -2135,7 +2135,7 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id) | |||
2135 | * not an error :-) | 2135 | * not an error :-) |
2136 | */ | 2136 | */ |
2137 | 2137 | ||
2138 | for (i = 0; i < sizeof(speeds) / sizeof(speeds[0]); ++i) { | 2138 | for (i = 0; i < ARRAY_SIZE(speeds); ++i) { |
2139 | aiptek->curSetting.programmableDelay = speeds[i]; | 2139 | aiptek->curSetting.programmableDelay = speeds[i]; |
2140 | (void)aiptek_program_tablet(aiptek); | 2140 | (void)aiptek_program_tablet(aiptek); |
2141 | if (aiptek->inputdev->absmax[ABS_X] > 0) { | 2141 | if (aiptek->inputdev->absmax[ABS_X] > 0) { |
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)); |
diff --git a/drivers/usb/net/zd1201.c b/drivers/usb/net/zd1201.c index 4d6673adc8fc..2af21a620c07 100644 --- a/drivers/usb/net/zd1201.c +++ b/drivers/usb/net/zd1201.c | |||
@@ -1722,7 +1722,7 @@ static const struct iw_priv_args zd1201_private_args[] = { | |||
1722 | IW_PRIV_TYPE_NONE, "sethostauth" }, | 1722 | IW_PRIV_TYPE_NONE, "sethostauth" }, |
1723 | { ZD1201GIWHOSTAUTH, IW_PRIV_TYPE_NONE, | 1723 | { ZD1201GIWHOSTAUTH, IW_PRIV_TYPE_NONE, |
1724 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "gethostauth" }, | 1724 | IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "gethostauth" }, |
1725 | { ZD1201SIWAUTHSTA, IW_PRIV_TYPE_ADDR | IW_PRIV_SIZE_FIXED | 1, | 1725 | { ZD1201SIWAUTHSTA, IW_PRIV_TYPE_ADDR | IW_PRIV_SIZE_FIXED | 1, |
1726 | IW_PRIV_TYPE_NONE, "authstation" }, | 1726 | IW_PRIV_TYPE_NONE, "authstation" }, |
1727 | { ZD1201SIWMAXASSOC, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, | 1727 | { ZD1201SIWMAXASSOC, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, |
1728 | IW_PRIV_TYPE_NONE, "setmaxassoc" }, | 1728 | IW_PRIV_TYPE_NONE, "setmaxassoc" }, |
@@ -1731,9 +1731,9 @@ static const struct iw_priv_args zd1201_private_args[] = { | |||
1731 | }; | 1731 | }; |
1732 | 1732 | ||
1733 | static const struct iw_handler_def zd1201_iw_handlers = { | 1733 | static const struct iw_handler_def zd1201_iw_handlers = { |
1734 | .num_standard = sizeof(zd1201_iw_handler)/sizeof(iw_handler), | 1734 | .num_standard = ARRAY_SIZE(zd1201_iw_handler), |
1735 | .num_private = sizeof(zd1201_private_handler)/sizeof(iw_handler), | 1735 | .num_private = ARRAY_SIZE(zd1201_private_handler), |
1736 | .num_private_args = sizeof(zd1201_private_args)/sizeof(struct iw_priv_args), | 1736 | .num_private_args = ARRAY_SIZE(zd1201_private_args), |
1737 | .standard = (iw_handler *)zd1201_iw_handler, | 1737 | .standard = (iw_handler *)zd1201_iw_handler, |
1738 | .private = (iw_handler *)zd1201_private_handler, | 1738 | .private = (iw_handler *)zd1201_private_handler, |
1739 | .private_args = (struct iw_priv_args *) zd1201_private_args, | 1739 | .private_args = (struct iw_priv_args *) zd1201_private_args, |
diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c index 89bb3563c919..faedbeb6ba49 100644 --- a/drivers/usb/serial/io_edgeport.c +++ b/drivers/usb/serial/io_edgeport.c | |||
@@ -2353,7 +2353,7 @@ static int calc_baud_rate_divisor (int baudrate, int *divisor) | |||
2353 | 2353 | ||
2354 | dbg("%s - %d", __FUNCTION__, baudrate); | 2354 | dbg("%s - %d", __FUNCTION__, baudrate); |
2355 | 2355 | ||
2356 | for (i = 0; i < NUM_ENTRIES(divisor_table); i++) { | 2356 | for (i = 0; i < ARRAY_SIZE(divisor_table); i++) { |
2357 | if ( divisor_table[i].BaudRate == baudrate ) { | 2357 | if ( divisor_table[i].BaudRate == baudrate ) { |
2358 | *divisor = divisor_table[i].Divisor; | 2358 | *divisor = divisor_table[i].Divisor; |
2359 | return 0; | 2359 | return 0; |
diff --git a/drivers/usb/serial/io_edgeport.h b/drivers/usb/serial/io_edgeport.h index 5112d7aac055..123fa8a904e6 100644 --- a/drivers/usb/serial/io_edgeport.h +++ b/drivers/usb/serial/io_edgeport.h | |||
@@ -31,9 +31,6 @@ | |||
31 | #ifndef HIGH8 | 31 | #ifndef HIGH8 |
32 | #define HIGH8(a) ((unsigned char)((a & 0xff00) >> 8)) | 32 | #define HIGH8(a) ((unsigned char)((a & 0xff00) >> 8)) |
33 | #endif | 33 | #endif |
34 | #ifndef NUM_ENTRIES | ||
35 | #define NUM_ENTRIES(x) (sizeof(x)/sizeof((x)[0])) | ||
36 | #endif | ||
37 | 34 | ||
38 | #ifndef __KERNEL__ | 35 | #ifndef __KERNEL__ |
39 | #define __KERNEL__ | 36 | #define __KERNEL__ |
diff --git a/drivers/usb/serial/safe_serial.c b/drivers/usb/serial/safe_serial.c index 86dc21c728a5..f0215f850d2d 100644 --- a/drivers/usb/serial/safe_serial.c +++ b/drivers/usb/serial/safe_serial.c | |||
@@ -425,7 +425,7 @@ static int __init safe_init (void) | |||
425 | if (vendor || product) { | 425 | if (vendor || product) { |
426 | info ("vendor: %x product: %x\n", vendor, product); | 426 | info ("vendor: %x product: %x\n", vendor, product); |
427 | 427 | ||
428 | for (i = 0; i < (sizeof (id_table) / sizeof (struct usb_device_id)); i++) { | 428 | for (i = 0; i < ARRAY_SIZE(id_table); i++) { |
429 | if (!id_table[i].idVendor && !id_table[i].idProduct) { | 429 | if (!id_table[i].idVendor && !id_table[i].idProduct) { |
430 | id_table[i].idVendor = vendor; | 430 | id_table[i].idVendor = vendor; |
431 | id_table[i].idProduct = product; | 431 | id_table[i].idProduct = product; |
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c index 9e53ec75bcfd..abb830cb77bd 100644 --- a/drivers/usb/serial/ti_usb_3410_5052.c +++ b/drivers/usb/serial/ti_usb_3410_5052.c | |||
@@ -351,17 +351,14 @@ static int __init ti_init(void) | |||
351 | int i,j; | 351 | int i,j; |
352 | int ret; | 352 | int ret; |
353 | 353 | ||
354 | |||
355 | /* insert extra vendor and product ids */ | 354 | /* insert extra vendor and product ids */ |
356 | j = sizeof(ti_id_table_3410)/sizeof(struct usb_device_id) | 355 | j = ARRAY_SIZE(ti_id_table_3410) - TI_EXTRA_VID_PID_COUNT - 1; |
357 | - TI_EXTRA_VID_PID_COUNT - 1; | ||
358 | for (i=0; i<min(vendor_3410_count,product_3410_count); i++,j++) { | 356 | for (i=0; i<min(vendor_3410_count,product_3410_count); i++,j++) { |
359 | ti_id_table_3410[j].idVendor = vendor_3410[i]; | 357 | ti_id_table_3410[j].idVendor = vendor_3410[i]; |
360 | ti_id_table_3410[j].idProduct = product_3410[i]; | 358 | ti_id_table_3410[j].idProduct = product_3410[i]; |
361 | ti_id_table_3410[j].match_flags = USB_DEVICE_ID_MATCH_DEVICE; | 359 | ti_id_table_3410[j].match_flags = USB_DEVICE_ID_MATCH_DEVICE; |
362 | } | 360 | } |
363 | j = sizeof(ti_id_table_5052)/sizeof(struct usb_device_id) | 361 | j = ARRAY_SIZE(ti_id_table_5052) - TI_EXTRA_VID_PID_COUNT - 1; |
364 | - TI_EXTRA_VID_PID_COUNT - 1; | ||
365 | for (i=0; i<min(vendor_5052_count,product_5052_count); i++,j++) { | 362 | for (i=0; i<min(vendor_5052_count,product_5052_count); i++,j++) { |
366 | ti_id_table_5052[j].idVendor = vendor_5052[i]; | 363 | ti_id_table_5052[j].idVendor = vendor_5052[i]; |
367 | ti_id_table_5052[j].idProduct = product_5052[i]; | 364 | ti_id_table_5052[j].idProduct = product_5052[i]; |
diff --git a/drivers/usb/storage/sddr09.c b/drivers/usb/storage/sddr09.c index b8e7802c871d..fb8bacaae27c 100644 --- a/drivers/usb/storage/sddr09.c +++ b/drivers/usb/storage/sddr09.c | |||
@@ -133,13 +133,11 @@ static struct nand_flash_dev nand_flash_ids[] = { | |||
133 | { 0,} | 133 | { 0,} |
134 | }; | 134 | }; |
135 | 135 | ||
136 | #define SIZE(a) (sizeof(a)/sizeof((a)[0])) | ||
137 | |||
138 | static struct nand_flash_dev * | 136 | static struct nand_flash_dev * |
139 | nand_find_id(unsigned char id) { | 137 | nand_find_id(unsigned char id) { |
140 | int i; | 138 | int i; |
141 | 139 | ||
142 | for (i = 0; i < SIZE(nand_flash_ids); i++) | 140 | for (i = 0; i < ARRAY_SIZE(nand_flash_ids); i++) |
143 | if (nand_flash_ids[i].model_id == id) | 141 | if (nand_flash_ids[i].model_id == id) |
144 | return &(nand_flash_ids[i]); | 142 | return &(nand_flash_ids[i]); |
145 | return NULL; | 143 | return NULL; |