aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@nuerscht.ch>2005-12-11 10:20:08 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2006-01-04 16:51:43 -0500
commit52950ed40dc97456209979af1d8f51b63cf6dcab (patch)
tree527fb1a339889b3df9d227b1c17f87bc487f397f /drivers/usb/serial
parentf3d34ed48c80903544b509031fee64838d29f35f (diff)
[PATCH] USB: Use ARRAY_SIZE macro
Use ARRAY_SIZE macro instead of sizeof(x)/sizeof(x[0]) and remove duplicates of ARRAY_SIZE. Some trailing whitespaces are also removed. Patch is compile-tested on i386. Signed-off-by: Tobias Klauser <tklauser@nuerscht.ch> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/serial')
-rw-r--r--drivers/usb/serial/io_edgeport.c2
-rw-r--r--drivers/usb/serial/io_edgeport.h3
-rw-r--r--drivers/usb/serial/safe_serial.c2
-rw-r--r--drivers/usb/serial/ti_usb_3410_5052.c7
4 files changed, 4 insertions, 10 deletions
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];