diff options
Diffstat (limited to 'drivers/usb/serial')
34 files changed, 106 insertions, 46 deletions
diff --git a/drivers/usb/serial/airprime.c b/drivers/usb/serial/airprime.c index 1f29d8837327..dbf1f063098c 100644 --- a/drivers/usb/serial/airprime.c +++ b/drivers/usb/serial/airprime.c | |||
@@ -23,11 +23,11 @@ static struct usb_device_id id_table [] = { | |||
23 | MODULE_DEVICE_TABLE(usb, id_table); | 23 | MODULE_DEVICE_TABLE(usb, id_table); |
24 | 24 | ||
25 | static struct usb_driver airprime_driver = { | 25 | static struct usb_driver airprime_driver = { |
26 | .owner = THIS_MODULE, | ||
27 | .name = "airprime", | 26 | .name = "airprime", |
28 | .probe = usb_serial_probe, | 27 | .probe = usb_serial_probe, |
29 | .disconnect = usb_serial_disconnect, | 28 | .disconnect = usb_serial_disconnect, |
30 | .id_table = id_table, | 29 | .id_table = id_table, |
30 | .no_dynamic_id = 1, | ||
31 | }; | 31 | }; |
32 | 32 | ||
33 | static struct usb_serial_driver airprime_device = { | 33 | static struct usb_serial_driver airprime_device = { |
diff --git a/drivers/usb/serial/anydata.c b/drivers/usb/serial/anydata.c index 18022a74a3dc..343f6f228220 100644 --- a/drivers/usb/serial/anydata.c +++ b/drivers/usb/serial/anydata.c | |||
@@ -27,11 +27,11 @@ static int buffer_size; | |||
27 | static int debug; | 27 | static int debug; |
28 | 28 | ||
29 | static struct usb_driver anydata_driver = { | 29 | static struct usb_driver anydata_driver = { |
30 | .owner = THIS_MODULE, | ||
31 | .name = "anydata", | 30 | .name = "anydata", |
32 | .probe = usb_serial_probe, | 31 | .probe = usb_serial_probe, |
33 | .disconnect = usb_serial_disconnect, | 32 | .disconnect = usb_serial_disconnect, |
34 | .id_table = id_table, | 33 | .id_table = id_table, |
34 | .no_dynamic_id = 1, | ||
35 | }; | 35 | }; |
36 | 36 | ||
37 | static int anydata_open(struct usb_serial_port *port, struct file *filp) | 37 | static int anydata_open(struct usb_serial_port *port, struct file *filp) |
diff --git a/drivers/usb/serial/belkin_sa.c b/drivers/usb/serial/belkin_sa.c index 84bc0ee4f061..4144777ea18b 100644 --- a/drivers/usb/serial/belkin_sa.c +++ b/drivers/usb/serial/belkin_sa.c | |||
@@ -113,11 +113,11 @@ static struct usb_device_id id_table_combined [] = { | |||
113 | MODULE_DEVICE_TABLE (usb, id_table_combined); | 113 | MODULE_DEVICE_TABLE (usb, id_table_combined); |
114 | 114 | ||
115 | static struct usb_driver belkin_driver = { | 115 | static struct usb_driver belkin_driver = { |
116 | .owner = THIS_MODULE, | ||
117 | .name = "belkin", | 116 | .name = "belkin", |
118 | .probe = usb_serial_probe, | 117 | .probe = usb_serial_probe, |
119 | .disconnect = usb_serial_disconnect, | 118 | .disconnect = usb_serial_disconnect, |
120 | .id_table = id_table_combined, | 119 | .id_table = id_table_combined, |
120 | .no_dynamic_id = 1, | ||
121 | }; | 121 | }; |
122 | 122 | ||
123 | /* All of the device info needed for the serial converters */ | 123 | /* All of the device info needed for the serial converters */ |
diff --git a/drivers/usb/serial/cp2101.c b/drivers/usb/serial/cp2101.c index c9787001cf2a..da46b351e188 100644 --- a/drivers/usb/serial/cp2101.c +++ b/drivers/usb/serial/cp2101.c | |||
@@ -67,11 +67,11 @@ static struct usb_device_id id_table [] = { | |||
67 | MODULE_DEVICE_TABLE (usb, id_table); | 67 | MODULE_DEVICE_TABLE (usb, id_table); |
68 | 68 | ||
69 | static struct usb_driver cp2101_driver = { | 69 | static struct usb_driver cp2101_driver = { |
70 | .owner = THIS_MODULE, | ||
71 | .name = "cp2101", | 70 | .name = "cp2101", |
72 | .probe = usb_serial_probe, | 71 | .probe = usb_serial_probe, |
73 | .disconnect = usb_serial_disconnect, | 72 | .disconnect = usb_serial_disconnect, |
74 | .id_table = id_table, | 73 | .id_table = id_table, |
74 | .no_dynamic_id = 1, | ||
75 | }; | 75 | }; |
76 | 76 | ||
77 | static struct usb_serial_driver cp2101_device = { | 77 | static struct usb_serial_driver cp2101_device = { |
diff --git a/drivers/usb/serial/cyberjack.c b/drivers/usb/serial/cyberjack.c index e581e4ae8483..6d18d4eaba35 100644 --- a/drivers/usb/serial/cyberjack.c +++ b/drivers/usb/serial/cyberjack.c | |||
@@ -76,11 +76,11 @@ static struct usb_device_id id_table [] = { | |||
76 | MODULE_DEVICE_TABLE (usb, id_table); | 76 | MODULE_DEVICE_TABLE (usb, id_table); |
77 | 77 | ||
78 | static struct usb_driver cyberjack_driver = { | 78 | static struct usb_driver cyberjack_driver = { |
79 | .owner = THIS_MODULE, | ||
80 | .name = "cyberjack", | 79 | .name = "cyberjack", |
81 | .probe = usb_serial_probe, | 80 | .probe = usb_serial_probe, |
82 | .disconnect = usb_serial_disconnect, | 81 | .disconnect = usb_serial_disconnect, |
83 | .id_table = id_table, | 82 | .id_table = id_table, |
83 | .no_dynamic_id = 1, | ||
84 | }; | 84 | }; |
85 | 85 | ||
86 | static struct usb_serial_driver cyberjack_device = { | 86 | static struct usb_serial_driver cyberjack_device = { |
diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c index af9290ed257b..af18355e94cc 100644 --- a/drivers/usb/serial/cypress_m8.c +++ b/drivers/usb/serial/cypress_m8.c | |||
@@ -112,6 +112,7 @@ static struct usb_driver cypress_driver = { | |||
112 | .probe = usb_serial_probe, | 112 | .probe = usb_serial_probe, |
113 | .disconnect = usb_serial_disconnect, | 113 | .disconnect = usb_serial_disconnect, |
114 | .id_table = id_table_combined, | 114 | .id_table = id_table_combined, |
115 | .no_dynamic_id = 1, | ||
115 | }; | 116 | }; |
116 | 117 | ||
117 | struct cypress_private { | 118 | struct cypress_private { |
diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c index dc74644a603d..8fc414bd5b24 100644 --- a/drivers/usb/serial/digi_acceleport.c +++ b/drivers/usb/serial/digi_acceleport.c | |||
@@ -493,11 +493,11 @@ static struct usb_device_id id_table_4 [] = { | |||
493 | MODULE_DEVICE_TABLE (usb, id_table_combined); | 493 | MODULE_DEVICE_TABLE (usb, id_table_combined); |
494 | 494 | ||
495 | static struct usb_driver digi_driver = { | 495 | static struct usb_driver digi_driver = { |
496 | .owner = THIS_MODULE, | ||
497 | .name = "digi_acceleport", | 496 | .name = "digi_acceleport", |
498 | .probe = usb_serial_probe, | 497 | .probe = usb_serial_probe, |
499 | .disconnect = usb_serial_disconnect, | 498 | .disconnect = usb_serial_disconnect, |
500 | .id_table = id_table_combined, | 499 | .id_table = id_table_combined, |
500 | .no_dynamic_id = 1, | ||
501 | }; | 501 | }; |
502 | 502 | ||
503 | 503 | ||
diff --git a/drivers/usb/serial/empeg.c b/drivers/usb/serial/empeg.c index 0b0546dcc7b9..79a766e9ca23 100644 --- a/drivers/usb/serial/empeg.c +++ b/drivers/usb/serial/empeg.c | |||
@@ -105,11 +105,11 @@ static struct usb_device_id id_table [] = { | |||
105 | MODULE_DEVICE_TABLE (usb, id_table); | 105 | MODULE_DEVICE_TABLE (usb, id_table); |
106 | 106 | ||
107 | static struct usb_driver empeg_driver = { | 107 | static struct usb_driver empeg_driver = { |
108 | .owner = THIS_MODULE, | ||
109 | .name = "empeg", | 108 | .name = "empeg", |
110 | .probe = usb_serial_probe, | 109 | .probe = usb_serial_probe, |
111 | .disconnect = usb_serial_disconnect, | 110 | .disconnect = usb_serial_disconnect, |
112 | .id_table = id_table, | 111 | .id_table = id_table, |
112 | .no_dynamic_id = 1, | ||
113 | }; | 113 | }; |
114 | 114 | ||
115 | static struct usb_serial_driver empeg_device = { | 115 | static struct usb_serial_driver empeg_device = { |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 06e04b442ff1..eb863b3f2d79 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -471,12 +471,15 @@ static struct usb_device_id id_table_combined [] = { | |||
471 | { USB_DEVICE(FTDI_VID, FTDI_ACTIVE_ROBOTS_PID) }, | 471 | { USB_DEVICE(FTDI_VID, FTDI_ACTIVE_ROBOTS_PID) }, |
472 | { USB_DEVICE(FTDI_VID, FTDI_MHAM_Y6_PID) }, | 472 | { USB_DEVICE(FTDI_VID, FTDI_MHAM_Y6_PID) }, |
473 | { USB_DEVICE(FTDI_VID, FTDI_MHAM_Y8_PID) }, | 473 | { USB_DEVICE(FTDI_VID, FTDI_MHAM_Y8_PID) }, |
474 | { USB_DEVICE(FTDI_VID, FTDI_TERATRONIK_VCP_PID) }, | ||
475 | { USB_DEVICE(FTDI_VID, FTDI_TERATRONIK_D2XX_PID) }, | ||
474 | { USB_DEVICE(EVOLUTION_VID, EVOLUTION_ER1_PID) }, | 476 | { USB_DEVICE(EVOLUTION_VID, EVOLUTION_ER1_PID) }, |
475 | { USB_DEVICE(FTDI_VID, FTDI_ARTEMIS_PID) }, | 477 | { USB_DEVICE(FTDI_VID, FTDI_ARTEMIS_PID) }, |
476 | { USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16_PID) }, | 478 | { USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16_PID) }, |
477 | { USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16HR_PID) }, | 479 | { USB_DEVICE(FTDI_VID, FTDI_ATIK_ATK16HR_PID) }, |
478 | { USB_DEVICE(KOBIL_VID, KOBIL_CONV_B1_PID) }, | 480 | { USB_DEVICE(KOBIL_VID, KOBIL_CONV_B1_PID) }, |
479 | { USB_DEVICE(KOBIL_VID, KOBIL_CONV_KAAN_PID) }, | 481 | { USB_DEVICE(KOBIL_VID, KOBIL_CONV_KAAN_PID) }, |
482 | { USB_DEVICE(POSIFLEX_VID, POSIFLEX_PP7000_PID) }, | ||
480 | { }, /* Optional parameter entry */ | 483 | { }, /* Optional parameter entry */ |
481 | { } /* Terminating entry */ | 484 | { } /* Terminating entry */ |
482 | }; | 485 | }; |
@@ -488,9 +491,10 @@ static struct usb_driver ftdi_driver = { | |||
488 | .probe = usb_serial_probe, | 491 | .probe = usb_serial_probe, |
489 | .disconnect = usb_serial_disconnect, | 492 | .disconnect = usb_serial_disconnect, |
490 | .id_table = id_table_combined, | 493 | .id_table = id_table_combined, |
494 | .no_dynamic_id = 1, | ||
491 | }; | 495 | }; |
492 | 496 | ||
493 | static char *ftdi_chip_name[] = { | 497 | static const char *ftdi_chip_name[] = { |
494 | [SIO] = "SIO", /* the serial part of FT8U100AX */ | 498 | [SIO] = "SIO", /* the serial part of FT8U100AX */ |
495 | [FT8U232AM] = "FT8U232AM", | 499 | [FT8U232AM] = "FT8U232AM", |
496 | [FT232BM] = "FT232BM", | 500 | [FT232BM] = "FT232BM", |
diff --git a/drivers/usb/serial/ftdi_sio.h b/drivers/usb/serial/ftdi_sio.h index 773ea3eca086..00d45f8600de 100644 --- a/drivers/usb/serial/ftdi_sio.h +++ b/drivers/usb/serial/ftdi_sio.h | |||
@@ -343,6 +343,13 @@ | |||
343 | #define XSENS_CONVERTER_7_PID 0xD38F | 343 | #define XSENS_CONVERTER_7_PID 0xD38F |
344 | 344 | ||
345 | /* | 345 | /* |
346 | * Teratronik product ids. | ||
347 | * Submitted by O. Wölfelschneider. | ||
348 | */ | ||
349 | #define FTDI_TERATRONIK_VCP_PID 0xEC88 /* Teratronik device (preferring VCP driver on windows) */ | ||
350 | #define FTDI_TERATRONIK_D2XX_PID 0xEC89 /* Teratronik device (preferring D2XX driver on windows) */ | ||
351 | |||
352 | /* | ||
346 | * Evolution Robotics products (http://www.evolution.com/). | 353 | * Evolution Robotics products (http://www.evolution.com/). |
347 | * Submitted by Shawn M. Lavelle. | 354 | * Submitted by Shawn M. Lavelle. |
348 | */ | 355 | */ |
@@ -352,6 +359,12 @@ | |||
352 | /* Pyramid Computer GmbH */ | 359 | /* Pyramid Computer GmbH */ |
353 | #define FTDI_PYRAMID_PID 0xE6C8 /* Pyramid Appliance Display */ | 360 | #define FTDI_PYRAMID_PID 0xE6C8 /* Pyramid Appliance Display */ |
354 | 361 | ||
362 | /* | ||
363 | * Posiflex inc retail equipment (http://www.posiflex.com.tw) | ||
364 | */ | ||
365 | #define POSIFLEX_VID 0x0d3a /* Vendor ID */ | ||
366 | #define POSIFLEX_PP7000_PID 0x0300 /* PP-7000II thermal printer */ | ||
367 | |||
355 | /* Commands */ | 368 | /* Commands */ |
356 | #define FTDI_SIO_RESET 0 /* Reset the port */ | 369 | #define FTDI_SIO_RESET 0 /* Reset the port */ |
357 | #define FTDI_SIO_MODEM_CTRL 1 /* Set the modem control register */ | 370 | #define FTDI_SIO_MODEM_CTRL 1 /* Set the modem control register */ |
@@ -714,7 +727,7 @@ typedef enum { | |||
714 | */ | 727 | */ |
715 | 728 | ||
716 | /* FTDI_SIO_GET_MODEM_STATUS */ | 729 | /* FTDI_SIO_GET_MODEM_STATUS */ |
717 | /* Retreive the current value of the modem status register */ | 730 | /* Retrieve the current value of the modem status register */ |
718 | 731 | ||
719 | #define FTDI_SIO_GET_MODEM_STATUS_REQUEST_TYPE 0xc0 | 732 | #define FTDI_SIO_GET_MODEM_STATUS_REQUEST_TYPE 0xc0 |
720 | #define FTDI_SIO_GET_MODEM_STATUS_REQUEST FTDI_SIO_GET_MODEM_STATUS | 733 | #define FTDI_SIO_GET_MODEM_STATUS_REQUEST FTDI_SIO_GET_MODEM_STATUS |
diff --git a/drivers/usb/serial/garmin_gps.c b/drivers/usb/serial/garmin_gps.c index 35820bda7ae1..452efce72714 100644 --- a/drivers/usb/serial/garmin_gps.c +++ b/drivers/usb/serial/garmin_gps.c | |||
@@ -222,11 +222,11 @@ static struct usb_device_id id_table [] = { | |||
222 | MODULE_DEVICE_TABLE (usb, id_table); | 222 | MODULE_DEVICE_TABLE (usb, id_table); |
223 | 223 | ||
224 | static struct usb_driver garmin_driver = { | 224 | static struct usb_driver garmin_driver = { |
225 | .owner = THIS_MODULE, | ||
226 | .name = "garmin_gps", | 225 | .name = "garmin_gps", |
227 | .probe = usb_serial_probe, | 226 | .probe = usb_serial_probe, |
228 | .disconnect = usb_serial_disconnect, | 227 | .disconnect = usb_serial_disconnect, |
229 | .id_table = id_table, | 228 | .id_table = id_table, |
229 | .no_dynamic_id = 1, | ||
230 | }; | 230 | }; |
231 | 231 | ||
232 | 232 | ||
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c index 53a47c31cd0e..4ddac620fc0c 100644 --- a/drivers/usb/serial/generic.c +++ b/drivers/usb/serial/generic.c | |||
@@ -68,11 +68,11 @@ static int generic_probe(struct usb_interface *interface, | |||
68 | } | 68 | } |
69 | 69 | ||
70 | static struct usb_driver generic_driver = { | 70 | static struct usb_driver generic_driver = { |
71 | .owner = THIS_MODULE, | ||
72 | .name = "usbserial_generic", | 71 | .name = "usbserial_generic", |
73 | .probe = generic_probe, | 72 | .probe = generic_probe, |
74 | .disconnect = usb_serial_disconnect, | 73 | .disconnect = usb_serial_disconnect, |
75 | .id_table = generic_serial_ids, | 74 | .id_table = generic_serial_ids, |
75 | .no_dynamic_id = 1, | ||
76 | }; | 76 | }; |
77 | #endif | 77 | #endif |
78 | 78 | ||
diff --git a/drivers/usb/serial/hp4x.c b/drivers/usb/serial/hp4x.c index 8eadfb705601..e9719da2aca1 100644 --- a/drivers/usb/serial/hp4x.c +++ b/drivers/usb/serial/hp4x.c | |||
@@ -37,11 +37,11 @@ static struct usb_device_id id_table [] = { | |||
37 | MODULE_DEVICE_TABLE(usb, id_table); | 37 | MODULE_DEVICE_TABLE(usb, id_table); |
38 | 38 | ||
39 | static struct usb_driver hp49gp_driver = { | 39 | static struct usb_driver hp49gp_driver = { |
40 | .owner = THIS_MODULE, | ||
41 | .name = "hp4X", | 40 | .name = "hp4X", |
42 | .probe = usb_serial_probe, | 41 | .probe = usb_serial_probe, |
43 | .disconnect = usb_serial_disconnect, | 42 | .disconnect = usb_serial_disconnect, |
44 | .id_table = id_table, | 43 | .id_table = id_table, |
44 | .no_dynamic_id = 1, | ||
45 | }; | 45 | }; |
46 | 46 | ||
47 | static struct usb_serial_driver hp49gp_device = { | 47 | static struct usb_serial_driver hp49gp_device = { |
diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c index dc4c498bd1ed..faedbeb6ba49 100644 --- a/drivers/usb/serial/io_edgeport.c +++ b/drivers/usb/serial/io_edgeport.c | |||
@@ -184,7 +184,7 @@ struct divisor_table_entry { | |||
184 | // These assume a 3.6864MHz crystal, the standard /16, and | 184 | // These assume a 3.6864MHz crystal, the standard /16, and |
185 | // MCR.7 = 0. | 185 | // MCR.7 = 0. |
186 | // | 186 | // |
187 | static struct divisor_table_entry divisor_table[] = { | 187 | static const struct divisor_table_entry divisor_table[] = { |
188 | { 50, 4608}, | 188 | { 50, 4608}, |
189 | { 75, 3072}, | 189 | { 75, 3072}, |
190 | { 110, 2095}, /* 2094.545455 => 230450 => .0217 % over */ | 190 | { 110, 2095}, /* 2094.545455 => 230450 => .0217 % over */ |
@@ -242,11 +242,11 @@ static void edge_shutdown (struct usb_serial *serial); | |||
242 | #include "io_tables.h" /* all of the devices that this driver supports */ | 242 | #include "io_tables.h" /* all of the devices that this driver supports */ |
243 | 243 | ||
244 | static struct usb_driver io_driver = { | 244 | static struct usb_driver io_driver = { |
245 | .owner = THIS_MODULE, | ||
246 | .name = "io_edgeport", | 245 | .name = "io_edgeport", |
247 | .probe = usb_serial_probe, | 246 | .probe = usb_serial_probe, |
248 | .disconnect = usb_serial_disconnect, | 247 | .disconnect = usb_serial_disconnect, |
249 | .id_table = id_table_combined, | 248 | .id_table = id_table_combined, |
249 | .no_dynamic_id = 1, | ||
250 | }; | 250 | }; |
251 | 251 | ||
252 | /* function prototypes for all of our local functions */ | 252 | /* function prototypes for all of our local functions */ |
@@ -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/io_fw_boot2.h b/drivers/usb/serial/io_fw_boot2.h index c7c3a3c305fe..e3463de99de4 100644 --- a/drivers/usb/serial/io_fw_boot2.h +++ b/drivers/usb/serial/io_fw_boot2.h | |||
@@ -537,7 +537,7 @@ static unsigned char IMAGE_ARRAY_NAME[] = { | |||
537 | 537 | ||
538 | }; | 538 | }; |
539 | 539 | ||
540 | static struct edge_firmware_version_info IMAGE_VERSION_NAME = { | 540 | static const struct edge_firmware_version_info IMAGE_VERSION_NAME = { |
541 | 2, 0, 3 }; // Major, Minor, Build | 541 | 2, 0, 3 }; // Major, Minor, Build |
542 | 542 | ||
543 | #undef IMAGE_VERSION_NAME | 543 | #undef IMAGE_VERSION_NAME |
diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c index 832b6d6734c0..2edf9cabad20 100644 --- a/drivers/usb/serial/io_ti.c +++ b/drivers/usb/serial/io_ti.c | |||
@@ -216,11 +216,11 @@ static struct usb_device_id id_table_combined [] = { | |||
216 | MODULE_DEVICE_TABLE (usb, id_table_combined); | 216 | MODULE_DEVICE_TABLE (usb, id_table_combined); |
217 | 217 | ||
218 | static struct usb_driver io_driver = { | 218 | static struct usb_driver io_driver = { |
219 | .owner = THIS_MODULE, | ||
220 | .name = "io_ti", | 219 | .name = "io_ti", |
221 | .probe = usb_serial_probe, | 220 | .probe = usb_serial_probe, |
222 | .disconnect = usb_serial_disconnect, | 221 | .disconnect = usb_serial_disconnect, |
223 | .id_table = id_table_combined, | 222 | .id_table = id_table_combined, |
223 | .no_dynamic_id = 1, | ||
224 | }; | 224 | }; |
225 | 225 | ||
226 | 226 | ||
@@ -2843,7 +2843,7 @@ static struct edge_buf *edge_buf_alloc(unsigned int size) | |||
2843 | * Free the buffer and all associated memory. | 2843 | * Free the buffer and all associated memory. |
2844 | */ | 2844 | */ |
2845 | 2845 | ||
2846 | void edge_buf_free(struct edge_buf *eb) | 2846 | static void edge_buf_free(struct edge_buf *eb) |
2847 | { | 2847 | { |
2848 | if (eb) { | 2848 | if (eb) { |
2849 | kfree(eb->buf_buf); | 2849 | kfree(eb->buf_buf); |
diff --git a/drivers/usb/serial/ipaq.c b/drivers/usb/serial/ipaq.c index d5d066488100..06d07cea0b70 100644 --- a/drivers/usb/serial/ipaq.c +++ b/drivers/usb/serial/ipaq.c | |||
@@ -542,11 +542,11 @@ static struct usb_device_id ipaq_id_table [] = { | |||
542 | MODULE_DEVICE_TABLE (usb, ipaq_id_table); | 542 | MODULE_DEVICE_TABLE (usb, ipaq_id_table); |
543 | 543 | ||
544 | static struct usb_driver ipaq_driver = { | 544 | static struct usb_driver ipaq_driver = { |
545 | .owner = THIS_MODULE, | ||
546 | .name = "ipaq", | 545 | .name = "ipaq", |
547 | .probe = usb_serial_probe, | 546 | .probe = usb_serial_probe, |
548 | .disconnect = usb_serial_disconnect, | 547 | .disconnect = usb_serial_disconnect, |
549 | .id_table = ipaq_id_table, | 548 | .id_table = ipaq_id_table, |
549 | .no_dynamic_id = 1, | ||
550 | }; | 550 | }; |
551 | 551 | ||
552 | 552 | ||
diff --git a/drivers/usb/serial/ipw.c b/drivers/usb/serial/ipw.c index 7744b8148bc5..2dd191f5fe76 100644 --- a/drivers/usb/serial/ipw.c +++ b/drivers/usb/serial/ipw.c | |||
@@ -152,11 +152,11 @@ static struct usb_device_id usb_ipw_ids[] = { | |||
152 | MODULE_DEVICE_TABLE(usb, usb_ipw_ids); | 152 | MODULE_DEVICE_TABLE(usb, usb_ipw_ids); |
153 | 153 | ||
154 | static struct usb_driver usb_ipw_driver = { | 154 | static struct usb_driver usb_ipw_driver = { |
155 | .owner = THIS_MODULE, | ||
156 | .name = "ipwtty", | 155 | .name = "ipwtty", |
157 | .probe = usb_serial_probe, | 156 | .probe = usb_serial_probe, |
158 | .disconnect = usb_serial_disconnect, | 157 | .disconnect = usb_serial_disconnect, |
159 | .id_table = usb_ipw_ids, | 158 | .id_table = usb_ipw_ids, |
159 | .no_dynamic_id = 1, | ||
160 | }; | 160 | }; |
161 | 161 | ||
162 | static int debug; | 162 | static int debug; |
diff --git a/drivers/usb/serial/ir-usb.c b/drivers/usb/serial/ir-usb.c index 19f329e9bdcf..a59010421444 100644 --- a/drivers/usb/serial/ir-usb.c +++ b/drivers/usb/serial/ir-usb.c | |||
@@ -125,11 +125,11 @@ static struct usb_device_id id_table [] = { | |||
125 | MODULE_DEVICE_TABLE (usb, id_table); | 125 | MODULE_DEVICE_TABLE (usb, id_table); |
126 | 126 | ||
127 | static struct usb_driver ir_driver = { | 127 | static struct usb_driver ir_driver = { |
128 | .owner = THIS_MODULE, | ||
129 | .name = "ir-usb", | 128 | .name = "ir-usb", |
130 | .probe = usb_serial_probe, | 129 | .probe = usb_serial_probe, |
131 | .disconnect = usb_serial_disconnect, | 130 | .disconnect = usb_serial_disconnect, |
132 | .id_table = id_table, | 131 | .id_table = id_table, |
132 | .no_dynamic_id = 1, | ||
133 | }; | 133 | }; |
134 | 134 | ||
135 | 135 | ||
diff --git a/drivers/usb/serial/keyspan.h b/drivers/usb/serial/keyspan.h index 5cfc13b5e56f..7472ed6bf626 100644 --- a/drivers/usb/serial/keyspan.h +++ b/drivers/usb/serial/keyspan.h | |||
@@ -520,11 +520,11 @@ static struct usb_device_id keyspan_ids_combined[] = { | |||
520 | MODULE_DEVICE_TABLE(usb, keyspan_ids_combined); | 520 | MODULE_DEVICE_TABLE(usb, keyspan_ids_combined); |
521 | 521 | ||
522 | static struct usb_driver keyspan_driver = { | 522 | static struct usb_driver keyspan_driver = { |
523 | .owner = THIS_MODULE, | ||
524 | .name = "keyspan", | 523 | .name = "keyspan", |
525 | .probe = usb_serial_probe, | 524 | .probe = usb_serial_probe, |
526 | .disconnect = usb_serial_disconnect, | 525 | .disconnect = usb_serial_disconnect, |
527 | .id_table = keyspan_ids_combined, | 526 | .id_table = keyspan_ids_combined, |
527 | .no_dynamic_id = 1, | ||
528 | }; | 528 | }; |
529 | 529 | ||
530 | /* usb_device_id table for the pre-firmware download keyspan devices */ | 530 | /* usb_device_id table for the pre-firmware download keyspan devices */ |
diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c index cd4f48bd83b6..b0441c35f98f 100644 --- a/drivers/usb/serial/keyspan_pda.c +++ b/drivers/usb/serial/keyspan_pda.c | |||
@@ -150,11 +150,11 @@ static struct usb_device_id id_table_combined [] = { | |||
150 | MODULE_DEVICE_TABLE (usb, id_table_combined); | 150 | MODULE_DEVICE_TABLE (usb, id_table_combined); |
151 | 151 | ||
152 | static struct usb_driver keyspan_pda_driver = { | 152 | static struct usb_driver keyspan_pda_driver = { |
153 | .owner = THIS_MODULE, | ||
154 | .name = "keyspan_pda", | 153 | .name = "keyspan_pda", |
155 | .probe = usb_serial_probe, | 154 | .probe = usb_serial_probe, |
156 | .disconnect = usb_serial_disconnect, | 155 | .disconnect = usb_serial_disconnect, |
157 | .id_table = id_table_combined, | 156 | .id_table = id_table_combined, |
157 | .no_dynamic_id = 1, | ||
158 | }; | 158 | }; |
159 | 159 | ||
160 | static struct usb_device_id id_table_std [] = { | 160 | static struct usb_device_id id_table_std [] = { |
diff --git a/drivers/usb/serial/kl5kusb105.c b/drivers/usb/serial/kl5kusb105.c index a8951c0fd020..4e2f7dfb58b2 100644 --- a/drivers/usb/serial/kl5kusb105.c +++ b/drivers/usb/serial/kl5kusb105.c | |||
@@ -116,11 +116,11 @@ static struct usb_device_id id_table [] = { | |||
116 | MODULE_DEVICE_TABLE (usb, id_table); | 116 | MODULE_DEVICE_TABLE (usb, id_table); |
117 | 117 | ||
118 | static struct usb_driver kl5kusb105d_driver = { | 118 | static struct usb_driver kl5kusb105d_driver = { |
119 | .owner = THIS_MODULE, | ||
120 | .name = "kl5kusb105d", | 119 | .name = "kl5kusb105d", |
121 | .probe = usb_serial_probe, | 120 | .probe = usb_serial_probe, |
122 | .disconnect = usb_serial_disconnect, | 121 | .disconnect = usb_serial_disconnect, |
123 | .id_table = id_table, | 122 | .id_table = id_table, |
123 | .no_dynamic_id = 1, | ||
124 | }; | 124 | }; |
125 | 125 | ||
126 | static struct usb_serial_driver kl5kusb105d_device = { | 126 | static struct usb_serial_driver kl5kusb105d_device = { |
diff --git a/drivers/usb/serial/kobil_sct.c b/drivers/usb/serial/kobil_sct.c index 9456dd9dd136..d9c21e275130 100644 --- a/drivers/usb/serial/kobil_sct.c +++ b/drivers/usb/serial/kobil_sct.c | |||
@@ -97,11 +97,11 @@ static struct usb_device_id id_table [] = { | |||
97 | MODULE_DEVICE_TABLE (usb, id_table); | 97 | MODULE_DEVICE_TABLE (usb, id_table); |
98 | 98 | ||
99 | static struct usb_driver kobil_driver = { | 99 | static struct usb_driver kobil_driver = { |
100 | .owner = THIS_MODULE, | ||
101 | .name = "kobil", | 100 | .name = "kobil", |
102 | .probe = usb_serial_probe, | 101 | .probe = usb_serial_probe, |
103 | .disconnect = usb_serial_disconnect, | 102 | .disconnect = usb_serial_disconnect, |
104 | .id_table = id_table, | 103 | .id_table = id_table, |
104 | .no_dynamic_id = 1, | ||
105 | }; | 105 | }; |
106 | 106 | ||
107 | 107 | ||
diff --git a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c index ca5dbadb9b7e..b6d6cab9c859 100644 --- a/drivers/usb/serial/mct_u232.c +++ b/drivers/usb/serial/mct_u232.c | |||
@@ -125,11 +125,11 @@ static struct usb_device_id id_table_combined [] = { | |||
125 | MODULE_DEVICE_TABLE (usb, id_table_combined); | 125 | MODULE_DEVICE_TABLE (usb, id_table_combined); |
126 | 126 | ||
127 | static struct usb_driver mct_u232_driver = { | 127 | static struct usb_driver mct_u232_driver = { |
128 | .owner = THIS_MODULE, | ||
129 | .name = "mct_u232", | 128 | .name = "mct_u232", |
130 | .probe = usb_serial_probe, | 129 | .probe = usb_serial_probe, |
131 | .disconnect = usb_serial_disconnect, | 130 | .disconnect = usb_serial_disconnect, |
132 | .id_table = id_table_combined, | 131 | .id_table = id_table_combined, |
132 | .no_dynamic_id = 1, | ||
133 | }; | 133 | }; |
134 | 134 | ||
135 | static struct usb_serial_driver mct_u232_device = { | 135 | static struct usb_serial_driver mct_u232_device = { |
diff --git a/drivers/usb/serial/omninet.c b/drivers/usb/serial/omninet.c index 3caf97072ac0..762d8ff9a1e4 100644 --- a/drivers/usb/serial/omninet.c +++ b/drivers/usb/serial/omninet.c | |||
@@ -80,11 +80,11 @@ static struct usb_device_id id_table [] = { | |||
80 | MODULE_DEVICE_TABLE (usb, id_table); | 80 | MODULE_DEVICE_TABLE (usb, id_table); |
81 | 81 | ||
82 | static struct usb_driver omninet_driver = { | 82 | static struct usb_driver omninet_driver = { |
83 | .owner = THIS_MODULE, | ||
84 | .name = "omninet", | 83 | .name = "omninet", |
85 | .probe = usb_serial_probe, | 84 | .probe = usb_serial_probe, |
86 | .disconnect = usb_serial_disconnect, | 85 | .disconnect = usb_serial_disconnect, |
87 | .id_table = id_table, | 86 | .id_table = id_table, |
87 | .no_dynamic_id = 1, | ||
88 | }; | 88 | }; |
89 | 89 | ||
90 | 90 | ||
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index 7716000045b7..3fd2405304fd 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
@@ -95,11 +95,11 @@ static struct usb_device_id option_ids[] = { | |||
95 | MODULE_DEVICE_TABLE(usb, option_ids); | 95 | MODULE_DEVICE_TABLE(usb, option_ids); |
96 | 96 | ||
97 | static struct usb_driver option_driver = { | 97 | static struct usb_driver option_driver = { |
98 | .owner = THIS_MODULE, | ||
99 | .name = "option", | 98 | .name = "option", |
100 | .probe = usb_serial_probe, | 99 | .probe = usb_serial_probe, |
101 | .disconnect = usb_serial_disconnect, | 100 | .disconnect = usb_serial_disconnect, |
102 | .id_table = option_ids, | 101 | .id_table = option_ids, |
102 | .no_dynamic_id = 1, | ||
103 | }; | 103 | }; |
104 | 104 | ||
105 | /* The card has three separate interfaces, wich the serial driver | 105 | /* The card has three separate interfaces, wich the serial driver |
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index 41a45a5025b2..f03721056190 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c | |||
@@ -82,11 +82,11 @@ static struct usb_device_id id_table [] = { | |||
82 | MODULE_DEVICE_TABLE (usb, id_table); | 82 | MODULE_DEVICE_TABLE (usb, id_table); |
83 | 83 | ||
84 | static struct usb_driver pl2303_driver = { | 84 | static struct usb_driver pl2303_driver = { |
85 | .owner = THIS_MODULE, | ||
86 | .name = "pl2303", | 85 | .name = "pl2303", |
87 | .probe = usb_serial_probe, | 86 | .probe = usb_serial_probe, |
88 | .disconnect = usb_serial_disconnect, | 87 | .disconnect = usb_serial_disconnect, |
89 | .id_table = id_table, | 88 | .id_table = id_table, |
89 | .no_dynamic_id = 1, | ||
90 | }; | 90 | }; |
91 | 91 | ||
92 | #define SET_LINE_REQUEST_TYPE 0x21 | 92 | #define SET_LINE_REQUEST_TYPE 0x21 |
@@ -810,7 +810,7 @@ static void pl2303_update_line_status(struct usb_serial_port *port, | |||
810 | struct pl2303_private *priv = usb_get_serial_port_data(port); | 810 | struct pl2303_private *priv = usb_get_serial_port_data(port); |
811 | unsigned long flags; | 811 | unsigned long flags; |
812 | u8 status_idx = UART_STATE; | 812 | u8 status_idx = UART_STATE; |
813 | u8 length = UART_STATE; | 813 | u8 length = UART_STATE + 1; |
814 | 814 | ||
815 | if ((le16_to_cpu(port->serial->dev->descriptor.idVendor) == SIEMENS_VENDOR_ID) && | 815 | if ((le16_to_cpu(port->serial->dev->descriptor.idVendor) == SIEMENS_VENDOR_ID) && |
816 | (le16_to_cpu(port->serial->dev->descriptor.idProduct) == SIEMENS_PRODUCT_ID_X65 || | 816 | (le16_to_cpu(port->serial->dev->descriptor.idProduct) == SIEMENS_PRODUCT_ID_X65 || |
diff --git a/drivers/usb/serial/safe_serial.c b/drivers/usb/serial/safe_serial.c index c22bdc0c4dfd..f0215f850d2d 100644 --- a/drivers/usb/serial/safe_serial.c +++ b/drivers/usb/serial/safe_serial.c | |||
@@ -160,14 +160,14 @@ static struct usb_device_id id_table[] = { | |||
160 | MODULE_DEVICE_TABLE (usb, id_table); | 160 | MODULE_DEVICE_TABLE (usb, id_table); |
161 | 161 | ||
162 | static struct usb_driver safe_driver = { | 162 | static struct usb_driver safe_driver = { |
163 | .owner = THIS_MODULE, | ||
164 | .name = "safe_serial", | 163 | .name = "safe_serial", |
165 | .probe = usb_serial_probe, | 164 | .probe = usb_serial_probe, |
166 | .disconnect = usb_serial_disconnect, | 165 | .disconnect = usb_serial_disconnect, |
167 | .id_table = id_table, | 166 | .id_table = id_table, |
167 | .no_dynamic_id = 1, | ||
168 | }; | 168 | }; |
169 | 169 | ||
170 | static __u16 crc10_table[256] = { | 170 | static const __u16 crc10_table[256] = { |
171 | 0x000, 0x233, 0x255, 0x066, 0x299, 0x0aa, 0x0cc, 0x2ff, 0x301, 0x132, 0x154, 0x367, 0x198, 0x3ab, 0x3cd, 0x1fe, | 171 | 0x000, 0x233, 0x255, 0x066, 0x299, 0x0aa, 0x0cc, 0x2ff, 0x301, 0x132, 0x154, 0x367, 0x198, 0x3ab, 0x3cd, 0x1fe, |
172 | 0x031, 0x202, 0x264, 0x057, 0x2a8, 0x09b, 0x0fd, 0x2ce, 0x330, 0x103, 0x165, 0x356, 0x1a9, 0x39a, 0x3fc, 0x1cf, | 172 | 0x031, 0x202, 0x264, 0x057, 0x2a8, 0x09b, 0x0fd, 0x2ce, 0x330, 0x103, 0x165, 0x356, 0x1a9, 0x39a, 0x3fc, 0x1cf, |
173 | 0x062, 0x251, 0x237, 0x004, 0x2fb, 0x0c8, 0x0ae, 0x29d, 0x363, 0x150, 0x136, 0x305, 0x1fa, 0x3c9, 0x3af, 0x19c, | 173 | 0x062, 0x251, 0x237, 0x004, 0x2fb, 0x0c8, 0x0ae, 0x29d, 0x363, 0x150, 0x136, 0x305, 0x1fa, 0x3c9, 0x3af, 0x19c, |
@@ -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 205dbf7201da..abb830cb77bd 100644 --- a/drivers/usb/serial/ti_usb_3410_5052.c +++ b/drivers/usb/serial/ti_usb_3410_5052.c | |||
@@ -248,11 +248,11 @@ static struct usb_device_id ti_id_table_combined[] = { | |||
248 | }; | 248 | }; |
249 | 249 | ||
250 | static struct usb_driver ti_usb_driver = { | 250 | static struct usb_driver ti_usb_driver = { |
251 | .owner = THIS_MODULE, | ||
252 | .name = "ti_usb_3410_5052", | 251 | .name = "ti_usb_3410_5052", |
253 | .probe = usb_serial_probe, | 252 | .probe = usb_serial_probe, |
254 | .disconnect = usb_serial_disconnect, | 253 | .disconnect = usb_serial_disconnect, |
255 | .id_table = ti_id_table_combined, | 254 | .id_table = ti_id_table_combined, |
255 | .no_dynamic_id = 1, | ||
256 | }; | 256 | }; |
257 | 257 | ||
258 | static struct usb_serial_driver ti_1port_device = { | 258 | static struct usb_serial_driver ti_1port_device = { |
@@ -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/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index 0c4881d18cd5..8bc8337c99c4 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/list.h> | 30 | #include <linux/list.h> |
31 | #include <linux/smp_lock.h> | 31 | #include <linux/smp_lock.h> |
32 | #include <asm/uaccess.h> | 32 | #include <asm/uaccess.h> |
33 | #include <asm/semaphore.h> | ||
33 | #include <linux/usb.h> | 34 | #include <linux/usb.h> |
34 | #include "usb-serial.h" | 35 | #include "usb-serial.h" |
35 | #include "pl2303.h" | 36 | #include "pl2303.h" |
@@ -42,10 +43,10 @@ | |||
42 | 43 | ||
43 | /* Driver structure we register with the USB core */ | 44 | /* Driver structure we register with the USB core */ |
44 | static struct usb_driver usb_serial_driver = { | 45 | static struct usb_driver usb_serial_driver = { |
45 | .owner = THIS_MODULE, | ||
46 | .name = "usbserial", | 46 | .name = "usbserial", |
47 | .probe = usb_serial_probe, | 47 | .probe = usb_serial_probe, |
48 | .disconnect = usb_serial_disconnect, | 48 | .disconnect = usb_serial_disconnect, |
49 | .no_dynamic_id = 1, | ||
49 | }; | 50 | }; |
50 | 51 | ||
51 | /* There is no MODULE_DEVICE_TABLE for usbserial.c. Instead | 52 | /* There is no MODULE_DEVICE_TABLE for usbserial.c. Instead |
@@ -188,6 +189,11 @@ static int serial_open (struct tty_struct *tty, struct file * filp) | |||
188 | 189 | ||
189 | portNumber = tty->index - serial->minor; | 190 | portNumber = tty->index - serial->minor; |
190 | port = serial->port[portNumber]; | 191 | port = serial->port[portNumber]; |
192 | if (!port) | ||
193 | return -ENODEV; | ||
194 | |||
195 | if (down_interruptible(&port->sem)) | ||
196 | return -ERESTARTSYS; | ||
191 | 197 | ||
192 | ++port->open_count; | 198 | ++port->open_count; |
193 | 199 | ||
@@ -213,6 +219,7 @@ static int serial_open (struct tty_struct *tty, struct file * filp) | |||
213 | goto bailout_module_put; | 219 | goto bailout_module_put; |
214 | } | 220 | } |
215 | 221 | ||
222 | up(&port->sem); | ||
216 | return 0; | 223 | return 0; |
217 | 224 | ||
218 | bailout_module_put: | 225 | bailout_module_put: |
@@ -220,6 +227,7 @@ bailout_module_put: | |||
220 | bailout_kref_put: | 227 | bailout_kref_put: |
221 | kref_put(&serial->kref, destroy_serial); | 228 | kref_put(&serial->kref, destroy_serial); |
222 | port->open_count = 0; | 229 | port->open_count = 0; |
230 | up(&port->sem); | ||
223 | return retval; | 231 | return retval; |
224 | } | 232 | } |
225 | 233 | ||
@@ -232,8 +240,10 @@ static void serial_close(struct tty_struct *tty, struct file * filp) | |||
232 | 240 | ||
233 | dbg("%s - port %d", __FUNCTION__, port->number); | 241 | dbg("%s - port %d", __FUNCTION__, port->number); |
234 | 242 | ||
243 | down(&port->sem); | ||
244 | |||
235 | if (port->open_count == 0) | 245 | if (port->open_count == 0) |
236 | return; | 246 | goto out; |
237 | 247 | ||
238 | --port->open_count; | 248 | --port->open_count; |
239 | if (port->open_count == 0) { | 249 | if (port->open_count == 0) { |
@@ -251,6 +261,9 @@ static void serial_close(struct tty_struct *tty, struct file * filp) | |||
251 | } | 261 | } |
252 | 262 | ||
253 | kref_put(&port->serial->kref, destroy_serial); | 263 | kref_put(&port->serial->kref, destroy_serial); |
264 | |||
265 | out: | ||
266 | up(&port->sem); | ||
254 | } | 267 | } |
255 | 268 | ||
256 | static int serial_write (struct tty_struct * tty, const unsigned char *buf, int count) | 269 | static int serial_write (struct tty_struct * tty, const unsigned char *buf, int count) |
@@ -258,6 +271,9 @@ static int serial_write (struct tty_struct * tty, const unsigned char *buf, int | |||
258 | struct usb_serial_port *port = tty->driver_data; | 271 | struct usb_serial_port *port = tty->driver_data; |
259 | int retval = -EINVAL; | 272 | int retval = -EINVAL; |
260 | 273 | ||
274 | if (!port) | ||
275 | goto exit; | ||
276 | |||
261 | dbg("%s - port %d, %d byte(s)", __FUNCTION__, port->number, count); | 277 | dbg("%s - port %d, %d byte(s)", __FUNCTION__, port->number, count); |
262 | 278 | ||
263 | if (!port->open_count) { | 279 | if (!port->open_count) { |
@@ -277,6 +293,9 @@ static int serial_write_room (struct tty_struct *tty) | |||
277 | struct usb_serial_port *port = tty->driver_data; | 293 | struct usb_serial_port *port = tty->driver_data; |
278 | int retval = -EINVAL; | 294 | int retval = -EINVAL; |
279 | 295 | ||
296 | if (!port) | ||
297 | goto exit; | ||
298 | |||
280 | dbg("%s - port %d", __FUNCTION__, port->number); | 299 | dbg("%s - port %d", __FUNCTION__, port->number); |
281 | 300 | ||
282 | if (!port->open_count) { | 301 | if (!port->open_count) { |
@@ -296,6 +315,9 @@ static int serial_chars_in_buffer (struct tty_struct *tty) | |||
296 | struct usb_serial_port *port = tty->driver_data; | 315 | struct usb_serial_port *port = tty->driver_data; |
297 | int retval = -EINVAL; | 316 | int retval = -EINVAL; |
298 | 317 | ||
318 | if (!port) | ||
319 | goto exit; | ||
320 | |||
299 | dbg("%s = port %d", __FUNCTION__, port->number); | 321 | dbg("%s = port %d", __FUNCTION__, port->number); |
300 | 322 | ||
301 | if (!port->open_count) { | 323 | if (!port->open_count) { |
@@ -314,6 +336,9 @@ static void serial_throttle (struct tty_struct * tty) | |||
314 | { | 336 | { |
315 | struct usb_serial_port *port = tty->driver_data; | 337 | struct usb_serial_port *port = tty->driver_data; |
316 | 338 | ||
339 | if (!port) | ||
340 | return; | ||
341 | |||
317 | dbg("%s - port %d", __FUNCTION__, port->number); | 342 | dbg("%s - port %d", __FUNCTION__, port->number); |
318 | 343 | ||
319 | if (!port->open_count) { | 344 | if (!port->open_count) { |
@@ -330,6 +355,9 @@ static void serial_unthrottle (struct tty_struct * tty) | |||
330 | { | 355 | { |
331 | struct usb_serial_port *port = tty->driver_data; | 356 | struct usb_serial_port *port = tty->driver_data; |
332 | 357 | ||
358 | if (!port) | ||
359 | return; | ||
360 | |||
333 | dbg("%s - port %d", __FUNCTION__, port->number); | 361 | dbg("%s - port %d", __FUNCTION__, port->number); |
334 | 362 | ||
335 | if (!port->open_count) { | 363 | if (!port->open_count) { |
@@ -347,6 +375,9 @@ static int serial_ioctl (struct tty_struct *tty, struct file * file, unsigned in | |||
347 | struct usb_serial_port *port = tty->driver_data; | 375 | struct usb_serial_port *port = tty->driver_data; |
348 | int retval = -ENODEV; | 376 | int retval = -ENODEV; |
349 | 377 | ||
378 | if (!port) | ||
379 | goto exit; | ||
380 | |||
350 | dbg("%s - port %d, cmd 0x%.4x", __FUNCTION__, port->number, cmd); | 381 | dbg("%s - port %d, cmd 0x%.4x", __FUNCTION__, port->number, cmd); |
351 | 382 | ||
352 | if (!port->open_count) { | 383 | if (!port->open_count) { |
@@ -368,6 +399,9 @@ static void serial_set_termios (struct tty_struct *tty, struct termios * old) | |||
368 | { | 399 | { |
369 | struct usb_serial_port *port = tty->driver_data; | 400 | struct usb_serial_port *port = tty->driver_data; |
370 | 401 | ||
402 | if (!port) | ||
403 | return; | ||
404 | |||
371 | dbg("%s - port %d", __FUNCTION__, port->number); | 405 | dbg("%s - port %d", __FUNCTION__, port->number); |
372 | 406 | ||
373 | if (!port->open_count) { | 407 | if (!port->open_count) { |
@@ -384,6 +418,9 @@ static void serial_break (struct tty_struct *tty, int break_state) | |||
384 | { | 418 | { |
385 | struct usb_serial_port *port = tty->driver_data; | 419 | struct usb_serial_port *port = tty->driver_data; |
386 | 420 | ||
421 | if (!port) | ||
422 | return; | ||
423 | |||
387 | dbg("%s - port %d", __FUNCTION__, port->number); | 424 | dbg("%s - port %d", __FUNCTION__, port->number); |
388 | 425 | ||
389 | if (!port->open_count) { | 426 | if (!port->open_count) { |
@@ -445,6 +482,9 @@ static int serial_tiocmget (struct tty_struct *tty, struct file *file) | |||
445 | { | 482 | { |
446 | struct usb_serial_port *port = tty->driver_data; | 483 | struct usb_serial_port *port = tty->driver_data; |
447 | 484 | ||
485 | if (!port) | ||
486 | goto exit; | ||
487 | |||
448 | dbg("%s - port %d", __FUNCTION__, port->number); | 488 | dbg("%s - port %d", __FUNCTION__, port->number); |
449 | 489 | ||
450 | if (!port->open_count) { | 490 | if (!port->open_count) { |
@@ -464,6 +504,9 @@ static int serial_tiocmset (struct tty_struct *tty, struct file *file, | |||
464 | { | 504 | { |
465 | struct usb_serial_port *port = tty->driver_data; | 505 | struct usb_serial_port *port = tty->driver_data; |
466 | 506 | ||
507 | if (!port) | ||
508 | goto exit; | ||
509 | |||
467 | dbg("%s - port %d", __FUNCTION__, port->number); | 510 | dbg("%s - port %d", __FUNCTION__, port->number); |
468 | 511 | ||
469 | if (!port->open_count) { | 512 | if (!port->open_count) { |
@@ -742,6 +785,7 @@ int usb_serial_probe(struct usb_interface *interface, | |||
742 | port->number = i + serial->minor; | 785 | port->number = i + serial->minor; |
743 | port->serial = serial; | 786 | port->serial = serial; |
744 | spin_lock_init(&port->lock); | 787 | spin_lock_init(&port->lock); |
788 | sema_init(&port->sem, 1); | ||
745 | INIT_WORK(&port->work, usb_serial_port_softint, port); | 789 | INIT_WORK(&port->work, usb_serial_port_softint, port); |
746 | serial->port[i] = port; | 790 | serial->port[i] = port; |
747 | } | 791 | } |
diff --git a/drivers/usb/serial/usb-serial.h b/drivers/usb/serial/usb-serial.h index 238a5a871ed6..d7d27c3385b3 100644 --- a/drivers/usb/serial/usb-serial.h +++ b/drivers/usb/serial/usb-serial.h | |||
@@ -16,6 +16,7 @@ | |||
16 | 16 | ||
17 | #include <linux/config.h> | 17 | #include <linux/config.h> |
18 | #include <linux/kref.h> | 18 | #include <linux/kref.h> |
19 | #include <asm/semaphore.h> | ||
19 | 20 | ||
20 | #define SERIAL_TTY_MAJOR 188 /* Nice legal number now */ | 21 | #define SERIAL_TTY_MAJOR 188 /* Nice legal number now */ |
21 | #define SERIAL_TTY_MINORS 255 /* loads of devices :) */ | 22 | #define SERIAL_TTY_MINORS 255 /* loads of devices :) */ |
@@ -30,6 +31,8 @@ | |||
30 | * @serial: pointer back to the struct usb_serial owner of this port. | 31 | * @serial: pointer back to the struct usb_serial owner of this port. |
31 | * @tty: pointer to the corresponding tty for this port. | 32 | * @tty: pointer to the corresponding tty for this port. |
32 | * @lock: spinlock to grab when updating portions of this structure. | 33 | * @lock: spinlock to grab when updating portions of this structure. |
34 | * @sem: semaphore used to synchronize serial_open() and serial_close() | ||
35 | * access for this port. | ||
33 | * @number: the number of the port (the minor number). | 36 | * @number: the number of the port (the minor number). |
34 | * @interrupt_in_buffer: pointer to the interrupt in buffer for this port. | 37 | * @interrupt_in_buffer: pointer to the interrupt in buffer for this port. |
35 | * @interrupt_in_urb: pointer to the interrupt in struct urb for this port. | 38 | * @interrupt_in_urb: pointer to the interrupt in struct urb for this port. |
@@ -60,6 +63,7 @@ struct usb_serial_port { | |||
60 | struct usb_serial * serial; | 63 | struct usb_serial * serial; |
61 | struct tty_struct * tty; | 64 | struct tty_struct * tty; |
62 | spinlock_t lock; | 65 | spinlock_t lock; |
66 | struct semaphore sem; | ||
63 | unsigned char number; | 67 | unsigned char number; |
64 | 68 | ||
65 | unsigned char * interrupt_in_buffer; | 69 | unsigned char * interrupt_in_buffer; |
diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c index a473c1c34559..49b1fbe61f25 100644 --- a/drivers/usb/serial/visor.c +++ b/drivers/usb/serial/visor.c | |||
@@ -173,11 +173,11 @@ static struct usb_device_id id_table_combined [] = { | |||
173 | MODULE_DEVICE_TABLE (usb, id_table_combined); | 173 | MODULE_DEVICE_TABLE (usb, id_table_combined); |
174 | 174 | ||
175 | static struct usb_driver visor_driver = { | 175 | static struct usb_driver visor_driver = { |
176 | .owner = THIS_MODULE, | ||
177 | .name = "visor", | 176 | .name = "visor", |
178 | .probe = usb_serial_probe, | 177 | .probe = usb_serial_probe, |
179 | .disconnect = usb_serial_disconnect, | 178 | .disconnect = usb_serial_disconnect, |
180 | .id_table = id_table_combined, | 179 | .id_table = id_table_combined, |
180 | .no_dynamic_id = 1, | ||
181 | }; | 181 | }; |
182 | 182 | ||
183 | /* All of the device info needed for the Handspring Visor, and Palm 4.0 devices */ | 183 | /* All of the device info needed for the Handspring Visor, and Palm 4.0 devices */ |
diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c index 18c3183be769..a7c3c4734d83 100644 --- a/drivers/usb/serial/whiteheat.c +++ b/drivers/usb/serial/whiteheat.c | |||
@@ -127,11 +127,11 @@ static struct usb_device_id id_table_combined [] = { | |||
127 | MODULE_DEVICE_TABLE (usb, id_table_combined); | 127 | MODULE_DEVICE_TABLE (usb, id_table_combined); |
128 | 128 | ||
129 | static struct usb_driver whiteheat_driver = { | 129 | static struct usb_driver whiteheat_driver = { |
130 | .owner = THIS_MODULE, | ||
131 | .name = "whiteheat", | 130 | .name = "whiteheat", |
132 | .probe = usb_serial_probe, | 131 | .probe = usb_serial_probe, |
133 | .disconnect = usb_serial_disconnect, | 132 | .disconnect = usb_serial_disconnect, |
134 | .id_table = id_table_combined, | 133 | .id_table = id_table_combined, |
134 | .no_dynamic_id = 1, | ||
135 | }; | 135 | }; |
136 | 136 | ||
137 | /* function prototypes for the Connect Tech WhiteHEAT prerenumeration device */ | 137 | /* function prototypes for the Connect Tech WhiteHEAT prerenumeration device */ |