diff options
37 files changed, 397 insertions, 254 deletions
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c index 103189095c80..3bb5d241dd40 100644 --- a/drivers/serial/serial_core.c +++ b/drivers/serial/serial_core.c | |||
@@ -1875,6 +1875,7 @@ uart_set_options(struct uart_port *port, struct console *co, | |||
1875 | int baud, int parity, int bits, int flow) | 1875 | int baud, int parity, int bits, int flow) |
1876 | { | 1876 | { |
1877 | struct ktermios termios; | 1877 | struct ktermios termios; |
1878 | static struct ktermios dummy; | ||
1878 | int i; | 1879 | int i; |
1879 | 1880 | ||
1880 | /* | 1881 | /* |
@@ -1920,7 +1921,7 @@ uart_set_options(struct uart_port *port, struct console *co, | |||
1920 | */ | 1921 | */ |
1921 | port->mctrl |= TIOCM_DTR; | 1922 | port->mctrl |= TIOCM_DTR; |
1922 | 1923 | ||
1923 | port->ops->set_termios(port, &termios, NULL); | 1924 | port->ops->set_termios(port, &termios, &dummy); |
1924 | co->cflag = termios.c_cflag; | 1925 | co->cflag = termios.c_cflag; |
1925 | 1926 | ||
1926 | return 0; | 1927 | return 0; |
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index 8bdaa157ffe7..eb4ac47612a5 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c | |||
@@ -1641,7 +1641,13 @@ free_interfaces: | |||
1641 | intf->dev.bus_id, ret); | 1641 | intf->dev.bus_id, ret); |
1642 | continue; | 1642 | continue; |
1643 | } | 1643 | } |
1644 | usb_create_sysfs_intf_files (intf); | 1644 | |
1645 | /* The driver's probe method can call usb_set_interface(), | ||
1646 | * which would mean the interface's sysfs files are already | ||
1647 | * created. Just in case, we'll remove them first. | ||
1648 | */ | ||
1649 | usb_remove_sysfs_intf_files(intf); | ||
1650 | usb_create_sysfs_intf_files(intf); | ||
1645 | } | 1651 | } |
1646 | 1652 | ||
1647 | usb_autosuspend_device(dev); | 1653 | usb_autosuspend_device(dev); |
diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c index c20c03aaf012..d05ead20081c 100644 --- a/drivers/usb/core/urb.c +++ b/drivers/usb/core/urb.c | |||
@@ -372,7 +372,7 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags) | |||
372 | 372 | ||
373 | /* enforce simple/standard policy */ | 373 | /* enforce simple/standard policy */ |
374 | allowed = (URB_NO_TRANSFER_DMA_MAP | URB_NO_SETUP_DMA_MAP | | 374 | allowed = (URB_NO_TRANSFER_DMA_MAP | URB_NO_SETUP_DMA_MAP | |
375 | URB_NO_INTERRUPT | URB_DIR_MASK); | 375 | URB_NO_INTERRUPT | URB_DIR_MASK | URB_FREE_BUFFER); |
376 | switch (xfertype) { | 376 | switch (xfertype) { |
377 | case USB_ENDPOINT_XFER_BULK: | 377 | case USB_ENDPOINT_XFER_BULK: |
378 | if (is_out) | 378 | if (is_out) |
diff --git a/drivers/usb/gadget/amd5536udc.c b/drivers/usb/gadget/amd5536udc.c index 1c8040602525..c72e9620bf8d 100644 --- a/drivers/usb/gadget/amd5536udc.c +++ b/drivers/usb/gadget/amd5536udc.c | |||
@@ -3289,7 +3289,7 @@ static int udc_pci_probe( | |||
3289 | dev->chiprev = pdev->revision; | 3289 | dev->chiprev = pdev->revision; |
3290 | 3290 | ||
3291 | pci_set_master(pdev); | 3291 | pci_set_master(pdev); |
3292 | pci_set_mwi(pdev); | 3292 | pci_try_set_mwi(pdev); |
3293 | 3293 | ||
3294 | /* init dma pools */ | 3294 | /* init dma pools */ |
3295 | if (use_dma) { | 3295 | if (use_dma) { |
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index c978d622fa8a..177e78ed241b 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig | |||
@@ -156,7 +156,7 @@ config USB_OHCI_HCD_PCI | |||
156 | 156 | ||
157 | config USB_OHCI_HCD_SSB | 157 | config USB_OHCI_HCD_SSB |
158 | bool "OHCI support for Broadcom SSB OHCI core" | 158 | bool "OHCI support for Broadcom SSB OHCI core" |
159 | depends on USB_OHCI_HCD && SSB && EXPERIMENTAL | 159 | depends on USB_OHCI_HCD && (SSB = y || SSB = CONFIG_USB_OHCI_HCD) && EXPERIMENTAL |
160 | default n | 160 | default n |
161 | ---help--- | 161 | ---help--- |
162 | Support for the Sonics Silicon Backplane (SSB) attached | 162 | Support for the Sonics Silicon Backplane (SSB) attached |
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c index 240c7f507541..704f33fdd2f1 100644 --- a/drivers/usb/host/ohci-hcd.c +++ b/drivers/usb/host/ohci-hcd.c | |||
@@ -80,7 +80,10 @@ static const char hcd_name [] = "ohci_hcd"; | |||
80 | static void ohci_dump (struct ohci_hcd *ohci, int verbose); | 80 | static void ohci_dump (struct ohci_hcd *ohci, int verbose); |
81 | static int ohci_init (struct ohci_hcd *ohci); | 81 | static int ohci_init (struct ohci_hcd *ohci); |
82 | static void ohci_stop (struct usb_hcd *hcd); | 82 | static void ohci_stop (struct usb_hcd *hcd); |
83 | |||
84 | #if defined(CONFIG_PM) || defined(CONFIG_PCI) | ||
83 | static int ohci_restart (struct ohci_hcd *ohci); | 85 | static int ohci_restart (struct ohci_hcd *ohci); |
86 | #endif | ||
84 | 87 | ||
85 | #include "ohci-hub.c" | 88 | #include "ohci-hub.c" |
86 | #include "ohci-dbg.c" | 89 | #include "ohci-dbg.c" |
@@ -396,7 +399,7 @@ static int check_ed(struct ohci_hcd *ohci, struct ed *ed) | |||
396 | */ | 399 | */ |
397 | static void unlink_watchdog_func(unsigned long _ohci) | 400 | static void unlink_watchdog_func(unsigned long _ohci) |
398 | { | 401 | { |
399 | long flags; | 402 | unsigned long flags; |
400 | unsigned max; | 403 | unsigned max; |
401 | unsigned seen_count = 0; | 404 | unsigned seen_count = 0; |
402 | unsigned i; | 405 | unsigned i; |
@@ -893,6 +896,8 @@ static void ohci_stop (struct usb_hcd *hcd) | |||
893 | 896 | ||
894 | /*-------------------------------------------------------------------------*/ | 897 | /*-------------------------------------------------------------------------*/ |
895 | 898 | ||
899 | #if defined(CONFIG_PM) || defined(CONFIG_PCI) | ||
900 | |||
896 | /* must not be called from interrupt context */ | 901 | /* must not be called from interrupt context */ |
897 | static int ohci_restart (struct ohci_hcd *ohci) | 902 | static int ohci_restart (struct ohci_hcd *ohci) |
898 | { | 903 | { |
@@ -954,6 +959,8 @@ static int ohci_restart (struct ohci_hcd *ohci) | |||
954 | return 0; | 959 | return 0; |
955 | } | 960 | } |
956 | 961 | ||
962 | #endif | ||
963 | |||
957 | /*-------------------------------------------------------------------------*/ | 964 | /*-------------------------------------------------------------------------*/ |
958 | 965 | ||
959 | #define DRIVER_INFO DRIVER_VERSION " " DRIVER_DESC | 966 | #define DRIVER_INFO DRIVER_VERSION " " DRIVER_DESC |
diff --git a/drivers/usb/host/uhci-q.c b/drivers/usb/host/uhci-q.c index e5d60d5b105a..60379b17bbc1 100644 --- a/drivers/usb/host/uhci-q.c +++ b/drivers/usb/host/uhci-q.c | |||
@@ -1271,7 +1271,8 @@ static int uhci_submit_isochronous(struct uhci_hcd *uhci, struct urb *urb, | |||
1271 | } else if (qh->period != urb->interval) { | 1271 | } else if (qh->period != urb->interval) { |
1272 | return -EINVAL; /* Can't change the period */ | 1272 | return -EINVAL; /* Can't change the period */ |
1273 | 1273 | ||
1274 | } else { /* Pick up where the last URB leaves off */ | 1274 | } else { |
1275 | /* Find the next unused frame */ | ||
1275 | if (list_empty(&qh->queue)) { | 1276 | if (list_empty(&qh->queue)) { |
1276 | frame = qh->iso_frame; | 1277 | frame = qh->iso_frame; |
1277 | } else { | 1278 | } else { |
@@ -1283,10 +1284,18 @@ static int uhci_submit_isochronous(struct uhci_hcd *uhci, struct urb *urb, | |||
1283 | lurb->number_of_packets * | 1284 | lurb->number_of_packets * |
1284 | lurb->interval; | 1285 | lurb->interval; |
1285 | } | 1286 | } |
1286 | if (urb->transfer_flags & URB_ISO_ASAP) | 1287 | if (urb->transfer_flags & URB_ISO_ASAP) { |
1287 | urb->start_frame = frame; | 1288 | /* Skip some frames if necessary to insure |
1288 | else if (urb->start_frame != frame) | 1289 | * the start frame is in the future. |
1289 | return -EINVAL; | 1290 | */ |
1291 | uhci_get_current_frame_number(uhci); | ||
1292 | if (uhci_frame_before_eq(frame, uhci->frame_number)) { | ||
1293 | frame = uhci->frame_number + 1; | ||
1294 | frame += ((qh->phase - frame) & | ||
1295 | (qh->period - 1)); | ||
1296 | } | ||
1297 | } /* Otherwise pick up where the last URB leaves off */ | ||
1298 | urb->start_frame = frame; | ||
1290 | } | 1299 | } |
1291 | 1300 | ||
1292 | /* Make sure we won't have to go too far into the future */ | 1301 | /* Make sure we won't have to go too far into the future */ |
diff --git a/drivers/usb/misc/cytherm.c b/drivers/usb/misc/cytherm.c index 2677fea147d9..1cd9e7eba93b 100644 --- a/drivers/usb/misc/cytherm.c +++ b/drivers/usb/misc/cytherm.c | |||
@@ -399,7 +399,6 @@ static void cytherm_disconnect(struct usb_interface *interface) | |||
399 | struct usb_cytherm *dev; | 399 | struct usb_cytherm *dev; |
400 | 400 | ||
401 | dev = usb_get_intfdata (interface); | 401 | dev = usb_get_intfdata (interface); |
402 | usb_set_intfdata (interface, NULL); | ||
403 | 402 | ||
404 | device_remove_file(&interface->dev, &dev_attr_brightness); | 403 | device_remove_file(&interface->dev, &dev_attr_brightness); |
405 | device_remove_file(&interface->dev, &dev_attr_temp); | 404 | device_remove_file(&interface->dev, &dev_attr_temp); |
@@ -407,6 +406,9 @@ static void cytherm_disconnect(struct usb_interface *interface) | |||
407 | device_remove_file(&interface->dev, &dev_attr_port0); | 406 | device_remove_file(&interface->dev, &dev_attr_port0); |
408 | device_remove_file(&interface->dev, &dev_attr_port1); | 407 | device_remove_file(&interface->dev, &dev_attr_port1); |
409 | 408 | ||
409 | /* first remove the files, then NULL the pointer */ | ||
410 | usb_set_intfdata (interface, NULL); | ||
411 | |||
410 | usb_put_dev(dev->udev); | 412 | usb_put_dev(dev->udev); |
411 | 413 | ||
412 | kfree(dev); | 414 | kfree(dev); |
diff --git a/drivers/usb/misc/emi26.c b/drivers/usb/misc/emi26.c index cd137577bb2d..4a09b87bdd28 100644 --- a/drivers/usb/misc/emi26.c +++ b/drivers/usb/misc/emi26.c | |||
@@ -114,6 +114,10 @@ static int emi26_load_firmware (struct usb_device *dev) | |||
114 | 114 | ||
115 | /* De-assert reset (let the CPU run) */ | 115 | /* De-assert reset (let the CPU run) */ |
116 | err = emi26_set_reset(dev,0); | 116 | err = emi26_set_reset(dev,0); |
117 | if (err < 0) { | ||
118 | err("%s - error loading firmware: error = %d", __FUNCTION__, err); | ||
119 | goto wraperr; | ||
120 | } | ||
117 | msleep(250); /* let device settle */ | 121 | msleep(250); /* let device settle */ |
118 | 122 | ||
119 | /* 2. We upload the FPGA firmware into the EMI | 123 | /* 2. We upload the FPGA firmware into the EMI |
diff --git a/drivers/usb/misc/emi62.c b/drivers/usb/misc/emi62.c index 4758cc5ccebc..d1362415922c 100644 --- a/drivers/usb/misc/emi62.c +++ b/drivers/usb/misc/emi62.c | |||
@@ -123,6 +123,10 @@ static int emi62_load_firmware (struct usb_device *dev) | |||
123 | 123 | ||
124 | /* De-assert reset (let the CPU run) */ | 124 | /* De-assert reset (let the CPU run) */ |
125 | err = emi62_set_reset(dev,0); | 125 | err = emi62_set_reset(dev,0); |
126 | if (err < 0) { | ||
127 | err("%s - error loading firmware: error = %d", __FUNCTION__, err); | ||
128 | goto wraperr; | ||
129 | } | ||
126 | msleep(250); /* let device settle */ | 130 | msleep(250); /* let device settle */ |
127 | 131 | ||
128 | /* 2. We upload the FPGA firmware into the EMI | 132 | /* 2. We upload the FPGA firmware into the EMI |
diff --git a/drivers/usb/misc/ftdi-elan.c b/drivers/usb/misc/ftdi-elan.c index d3d8cd6ff103..148b7fe639b2 100644 --- a/drivers/usb/misc/ftdi-elan.c +++ b/drivers/usb/misc/ftdi-elan.c | |||
@@ -147,7 +147,7 @@ struct u132_target { | |||
147 | /* Structure to hold all of our device specific stuff*/ | 147 | /* Structure to hold all of our device specific stuff*/ |
148 | struct usb_ftdi { | 148 | struct usb_ftdi { |
149 | struct list_head ftdi_list; | 149 | struct list_head ftdi_list; |
150 | struct semaphore u132_lock; | 150 | struct mutex u132_lock; |
151 | int command_next; | 151 | int command_next; |
152 | int command_head; | 152 | int command_head; |
153 | struct u132_command command[COMMAND_SIZE]; | 153 | struct u132_command command[COMMAND_SIZE]; |
@@ -330,39 +330,39 @@ static int ftdi_elan_hcd_init(struct usb_ftdi *ftdi) | |||
330 | 330 | ||
331 | static void ftdi_elan_abandon_completions(struct usb_ftdi *ftdi) | 331 | static void ftdi_elan_abandon_completions(struct usb_ftdi *ftdi) |
332 | { | 332 | { |
333 | down(&ftdi->u132_lock); | 333 | mutex_lock(&ftdi->u132_lock); |
334 | while (ftdi->respond_next > ftdi->respond_head) { | 334 | while (ftdi->respond_next > ftdi->respond_head) { |
335 | struct u132_respond *respond = &ftdi->respond[RESPOND_MASK & | 335 | struct u132_respond *respond = &ftdi->respond[RESPOND_MASK & |
336 | ftdi->respond_head++]; | 336 | ftdi->respond_head++]; |
337 | *respond->result = -ESHUTDOWN; | 337 | *respond->result = -ESHUTDOWN; |
338 | *respond->value = 0; | 338 | *respond->value = 0; |
339 | complete(&respond->wait_completion); | 339 | complete(&respond->wait_completion); |
340 | } up(&ftdi->u132_lock); | 340 | } mutex_unlock(&ftdi->u132_lock); |
341 | } | 341 | } |
342 | 342 | ||
343 | static void ftdi_elan_abandon_targets(struct usb_ftdi *ftdi) | 343 | static void ftdi_elan_abandon_targets(struct usb_ftdi *ftdi) |
344 | { | 344 | { |
345 | int ed_number = 4; | 345 | int ed_number = 4; |
346 | down(&ftdi->u132_lock); | 346 | mutex_lock(&ftdi->u132_lock); |
347 | while (ed_number-- > 0) { | 347 | while (ed_number-- > 0) { |
348 | struct u132_target *target = &ftdi->target[ed_number]; | 348 | struct u132_target *target = &ftdi->target[ed_number]; |
349 | if (target->active == 1) { | 349 | if (target->active == 1) { |
350 | target->condition_code = TD_DEVNOTRESP; | 350 | target->condition_code = TD_DEVNOTRESP; |
351 | up(&ftdi->u132_lock); | 351 | mutex_unlock(&ftdi->u132_lock); |
352 | ftdi_elan_do_callback(ftdi, target, NULL, 0); | 352 | ftdi_elan_do_callback(ftdi, target, NULL, 0); |
353 | down(&ftdi->u132_lock); | 353 | mutex_lock(&ftdi->u132_lock); |
354 | } | 354 | } |
355 | } | 355 | } |
356 | ftdi->recieved = 0; | 356 | ftdi->recieved = 0; |
357 | ftdi->expected = 4; | 357 | ftdi->expected = 4; |
358 | ftdi->ed_found = 0; | 358 | ftdi->ed_found = 0; |
359 | up(&ftdi->u132_lock); | 359 | mutex_unlock(&ftdi->u132_lock); |
360 | } | 360 | } |
361 | 361 | ||
362 | static void ftdi_elan_flush_targets(struct usb_ftdi *ftdi) | 362 | static void ftdi_elan_flush_targets(struct usb_ftdi *ftdi) |
363 | { | 363 | { |
364 | int ed_number = 4; | 364 | int ed_number = 4; |
365 | down(&ftdi->u132_lock); | 365 | mutex_lock(&ftdi->u132_lock); |
366 | while (ed_number-- > 0) { | 366 | while (ed_number-- > 0) { |
367 | struct u132_target *target = &ftdi->target[ed_number]; | 367 | struct u132_target *target = &ftdi->target[ed_number]; |
368 | target->abandoning = 1; | 368 | target->abandoning = 1; |
@@ -382,9 +382,9 @@ static void ftdi_elan_flush_targets(struct usb_ftdi *ftdi) | |||
382 | ftdi->command_next += 1; | 382 | ftdi->command_next += 1; |
383 | ftdi_elan_kick_command_queue(ftdi); | 383 | ftdi_elan_kick_command_queue(ftdi); |
384 | } else { | 384 | } else { |
385 | up(&ftdi->u132_lock); | 385 | mutex_unlock(&ftdi->u132_lock); |
386 | msleep(100); | 386 | msleep(100); |
387 | down(&ftdi->u132_lock); | 387 | mutex_lock(&ftdi->u132_lock); |
388 | goto wait_1; | 388 | goto wait_1; |
389 | } | 389 | } |
390 | } | 390 | } |
@@ -404,9 +404,9 @@ static void ftdi_elan_flush_targets(struct usb_ftdi *ftdi) | |||
404 | ftdi->command_next += 1; | 404 | ftdi->command_next += 1; |
405 | ftdi_elan_kick_command_queue(ftdi); | 405 | ftdi_elan_kick_command_queue(ftdi); |
406 | } else { | 406 | } else { |
407 | up(&ftdi->u132_lock); | 407 | mutex_unlock(&ftdi->u132_lock); |
408 | msleep(100); | 408 | msleep(100); |
409 | down(&ftdi->u132_lock); | 409 | mutex_lock(&ftdi->u132_lock); |
410 | goto wait_2; | 410 | goto wait_2; |
411 | } | 411 | } |
412 | } | 412 | } |
@@ -414,13 +414,13 @@ static void ftdi_elan_flush_targets(struct usb_ftdi *ftdi) | |||
414 | ftdi->recieved = 0; | 414 | ftdi->recieved = 0; |
415 | ftdi->expected = 4; | 415 | ftdi->expected = 4; |
416 | ftdi->ed_found = 0; | 416 | ftdi->ed_found = 0; |
417 | up(&ftdi->u132_lock); | 417 | mutex_unlock(&ftdi->u132_lock); |
418 | } | 418 | } |
419 | 419 | ||
420 | static void ftdi_elan_cancel_targets(struct usb_ftdi *ftdi) | 420 | static void ftdi_elan_cancel_targets(struct usb_ftdi *ftdi) |
421 | { | 421 | { |
422 | int ed_number = 4; | 422 | int ed_number = 4; |
423 | down(&ftdi->u132_lock); | 423 | mutex_lock(&ftdi->u132_lock); |
424 | while (ed_number-- > 0) { | 424 | while (ed_number-- > 0) { |
425 | struct u132_target *target = &ftdi->target[ed_number]; | 425 | struct u132_target *target = &ftdi->target[ed_number]; |
426 | target->abandoning = 1; | 426 | target->abandoning = 1; |
@@ -440,9 +440,9 @@ static void ftdi_elan_cancel_targets(struct usb_ftdi *ftdi) | |||
440 | ftdi->command_next += 1; | 440 | ftdi->command_next += 1; |
441 | ftdi_elan_kick_command_queue(ftdi); | 441 | ftdi_elan_kick_command_queue(ftdi); |
442 | } else { | 442 | } else { |
443 | up(&ftdi->u132_lock); | 443 | mutex_unlock(&ftdi->u132_lock); |
444 | msleep(100); | 444 | msleep(100); |
445 | down(&ftdi->u132_lock); | 445 | mutex_lock(&ftdi->u132_lock); |
446 | goto wait; | 446 | goto wait; |
447 | } | 447 | } |
448 | } | 448 | } |
@@ -450,7 +450,7 @@ static void ftdi_elan_cancel_targets(struct usb_ftdi *ftdi) | |||
450 | ftdi->recieved = 0; | 450 | ftdi->recieved = 0; |
451 | ftdi->expected = 4; | 451 | ftdi->expected = 4; |
452 | ftdi->ed_found = 0; | 452 | ftdi->ed_found = 0; |
453 | up(&ftdi->u132_lock); | 453 | mutex_unlock(&ftdi->u132_lock); |
454 | } | 454 | } |
455 | 455 | ||
456 | static void ftdi_elan_kick_command_queue(struct usb_ftdi *ftdi) | 456 | static void ftdi_elan_kick_command_queue(struct usb_ftdi *ftdi) |
@@ -886,14 +886,14 @@ static char *have_ed_set_response(struct usb_ftdi *ftdi, | |||
886 | char *b) | 886 | char *b) |
887 | { | 887 | { |
888 | int payload = (ed_length >> 0) & 0x07FF; | 888 | int payload = (ed_length >> 0) & 0x07FF; |
889 | down(&ftdi->u132_lock); | 889 | mutex_lock(&ftdi->u132_lock); |
890 | target->actual = 0; | 890 | target->actual = 0; |
891 | target->non_null = (ed_length >> 15) & 0x0001; | 891 | target->non_null = (ed_length >> 15) & 0x0001; |
892 | target->repeat_number = (ed_length >> 11) & 0x000F; | 892 | target->repeat_number = (ed_length >> 11) & 0x000F; |
893 | if (ed_type == 0x02) { | 893 | if (ed_type == 0x02) { |
894 | if (payload == 0 || target->abandoning > 0) { | 894 | if (payload == 0 || target->abandoning > 0) { |
895 | target->abandoning = 0; | 895 | target->abandoning = 0; |
896 | up(&ftdi->u132_lock); | 896 | mutex_unlock(&ftdi->u132_lock); |
897 | ftdi_elan_do_callback(ftdi, target, 4 + ftdi->response, | 897 | ftdi_elan_do_callback(ftdi, target, 4 + ftdi->response, |
898 | payload); | 898 | payload); |
899 | ftdi->recieved = 0; | 899 | ftdi->recieved = 0; |
@@ -903,13 +903,13 @@ static char *have_ed_set_response(struct usb_ftdi *ftdi, | |||
903 | } else { | 903 | } else { |
904 | ftdi->expected = 4 + payload; | 904 | ftdi->expected = 4 + payload; |
905 | ftdi->ed_found = 1; | 905 | ftdi->ed_found = 1; |
906 | up(&ftdi->u132_lock); | 906 | mutex_unlock(&ftdi->u132_lock); |
907 | return b; | 907 | return b; |
908 | } | 908 | } |
909 | } else if (ed_type == 0x03) { | 909 | } else if (ed_type == 0x03) { |
910 | if (payload == 0 || target->abandoning > 0) { | 910 | if (payload == 0 || target->abandoning > 0) { |
911 | target->abandoning = 0; | 911 | target->abandoning = 0; |
912 | up(&ftdi->u132_lock); | 912 | mutex_unlock(&ftdi->u132_lock); |
913 | ftdi_elan_do_callback(ftdi, target, 4 + ftdi->response, | 913 | ftdi_elan_do_callback(ftdi, target, 4 + ftdi->response, |
914 | payload); | 914 | payload); |
915 | ftdi->recieved = 0; | 915 | ftdi->recieved = 0; |
@@ -919,12 +919,12 @@ static char *have_ed_set_response(struct usb_ftdi *ftdi, | |||
919 | } else { | 919 | } else { |
920 | ftdi->expected = 4 + payload; | 920 | ftdi->expected = 4 + payload; |
921 | ftdi->ed_found = 1; | 921 | ftdi->ed_found = 1; |
922 | up(&ftdi->u132_lock); | 922 | mutex_unlock(&ftdi->u132_lock); |
923 | return b; | 923 | return b; |
924 | } | 924 | } |
925 | } else if (ed_type == 0x01) { | 925 | } else if (ed_type == 0x01) { |
926 | target->abandoning = 0; | 926 | target->abandoning = 0; |
927 | up(&ftdi->u132_lock); | 927 | mutex_unlock(&ftdi->u132_lock); |
928 | ftdi_elan_do_callback(ftdi, target, 4 + ftdi->response, | 928 | ftdi_elan_do_callback(ftdi, target, 4 + ftdi->response, |
929 | payload); | 929 | payload); |
930 | ftdi->recieved = 0; | 930 | ftdi->recieved = 0; |
@@ -933,7 +933,7 @@ static char *have_ed_set_response(struct usb_ftdi *ftdi, | |||
933 | return ftdi->response; | 933 | return ftdi->response; |
934 | } else { | 934 | } else { |
935 | target->abandoning = 0; | 935 | target->abandoning = 0; |
936 | up(&ftdi->u132_lock); | 936 | mutex_unlock(&ftdi->u132_lock); |
937 | ftdi_elan_do_callback(ftdi, target, 4 + ftdi->response, | 937 | ftdi_elan_do_callback(ftdi, target, 4 + ftdi->response, |
938 | payload); | 938 | payload); |
939 | ftdi->recieved = 0; | 939 | ftdi->recieved = 0; |
@@ -947,12 +947,12 @@ static char *have_ed_get_response(struct usb_ftdi *ftdi, | |||
947 | struct u132_target *target, u16 ed_length, int ed_number, int ed_type, | 947 | struct u132_target *target, u16 ed_length, int ed_number, int ed_type, |
948 | char *b) | 948 | char *b) |
949 | { | 949 | { |
950 | down(&ftdi->u132_lock); | 950 | mutex_lock(&ftdi->u132_lock); |
951 | target->condition_code = TD_DEVNOTRESP; | 951 | target->condition_code = TD_DEVNOTRESP; |
952 | target->actual = (ed_length >> 0) & 0x01FF; | 952 | target->actual = (ed_length >> 0) & 0x01FF; |
953 | target->non_null = (ed_length >> 15) & 0x0001; | 953 | target->non_null = (ed_length >> 15) & 0x0001; |
954 | target->repeat_number = (ed_length >> 11) & 0x000F; | 954 | target->repeat_number = (ed_length >> 11) & 0x000F; |
955 | up(&ftdi->u132_lock); | 955 | mutex_unlock(&ftdi->u132_lock); |
956 | if (target->active) | 956 | if (target->active) |
957 | ftdi_elan_do_callback(ftdi, target, NULL, 0); | 957 | ftdi_elan_do_callback(ftdi, target, NULL, 0); |
958 | target->abandoning = 0; | 958 | target->abandoning = 0; |
@@ -1278,7 +1278,7 @@ static int ftdi_elan_write_reg(struct usb_ftdi *ftdi, u32 data) | |||
1278 | return -ENODEV; | 1278 | return -ENODEV; |
1279 | } else { | 1279 | } else { |
1280 | int command_size; | 1280 | int command_size; |
1281 | down(&ftdi->u132_lock); | 1281 | mutex_lock(&ftdi->u132_lock); |
1282 | command_size = ftdi->command_next - ftdi->command_head; | 1282 | command_size = ftdi->command_next - ftdi->command_head; |
1283 | if (command_size < COMMAND_SIZE) { | 1283 | if (command_size < COMMAND_SIZE) { |
1284 | struct u132_command *command = &ftdi->command[ | 1284 | struct u132_command *command = &ftdi->command[ |
@@ -1292,10 +1292,10 @@ static int ftdi_elan_write_reg(struct usb_ftdi *ftdi, u32 data) | |||
1292 | command->buffer = &command->value; | 1292 | command->buffer = &command->value; |
1293 | ftdi->command_next += 1; | 1293 | ftdi->command_next += 1; |
1294 | ftdi_elan_kick_command_queue(ftdi); | 1294 | ftdi_elan_kick_command_queue(ftdi); |
1295 | up(&ftdi->u132_lock); | 1295 | mutex_unlock(&ftdi->u132_lock); |
1296 | return 0; | 1296 | return 0; |
1297 | } else { | 1297 | } else { |
1298 | up(&ftdi->u132_lock); | 1298 | mutex_unlock(&ftdi->u132_lock); |
1299 | msleep(100); | 1299 | msleep(100); |
1300 | goto wait; | 1300 | goto wait; |
1301 | } | 1301 | } |
@@ -1310,7 +1310,7 @@ static int ftdi_elan_write_config(struct usb_ftdi *ftdi, int config_offset, | |||
1310 | return -ENODEV; | 1310 | return -ENODEV; |
1311 | } else { | 1311 | } else { |
1312 | int command_size; | 1312 | int command_size; |
1313 | down(&ftdi->u132_lock); | 1313 | mutex_lock(&ftdi->u132_lock); |
1314 | command_size = ftdi->command_next - ftdi->command_head; | 1314 | command_size = ftdi->command_next - ftdi->command_head; |
1315 | if (command_size < COMMAND_SIZE) { | 1315 | if (command_size < COMMAND_SIZE) { |
1316 | struct u132_command *command = &ftdi->command[ | 1316 | struct u132_command *command = &ftdi->command[ |
@@ -1324,10 +1324,10 @@ static int ftdi_elan_write_config(struct usb_ftdi *ftdi, int config_offset, | |||
1324 | command->buffer = &command->value; | 1324 | command->buffer = &command->value; |
1325 | ftdi->command_next += 1; | 1325 | ftdi->command_next += 1; |
1326 | ftdi_elan_kick_command_queue(ftdi); | 1326 | ftdi_elan_kick_command_queue(ftdi); |
1327 | up(&ftdi->u132_lock); | 1327 | mutex_unlock(&ftdi->u132_lock); |
1328 | return 0; | 1328 | return 0; |
1329 | } else { | 1329 | } else { |
1330 | up(&ftdi->u132_lock); | 1330 | mutex_unlock(&ftdi->u132_lock); |
1331 | msleep(100); | 1331 | msleep(100); |
1332 | goto wait; | 1332 | goto wait; |
1333 | } | 1333 | } |
@@ -1342,7 +1342,7 @@ static int ftdi_elan_write_pcimem(struct usb_ftdi *ftdi, int mem_offset, | |||
1342 | return -ENODEV; | 1342 | return -ENODEV; |
1343 | } else { | 1343 | } else { |
1344 | int command_size; | 1344 | int command_size; |
1345 | down(&ftdi->u132_lock); | 1345 | mutex_lock(&ftdi->u132_lock); |
1346 | command_size = ftdi->command_next - ftdi->command_head; | 1346 | command_size = ftdi->command_next - ftdi->command_head; |
1347 | if (command_size < COMMAND_SIZE) { | 1347 | if (command_size < COMMAND_SIZE) { |
1348 | struct u132_command *command = &ftdi->command[ | 1348 | struct u132_command *command = &ftdi->command[ |
@@ -1356,10 +1356,10 @@ static int ftdi_elan_write_pcimem(struct usb_ftdi *ftdi, int mem_offset, | |||
1356 | command->buffer = &command->value; | 1356 | command->buffer = &command->value; |
1357 | ftdi->command_next += 1; | 1357 | ftdi->command_next += 1; |
1358 | ftdi_elan_kick_command_queue(ftdi); | 1358 | ftdi_elan_kick_command_queue(ftdi); |
1359 | up(&ftdi->u132_lock); | 1359 | mutex_unlock(&ftdi->u132_lock); |
1360 | return 0; | 1360 | return 0; |
1361 | } else { | 1361 | } else { |
1362 | up(&ftdi->u132_lock); | 1362 | mutex_unlock(&ftdi->u132_lock); |
1363 | msleep(100); | 1363 | msleep(100); |
1364 | goto wait; | 1364 | goto wait; |
1365 | } | 1365 | } |
@@ -1382,7 +1382,7 @@ static int ftdi_elan_read_reg(struct usb_ftdi *ftdi, u32 *data) | |||
1382 | } else { | 1382 | } else { |
1383 | int command_size; | 1383 | int command_size; |
1384 | int respond_size; | 1384 | int respond_size; |
1385 | down(&ftdi->u132_lock); | 1385 | mutex_lock(&ftdi->u132_lock); |
1386 | command_size = ftdi->command_next - ftdi->command_head; | 1386 | command_size = ftdi->command_next - ftdi->command_head; |
1387 | respond_size = ftdi->respond_next - ftdi->respond_head; | 1387 | respond_size = ftdi->respond_next - ftdi->respond_head; |
1388 | if (command_size < COMMAND_SIZE && respond_size < RESPOND_SIZE) | 1388 | if (command_size < COMMAND_SIZE && respond_size < RESPOND_SIZE) |
@@ -1405,11 +1405,11 @@ static int ftdi_elan_read_reg(struct usb_ftdi *ftdi, u32 *data) | |||
1405 | ftdi->command_next += 1; | 1405 | ftdi->command_next += 1; |
1406 | ftdi->respond_next += 1; | 1406 | ftdi->respond_next += 1; |
1407 | ftdi_elan_kick_command_queue(ftdi); | 1407 | ftdi_elan_kick_command_queue(ftdi); |
1408 | up(&ftdi->u132_lock); | 1408 | mutex_unlock(&ftdi->u132_lock); |
1409 | wait_for_completion(&respond->wait_completion); | 1409 | wait_for_completion(&respond->wait_completion); |
1410 | return result; | 1410 | return result; |
1411 | } else { | 1411 | } else { |
1412 | up(&ftdi->u132_lock); | 1412 | mutex_unlock(&ftdi->u132_lock); |
1413 | msleep(100); | 1413 | msleep(100); |
1414 | goto wait; | 1414 | goto wait; |
1415 | } | 1415 | } |
@@ -1425,7 +1425,7 @@ static int ftdi_elan_read_config(struct usb_ftdi *ftdi, int config_offset, | |||
1425 | } else { | 1425 | } else { |
1426 | int command_size; | 1426 | int command_size; |
1427 | int respond_size; | 1427 | int respond_size; |
1428 | down(&ftdi->u132_lock); | 1428 | mutex_lock(&ftdi->u132_lock); |
1429 | command_size = ftdi->command_next - ftdi->command_head; | 1429 | command_size = ftdi->command_next - ftdi->command_head; |
1430 | respond_size = ftdi->respond_next - ftdi->respond_head; | 1430 | respond_size = ftdi->respond_next - ftdi->respond_head; |
1431 | if (command_size < COMMAND_SIZE && respond_size < RESPOND_SIZE) | 1431 | if (command_size < COMMAND_SIZE && respond_size < RESPOND_SIZE) |
@@ -1449,11 +1449,11 @@ static int ftdi_elan_read_config(struct usb_ftdi *ftdi, int config_offset, | |||
1449 | ftdi->command_next += 1; | 1449 | ftdi->command_next += 1; |
1450 | ftdi->respond_next += 1; | 1450 | ftdi->respond_next += 1; |
1451 | ftdi_elan_kick_command_queue(ftdi); | 1451 | ftdi_elan_kick_command_queue(ftdi); |
1452 | up(&ftdi->u132_lock); | 1452 | mutex_unlock(&ftdi->u132_lock); |
1453 | wait_for_completion(&respond->wait_completion); | 1453 | wait_for_completion(&respond->wait_completion); |
1454 | return result; | 1454 | return result; |
1455 | } else { | 1455 | } else { |
1456 | up(&ftdi->u132_lock); | 1456 | mutex_unlock(&ftdi->u132_lock); |
1457 | msleep(100); | 1457 | msleep(100); |
1458 | goto wait; | 1458 | goto wait; |
1459 | } | 1459 | } |
@@ -1469,7 +1469,7 @@ static int ftdi_elan_read_pcimem(struct usb_ftdi *ftdi, int mem_offset, | |||
1469 | } else { | 1469 | } else { |
1470 | int command_size; | 1470 | int command_size; |
1471 | int respond_size; | 1471 | int respond_size; |
1472 | down(&ftdi->u132_lock); | 1472 | mutex_lock(&ftdi->u132_lock); |
1473 | command_size = ftdi->command_next - ftdi->command_head; | 1473 | command_size = ftdi->command_next - ftdi->command_head; |
1474 | respond_size = ftdi->respond_next - ftdi->respond_head; | 1474 | respond_size = ftdi->respond_next - ftdi->respond_head; |
1475 | if (command_size < COMMAND_SIZE && respond_size < RESPOND_SIZE) | 1475 | if (command_size < COMMAND_SIZE && respond_size < RESPOND_SIZE) |
@@ -1493,11 +1493,11 @@ static int ftdi_elan_read_pcimem(struct usb_ftdi *ftdi, int mem_offset, | |||
1493 | ftdi->command_next += 1; | 1493 | ftdi->command_next += 1; |
1494 | ftdi->respond_next += 1; | 1494 | ftdi->respond_next += 1; |
1495 | ftdi_elan_kick_command_queue(ftdi); | 1495 | ftdi_elan_kick_command_queue(ftdi); |
1496 | up(&ftdi->u132_lock); | 1496 | mutex_unlock(&ftdi->u132_lock); |
1497 | wait_for_completion(&respond->wait_completion); | 1497 | wait_for_completion(&respond->wait_completion); |
1498 | return result; | 1498 | return result; |
1499 | } else { | 1499 | } else { |
1500 | up(&ftdi->u132_lock); | 1500 | mutex_unlock(&ftdi->u132_lock); |
1501 | msleep(100); | 1501 | msleep(100); |
1502 | goto wait; | 1502 | goto wait; |
1503 | } | 1503 | } |
@@ -1529,7 +1529,7 @@ static int ftdi_elan_edset_setup(struct usb_ftdi *ftdi, u8 ed_number, | |||
1529 | return -ENODEV; | 1529 | return -ENODEV; |
1530 | } else { | 1530 | } else { |
1531 | int command_size; | 1531 | int command_size; |
1532 | down(&ftdi->u132_lock); | 1532 | mutex_lock(&ftdi->u132_lock); |
1533 | command_size = ftdi->command_next - ftdi->command_head; | 1533 | command_size = ftdi->command_next - ftdi->command_head; |
1534 | if (command_size < COMMAND_SIZE) { | 1534 | if (command_size < COMMAND_SIZE) { |
1535 | struct u132_target *target = &ftdi->target[ed]; | 1535 | struct u132_target *target = &ftdi->target[ed]; |
@@ -1550,10 +1550,10 @@ static int ftdi_elan_edset_setup(struct usb_ftdi *ftdi, u8 ed_number, | |||
1550 | target->active = 1; | 1550 | target->active = 1; |
1551 | ftdi->command_next += 1; | 1551 | ftdi->command_next += 1; |
1552 | ftdi_elan_kick_command_queue(ftdi); | 1552 | ftdi_elan_kick_command_queue(ftdi); |
1553 | up(&ftdi->u132_lock); | 1553 | mutex_unlock(&ftdi->u132_lock); |
1554 | return 0; | 1554 | return 0; |
1555 | } else { | 1555 | } else { |
1556 | up(&ftdi->u132_lock); | 1556 | mutex_unlock(&ftdi->u132_lock); |
1557 | msleep(100); | 1557 | msleep(100); |
1558 | goto wait; | 1558 | goto wait; |
1559 | } | 1559 | } |
@@ -1586,7 +1586,7 @@ static int ftdi_elan_edset_input(struct usb_ftdi *ftdi, u8 ed_number, | |||
1586 | return -ENODEV; | 1586 | return -ENODEV; |
1587 | } else { | 1587 | } else { |
1588 | int command_size; | 1588 | int command_size; |
1589 | down(&ftdi->u132_lock); | 1589 | mutex_lock(&ftdi->u132_lock); |
1590 | command_size = ftdi->command_next - ftdi->command_head; | 1590 | command_size = ftdi->command_next - ftdi->command_head; |
1591 | if (command_size < COMMAND_SIZE) { | 1591 | if (command_size < COMMAND_SIZE) { |
1592 | struct u132_target *target = &ftdi->target[ed]; | 1592 | struct u132_target *target = &ftdi->target[ed]; |
@@ -1615,10 +1615,10 @@ static int ftdi_elan_edset_input(struct usb_ftdi *ftdi, u8 ed_number, | |||
1615 | target->active = 1; | 1615 | target->active = 1; |
1616 | ftdi->command_next += 1; | 1616 | ftdi->command_next += 1; |
1617 | ftdi_elan_kick_command_queue(ftdi); | 1617 | ftdi_elan_kick_command_queue(ftdi); |
1618 | up(&ftdi->u132_lock); | 1618 | mutex_unlock(&ftdi->u132_lock); |
1619 | return 0; | 1619 | return 0; |
1620 | } else { | 1620 | } else { |
1621 | up(&ftdi->u132_lock); | 1621 | mutex_unlock(&ftdi->u132_lock); |
1622 | msleep(100); | 1622 | msleep(100); |
1623 | goto wait; | 1623 | goto wait; |
1624 | } | 1624 | } |
@@ -1651,7 +1651,7 @@ static int ftdi_elan_edset_empty(struct usb_ftdi *ftdi, u8 ed_number, | |||
1651 | return -ENODEV; | 1651 | return -ENODEV; |
1652 | } else { | 1652 | } else { |
1653 | int command_size; | 1653 | int command_size; |
1654 | down(&ftdi->u132_lock); | 1654 | mutex_lock(&ftdi->u132_lock); |
1655 | command_size = ftdi->command_next - ftdi->command_head; | 1655 | command_size = ftdi->command_next - ftdi->command_head; |
1656 | if (command_size < COMMAND_SIZE) { | 1656 | if (command_size < COMMAND_SIZE) { |
1657 | struct u132_target *target = &ftdi->target[ed]; | 1657 | struct u132_target *target = &ftdi->target[ed]; |
@@ -1672,10 +1672,10 @@ static int ftdi_elan_edset_empty(struct usb_ftdi *ftdi, u8 ed_number, | |||
1672 | target->active = 1; | 1672 | target->active = 1; |
1673 | ftdi->command_next += 1; | 1673 | ftdi->command_next += 1; |
1674 | ftdi_elan_kick_command_queue(ftdi); | 1674 | ftdi_elan_kick_command_queue(ftdi); |
1675 | up(&ftdi->u132_lock); | 1675 | mutex_unlock(&ftdi->u132_lock); |
1676 | return 0; | 1676 | return 0; |
1677 | } else { | 1677 | } else { |
1678 | up(&ftdi->u132_lock); | 1678 | mutex_unlock(&ftdi->u132_lock); |
1679 | msleep(100); | 1679 | msleep(100); |
1680 | goto wait; | 1680 | goto wait; |
1681 | } | 1681 | } |
@@ -1708,7 +1708,7 @@ static int ftdi_elan_edset_output(struct usb_ftdi *ftdi, u8 ed_number, | |||
1708 | return -ENODEV; | 1708 | return -ENODEV; |
1709 | } else { | 1709 | } else { |
1710 | int command_size; | 1710 | int command_size; |
1711 | down(&ftdi->u132_lock); | 1711 | mutex_lock(&ftdi->u132_lock); |
1712 | command_size = ftdi->command_next - ftdi->command_head; | 1712 | command_size = ftdi->command_next - ftdi->command_head; |
1713 | if (command_size < COMMAND_SIZE) { | 1713 | if (command_size < COMMAND_SIZE) { |
1714 | u8 *b; | 1714 | u8 *b; |
@@ -1751,10 +1751,10 @@ static int ftdi_elan_edset_output(struct usb_ftdi *ftdi, u8 ed_number, | |||
1751 | target->active = 1; | 1751 | target->active = 1; |
1752 | ftdi->command_next += 1; | 1752 | ftdi->command_next += 1; |
1753 | ftdi_elan_kick_command_queue(ftdi); | 1753 | ftdi_elan_kick_command_queue(ftdi); |
1754 | up(&ftdi->u132_lock); | 1754 | mutex_unlock(&ftdi->u132_lock); |
1755 | return 0; | 1755 | return 0; |
1756 | } else { | 1756 | } else { |
1757 | up(&ftdi->u132_lock); | 1757 | mutex_unlock(&ftdi->u132_lock); |
1758 | msleep(100); | 1758 | msleep(100); |
1759 | goto wait; | 1759 | goto wait; |
1760 | } | 1760 | } |
@@ -1787,7 +1787,7 @@ static int ftdi_elan_edset_single(struct usb_ftdi *ftdi, u8 ed_number, | |||
1787 | return -ENODEV; | 1787 | return -ENODEV; |
1788 | } else { | 1788 | } else { |
1789 | int command_size; | 1789 | int command_size; |
1790 | down(&ftdi->u132_lock); | 1790 | mutex_lock(&ftdi->u132_lock); |
1791 | command_size = ftdi->command_next - ftdi->command_head; | 1791 | command_size = ftdi->command_next - ftdi->command_head; |
1792 | if (command_size < COMMAND_SIZE) { | 1792 | if (command_size < COMMAND_SIZE) { |
1793 | int remaining_length = urb->transfer_buffer_length - | 1793 | int remaining_length = urb->transfer_buffer_length - |
@@ -1816,10 +1816,10 @@ static int ftdi_elan_edset_single(struct usb_ftdi *ftdi, u8 ed_number, | |||
1816 | target->active = 1; | 1816 | target->active = 1; |
1817 | ftdi->command_next += 1; | 1817 | ftdi->command_next += 1; |
1818 | ftdi_elan_kick_command_queue(ftdi); | 1818 | ftdi_elan_kick_command_queue(ftdi); |
1819 | up(&ftdi->u132_lock); | 1819 | mutex_unlock(&ftdi->u132_lock); |
1820 | return 0; | 1820 | return 0; |
1821 | } else { | 1821 | } else { |
1822 | up(&ftdi->u132_lock); | 1822 | mutex_unlock(&ftdi->u132_lock); |
1823 | msleep(100); | 1823 | msleep(100); |
1824 | goto wait; | 1824 | goto wait; |
1825 | } | 1825 | } |
@@ -1849,9 +1849,9 @@ static int ftdi_elan_edset_flush(struct usb_ftdi *ftdi, u8 ed_number, | |||
1849 | return -ENODEV; | 1849 | return -ENODEV; |
1850 | } else { | 1850 | } else { |
1851 | struct u132_target *target = &ftdi->target[ed]; | 1851 | struct u132_target *target = &ftdi->target[ed]; |
1852 | down(&ftdi->u132_lock); | 1852 | mutex_lock(&ftdi->u132_lock); |
1853 | if (target->abandoning > 0) { | 1853 | if (target->abandoning > 0) { |
1854 | up(&ftdi->u132_lock); | 1854 | mutex_unlock(&ftdi->u132_lock); |
1855 | return 0; | 1855 | return 0; |
1856 | } else { | 1856 | } else { |
1857 | target->abandoning = 1; | 1857 | target->abandoning = 1; |
@@ -1873,13 +1873,13 @@ static int ftdi_elan_edset_flush(struct usb_ftdi *ftdi, u8 ed_number, | |||
1873 | ftdi->command_next += 1; | 1873 | ftdi->command_next += 1; |
1874 | ftdi_elan_kick_command_queue(ftdi); | 1874 | ftdi_elan_kick_command_queue(ftdi); |
1875 | } else { | 1875 | } else { |
1876 | up(&ftdi->u132_lock); | 1876 | mutex_unlock(&ftdi->u132_lock); |
1877 | msleep(100); | 1877 | msleep(100); |
1878 | down(&ftdi->u132_lock); | 1878 | mutex_lock(&ftdi->u132_lock); |
1879 | goto wait_1; | 1879 | goto wait_1; |
1880 | } | 1880 | } |
1881 | } | 1881 | } |
1882 | up(&ftdi->u132_lock); | 1882 | mutex_unlock(&ftdi->u132_lock); |
1883 | return 0; | 1883 | return 0; |
1884 | } | 1884 | } |
1885 | } | 1885 | } |
@@ -2793,7 +2793,7 @@ static int ftdi_elan_probe(struct usb_interface *interface, | |||
2793 | init_MUTEX(&ftdi->sw_lock); | 2793 | init_MUTEX(&ftdi->sw_lock); |
2794 | ftdi->udev = usb_get_dev(interface_to_usbdev(interface)); | 2794 | ftdi->udev = usb_get_dev(interface_to_usbdev(interface)); |
2795 | ftdi->interface = interface; | 2795 | ftdi->interface = interface; |
2796 | init_MUTEX(&ftdi->u132_lock); | 2796 | mutex_init(&ftdi->u132_lock); |
2797 | ftdi->expected = 4; | 2797 | ftdi->expected = 4; |
2798 | iface_desc = interface->cur_altsetting; | 2798 | iface_desc = interface->cur_altsetting; |
2799 | for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) { | 2799 | for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) { |
diff --git a/drivers/usb/misc/idmouse.c b/drivers/usb/misc/idmouse.c index e6fd024024f5..4bcf7fb4e5da 100644 --- a/drivers/usb/misc/idmouse.c +++ b/drivers/usb/misc/idmouse.c | |||
@@ -66,6 +66,7 @@ static struct usb_device_id idmouse_table[] = { | |||
66 | USB_TYPE_VENDOR | USB_RECIP_ENDPOINT | USB_DIR_OUT, value, index, NULL, 0, 1000) | 66 | USB_TYPE_VENDOR | USB_RECIP_ENDPOINT | USB_DIR_OUT, value, index, NULL, 0, 1000) |
67 | 67 | ||
68 | MODULE_DEVICE_TABLE(usb, idmouse_table); | 68 | MODULE_DEVICE_TABLE(usb, idmouse_table); |
69 | static DEFINE_MUTEX(open_disc_mutex); | ||
69 | 70 | ||
70 | /* structure to hold all of our device specific stuff */ | 71 | /* structure to hold all of our device specific stuff */ |
71 | struct usb_idmouse { | 72 | struct usb_idmouse { |
@@ -80,7 +81,7 @@ struct usb_idmouse { | |||
80 | 81 | ||
81 | int open; /* if the port is open or not */ | 82 | int open; /* if the port is open or not */ |
82 | int present; /* if the device is not disconnected */ | 83 | int present; /* if the device is not disconnected */ |
83 | struct semaphore sem; /* locks this structure */ | 84 | struct mutex lock; /* locks this structure */ |
84 | 85 | ||
85 | }; | 86 | }; |
86 | 87 | ||
@@ -213,13 +214,17 @@ static int idmouse_open(struct inode *inode, struct file *file) | |||
213 | if (!interface) | 214 | if (!interface) |
214 | return -ENODEV; | 215 | return -ENODEV; |
215 | 216 | ||
217 | mutex_lock(&open_disc_mutex); | ||
216 | /* get the device information block from the interface */ | 218 | /* get the device information block from the interface */ |
217 | dev = usb_get_intfdata(interface); | 219 | dev = usb_get_intfdata(interface); |
218 | if (!dev) | 220 | if (!dev) { |
221 | mutex_unlock(&open_disc_mutex); | ||
219 | return -ENODEV; | 222 | return -ENODEV; |
223 | } | ||
220 | 224 | ||
221 | /* lock this device */ | 225 | /* lock this device */ |
222 | down(&dev->sem); | 226 | mutex_lock(&dev->lock); |
227 | mutex_unlock(&open_disc_mutex); | ||
223 | 228 | ||
224 | /* check if already open */ | 229 | /* check if already open */ |
225 | if (dev->open) { | 230 | if (dev->open) { |
@@ -245,7 +250,7 @@ static int idmouse_open(struct inode *inode, struct file *file) | |||
245 | error: | 250 | error: |
246 | 251 | ||
247 | /* unlock this device */ | 252 | /* unlock this device */ |
248 | up(&dev->sem); | 253 | mutex_unlock(&dev->lock); |
249 | return result; | 254 | return result; |
250 | } | 255 | } |
251 | 256 | ||
@@ -258,12 +263,14 @@ static int idmouse_release(struct inode *inode, struct file *file) | |||
258 | if (dev == NULL) | 263 | if (dev == NULL) |
259 | return -ENODEV; | 264 | return -ENODEV; |
260 | 265 | ||
266 | mutex_lock(&open_disc_mutex); | ||
261 | /* lock our device */ | 267 | /* lock our device */ |
262 | down(&dev->sem); | 268 | mutex_lock(&dev->lock); |
263 | 269 | ||
264 | /* are we really open? */ | 270 | /* are we really open? */ |
265 | if (dev->open <= 0) { | 271 | if (dev->open <= 0) { |
266 | up(&dev->sem); | 272 | mutex_unlock(&dev->lock); |
273 | mutex_unlock(&open_disc_mutex); | ||
267 | return -ENODEV; | 274 | return -ENODEV; |
268 | } | 275 | } |
269 | 276 | ||
@@ -271,10 +278,12 @@ static int idmouse_release(struct inode *inode, struct file *file) | |||
271 | 278 | ||
272 | if (!dev->present) { | 279 | if (!dev->present) { |
273 | /* the device was unplugged before the file was released */ | 280 | /* the device was unplugged before the file was released */ |
274 | up(&dev->sem); | 281 | mutex_unlock(&dev->lock); |
282 | mutex_unlock(&open_disc_mutex); | ||
275 | idmouse_delete(dev); | 283 | idmouse_delete(dev); |
276 | } else { | 284 | } else { |
277 | up(&dev->sem); | 285 | mutex_unlock(&dev->lock); |
286 | mutex_unlock(&open_disc_mutex); | ||
278 | } | 287 | } |
279 | return 0; | 288 | return 0; |
280 | } | 289 | } |
@@ -286,18 +295,18 @@ static ssize_t idmouse_read(struct file *file, char __user *buffer, size_t count | |||
286 | int result; | 295 | int result; |
287 | 296 | ||
288 | /* lock this object */ | 297 | /* lock this object */ |
289 | down(&dev->sem); | 298 | mutex_lock(&dev->lock); |
290 | 299 | ||
291 | /* verify that the device wasn't unplugged */ | 300 | /* verify that the device wasn't unplugged */ |
292 | if (!dev->present) { | 301 | if (!dev->present) { |
293 | up(&dev->sem); | 302 | mutex_unlock(&dev->lock); |
294 | return -ENODEV; | 303 | return -ENODEV; |
295 | } | 304 | } |
296 | 305 | ||
297 | result = simple_read_from_buffer(buffer, count, ppos, | 306 | result = simple_read_from_buffer(buffer, count, ppos, |
298 | dev->bulk_in_buffer, IMGSIZE); | 307 | dev->bulk_in_buffer, IMGSIZE); |
299 | /* unlock the device */ | 308 | /* unlock the device */ |
300 | up(&dev->sem); | 309 | mutex_unlock(&dev->lock); |
301 | return result; | 310 | return result; |
302 | } | 311 | } |
303 | 312 | ||
@@ -320,7 +329,7 @@ static int idmouse_probe(struct usb_interface *interface, | |||
320 | if (dev == NULL) | 329 | if (dev == NULL) |
321 | return -ENOMEM; | 330 | return -ENOMEM; |
322 | 331 | ||
323 | init_MUTEX(&dev->sem); | 332 | mutex_init(&dev->lock); |
324 | dev->udev = udev; | 333 | dev->udev = udev; |
325 | dev->interface = interface; | 334 | dev->interface = interface; |
326 | 335 | ||
@@ -372,24 +381,26 @@ static void idmouse_disconnect(struct usb_interface *interface) | |||
372 | 381 | ||
373 | /* get device structure */ | 382 | /* get device structure */ |
374 | dev = usb_get_intfdata(interface); | 383 | dev = usb_get_intfdata(interface); |
375 | usb_set_intfdata(interface, NULL); | ||
376 | 384 | ||
377 | /* give back our minor */ | 385 | /* give back our minor */ |
378 | usb_deregister_dev(interface, &idmouse_class); | 386 | usb_deregister_dev(interface, &idmouse_class); |
379 | 387 | ||
380 | /* lock it */ | 388 | mutex_lock(&open_disc_mutex); |
381 | down(&dev->sem); | 389 | usb_set_intfdata(interface, NULL); |
390 | /* lock the device */ | ||
391 | mutex_lock(&dev->lock); | ||
392 | mutex_unlock(&open_disc_mutex); | ||
382 | 393 | ||
383 | /* prevent device read, write and ioctl */ | 394 | /* prevent device read, write and ioctl */ |
384 | dev->present = 0; | 395 | dev->present = 0; |
385 | 396 | ||
386 | /* if the device is opened, idmouse_release will clean this up */ | 397 | /* if the device is opened, idmouse_release will clean this up */ |
387 | if (!dev->open) { | 398 | if (!dev->open) { |
388 | up(&dev->sem); | 399 | mutex_unlock(&dev->lock); |
389 | idmouse_delete(dev); | 400 | idmouse_delete(dev); |
390 | } else { | 401 | } else { |
391 | /* unlock */ | 402 | /* unlock */ |
392 | up(&dev->sem); | 403 | mutex_unlock(&dev->lock); |
393 | } | 404 | } |
394 | 405 | ||
395 | info("%s disconnected", DRIVER_DESC); | 406 | info("%s disconnected", DRIVER_DESC); |
diff --git a/drivers/usb/misc/iowarrior.c b/drivers/usb/misc/iowarrior.c index d372fbc4effb..764696ff1e8e 100644 --- a/drivers/usb/misc/iowarrior.c +++ b/drivers/usb/misc/iowarrior.c | |||
@@ -66,6 +66,7 @@ module_param(debug, bool, 0644); | |||
66 | MODULE_PARM_DESC(debug, "debug=1 enables debugging messages"); | 66 | MODULE_PARM_DESC(debug, "debug=1 enables debugging messages"); |
67 | 67 | ||
68 | static struct usb_driver iowarrior_driver; | 68 | static struct usb_driver iowarrior_driver; |
69 | static DEFINE_MUTEX(iowarrior_open_disc_lock); | ||
69 | 70 | ||
70 | /*--------------*/ | 71 | /*--------------*/ |
71 | /* data */ | 72 | /* data */ |
@@ -351,7 +352,7 @@ static ssize_t iowarrior_write(struct file *file, | |||
351 | 352 | ||
352 | mutex_lock(&dev->mutex); | 353 | mutex_lock(&dev->mutex); |
353 | /* verify that the device wasn't unplugged */ | 354 | /* verify that the device wasn't unplugged */ |
354 | if (dev == NULL || !dev->present) { | 355 | if (!dev->present) { |
355 | retval = -ENODEV; | 356 | retval = -ENODEV; |
356 | goto exit; | 357 | goto exit; |
357 | } | 358 | } |
@@ -608,11 +609,15 @@ static int iowarrior_open(struct inode *inode, struct file *file) | |||
608 | return -ENODEV; | 609 | return -ENODEV; |
609 | } | 610 | } |
610 | 611 | ||
612 | mutex_lock(&iowarrior_open_disc_lock); | ||
611 | dev = usb_get_intfdata(interface); | 613 | dev = usb_get_intfdata(interface); |
612 | if (!dev) | 614 | if (!dev) { |
615 | mutex_unlock(&iowarrior_open_disc_lock); | ||
613 | return -ENODEV; | 616 | return -ENODEV; |
617 | } | ||
614 | 618 | ||
615 | mutex_lock(&dev->mutex); | 619 | mutex_lock(&dev->mutex); |
620 | mutex_unlock(&iowarrior_open_disc_lock); | ||
616 | 621 | ||
617 | /* Only one process can open each device, no sharing. */ | 622 | /* Only one process can open each device, no sharing. */ |
618 | if (dev->opened) { | 623 | if (dev->opened) { |
@@ -866,6 +871,7 @@ static void iowarrior_disconnect(struct usb_interface *interface) | |||
866 | int minor; | 871 | int minor; |
867 | 872 | ||
868 | dev = usb_get_intfdata(interface); | 873 | dev = usb_get_intfdata(interface); |
874 | mutex_lock(&iowarrior_open_disc_lock); | ||
869 | usb_set_intfdata(interface, NULL); | 875 | usb_set_intfdata(interface, NULL); |
870 | 876 | ||
871 | minor = dev->minor; | 877 | minor = dev->minor; |
@@ -879,6 +885,7 @@ static void iowarrior_disconnect(struct usb_interface *interface) | |||
879 | dev->present = 0; | 885 | dev->present = 0; |
880 | 886 | ||
881 | mutex_unlock(&dev->mutex); | 887 | mutex_unlock(&dev->mutex); |
888 | mutex_unlock(&iowarrior_open_disc_lock); | ||
882 | 889 | ||
883 | if (dev->opened) { | 890 | if (dev->opened) { |
884 | /* There is a process that holds a filedescriptor to the device , | 891 | /* There is a process that holds a filedescriptor to the device , |
diff --git a/drivers/usb/misc/legousbtower.c b/drivers/usb/misc/legousbtower.c index 561970b889a5..aab320085ebf 100644 --- a/drivers/usb/misc/legousbtower.c +++ b/drivers/usb/misc/legousbtower.c | |||
@@ -198,6 +198,7 @@ static struct usb_device_id tower_table [] = { | |||
198 | }; | 198 | }; |
199 | 199 | ||
200 | MODULE_DEVICE_TABLE (usb, tower_table); | 200 | MODULE_DEVICE_TABLE (usb, tower_table); |
201 | static DEFINE_MUTEX(open_disc_mutex); | ||
201 | 202 | ||
202 | #define LEGO_USB_TOWER_MINOR_BASE 160 | 203 | #define LEGO_USB_TOWER_MINOR_BASE 160 |
203 | 204 | ||
@@ -350,25 +351,31 @@ static int tower_open (struct inode *inode, struct file *file) | |||
350 | goto exit; | 351 | goto exit; |
351 | } | 352 | } |
352 | 353 | ||
354 | mutex_lock(&open_disc_mutex); | ||
353 | dev = usb_get_intfdata(interface); | 355 | dev = usb_get_intfdata(interface); |
354 | 356 | ||
355 | if (!dev) { | 357 | if (!dev) { |
358 | mutex_unlock(&open_disc_mutex); | ||
356 | retval = -ENODEV; | 359 | retval = -ENODEV; |
357 | goto exit; | 360 | goto exit; |
358 | } | 361 | } |
359 | 362 | ||
360 | /* lock this device */ | 363 | /* lock this device */ |
361 | if (down_interruptible (&dev->sem)) { | 364 | if (down_interruptible (&dev->sem)) { |
365 | mutex_unlock(&open_disc_mutex); | ||
362 | retval = -ERESTARTSYS; | 366 | retval = -ERESTARTSYS; |
363 | goto exit; | 367 | goto exit; |
364 | } | 368 | } |
365 | 369 | ||
370 | |||
366 | /* allow opening only once */ | 371 | /* allow opening only once */ |
367 | if (dev->open_count) { | 372 | if (dev->open_count) { |
373 | mutex_unlock(&open_disc_mutex); | ||
368 | retval = -EBUSY; | 374 | retval = -EBUSY; |
369 | goto unlock_exit; | 375 | goto unlock_exit; |
370 | } | 376 | } |
371 | dev->open_count = 1; | 377 | dev->open_count = 1; |
378 | mutex_unlock(&open_disc_mutex); | ||
372 | 379 | ||
373 | /* reset the tower */ | 380 | /* reset the tower */ |
374 | result = usb_control_msg (dev->udev, | 381 | result = usb_control_msg (dev->udev, |
@@ -437,9 +444,10 @@ static int tower_release (struct inode *inode, struct file *file) | |||
437 | if (dev == NULL) { | 444 | if (dev == NULL) { |
438 | dbg(1, "%s: object is NULL", __FUNCTION__); | 445 | dbg(1, "%s: object is NULL", __FUNCTION__); |
439 | retval = -ENODEV; | 446 | retval = -ENODEV; |
440 | goto exit; | 447 | goto exit_nolock; |
441 | } | 448 | } |
442 | 449 | ||
450 | mutex_lock(&open_disc_mutex); | ||
443 | if (down_interruptible (&dev->sem)) { | 451 | if (down_interruptible (&dev->sem)) { |
444 | retval = -ERESTARTSYS; | 452 | retval = -ERESTARTSYS; |
445 | goto exit; | 453 | goto exit; |
@@ -468,6 +476,8 @@ unlock_exit: | |||
468 | up (&dev->sem); | 476 | up (&dev->sem); |
469 | 477 | ||
470 | exit: | 478 | exit: |
479 | mutex_unlock(&open_disc_mutex); | ||
480 | exit_nolock: | ||
471 | dbg(2, "%s: leave, return value %d", __FUNCTION__, retval); | 481 | dbg(2, "%s: leave, return value %d", __FUNCTION__, retval); |
472 | return retval; | 482 | return retval; |
473 | } | 483 | } |
@@ -989,6 +999,7 @@ static void tower_disconnect (struct usb_interface *interface) | |||
989 | dbg(2, "%s: enter", __FUNCTION__); | 999 | dbg(2, "%s: enter", __FUNCTION__); |
990 | 1000 | ||
991 | dev = usb_get_intfdata (interface); | 1001 | dev = usb_get_intfdata (interface); |
1002 | mutex_lock(&open_disc_mutex); | ||
992 | usb_set_intfdata (interface, NULL); | 1003 | usb_set_intfdata (interface, NULL); |
993 | 1004 | ||
994 | minor = dev->minor; | 1005 | minor = dev->minor; |
@@ -997,6 +1008,7 @@ static void tower_disconnect (struct usb_interface *interface) | |||
997 | usb_deregister_dev (interface, &tower_class); | 1008 | usb_deregister_dev (interface, &tower_class); |
998 | 1009 | ||
999 | down (&dev->sem); | 1010 | down (&dev->sem); |
1011 | mutex_unlock(&open_disc_mutex); | ||
1000 | 1012 | ||
1001 | /* if the device is not opened, then we clean up right now */ | 1013 | /* if the device is not opened, then we clean up right now */ |
1002 | if (!dev->open_count) { | 1014 | if (!dev->open_count) { |
diff --git a/drivers/usb/misc/rio500.c b/drivers/usb/misc/rio500.c index 88f6abe73624..330c18e390b8 100644 --- a/drivers/usb/misc/rio500.c +++ b/drivers/usb/misc/rio500.c | |||
@@ -118,10 +118,7 @@ ioctl_rio(struct inode *inode, struct file *file, unsigned int cmd, | |||
118 | 118 | ||
119 | mutex_lock(&(rio->lock)); | 119 | mutex_lock(&(rio->lock)); |
120 | /* Sanity check to make sure rio is connected, powered, etc */ | 120 | /* Sanity check to make sure rio is connected, powered, etc */ |
121 | if ( rio == NULL || | 121 | if (rio->present == 0 || rio->rio_dev == NULL) { |
122 | rio->present == 0 || | ||
123 | rio->rio_dev == NULL ) | ||
124 | { | ||
125 | retval = -ENODEV; | 122 | retval = -ENODEV; |
126 | goto err_out; | 123 | goto err_out; |
127 | } | 124 | } |
@@ -280,10 +277,7 @@ write_rio(struct file *file, const char __user *buffer, | |||
280 | if (intr) | 277 | if (intr) |
281 | return -EINTR; | 278 | return -EINTR; |
282 | /* Sanity check to make sure rio is connected, powered, etc */ | 279 | /* Sanity check to make sure rio is connected, powered, etc */ |
283 | if ( rio == NULL || | 280 | if (rio->present == 0 || rio->rio_dev == NULL) { |
284 | rio->present == 0 || | ||
285 | rio->rio_dev == NULL ) | ||
286 | { | ||
287 | mutex_unlock(&(rio->lock)); | 281 | mutex_unlock(&(rio->lock)); |
288 | return -ENODEV; | 282 | return -ENODEV; |
289 | } | 283 | } |
@@ -369,10 +363,7 @@ read_rio(struct file *file, char __user *buffer, size_t count, loff_t * ppos) | |||
369 | if (intr) | 363 | if (intr) |
370 | return -EINTR; | 364 | return -EINTR; |
371 | /* Sanity check to make sure rio is connected, powered, etc */ | 365 | /* Sanity check to make sure rio is connected, powered, etc */ |
372 | if ( rio == NULL || | 366 | if (rio->present == 0 || rio->rio_dev == NULL) { |
373 | rio->present == 0 || | ||
374 | rio->rio_dev == NULL ) | ||
375 | { | ||
376 | mutex_unlock(&(rio->lock)); | 367 | mutex_unlock(&(rio->lock)); |
377 | return -ENODEV; | 368 | return -ENODEV; |
378 | } | 369 | } |
diff --git a/drivers/usb/misc/usblcd.c b/drivers/usb/misc/usblcd.c index 719842032712..20777d01db62 100644 --- a/drivers/usb/misc/usblcd.c +++ b/drivers/usb/misc/usblcd.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/init.h> | 17 | #include <linux/init.h> |
18 | #include <linux/slab.h> | 18 | #include <linux/slab.h> |
19 | #include <linux/errno.h> | 19 | #include <linux/errno.h> |
20 | #include <linux/mutex.h> | ||
20 | #include <asm/uaccess.h> | 21 | #include <asm/uaccess.h> |
21 | #include <linux/usb.h> | 22 | #include <linux/usb.h> |
22 | 23 | ||
@@ -34,6 +35,8 @@ static struct usb_device_id id_table [] = { | |||
34 | }; | 35 | }; |
35 | MODULE_DEVICE_TABLE (usb, id_table); | 36 | MODULE_DEVICE_TABLE (usb, id_table); |
36 | 37 | ||
38 | static DEFINE_MUTEX(open_disc_mutex); | ||
39 | |||
37 | 40 | ||
38 | struct usb_lcd { | 41 | struct usb_lcd { |
39 | struct usb_device * udev; /* init: probe_lcd */ | 42 | struct usb_device * udev; /* init: probe_lcd */ |
@@ -79,12 +82,16 @@ static int lcd_open(struct inode *inode, struct file *file) | |||
79 | return -ENODEV; | 82 | return -ENODEV; |
80 | } | 83 | } |
81 | 84 | ||
85 | mutex_lock(&open_disc_mutex); | ||
82 | dev = usb_get_intfdata(interface); | 86 | dev = usb_get_intfdata(interface); |
83 | if (!dev) | 87 | if (!dev) { |
88 | mutex_unlock(&open_disc_mutex); | ||
84 | return -ENODEV; | 89 | return -ENODEV; |
90 | } | ||
85 | 91 | ||
86 | /* increment our usage count for the device */ | 92 | /* increment our usage count for the device */ |
87 | kref_get(&dev->kref); | 93 | kref_get(&dev->kref); |
94 | mutex_unlock(&open_disc_mutex); | ||
88 | 95 | ||
89 | /* grab a power reference */ | 96 | /* grab a power reference */ |
90 | r = usb_autopm_get_interface(interface); | 97 | r = usb_autopm_get_interface(interface); |
@@ -393,8 +400,10 @@ static void lcd_disconnect(struct usb_interface *interface) | |||
393 | struct usb_lcd *dev; | 400 | struct usb_lcd *dev; |
394 | int minor = interface->minor; | 401 | int minor = interface->minor; |
395 | 402 | ||
403 | mutex_lock(&open_disc_mutex); | ||
396 | dev = usb_get_intfdata(interface); | 404 | dev = usb_get_intfdata(interface); |
397 | usb_set_intfdata(interface, NULL); | 405 | usb_set_intfdata(interface, NULL); |
406 | mutex_unlock(&open_disc_mutex); | ||
398 | 407 | ||
399 | /* give back our minor */ | 408 | /* give back our minor */ |
400 | usb_deregister_dev(interface, &lcd_class); | 409 | usb_deregister_dev(interface, &lcd_class); |
diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c index 2a8e537cb046..ddfee918000d 100644 --- a/drivers/usb/serial/ark3116.c +++ b/drivers/usb/serial/ark3116.c | |||
@@ -161,7 +161,8 @@ static void ark3116_set_termios(struct usb_serial_port *port, | |||
161 | { | 161 | { |
162 | struct usb_serial *serial = port->serial; | 162 | struct usb_serial *serial = port->serial; |
163 | struct ark3116_private *priv = usb_get_serial_port_data(port); | 163 | struct ark3116_private *priv = usb_get_serial_port_data(port); |
164 | unsigned int cflag = port->tty->termios->c_cflag; | 164 | struct ktermios *termios = port->tty->termios; |
165 | unsigned int cflag = termios->c_cflag; | ||
165 | unsigned long flags; | 166 | unsigned long flags; |
166 | int baud; | 167 | int baud; |
167 | int ark3116_baud; | 168 | int ark3116_baud; |
@@ -177,11 +178,14 @@ static void ark3116_set_termios(struct usb_serial_port *port, | |||
177 | *(port->tty->termios) = tty_std_termios; | 178 | *(port->tty->termios) = tty_std_termios; |
178 | port->tty->termios->c_cflag = B9600 | CS8 | 179 | port->tty->termios->c_cflag = B9600 | CS8 |
179 | | CREAD | HUPCL | CLOCAL; | 180 | | CREAD | HUPCL | CLOCAL; |
181 | termios->c_ispeed = 9600; | ||
182 | termios->c_ospeed = 9600; | ||
180 | priv->termios_initialized = 1; | 183 | priv->termios_initialized = 1; |
181 | } | 184 | } |
182 | spin_unlock_irqrestore(&priv->lock, flags); | 185 | spin_unlock_irqrestore(&priv->lock, flags); |
183 | 186 | ||
184 | cflag = port->tty->termios->c_cflag; | 187 | cflag = termios->c_cflag; |
188 | termios->c_cflag &= ~(CMSPAR|CRTSCTS); | ||
185 | 189 | ||
186 | buf = kmalloc(1, GFP_KERNEL); | 190 | buf = kmalloc(1, GFP_KERNEL); |
187 | if (!buf) { | 191 | if (!buf) { |
@@ -254,9 +258,13 @@ static void ark3116_set_termios(struct usb_serial_port *port, | |||
254 | case 115200: | 258 | case 115200: |
255 | case 230400: | 259 | case 230400: |
256 | case 460800: | 260 | case 460800: |
261 | /* Report the resulting rate back to the caller */ | ||
262 | tty_encode_baud_rate(port->tty, baud, baud); | ||
257 | break; | 263 | break; |
258 | /* set 9600 as default (if given baudrate is invalid for example) */ | 264 | /* set 9600 as default (if given baudrate is invalid for example) */ |
259 | default: | 265 | default: |
266 | tty_encode_baud_rate(port->tty, 9600, 9600); | ||
267 | case 0: | ||
260 | baud = 9600; | 268 | baud = 9600; |
261 | } | 269 | } |
262 | 270 | ||
@@ -302,6 +310,7 @@ static void ark3116_set_termios(struct usb_serial_port *port, | |||
302 | /* TEST ARK3116_SND(154, 0xFE, 0x40, 0xFFFF, 0x0006); */ | 310 | /* TEST ARK3116_SND(154, 0xFE, 0x40, 0xFFFF, 0x0006); */ |
303 | 311 | ||
304 | kfree(buf); | 312 | kfree(buf); |
313 | |||
305 | return; | 314 | return; |
306 | } | 315 | } |
307 | 316 | ||
diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c index 6b252ceb39a8..42582d49b69c 100644 --- a/drivers/usb/serial/ch341.c +++ b/drivers/usb/serial/ch341.c | |||
@@ -272,9 +272,6 @@ static void ch341_set_termios(struct usb_serial_port *port, | |||
272 | 272 | ||
273 | dbg("ch341_set_termios()"); | 273 | dbg("ch341_set_termios()"); |
274 | 274 | ||
275 | if (!tty || !tty->termios) | ||
276 | return; | ||
277 | |||
278 | baud_rate = tty_get_baud_rate(tty); | 275 | baud_rate = tty_get_baud_rate(tty); |
279 | 276 | ||
280 | switch (baud_rate) { | 277 | switch (baud_rate) { |
@@ -299,6 +296,11 @@ static void ch341_set_termios(struct usb_serial_port *port, | |||
299 | * (cflag & PARENB) : parity {NONE, EVEN, ODD} | 296 | * (cflag & PARENB) : parity {NONE, EVEN, ODD} |
300 | * (cflag & CSTOPB) : stop bits [1, 2] | 297 | * (cflag & CSTOPB) : stop bits [1, 2] |
301 | */ | 298 | */ |
299 | |||
300 | /* Copy back the old hardware settings */ | ||
301 | tty_termios_copy_hw(tty->termios, old_termios); | ||
302 | /* And re-encode with the new baud */ | ||
303 | tty_encode_baud_rate(tty, baud_rate, baud_rate); | ||
302 | } | 304 | } |
303 | 305 | ||
304 | static struct usb_driver ch341_driver = { | 306 | static struct usb_driver ch341_driver = { |
diff --git a/drivers/usb/serial/console.c b/drivers/usb/serial/console.c index 9386e216d681..0362654d3b52 100644 --- a/drivers/usb/serial/console.c +++ b/drivers/usb/serial/console.c | |||
@@ -164,6 +164,7 @@ static int usb_console_setup(struct console *co, char *options) | |||
164 | } | 164 | } |
165 | 165 | ||
166 | if (serial->type->set_termios) { | 166 | if (serial->type->set_termios) { |
167 | struct ktermios dummy; | ||
167 | /* build up a fake tty structure so that the open call has something | 168 | /* build up a fake tty structure so that the open call has something |
168 | * to look at to get the cflag value */ | 169 | * to look at to get the cflag value */ |
169 | tty = kzalloc(sizeof(*tty), GFP_KERNEL); | 170 | tty = kzalloc(sizeof(*tty), GFP_KERNEL); |
@@ -177,12 +178,13 @@ static int usb_console_setup(struct console *co, char *options) | |||
177 | kfree (tty); | 178 | kfree (tty); |
178 | return -ENOMEM; | 179 | return -ENOMEM; |
179 | } | 180 | } |
181 | memset(&dummy, 0, sizeof(struct ktermios)); | ||
180 | termios->c_cflag = cflag; | 182 | termios->c_cflag = cflag; |
181 | tty->termios = termios; | 183 | tty->termios = termios; |
182 | port->tty = tty; | 184 | port->tty = tty; |
183 | 185 | ||
184 | /* set up the initial termios settings */ | 186 | /* set up the initial termios settings */ |
185 | serial->type->set_termios(port, NULL); | 187 | serial->type->set_termios(port, &dummy); |
186 | port->tty = NULL; | 188 | port->tty = NULL; |
187 | kfree (termios); | 189 | kfree (termios); |
188 | kfree (tty); | 190 | kfree (tty); |
diff --git a/drivers/usb/serial/cp2101.c b/drivers/usb/serial/cp2101.c index eb7df1835c11..3a83cb4c4bc2 100644 --- a/drivers/usb/serial/cp2101.c +++ b/drivers/usb/serial/cp2101.c | |||
@@ -361,7 +361,6 @@ static void cp2101_get_termios (struct usb_serial_port *port) | |||
361 | dbg("%s - no tty structures", __FUNCTION__); | 361 | dbg("%s - no tty structures", __FUNCTION__); |
362 | return; | 362 | return; |
363 | } | 363 | } |
364 | cflag = port->tty->termios->c_cflag; | ||
365 | 364 | ||
366 | cp2101_get_config(port, CP2101_BAUDRATE, &baud, 2); | 365 | cp2101_get_config(port, CP2101_BAUDRATE, &baud, 2); |
367 | /* Convert to baudrate */ | 366 | /* Convert to baudrate */ |
@@ -369,40 +368,9 @@ static void cp2101_get_termios (struct usb_serial_port *port) | |||
369 | baud = BAUD_RATE_GEN_FREQ / baud; | 368 | baud = BAUD_RATE_GEN_FREQ / baud; |
370 | 369 | ||
371 | dbg("%s - baud rate = %d", __FUNCTION__, baud); | 370 | dbg("%s - baud rate = %d", __FUNCTION__, baud); |
372 | cflag &= ~CBAUD; | 371 | |
373 | switch (baud) { | 372 | tty_encode_baud_rate(port->tty, baud, baud); |
374 | /* | 373 | cflag = port->tty->termios->c_cflag; |
375 | * The baud rates which are commented out below | ||
376 | * appear to be supported by the device | ||
377 | * but are non-standard | ||
378 | */ | ||
379 | case 600: cflag |= B600; break; | ||
380 | case 1200: cflag |= B1200; break; | ||
381 | case 1800: cflag |= B1800; break; | ||
382 | case 2400: cflag |= B2400; break; | ||
383 | case 4800: cflag |= B4800; break; | ||
384 | /*case 7200: cflag |= B7200; break;*/ | ||
385 | case 9600: cflag |= B9600; break; | ||
386 | /*case 14400: cflag |= B14400; break;*/ | ||
387 | case 19200: cflag |= B19200; break; | ||
388 | /*case 28800: cflag |= B28800; break;*/ | ||
389 | case 38400: cflag |= B38400; break; | ||
390 | /*case 55854: cflag |= B55054; break;*/ | ||
391 | case 57600: cflag |= B57600; break; | ||
392 | case 115200: cflag |= B115200; break; | ||
393 | /*case 127117: cflag |= B127117; break;*/ | ||
394 | case 230400: cflag |= B230400; break; | ||
395 | case 460800: cflag |= B460800; break; | ||
396 | case 921600: cflag |= B921600; break; | ||
397 | /*case 3686400: cflag |= B3686400; break;*/ | ||
398 | default: | ||
399 | dbg("%s - Baud rate is not supported, " | ||
400 | "using 9600 baud", __FUNCTION__); | ||
401 | cflag |= B9600; | ||
402 | cp2101_set_config_single(port, CP2101_BAUDRATE, | ||
403 | (BAUD_RATE_GEN_FREQ/9600)); | ||
404 | break; | ||
405 | } | ||
406 | 374 | ||
407 | cp2101_get_config(port, CP2101_BITS, &bits, 2); | 375 | cp2101_get_config(port, CP2101_BITS, &bits, 2); |
408 | cflag &= ~CSIZE; | 376 | cflag &= ~CSIZE; |
@@ -516,7 +484,7 @@ static void cp2101_get_termios (struct usb_serial_port *port) | |||
516 | static void cp2101_set_termios (struct usb_serial_port *port, | 484 | static void cp2101_set_termios (struct usb_serial_port *port, |
517 | struct ktermios *old_termios) | 485 | struct ktermios *old_termios) |
518 | { | 486 | { |
519 | unsigned int cflag, old_cflag=0; | 487 | unsigned int cflag, old_cflag; |
520 | int baud=0, bits; | 488 | int baud=0, bits; |
521 | unsigned int modem_ctl[4]; | 489 | unsigned int modem_ctl[4]; |
522 | 490 | ||
@@ -526,6 +494,8 @@ static void cp2101_set_termios (struct usb_serial_port *port, | |||
526 | dbg("%s - no tty structures", __FUNCTION__); | 494 | dbg("%s - no tty structures", __FUNCTION__); |
527 | return; | 495 | return; |
528 | } | 496 | } |
497 | port->tty->termios->c_cflag &= ~CMSPAR; | ||
498 | |||
529 | cflag = port->tty->termios->c_cflag; | 499 | cflag = port->tty->termios->c_cflag; |
530 | old_cflag = old_termios->c_cflag; | 500 | old_cflag = old_termios->c_cflag; |
531 | baud = tty_get_baud_rate(port->tty); | 501 | baud = tty_get_baud_rate(port->tty); |
@@ -563,11 +533,15 @@ static void cp2101_set_termios (struct usb_serial_port *port, | |||
563 | dbg("%s - Setting baud rate to %d baud", __FUNCTION__, | 533 | dbg("%s - Setting baud rate to %d baud", __FUNCTION__, |
564 | baud); | 534 | baud); |
565 | if (cp2101_set_config_single(port, CP2101_BAUDRATE, | 535 | if (cp2101_set_config_single(port, CP2101_BAUDRATE, |
566 | (BAUD_RATE_GEN_FREQ / baud))) | 536 | (BAUD_RATE_GEN_FREQ / baud))) { |
567 | dev_err(&port->dev, "Baud rate requested not " | 537 | dev_err(&port->dev, "Baud rate requested not " |
568 | "supported by device\n"); | 538 | "supported by device\n"); |
539 | baud = tty_termios_baud_rate(old_termios); | ||
540 | } | ||
569 | } | 541 | } |
570 | } | 542 | } |
543 | /* Report back the resulting baud rate */ | ||
544 | tty_encode_baud_rate(port->tty, baud, baud); | ||
571 | 545 | ||
572 | /* If the number of data bits is to be updated */ | 546 | /* If the number of data bits is to be updated */ |
573 | if ((cflag & CSIZE) != (old_cflag & CSIZE)) { | 547 | if ((cflag & CSIZE) != (old_cflag & CSIZE)) { |
diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c index dab2e66d111d..ae410c4678ea 100644 --- a/drivers/usb/serial/digi_acceleport.c +++ b/drivers/usb/serial/digi_acceleport.c | |||
@@ -973,6 +973,8 @@ static void digi_set_termios(struct usb_serial_port *port, | |||
973 | } | 973 | } |
974 | } | 974 | } |
975 | /* set parity */ | 975 | /* set parity */ |
976 | tty->termios->c_cflag &= ~CMSPAR; | ||
977 | |||
976 | if ((cflag&(PARENB|PARODD)) != (old_cflag&(PARENB|PARODD))) { | 978 | if ((cflag&(PARENB|PARODD)) != (old_cflag&(PARENB|PARODD))) { |
977 | if (cflag&PARENB) { | 979 | if (cflag&PARENB) { |
978 | if (cflag&PARODD) | 980 | if (cflag&PARODD) |
@@ -1054,15 +1056,15 @@ static void digi_set_termios(struct usb_serial_port *port, | |||
1054 | } | 1056 | } |
1055 | 1057 | ||
1056 | /* set output flow control */ | 1058 | /* set output flow control */ |
1057 | if ((iflag&IXON) != (old_iflag&IXON) | 1059 | if ((iflag & IXON) != (old_iflag & IXON) |
1058 | || (cflag&CRTSCTS) != (old_cflag&CRTSCTS)) { | 1060 | || (cflag & CRTSCTS) != (old_cflag & CRTSCTS)) { |
1059 | arg = 0; | 1061 | arg = 0; |
1060 | if (iflag&IXON) | 1062 | if (iflag & IXON) |
1061 | arg |= DIGI_OUTPUT_FLOW_CONTROL_XON_XOFF; | 1063 | arg |= DIGI_OUTPUT_FLOW_CONTROL_XON_XOFF; |
1062 | else | 1064 | else |
1063 | arg &= ~DIGI_OUTPUT_FLOW_CONTROL_XON_XOFF; | 1065 | arg &= ~DIGI_OUTPUT_FLOW_CONTROL_XON_XOFF; |
1064 | 1066 | ||
1065 | if (cflag&CRTSCTS) { | 1067 | if (cflag & CRTSCTS) { |
1066 | arg |= DIGI_OUTPUT_FLOW_CONTROL_CTS; | 1068 | arg |= DIGI_OUTPUT_FLOW_CONTROL_CTS; |
1067 | } else { | 1069 | } else { |
1068 | arg &= ~DIGI_OUTPUT_FLOW_CONTROL_CTS; | 1070 | arg &= ~DIGI_OUTPUT_FLOW_CONTROL_CTS; |
@@ -1076,8 +1078,8 @@ static void digi_set_termios(struct usb_serial_port *port, | |||
1076 | } | 1078 | } |
1077 | 1079 | ||
1078 | /* set receive enable/disable */ | 1080 | /* set receive enable/disable */ |
1079 | if ((cflag&CREAD) != (old_cflag&CREAD)) { | 1081 | if ((cflag & CREAD) != (old_cflag & CREAD)) { |
1080 | if (cflag&CREAD) | 1082 | if (cflag & CREAD) |
1081 | arg = DIGI_ENABLE; | 1083 | arg = DIGI_ENABLE; |
1082 | else | 1084 | else |
1083 | arg = DIGI_DISABLE; | 1085 | arg = DIGI_DISABLE; |
@@ -1089,7 +1091,7 @@ static void digi_set_termios(struct usb_serial_port *port, | |||
1089 | } | 1091 | } |
1090 | if ((ret = digi_write_oob_command(port, buf, i, 1)) != 0) | 1092 | if ((ret = digi_write_oob_command(port, buf, i, 1)) != 0) |
1091 | dbg("digi_set_termios: write oob failed, ret=%d", ret); | 1093 | dbg("digi_set_termios: write oob failed, ret=%d", ret); |
1092 | 1094 | tty_encode_baud_rate(tty, baud, baud); | |
1093 | } | 1095 | } |
1094 | 1096 | ||
1095 | 1097 | ||
diff --git a/drivers/usb/serial/empeg.c b/drivers/usb/serial/empeg.c index 050fcc996f56..a5c8e1e17ea5 100644 --- a/drivers/usb/serial/empeg.c +++ b/drivers/usb/serial/empeg.c | |||
@@ -449,14 +449,9 @@ static int empeg_ioctl (struct usb_serial_port *port, struct file * file, unsign | |||
449 | 449 | ||
450 | static void empeg_set_termios (struct usb_serial_port *port, struct ktermios *old_termios) | 450 | static void empeg_set_termios (struct usb_serial_port *port, struct ktermios *old_termios) |
451 | { | 451 | { |
452 | 452 | struct ktermios *termios = port->tty->termios; | |
453 | dbg("%s - port %d", __FUNCTION__, port->number); | 453 | dbg("%s - port %d", __FUNCTION__, port->number); |
454 | 454 | ||
455 | if ((!port->tty) || (!port->tty->termios)) { | ||
456 | dbg("%s - no tty structures", __FUNCTION__); | ||
457 | return; | ||
458 | } | ||
459 | |||
460 | /* | 455 | /* |
461 | * The empeg-car player wants these particular tty settings. | 456 | * The empeg-car player wants these particular tty settings. |
462 | * You could, for example, change the baud rate, however the | 457 | * You could, for example, change the baud rate, however the |
@@ -466,7 +461,7 @@ static void empeg_set_termios (struct usb_serial_port *port, struct ktermios *ol | |||
466 | * | 461 | * |
467 | * The default requirements for this device are: | 462 | * The default requirements for this device are: |
468 | */ | 463 | */ |
469 | port->tty->termios->c_iflag | 464 | termios->c_iflag |
470 | &= ~(IGNBRK /* disable ignore break */ | 465 | &= ~(IGNBRK /* disable ignore break */ |
471 | | BRKINT /* disable break causes interrupt */ | 466 | | BRKINT /* disable break causes interrupt */ |
472 | | PARMRK /* disable mark parity errors */ | 467 | | PARMRK /* disable mark parity errors */ |
@@ -476,24 +471,23 @@ static void empeg_set_termios (struct usb_serial_port *port, struct ktermios *ol | |||
476 | | ICRNL /* disable translate CR to NL */ | 471 | | ICRNL /* disable translate CR to NL */ |
477 | | IXON); /* disable enable XON/XOFF flow control */ | 472 | | IXON); /* disable enable XON/XOFF flow control */ |
478 | 473 | ||
479 | port->tty->termios->c_oflag | 474 | termios->c_oflag |
480 | &= ~OPOST; /* disable postprocess output characters */ | 475 | &= ~OPOST; /* disable postprocess output characters */ |
481 | 476 | ||
482 | port->tty->termios->c_lflag | 477 | termios->c_lflag |
483 | &= ~(ECHO /* disable echo input characters */ | 478 | &= ~(ECHO /* disable echo input characters */ |
484 | | ECHONL /* disable echo new line */ | 479 | | ECHONL /* disable echo new line */ |
485 | | ICANON /* disable erase, kill, werase, and rprnt special characters */ | 480 | | ICANON /* disable erase, kill, werase, and rprnt special characters */ |
486 | | ISIG /* disable interrupt, quit, and suspend special characters */ | 481 | | ISIG /* disable interrupt, quit, and suspend special characters */ |
487 | | IEXTEN); /* disable non-POSIX special characters */ | 482 | | IEXTEN); /* disable non-POSIX special characters */ |
488 | 483 | ||
489 | port->tty->termios->c_cflag | 484 | termios->c_cflag |
490 | &= ~(CSIZE /* no size */ | 485 | &= ~(CSIZE /* no size */ |
491 | | PARENB /* disable parity bit */ | 486 | | PARENB /* disable parity bit */ |
492 | | CBAUD); /* clear current baud rate */ | 487 | | CBAUD); /* clear current baud rate */ |
493 | 488 | ||
494 | port->tty->termios->c_cflag | 489 | termios->c_cflag |
495 | |= (CS8 /* character size 8 bits */ | 490 | |= CS8; /* character size 8 bits */ |
496 | | B115200); /* baud rate 115200 */ | ||
497 | 491 | ||
498 | /* | 492 | /* |
499 | * Force low_latency on; otherwise the pushes are scheduled; | 493 | * Force low_latency on; otherwise the pushes are scheduled; |
@@ -501,8 +495,7 @@ static void empeg_set_termios (struct usb_serial_port *port, struct ktermios *ol | |||
501 | * on the floor. We don't want to drop bytes on the floor. :) | 495 | * on the floor. We don't want to drop bytes on the floor. :) |
502 | */ | 496 | */ |
503 | port->tty->low_latency = 1; | 497 | port->tty->low_latency = 1; |
504 | 498 | tty_encode_baud_rate(port->tty, 115200, 115200); | |
505 | return; | ||
506 | } | 499 | } |
507 | 500 | ||
508 | 501 | ||
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 8a8a6b9fb05b..c40e77dccf8e 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -294,7 +294,7 @@ struct ftdi_private { | |||
294 | 294 | ||
295 | __u16 interface; /* FT2232C port interface (0 for FT232/245) */ | 295 | __u16 interface; /* FT2232C port interface (0 for FT232/245) */ |
296 | 296 | ||
297 | int force_baud; /* if non-zero, force the baud rate to this value */ | 297 | speed_t force_baud; /* if non-zero, force the baud rate to this value */ |
298 | int force_rtscts; /* if non-zero, force RTS-CTS to always be enabled */ | 298 | int force_rtscts; /* if non-zero, force RTS-CTS to always be enabled */ |
299 | 299 | ||
300 | spinlock_t tx_lock; /* spinlock for transmit state */ | 300 | spinlock_t tx_lock; /* spinlock for transmit state */ |
@@ -878,6 +878,7 @@ static __u32 get_ftdi_divisor(struct usb_serial_port * port) | |||
878 | if (div_value == 0) { | 878 | if (div_value == 0) { |
879 | dbg("%s - Baudrate (%d) requested is not supported", __FUNCTION__, baud); | 879 | dbg("%s - Baudrate (%d) requested is not supported", __FUNCTION__, baud); |
880 | div_value = ftdi_sio_b9600; | 880 | div_value = ftdi_sio_b9600; |
881 | baud = 9600; | ||
881 | div_okay = 0; | 882 | div_okay = 0; |
882 | } | 883 | } |
883 | break; | 884 | break; |
@@ -886,6 +887,7 @@ static __u32 get_ftdi_divisor(struct usb_serial_port * port) | |||
886 | div_value = ftdi_232am_baud_to_divisor(baud); | 887 | div_value = ftdi_232am_baud_to_divisor(baud); |
887 | } else { | 888 | } else { |
888 | dbg("%s - Baud rate too high!", __FUNCTION__); | 889 | dbg("%s - Baud rate too high!", __FUNCTION__); |
890 | baud = 9600; | ||
889 | div_value = ftdi_232am_baud_to_divisor(9600); | 891 | div_value = ftdi_232am_baud_to_divisor(9600); |
890 | div_okay = 0; | 892 | div_okay = 0; |
891 | } | 893 | } |
@@ -899,6 +901,7 @@ static __u32 get_ftdi_divisor(struct usb_serial_port * port) | |||
899 | dbg("%s - Baud rate too high!", __FUNCTION__); | 901 | dbg("%s - Baud rate too high!", __FUNCTION__); |
900 | div_value = ftdi_232bm_baud_to_divisor(9600); | 902 | div_value = ftdi_232bm_baud_to_divisor(9600); |
901 | div_okay = 0; | 903 | div_okay = 0; |
904 | baud = 9600; | ||
902 | } | 905 | } |
903 | break; | 906 | break; |
904 | } /* priv->chip_type */ | 907 | } /* priv->chip_type */ |
@@ -909,6 +912,7 @@ static __u32 get_ftdi_divisor(struct usb_serial_port * port) | |||
909 | ftdi_chip_name[priv->chip_type]); | 912 | ftdi_chip_name[priv->chip_type]); |
910 | } | 913 | } |
911 | 914 | ||
915 | tty_encode_baud_rate(port->tty, baud, baud); | ||
912 | return(div_value); | 916 | return(div_value); |
913 | } | 917 | } |
914 | 918 | ||
@@ -1263,7 +1267,7 @@ static void ftdi_USB_UIRT_setup (struct ftdi_private *priv) | |||
1263 | 1267 | ||
1264 | priv->flags |= ASYNC_SPD_CUST; | 1268 | priv->flags |= ASYNC_SPD_CUST; |
1265 | priv->custom_divisor = 77; | 1269 | priv->custom_divisor = 77; |
1266 | priv->force_baud = B38400; | 1270 | priv->force_baud = 38400; |
1267 | } /* ftdi_USB_UIRT_setup */ | 1271 | } /* ftdi_USB_UIRT_setup */ |
1268 | 1272 | ||
1269 | /* Setup for the HE-TIRA1 device, which requires hardwired | 1273 | /* Setup for the HE-TIRA1 device, which requires hardwired |
@@ -1274,7 +1278,7 @@ static void ftdi_HE_TIRA1_setup (struct ftdi_private *priv) | |||
1274 | 1278 | ||
1275 | priv->flags |= ASYNC_SPD_CUST; | 1279 | priv->flags |= ASYNC_SPD_CUST; |
1276 | priv->custom_divisor = 240; | 1280 | priv->custom_divisor = 240; |
1277 | priv->force_baud = B38400; | 1281 | priv->force_baud = 38400; |
1278 | priv->force_rtscts = 1; | 1282 | priv->force_rtscts = 1; |
1279 | } /* ftdi_HE_TIRA1_setup */ | 1283 | } /* ftdi_HE_TIRA1_setup */ |
1280 | 1284 | ||
@@ -1363,7 +1367,7 @@ static int ftdi_open (struct usb_serial_port *port, struct file *filp) | |||
1363 | 1367 | ||
1364 | /* ftdi_set_termios will send usb control messages */ | 1368 | /* ftdi_set_termios will send usb control messages */ |
1365 | if (port->tty) | 1369 | if (port->tty) |
1366 | ftdi_set_termios(port, NULL); | 1370 | ftdi_set_termios(port, port->tty->termios); |
1367 | 1371 | ||
1368 | /* FIXME: Flow control might be enabled, so it should be checked - | 1372 | /* FIXME: Flow control might be enabled, so it should be checked - |
1369 | we have no control of defaults! */ | 1373 | we have no control of defaults! */ |
@@ -1933,32 +1937,33 @@ static void ftdi_break_ctl( struct usb_serial_port *port, int break_state ) | |||
1933 | static void ftdi_set_termios (struct usb_serial_port *port, struct ktermios *old_termios) | 1937 | static void ftdi_set_termios (struct usb_serial_port *port, struct ktermios *old_termios) |
1934 | { /* ftdi_termios */ | 1938 | { /* ftdi_termios */ |
1935 | struct usb_device *dev = port->serial->dev; | 1939 | struct usb_device *dev = port->serial->dev; |
1936 | unsigned int cflag = port->tty->termios->c_cflag; | ||
1937 | struct ftdi_private *priv = usb_get_serial_port_data(port); | 1940 | struct ftdi_private *priv = usb_get_serial_port_data(port); |
1941 | struct ktermios *termios = port->tty->termios; | ||
1942 | unsigned int cflag = termios->c_cflag; | ||
1938 | __u16 urb_value; /* will hold the new flags */ | 1943 | __u16 urb_value; /* will hold the new flags */ |
1939 | char buf[1]; /* Perhaps I should dynamically alloc this? */ | 1944 | char buf[1]; /* Perhaps I should dynamically alloc this? */ |
1940 | 1945 | ||
1941 | // Added for xon/xoff support | 1946 | // Added for xon/xoff support |
1942 | unsigned int iflag = port->tty->termios->c_iflag; | 1947 | unsigned int iflag = termios->c_iflag; |
1943 | unsigned char vstop; | 1948 | unsigned char vstop; |
1944 | unsigned char vstart; | 1949 | unsigned char vstart; |
1945 | 1950 | ||
1946 | dbg("%s", __FUNCTION__); | 1951 | dbg("%s", __FUNCTION__); |
1947 | 1952 | ||
1948 | /* Force baud rate if this device requires it, unless it is set to B0. */ | 1953 | /* Force baud rate if this device requires it, unless it is set to B0. */ |
1949 | if (priv->force_baud && ((port->tty->termios->c_cflag & CBAUD) != B0)) { | 1954 | if (priv->force_baud && ((termios->c_cflag & CBAUD) != B0)) { |
1950 | dbg("%s: forcing baud rate for this device", __FUNCTION__); | 1955 | dbg("%s: forcing baud rate for this device", __FUNCTION__); |
1951 | port->tty->termios->c_cflag &= ~CBAUD; | 1956 | tty_encode_baud_rate(port->tty, priv->force_baud, |
1952 | port->tty->termios->c_cflag |= priv->force_baud; | 1957 | priv->force_baud); |
1953 | } | 1958 | } |
1954 | 1959 | ||
1955 | /* Force RTS-CTS if this device requires it. */ | 1960 | /* Force RTS-CTS if this device requires it. */ |
1956 | if (priv->force_rtscts) { | 1961 | if (priv->force_rtscts) { |
1957 | dbg("%s: forcing rtscts for this device", __FUNCTION__); | 1962 | dbg("%s: forcing rtscts for this device", __FUNCTION__); |
1958 | port->tty->termios->c_cflag |= CRTSCTS; | 1963 | termios->c_cflag |= CRTSCTS; |
1959 | } | 1964 | } |
1960 | 1965 | ||
1961 | cflag = port->tty->termios->c_cflag; | 1966 | cflag = termios->c_cflag; |
1962 | 1967 | ||
1963 | /* FIXME -For this cut I don't care if the line is really changing or | 1968 | /* FIXME -For this cut I don't care if the line is really changing or |
1964 | not - so just do the change regardless - should be able to | 1969 | not - so just do the change regardless - should be able to |
@@ -1969,6 +1974,8 @@ static void ftdi_set_termios (struct usb_serial_port *port, struct ktermios *old | |||
1969 | 1974 | ||
1970 | /* Set number of data bits, parity, stop bits */ | 1975 | /* Set number of data bits, parity, stop bits */ |
1971 | 1976 | ||
1977 | termios->c_cflag &= ~CMSPAR; | ||
1978 | |||
1972 | urb_value = 0; | 1979 | urb_value = 0; |
1973 | urb_value |= (cflag & CSTOPB ? FTDI_SIO_SET_DATA_STOP_BITS_2 : | 1980 | urb_value |= (cflag & CSTOPB ? FTDI_SIO_SET_DATA_STOP_BITS_2 : |
1974 | FTDI_SIO_SET_DATA_STOP_BITS_1); | 1981 | FTDI_SIO_SET_DATA_STOP_BITS_1); |
@@ -2048,8 +2055,8 @@ static void ftdi_set_termios (struct usb_serial_port *port, struct ktermios *old | |||
2048 | // Set the vstart and vstop -- could have been done up above where | 2055 | // Set the vstart and vstop -- could have been done up above where |
2049 | // a lot of other dereferencing is done but that would be very | 2056 | // a lot of other dereferencing is done but that would be very |
2050 | // inefficient as vstart and vstop are not always needed | 2057 | // inefficient as vstart and vstop are not always needed |
2051 | vstart=port->tty->termios->c_cc[VSTART]; | 2058 | vstart = termios->c_cc[VSTART]; |
2052 | vstop=port->tty->termios->c_cc[VSTOP]; | 2059 | vstop = termios->c_cc[VSTOP]; |
2053 | urb_value=(vstop << 8) | (vstart); | 2060 | urb_value=(vstop << 8) | (vstart); |
2054 | 2061 | ||
2055 | if (usb_control_msg(dev, | 2062 | if (usb_control_msg(dev, |
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c index 88a2c7dce335..9eb4a65ee4d9 100644 --- a/drivers/usb/serial/generic.c +++ b/drivers/usb/serial/generic.c | |||
@@ -208,14 +208,15 @@ int usb_serial_generic_write(struct usb_serial_port *port, const unsigned char * | |||
208 | 208 | ||
209 | /* only do something if we have a bulk out endpoint */ | 209 | /* only do something if we have a bulk out endpoint */ |
210 | if (serial->num_bulk_out) { | 210 | if (serial->num_bulk_out) { |
211 | spin_lock_bh(&port->lock); | 211 | unsigned long flags; |
212 | spin_lock_irqsave(&port->lock, flags); | ||
212 | if (port->write_urb_busy) { | 213 | if (port->write_urb_busy) { |
213 | spin_unlock_bh(&port->lock); | 214 | spin_unlock_irqrestore(&port->lock, flags); |
214 | dbg("%s - already writing", __FUNCTION__); | 215 | dbg("%s - already writing", __FUNCTION__); |
215 | return 0; | 216 | return 0; |
216 | } | 217 | } |
217 | port->write_urb_busy = 1; | 218 | port->write_urb_busy = 1; |
218 | spin_unlock_bh(&port->lock); | 219 | spin_unlock_irqrestore(&port->lock, flags); |
219 | 220 | ||
220 | count = (count > port->bulk_out_size) ? port->bulk_out_size : count; | 221 | count = (count > port->bulk_out_size) ? port->bulk_out_size : count; |
221 | 222 | ||
diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c index 8dd3abc99d63..a5d2e115e167 100644 --- a/drivers/usb/serial/io_edgeport.c +++ b/drivers/usb/serial/io_edgeport.c | |||
@@ -1503,22 +1503,16 @@ static void edge_unthrottle (struct usb_serial_port *port) | |||
1503 | *****************************************************************************/ | 1503 | *****************************************************************************/ |
1504 | static void edge_set_termios (struct usb_serial_port *port, struct ktermios *old_termios) | 1504 | static void edge_set_termios (struct usb_serial_port *port, struct ktermios *old_termios) |
1505 | { | 1505 | { |
1506 | /* FIXME: This function appears unused ?? */ | ||
1506 | struct edgeport_port *edge_port = usb_get_serial_port_data(port); | 1507 | struct edgeport_port *edge_port = usb_get_serial_port_data(port); |
1507 | struct tty_struct *tty = port->tty; | 1508 | struct tty_struct *tty = port->tty; |
1508 | unsigned int cflag; | 1509 | unsigned int cflag; |
1509 | 1510 | ||
1510 | if (!port->tty || !port->tty->termios) { | ||
1511 | dbg ("%s - no tty or termios", __FUNCTION__); | ||
1512 | return; | ||
1513 | } | ||
1514 | |||
1515 | cflag = tty->termios->c_cflag; | 1511 | cflag = tty->termios->c_cflag; |
1516 | dbg("%s - clfag %08x iflag %08x", __FUNCTION__, | 1512 | dbg("%s - clfag %08x iflag %08x", __FUNCTION__, |
1517 | tty->termios->c_cflag, tty->termios->c_iflag); | 1513 | tty->termios->c_cflag, tty->termios->c_iflag); |
1518 | if (old_termios) { | 1514 | dbg("%s - old clfag %08x old iflag %08x", __FUNCTION__, |
1519 | dbg("%s - old clfag %08x old iflag %08x", __FUNCTION__, | 1515 | old_termios->c_cflag, old_termios->c_iflag); |
1520 | old_termios->c_cflag, old_termios->c_iflag); | ||
1521 | } | ||
1522 | 1516 | ||
1523 | dbg("%s - port %d", __FUNCTION__, port->number); | 1517 | dbg("%s - port %d", __FUNCTION__, port->number); |
1524 | 1518 | ||
@@ -2653,7 +2647,11 @@ static void change_port_settings (struct edgeport_port *edge_port, struct ktermi | |||
2653 | 2647 | ||
2654 | dbg("%s - baud rate = %d", __FUNCTION__, baud); | 2648 | dbg("%s - baud rate = %d", __FUNCTION__, baud); |
2655 | status = send_cmd_write_baud_rate (edge_port, baud); | 2649 | status = send_cmd_write_baud_rate (edge_port, baud); |
2656 | 2650 | if (status == -1) { | |
2651 | /* Speed change was not possible - put back the old speed */ | ||
2652 | baud = tty_termios_baud_rate(old_termios); | ||
2653 | tty_encode_baud_rate(tty, baud, baud); | ||
2654 | } | ||
2657 | return; | 2655 | return; |
2658 | } | 2656 | } |
2659 | 2657 | ||
diff --git a/drivers/usb/serial/ir-usb.c b/drivers/usb/serial/ir-usb.c index 5ab6a0c5ac52..6b803ab98543 100644 --- a/drivers/usb/serial/ir-usb.c +++ b/drivers/usb/serial/ir-usb.c | |||
@@ -504,11 +504,6 @@ static void ir_set_termios (struct usb_serial_port *port, struct ktermios *old_t | |||
504 | 504 | ||
505 | dbg("%s - port %d", __FUNCTION__, port->number); | 505 | dbg("%s - port %d", __FUNCTION__, port->number); |
506 | 506 | ||
507 | if ((!port->tty) || (!port->tty->termios)) { | ||
508 | dbg("%s - no tty structures", __FUNCTION__); | ||
509 | return; | ||
510 | } | ||
511 | |||
512 | baud = tty_get_baud_rate(port->tty); | 507 | baud = tty_get_baud_rate(port->tty); |
513 | 508 | ||
514 | /* | 509 | /* |
@@ -531,8 +526,6 @@ static void ir_set_termios (struct usb_serial_port *port, struct ktermios *old_t | |||
531 | default: | 526 | default: |
532 | ir_baud = SPEED_9600; | 527 | ir_baud = SPEED_9600; |
533 | baud = 9600; | 528 | baud = 9600; |
534 | /* And once the new tty stuff is all done we need to | ||
535 | call back to correct the baud bits */ | ||
536 | } | 529 | } |
537 | 530 | ||
538 | if (xbof == -1) | 531 | if (xbof == -1) |
@@ -562,6 +555,10 @@ static void ir_set_termios (struct usb_serial_port *port, struct ktermios *old_t | |||
562 | result = usb_submit_urb (port->write_urb, GFP_KERNEL); | 555 | result = usb_submit_urb (port->write_urb, GFP_KERNEL); |
563 | if (result) | 556 | if (result) |
564 | dev_err(&port->dev, "%s - failed submitting write urb, error %d\n", __FUNCTION__, result); | 557 | dev_err(&port->dev, "%s - failed submitting write urb, error %d\n", __FUNCTION__, result); |
558 | |||
559 | /* Only speed changes are supported */ | ||
560 | tty_termios_copy_hw(port->tty->termios, old_termios); | ||
561 | tty_encode_baud_rate(port->tty, baud, baud); | ||
565 | } | 562 | } |
566 | 563 | ||
567 | 564 | ||
diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c index f2a6fce5de1e..6bfdba6a213f 100644 --- a/drivers/usb/serial/keyspan.c +++ b/drivers/usb/serial/keyspan.c | |||
@@ -278,29 +278,35 @@ static void keyspan_set_termios (struct usb_serial_port *port, | |||
278 | struct keyspan_port_private *p_priv; | 278 | struct keyspan_port_private *p_priv; |
279 | const struct keyspan_device_details *d_details; | 279 | const struct keyspan_device_details *d_details; |
280 | unsigned int cflag; | 280 | unsigned int cflag; |
281 | struct tty_struct *tty = port->tty; | ||
281 | 282 | ||
282 | dbg("%s", __FUNCTION__); | 283 | dbg("%s", __FUNCTION__); |
283 | 284 | ||
284 | p_priv = usb_get_serial_port_data(port); | 285 | p_priv = usb_get_serial_port_data(port); |
285 | d_details = p_priv->device_details; | 286 | d_details = p_priv->device_details; |
286 | cflag = port->tty->termios->c_cflag; | 287 | cflag = tty->termios->c_cflag; |
287 | device_port = port->number - port->serial->minor; | 288 | device_port = port->number - port->serial->minor; |
288 | 289 | ||
289 | /* Baud rate calculation takes baud rate as an integer | 290 | /* Baud rate calculation takes baud rate as an integer |
290 | so other rates can be generated if desired. */ | 291 | so other rates can be generated if desired. */ |
291 | baud_rate = tty_get_baud_rate(port->tty); | 292 | baud_rate = tty_get_baud_rate(tty); |
292 | /* If no match or invalid, don't change */ | 293 | /* If no match or invalid, don't change */ |
293 | if (baud_rate >= 0 | 294 | if (d_details->calculate_baud_rate(baud_rate, d_details->baudclk, |
294 | && d_details->calculate_baud_rate(baud_rate, d_details->baudclk, | ||
295 | NULL, NULL, NULL, device_port) == KEYSPAN_BAUD_RATE_OK) { | 295 | NULL, NULL, NULL, device_port) == KEYSPAN_BAUD_RATE_OK) { |
296 | /* FIXME - more to do here to ensure rate changes cleanly */ | 296 | /* FIXME - more to do here to ensure rate changes cleanly */ |
297 | /* FIXME - calcuate exact rate from divisor ? */ | ||
297 | p_priv->baud = baud_rate; | 298 | p_priv->baud = baud_rate; |
298 | } | 299 | } else |
300 | baud_rate = tty_termios_baud_rate(old_termios); | ||
299 | 301 | ||
302 | tty_encode_baud_rate(tty, baud_rate, baud_rate); | ||
300 | /* set CTS/RTS handshake etc. */ | 303 | /* set CTS/RTS handshake etc. */ |
301 | p_priv->cflag = cflag; | 304 | p_priv->cflag = cflag; |
302 | p_priv->flow_control = (cflag & CRTSCTS)? flow_cts: flow_none; | 305 | p_priv->flow_control = (cflag & CRTSCTS)? flow_cts: flow_none; |
303 | 306 | ||
307 | /* Mark/Space not supported */ | ||
308 | tty->termios->c_cflag &= ~CMSPAR; | ||
309 | |||
304 | keyspan_send_setup(port, 0); | 310 | keyspan_send_setup(port, 0); |
305 | } | 311 | } |
306 | 312 | ||
diff --git a/drivers/usb/serial/kobil_sct.c b/drivers/usb/serial/kobil_sct.c index 6f224195bd25..aee450246bfd 100644 --- a/drivers/usb/serial/kobil_sct.c +++ b/drivers/usb/serial/kobil_sct.c | |||
@@ -616,8 +616,9 @@ static void kobil_set_termios(struct usb_serial_port *port, struct ktermios *old | |||
616 | case 1200: | 616 | case 1200: |
617 | urb_val = SUSBCR_SBR_1200; | 617 | urb_val = SUSBCR_SBR_1200; |
618 | break; | 618 | break; |
619 | case 9600: | ||
620 | default: | 619 | default: |
620 | speed = 9600; | ||
621 | case 9600: | ||
621 | urb_val = SUSBCR_SBR_9600; | 622 | urb_val = SUSBCR_SBR_9600; |
622 | break; | 623 | break; |
623 | } | 624 | } |
@@ -641,6 +642,8 @@ static void kobil_set_termios(struct usb_serial_port *port, struct ktermios *old | |||
641 | urb_val |= SUSBCR_SPASB_NoParity; | 642 | urb_val |= SUSBCR_SPASB_NoParity; |
642 | strcat(settings, "No Parity"); | 643 | strcat(settings, "No Parity"); |
643 | } | 644 | } |
645 | port->tty->termios->c_cflag &= ~CMSPAR; | ||
646 | tty_encode_baud_rate(port->tty, speed, speed); | ||
644 | 647 | ||
645 | result = usb_control_msg( port->serial->dev, | 648 | result = usb_control_msg( port->serial->dev, |
646 | usb_rcvctrlpipe(port->serial->dev, 0 ), | 649 | usb_rcvctrlpipe(port->serial->dev, 0 ), |
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c index f76480f1455d..a5ced7e08cbf 100644 --- a/drivers/usb/serial/mos7840.c +++ b/drivers/usb/serial/mos7840.c | |||
@@ -1977,11 +1977,6 @@ static void mos7840_change_port_settings(struct moschip_port *mos7840_port, | |||
1977 | 1977 | ||
1978 | tty = mos7840_port->port->tty; | 1978 | tty = mos7840_port->port->tty; |
1979 | 1979 | ||
1980 | if ((!tty) || (!tty->termios)) { | ||
1981 | dbg("%s - no tty structures", __FUNCTION__); | ||
1982 | return; | ||
1983 | } | ||
1984 | |||
1985 | dbg("%s", "Entering .......... \n"); | 1980 | dbg("%s", "Entering .......... \n"); |
1986 | 1981 | ||
1987 | lData = LCR_BITS_8; | 1982 | lData = LCR_BITS_8; |
@@ -2151,11 +2146,6 @@ static void mos7840_set_termios(struct usb_serial_port *port, | |||
2151 | 2146 | ||
2152 | tty = port->tty; | 2147 | tty = port->tty; |
2153 | 2148 | ||
2154 | if (!port->tty || !port->tty->termios) { | ||
2155 | dbg("%s - no tty or termios", __FUNCTION__); | ||
2156 | return; | ||
2157 | } | ||
2158 | |||
2159 | if (!mos7840_port->open) { | 2149 | if (!mos7840_port->open) { |
2160 | dbg("%s - port not opened", __FUNCTION__); | 2150 | dbg("%s - port not opened", __FUNCTION__); |
2161 | return; | 2151 | return; |
@@ -2165,19 +2155,10 @@ static void mos7840_set_termios(struct usb_serial_port *port, | |||
2165 | 2155 | ||
2166 | cflag = tty->termios->c_cflag; | 2156 | cflag = tty->termios->c_cflag; |
2167 | 2157 | ||
2168 | if (!cflag) { | ||
2169 | dbg("%s %s\n", __FUNCTION__, "cflag is NULL"); | ||
2170 | return; | ||
2171 | } | ||
2172 | |||
2173 | dbg("%s - clfag %08x iflag %08x", __FUNCTION__, | 2158 | dbg("%s - clfag %08x iflag %08x", __FUNCTION__, |
2174 | tty->termios->c_cflag, RELEVANT_IFLAG(tty->termios->c_iflag)); | 2159 | tty->termios->c_cflag, RELEVANT_IFLAG(tty->termios->c_iflag)); |
2175 | 2160 | dbg("%s - old clfag %08x old iflag %08x", __FUNCTION__, | |
2176 | if (old_termios) { | 2161 | old_termios->c_cflag, RELEVANT_IFLAG(old_termios->c_iflag)); |
2177 | dbg("%s - old clfag %08x old iflag %08x", __FUNCTION__, | ||
2178 | old_termios->c_cflag, RELEVANT_IFLAG(old_termios->c_iflag)); | ||
2179 | } | ||
2180 | |||
2181 | dbg("%s - port %d", __FUNCTION__, port->number); | 2162 | dbg("%s - port %d", __FUNCTION__, port->number); |
2182 | 2163 | ||
2183 | /* change the port settings to the new ones specified */ | 2164 | /* change the port settings to the new ones specified */ |
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index a18659e0700c..4590124cf888 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
@@ -172,6 +172,8 @@ static struct usb_device_id option_ids[] = { | |||
172 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x2110) }, /* Novatel Merlin ES620 / Merlin ES720 / Ovation U720 */ | 172 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x2110) }, /* Novatel Merlin ES620 / Merlin ES720 / Ovation U720 */ |
173 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x2130) }, /* Novatel Merlin ES620 SM Bus */ | 173 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x2130) }, /* Novatel Merlin ES620 SM Bus */ |
174 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x2410) }, /* Novatel EU740 */ | 174 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x2410) }, /* Novatel EU740 */ |
175 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x4100) }, /* Novatel U727 */ | ||
176 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, 0x4400) }, /* Novatel MC950 */ | ||
175 | { USB_DEVICE(DELL_VENDOR_ID, 0x8114) }, /* Dell Wireless 5700 Mobile Broadband CDMA/EVDO Mini-Card == Novatel Expedite EV620 CDMA/EV-DO */ | 177 | { USB_DEVICE(DELL_VENDOR_ID, 0x8114) }, /* Dell Wireless 5700 Mobile Broadband CDMA/EVDO Mini-Card == Novatel Expedite EV620 CDMA/EV-DO */ |
176 | { USB_DEVICE(DELL_VENDOR_ID, 0x8115) }, /* Dell Wireless 5500 Mobile Broadband HSDPA Mini-Card == Novatel Expedite EU740 HSDPA/3G */ | 178 | { USB_DEVICE(DELL_VENDOR_ID, 0x8115) }, /* Dell Wireless 5500 Mobile Broadband HSDPA Mini-Card == Novatel Expedite EU740 HSDPA/3G */ |
177 | { USB_DEVICE(DELL_VENDOR_ID, 0x8116) }, /* Dell Wireless 5505 Mobile Broadband HSDPA Mini-Card == Novatel Expedite EU740 HSDPA/3G */ | 179 | { USB_DEVICE(DELL_VENDOR_ID, 0x8116) }, /* Dell Wireless 5505 Mobile Broadband HSDPA Mini-Card == Novatel Expedite EU740 HSDPA/3G */ |
@@ -311,7 +313,8 @@ static void option_set_termios(struct usb_serial_port *port, | |||
311 | struct ktermios *old_termios) | 313 | struct ktermios *old_termios) |
312 | { | 314 | { |
313 | dbg("%s", __FUNCTION__); | 315 | dbg("%s", __FUNCTION__); |
314 | 316 | /* Doesn't support option setting */ | |
317 | tty_termios_copy_hw(port->tty->termios, old_termios); | ||
315 | option_send_setup(port); | 318 | option_send_setup(port); |
316 | } | 319 | } |
317 | 320 | ||
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index 1da57fd9ea23..2cd3f1d4b687 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c | |||
@@ -56,6 +56,7 @@ static struct usb_device_id id_table [] = { | |||
56 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_RSAQ3) }, | 56 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_RSAQ3) }, |
57 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_PHAROS) }, | 57 | { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_PHAROS) }, |
58 | { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID) }, | 58 | { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID) }, |
59 | { USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID_RSAQ5) }, | ||
59 | { USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID) }, | 60 | { USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID) }, |
60 | { USB_DEVICE(ATEN_VENDOR_ID2, ATEN_PRODUCT_ID) }, | 61 | { USB_DEVICE(ATEN_VENDOR_ID2, ATEN_PRODUCT_ID) }, |
61 | { USB_DEVICE(ELCOM_VENDOR_ID, ELCOM_PRODUCT_ID) }, | 62 | { USB_DEVICE(ELCOM_VENDOR_ID, ELCOM_PRODUCT_ID) }, |
@@ -470,16 +471,13 @@ static void pl2303_set_termios(struct usb_serial_port *port, | |||
470 | 471 | ||
471 | dbg("%s - port %d", __FUNCTION__, port->number); | 472 | dbg("%s - port %d", __FUNCTION__, port->number); |
472 | 473 | ||
473 | if ((!port->tty) || (!port->tty->termios)) { | ||
474 | dbg("%s - no tty structures", __FUNCTION__); | ||
475 | return; | ||
476 | } | ||
477 | |||
478 | spin_lock_irqsave(&priv->lock, flags); | 474 | spin_lock_irqsave(&priv->lock, flags); |
479 | if (!priv->termios_initialized) { | 475 | if (!priv->termios_initialized) { |
480 | *(port->tty->termios) = tty_std_termios; | 476 | *(port->tty->termios) = tty_std_termios; |
481 | port->tty->termios->c_cflag = B9600 | CS8 | CREAD | | 477 | port->tty->termios->c_cflag = B9600 | CS8 | CREAD | |
482 | HUPCL | CLOCAL; | 478 | HUPCL | CLOCAL; |
479 | port->tty->termios->c_ispeed = 9600; | ||
480 | port->tty->termios->c_ospeed = 9600; | ||
483 | priv->termios_initialized = 1; | 481 | priv->termios_initialized = 1; |
484 | } | 482 | } |
485 | spin_unlock_irqrestore(&priv->lock, flags); | 483 | spin_unlock_irqrestore(&priv->lock, flags); |
@@ -596,6 +594,10 @@ static void pl2303_set_termios(struct usb_serial_port *port, | |||
596 | dbg ("0x40:0x1:0x0:0x0 %d", i); | 594 | dbg ("0x40:0x1:0x0:0x0 %d", i); |
597 | } | 595 | } |
598 | 596 | ||
597 | /* FIXME: Need to read back resulting baud rate */ | ||
598 | if (baud) | ||
599 | tty_encode_baud_rate(port->tty, baud, baud); | ||
600 | |||
599 | kfree(buf); | 601 | kfree(buf); |
600 | } | 602 | } |
601 | 603 | ||
diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h index c39bace5cbcc..ed603e3decd6 100644 --- a/drivers/usb/serial/pl2303.h +++ b/drivers/usb/serial/pl2303.h | |||
@@ -20,6 +20,7 @@ | |||
20 | 20 | ||
21 | #define IODATA_VENDOR_ID 0x04bb | 21 | #define IODATA_VENDOR_ID 0x04bb |
22 | #define IODATA_PRODUCT_ID 0x0a03 | 22 | #define IODATA_PRODUCT_ID 0x0a03 |
23 | #define IODATA_PRODUCT_ID_RSAQ5 0x0a0e | ||
23 | 24 | ||
24 | #define ELCOM_VENDOR_ID 0x056e | 25 | #define ELCOM_VENDOR_ID 0x056e |
25 | #define ELCOM_PRODUCT_ID 0x5003 | 26 | #define ELCOM_PRODUCT_ID 0x5003 |
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c index 959b3e4e9077..833f6e1e3721 100644 --- a/drivers/usb/serial/sierra.c +++ b/drivers/usb/serial/sierra.c | |||
@@ -224,7 +224,7 @@ static void sierra_set_termios(struct usb_serial_port *port, | |||
224 | struct ktermios *old_termios) | 224 | struct ktermios *old_termios) |
225 | { | 225 | { |
226 | dbg("%s", __FUNCTION__); | 226 | dbg("%s", __FUNCTION__); |
227 | 227 | tty_termios_copy_hw(port->tty->termios, old_termios); | |
228 | sierra_send_setup(port); | 228 | sierra_send_setup(port); |
229 | } | 229 | } |
230 | 230 | ||
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index 4b1bd7def4a5..497e29a700ca 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c | |||
@@ -429,6 +429,8 @@ static void serial_set_termios (struct tty_struct *tty, struct ktermios * old) | |||
429 | /* pass on to the driver specific version of this function if it is available */ | 429 | /* pass on to the driver specific version of this function if it is available */ |
430 | if (port->serial->type->set_termios) | 430 | if (port->serial->type->set_termios) |
431 | port->serial->type->set_termios(port, old); | 431 | port->serial->type->set_termios(port, old); |
432 | else | ||
433 | tty_termios_copy_hw(tty->termios, old); | ||
432 | } | 434 | } |
433 | 435 | ||
434 | static void serial_break (struct tty_struct *tty, int break_state) | 436 | static void serial_break (struct tty_struct *tty, int break_state) |
@@ -1121,7 +1123,9 @@ int usb_serial_resume(struct usb_interface *intf) | |||
1121 | { | 1123 | { |
1122 | struct usb_serial *serial = usb_get_intfdata(intf); | 1124 | struct usb_serial *serial = usb_get_intfdata(intf); |
1123 | 1125 | ||
1124 | return serial->type->resume(serial); | 1126 | if (serial->type->resume) |
1127 | return serial->type->resume(serial); | ||
1128 | return 0; | ||
1125 | } | 1129 | } |
1126 | EXPORT_SYMBOL(usb_serial_resume); | 1130 | EXPORT_SYMBOL(usb_serial_resume); |
1127 | 1131 | ||
diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c index cc8b44c08712..ee5dd8b5a713 100644 --- a/drivers/usb/serial/whiteheat.c +++ b/drivers/usb/serial/whiteheat.c | |||
@@ -885,16 +885,7 @@ static int whiteheat_ioctl (struct usb_serial_port *port, struct file * file, un | |||
885 | static void whiteheat_set_termios(struct usb_serial_port *port, struct ktermios *old_termios) | 885 | static void whiteheat_set_termios(struct usb_serial_port *port, struct ktermios *old_termios) |
886 | { | 886 | { |
887 | dbg("%s -port %d", __FUNCTION__, port->number); | 887 | dbg("%s -port %d", __FUNCTION__, port->number); |
888 | |||
889 | if ((!port->tty) || (!port->tty->termios)) { | ||
890 | dbg("%s - no tty structures", __FUNCTION__); | ||
891 | goto exit; | ||
892 | } | ||
893 | |||
894 | firm_setup_port(port); | 888 | firm_setup_port(port); |
895 | |||
896 | exit: | ||
897 | return; | ||
898 | } | 889 | } |
899 | 890 | ||
900 | 891 | ||
@@ -1244,6 +1235,8 @@ static int firm_setup_port(struct usb_serial_port *port) { | |||
1244 | port_settings.baud = tty_get_baud_rate(port->tty); | 1235 | port_settings.baud = tty_get_baud_rate(port->tty); |
1245 | dbg("%s - baud rate = %d", __FUNCTION__, port_settings.baud); | 1236 | dbg("%s - baud rate = %d", __FUNCTION__, port_settings.baud); |
1246 | 1237 | ||
1238 | /* fixme: should set validated settings */ | ||
1239 | tty_encode_baud_rate(port->tty, port_settings.baud, port_settings.baud); | ||
1247 | /* handle any settings that aren't specified in the tty structure */ | 1240 | /* handle any settings that aren't specified in the tty structure */ |
1248 | port_settings.lloop = 0; | 1241 | port_settings.lloop = 0; |
1249 | 1242 | ||
diff --git a/drivers/usb/storage/Kconfig b/drivers/usb/storage/Kconfig index fe2c4cd53f5a..7e53333be013 100644 --- a/drivers/usb/storage/Kconfig +++ b/drivers/usb/storage/Kconfig | |||
@@ -48,7 +48,6 @@ config USB_STORAGE_FREECOM | |||
48 | config USB_STORAGE_ISD200 | 48 | config USB_STORAGE_ISD200 |
49 | bool "ISD-200 USB/ATA Bridge support" | 49 | bool "ISD-200 USB/ATA Bridge support" |
50 | depends on USB_STORAGE | 50 | depends on USB_STORAGE |
51 | depends on BLK_DEV_IDE=y || BLK_DEV_IDE=USB_STORAGE | ||
52 | ---help--- | 51 | ---help--- |
53 | Say Y here if you want to use USB Mass Store devices based | 52 | Say Y here if you want to use USB Mass Store devices based |
54 | on the In-Systems Design ISD-200 USB/ATA bridge. | 53 | on the In-Systems Design ISD-200 USB/ATA bridge. |
diff --git a/drivers/usb/storage/isd200.c b/drivers/usb/storage/isd200.c index 93a7724e167a..49ba6c0ff1e8 100644 --- a/drivers/usb/storage/isd200.c +++ b/drivers/usb/storage/isd200.c | |||
@@ -977,6 +977,109 @@ static int isd200_manual_enum(struct us_data *us) | |||
977 | return(retStatus); | 977 | return(retStatus); |
978 | } | 978 | } |
979 | 979 | ||
980 | /* | ||
981 | * We are the last non IDE user of the legacy IDE ident structures | ||
982 | * and we thus want to keep a private copy of this function so the | ||
983 | * driver can be used without the obsolete drivers/ide layer | ||
984 | */ | ||
985 | |||
986 | static void isd200_fix_driveid (struct hd_driveid *id) | ||
987 | { | ||
988 | #ifndef __LITTLE_ENDIAN | ||
989 | # ifdef __BIG_ENDIAN | ||
990 | int i; | ||
991 | u16 *stringcast; | ||
992 | |||
993 | id->config = __le16_to_cpu(id->config); | ||
994 | id->cyls = __le16_to_cpu(id->cyls); | ||
995 | id->reserved2 = __le16_to_cpu(id->reserved2); | ||
996 | id->heads = __le16_to_cpu(id->heads); | ||
997 | id->track_bytes = __le16_to_cpu(id->track_bytes); | ||
998 | id->sector_bytes = __le16_to_cpu(id->sector_bytes); | ||
999 | id->sectors = __le16_to_cpu(id->sectors); | ||
1000 | id->vendor0 = __le16_to_cpu(id->vendor0); | ||
1001 | id->vendor1 = __le16_to_cpu(id->vendor1); | ||
1002 | id->vendor2 = __le16_to_cpu(id->vendor2); | ||
1003 | stringcast = (u16 *)&id->serial_no[0]; | ||
1004 | for (i = 0; i < (20/2); i++) | ||
1005 | stringcast[i] = __le16_to_cpu(stringcast[i]); | ||
1006 | id->buf_type = __le16_to_cpu(id->buf_type); | ||
1007 | id->buf_size = __le16_to_cpu(id->buf_size); | ||
1008 | id->ecc_bytes = __le16_to_cpu(id->ecc_bytes); | ||
1009 | stringcast = (u16 *)&id->fw_rev[0]; | ||
1010 | for (i = 0; i < (8/2); i++) | ||
1011 | stringcast[i] = __le16_to_cpu(stringcast[i]); | ||
1012 | stringcast = (u16 *)&id->model[0]; | ||
1013 | for (i = 0; i < (40/2); i++) | ||
1014 | stringcast[i] = __le16_to_cpu(stringcast[i]); | ||
1015 | id->dword_io = __le16_to_cpu(id->dword_io); | ||
1016 | id->reserved50 = __le16_to_cpu(id->reserved50); | ||
1017 | id->field_valid = __le16_to_cpu(id->field_valid); | ||
1018 | id->cur_cyls = __le16_to_cpu(id->cur_cyls); | ||
1019 | id->cur_heads = __le16_to_cpu(id->cur_heads); | ||
1020 | id->cur_sectors = __le16_to_cpu(id->cur_sectors); | ||
1021 | id->cur_capacity0 = __le16_to_cpu(id->cur_capacity0); | ||
1022 | id->cur_capacity1 = __le16_to_cpu(id->cur_capacity1); | ||
1023 | id->lba_capacity = __le32_to_cpu(id->lba_capacity); | ||
1024 | id->dma_1word = __le16_to_cpu(id->dma_1word); | ||
1025 | id->dma_mword = __le16_to_cpu(id->dma_mword); | ||
1026 | id->eide_pio_modes = __le16_to_cpu(id->eide_pio_modes); | ||
1027 | id->eide_dma_min = __le16_to_cpu(id->eide_dma_min); | ||
1028 | id->eide_dma_time = __le16_to_cpu(id->eide_dma_time); | ||
1029 | id->eide_pio = __le16_to_cpu(id->eide_pio); | ||
1030 | id->eide_pio_iordy = __le16_to_cpu(id->eide_pio_iordy); | ||
1031 | for (i = 0; i < 2; ++i) | ||
1032 | id->words69_70[i] = __le16_to_cpu(id->words69_70[i]); | ||
1033 | for (i = 0; i < 4; ++i) | ||
1034 | id->words71_74[i] = __le16_to_cpu(id->words71_74[i]); | ||
1035 | id->queue_depth = __le16_to_cpu(id->queue_depth); | ||
1036 | for (i = 0; i < 4; ++i) | ||
1037 | id->words76_79[i] = __le16_to_cpu(id->words76_79[i]); | ||
1038 | id->major_rev_num = __le16_to_cpu(id->major_rev_num); | ||
1039 | id->minor_rev_num = __le16_to_cpu(id->minor_rev_num); | ||
1040 | id->command_set_1 = __le16_to_cpu(id->command_set_1); | ||
1041 | id->command_set_2 = __le16_to_cpu(id->command_set_2); | ||
1042 | id->cfsse = __le16_to_cpu(id->cfsse); | ||
1043 | id->cfs_enable_1 = __le16_to_cpu(id->cfs_enable_1); | ||
1044 | id->cfs_enable_2 = __le16_to_cpu(id->cfs_enable_2); | ||
1045 | id->csf_default = __le16_to_cpu(id->csf_default); | ||
1046 | id->dma_ultra = __le16_to_cpu(id->dma_ultra); | ||
1047 | id->trseuc = __le16_to_cpu(id->trseuc); | ||
1048 | id->trsEuc = __le16_to_cpu(id->trsEuc); | ||
1049 | id->CurAPMvalues = __le16_to_cpu(id->CurAPMvalues); | ||
1050 | id->mprc = __le16_to_cpu(id->mprc); | ||
1051 | id->hw_config = __le16_to_cpu(id->hw_config); | ||
1052 | id->acoustic = __le16_to_cpu(id->acoustic); | ||
1053 | id->msrqs = __le16_to_cpu(id->msrqs); | ||
1054 | id->sxfert = __le16_to_cpu(id->sxfert); | ||
1055 | id->sal = __le16_to_cpu(id->sal); | ||
1056 | id->spg = __le32_to_cpu(id->spg); | ||
1057 | id->lba_capacity_2 = __le64_to_cpu(id->lba_capacity_2); | ||
1058 | for (i = 0; i < 22; i++) | ||
1059 | id->words104_125[i] = __le16_to_cpu(id->words104_125[i]); | ||
1060 | id->last_lun = __le16_to_cpu(id->last_lun); | ||
1061 | id->word127 = __le16_to_cpu(id->word127); | ||
1062 | id->dlf = __le16_to_cpu(id->dlf); | ||
1063 | id->csfo = __le16_to_cpu(id->csfo); | ||
1064 | for (i = 0; i < 26; i++) | ||
1065 | id->words130_155[i] = __le16_to_cpu(id->words130_155[i]); | ||
1066 | id->word156 = __le16_to_cpu(id->word156); | ||
1067 | for (i = 0; i < 3; i++) | ||
1068 | id->words157_159[i] = __le16_to_cpu(id->words157_159[i]); | ||
1069 | id->cfa_power = __le16_to_cpu(id->cfa_power); | ||
1070 | for (i = 0; i < 14; i++) | ||
1071 | id->words161_175[i] = __le16_to_cpu(id->words161_175[i]); | ||
1072 | for (i = 0; i < 31; i++) | ||
1073 | id->words176_205[i] = __le16_to_cpu(id->words176_205[i]); | ||
1074 | for (i = 0; i < 48; i++) | ||
1075 | id->words206_254[i] = __le16_to_cpu(id->words206_254[i]); | ||
1076 | id->integrity_word = __le16_to_cpu(id->integrity_word); | ||
1077 | # else | ||
1078 | # error "Please fix <asm/byteorder.h>" | ||
1079 | # endif | ||
1080 | #endif | ||
1081 | } | ||
1082 | |||
980 | 1083 | ||
981 | /************************************************************************** | 1084 | /************************************************************************** |
982 | * isd200_get_inquiry_data | 1085 | * isd200_get_inquiry_data |
@@ -1018,7 +1121,7 @@ static int isd200_get_inquiry_data( struct us_data *us ) | |||
1018 | int i; | 1121 | int i; |
1019 | __be16 *src; | 1122 | __be16 *src; |
1020 | __u16 *dest; | 1123 | __u16 *dest; |
1021 | ide_fix_driveid(id); | 1124 | isd200_fix_driveid(id); |
1022 | 1125 | ||
1023 | US_DEBUGP(" Identify Data Structure:\n"); | 1126 | US_DEBUGP(" Identify Data Structure:\n"); |
1024 | US_DEBUGP(" config = 0x%x\n", id->config); | 1127 | US_DEBUGP(" config = 0x%x\n", id->config); |