diff options
Diffstat (limited to 'drivers/usb/serial/sierra.c')
-rw-r--r-- | drivers/usb/serial/sierra.c | 185 |
1 files changed, 95 insertions, 90 deletions
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c index 17ac34f4d668..032f7aeb40a4 100644 --- a/drivers/usb/serial/sierra.c +++ b/drivers/usb/serial/sierra.c | |||
@@ -1,7 +1,10 @@ | |||
1 | /* | 1 | /* |
2 | USB Driver for Sierra Wireless | 2 | USB Driver for Sierra Wireless |
3 | 3 | ||
4 | Copyright (C) 2006, 2007, 2008 Kevin Lloyd <klloyd@sierrawireless.com> | 4 | Copyright (C) 2006, 2007, 2008 Kevin Lloyd <klloyd@sierrawireless.com>, |
5 | |||
6 | Copyright (C) 2008, 2009 Elina Pasheva, Matthew Safar, Rory Filer | ||
7 | <linux@sierrawireless.com> | ||
5 | 8 | ||
6 | IMPORTANT DISCLAIMER: This driver is not commercially supported by | 9 | IMPORTANT DISCLAIMER: This driver is not commercially supported by |
7 | Sierra Wireless. Use at your own risk. | 10 | Sierra Wireless. Use at your own risk. |
@@ -14,8 +17,8 @@ | |||
14 | Whom based his on the Keyspan driver by Hugh Blemings <hugh@blemings.org> | 17 | Whom based his on the Keyspan driver by Hugh Blemings <hugh@blemings.org> |
15 | */ | 18 | */ |
16 | 19 | ||
17 | #define DRIVER_VERSION "v.1.3.3" | 20 | #define DRIVER_VERSION "v.1.3.7" |
18 | #define DRIVER_AUTHOR "Kevin Lloyd <klloyd@sierrawireless.com>" | 21 | #define DRIVER_AUTHOR "Kevin Lloyd, Elina Pasheva, Matthew Safar, Rory Filer" |
19 | #define DRIVER_DESC "USB Driver for Sierra Wireless USB modems" | 22 | #define DRIVER_DESC "USB Driver for Sierra Wireless USB modems" |
20 | 23 | ||
21 | #include <linux/kernel.h> | 24 | #include <linux/kernel.h> |
@@ -30,10 +33,15 @@ | |||
30 | #define SWIMS_USB_REQUEST_SetPower 0x00 | 33 | #define SWIMS_USB_REQUEST_SetPower 0x00 |
31 | #define SWIMS_USB_REQUEST_SetNmea 0x07 | 34 | #define SWIMS_USB_REQUEST_SetNmea 0x07 |
32 | 35 | ||
33 | #define N_IN_URB 4 | 36 | #define N_IN_URB 8 |
34 | #define N_OUT_URB 4 | 37 | #define N_OUT_URB 64 |
35 | #define IN_BUFLEN 4096 | 38 | #define IN_BUFLEN 4096 |
36 | 39 | ||
40 | #define MAX_TRANSFER (PAGE_SIZE - 512) | ||
41 | /* MAX_TRANSFER is chosen so that the VM is not stressed by | ||
42 | allocations > PAGE_SIZE and the number of packets in a page | ||
43 | is an integer 512 is the largest possible packet on EHCI */ | ||
44 | |||
37 | static int debug; | 45 | static int debug; |
38 | static int nmea; | 46 | static int nmea; |
39 | 47 | ||
@@ -46,7 +54,7 @@ struct sierra_iface_info { | |||
46 | static int sierra_set_power_state(struct usb_device *udev, __u16 swiState) | 54 | static int sierra_set_power_state(struct usb_device *udev, __u16 swiState) |
47 | { | 55 | { |
48 | int result; | 56 | int result; |
49 | dev_dbg(&udev->dev, "%s", __func__); | 57 | dev_dbg(&udev->dev, "%s\n", __func__); |
50 | result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), | 58 | result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), |
51 | SWIMS_USB_REQUEST_SetPower, /* __u8 request */ | 59 | SWIMS_USB_REQUEST_SetPower, /* __u8 request */ |
52 | USB_TYPE_VENDOR, /* __u8 request type */ | 60 | USB_TYPE_VENDOR, /* __u8 request type */ |
@@ -61,7 +69,7 @@ static int sierra_set_power_state(struct usb_device *udev, __u16 swiState) | |||
61 | static int sierra_vsc_set_nmea(struct usb_device *udev, __u16 enable) | 69 | static int sierra_vsc_set_nmea(struct usb_device *udev, __u16 enable) |
62 | { | 70 | { |
63 | int result; | 71 | int result; |
64 | dev_dbg(&udev->dev, "%s", __func__); | 72 | dev_dbg(&udev->dev, "%s\n", __func__); |
65 | result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), | 73 | result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), |
66 | SWIMS_USB_REQUEST_SetNmea, /* __u8 request */ | 74 | SWIMS_USB_REQUEST_SetNmea, /* __u8 request */ |
67 | USB_TYPE_VENDOR, /* __u8 request type */ | 75 | USB_TYPE_VENDOR, /* __u8 request type */ |
@@ -75,18 +83,22 @@ static int sierra_vsc_set_nmea(struct usb_device *udev, __u16 enable) | |||
75 | 83 | ||
76 | static int sierra_calc_num_ports(struct usb_serial *serial) | 84 | static int sierra_calc_num_ports(struct usb_serial *serial) |
77 | { | 85 | { |
78 | int result; | 86 | int num_ports = 0; |
79 | int *num_ports = usb_get_serial_data(serial); | 87 | u8 ifnum, numendpoints; |
80 | dev_dbg(&serial->dev->dev, "%s", __func__); | ||
81 | 88 | ||
82 | result = *num_ports; | 89 | dev_dbg(&serial->dev->dev, "%s\n", __func__); |
83 | 90 | ||
84 | if (result) { | 91 | ifnum = serial->interface->cur_altsetting->desc.bInterfaceNumber; |
85 | kfree(num_ports); | 92 | numendpoints = serial->interface->cur_altsetting->desc.bNumEndpoints; |
86 | usb_set_serial_data(serial, NULL); | ||
87 | } | ||
88 | 93 | ||
89 | return result; | 94 | /* Dummy interface present on some SKUs should be ignored */ |
95 | if (ifnum == 0x99) | ||
96 | num_ports = 0; | ||
97 | else if (numendpoints <= 3) | ||
98 | num_ports = 1; | ||
99 | else | ||
100 | num_ports = (numendpoints-1)/2; | ||
101 | return num_ports; | ||
90 | } | 102 | } |
91 | 103 | ||
92 | static int is_blacklisted(const u8 ifnum, | 104 | static int is_blacklisted(const u8 ifnum, |
@@ -111,7 +123,7 @@ static int sierra_calc_interface(struct usb_serial *serial) | |||
111 | int interface; | 123 | int interface; |
112 | struct usb_interface *p_interface; | 124 | struct usb_interface *p_interface; |
113 | struct usb_host_interface *p_host_interface; | 125 | struct usb_host_interface *p_host_interface; |
114 | dev_dbg(&serial->dev->dev, "%s", __func__); | 126 | dev_dbg(&serial->dev->dev, "%s\n", __func__); |
115 | 127 | ||
116 | /* Get the interface structure pointer from the serial struct */ | 128 | /* Get the interface structure pointer from the serial struct */ |
117 | p_interface = serial->interface; | 129 | p_interface = serial->interface; |
@@ -132,23 +144,12 @@ static int sierra_probe(struct usb_serial *serial, | |||
132 | { | 144 | { |
133 | int result = 0; | 145 | int result = 0; |
134 | struct usb_device *udev; | 146 | struct usb_device *udev; |
135 | int *num_ports; | ||
136 | u8 ifnum; | 147 | u8 ifnum; |
137 | u8 numendpoints; | ||
138 | 148 | ||
139 | dev_dbg(&serial->dev->dev, "%s", __func__); | ||
140 | |||
141 | num_ports = kmalloc(sizeof(*num_ports), GFP_KERNEL); | ||
142 | if (!num_ports) | ||
143 | return -ENOMEM; | ||
144 | |||
145 | ifnum = serial->interface->cur_altsetting->desc.bInterfaceNumber; | ||
146 | numendpoints = serial->interface->cur_altsetting->desc.bNumEndpoints; | ||
147 | udev = serial->dev; | 149 | udev = serial->dev; |
150 | dev_dbg(&udev->dev, "%s\n", __func__); | ||
148 | 151 | ||
149 | /* Figure out the interface number from the serial structure */ | ||
150 | ifnum = sierra_calc_interface(serial); | 152 | ifnum = sierra_calc_interface(serial); |
151 | |||
152 | /* | 153 | /* |
153 | * If this interface supports more than 1 alternate | 154 | * If this interface supports more than 1 alternate |
154 | * select the 2nd one | 155 | * select the 2nd one |
@@ -160,20 +161,6 @@ static int sierra_probe(struct usb_serial *serial, | |||
160 | usb_set_interface(udev, ifnum, 1); | 161 | usb_set_interface(udev, ifnum, 1); |
161 | } | 162 | } |
162 | 163 | ||
163 | /* Dummy interface present on some SKUs should be ignored */ | ||
164 | if (ifnum == 0x99) | ||
165 | *num_ports = 0; | ||
166 | else if (numendpoints <= 3) | ||
167 | *num_ports = 1; | ||
168 | else | ||
169 | *num_ports = (numendpoints-1)/2; | ||
170 | |||
171 | /* | ||
172 | * save off our num_ports info so that we can use it in the | ||
173 | * calc_num_ports callback | ||
174 | */ | ||
175 | usb_set_serial_data(serial, (void *)num_ports); | ||
176 | |||
177 | /* ifnum could have changed - by calling usb_set_interface */ | 164 | /* ifnum could have changed - by calling usb_set_interface */ |
178 | ifnum = sierra_calc_interface(serial); | 165 | ifnum = sierra_calc_interface(serial); |
179 | 166 | ||
@@ -289,7 +276,7 @@ static int sierra_send_setup(struct usb_serial_port *port) | |||
289 | __u16 interface = 0; | 276 | __u16 interface = 0; |
290 | int val = 0; | 277 | int val = 0; |
291 | 278 | ||
292 | dev_dbg(&port->dev, "%s", __func__); | 279 | dev_dbg(&port->dev, "%s\n", __func__); |
293 | 280 | ||
294 | portdata = usb_get_serial_port_data(port); | 281 | portdata = usb_get_serial_port_data(port); |
295 | 282 | ||
@@ -332,7 +319,7 @@ static int sierra_send_setup(struct usb_serial_port *port) | |||
332 | static void sierra_set_termios(struct tty_struct *tty, | 319 | static void sierra_set_termios(struct tty_struct *tty, |
333 | struct usb_serial_port *port, struct ktermios *old_termios) | 320 | struct usb_serial_port *port, struct ktermios *old_termios) |
334 | { | 321 | { |
335 | dev_dbg(&port->dev, "%s", __func__); | 322 | dev_dbg(&port->dev, "%s\n", __func__); |
336 | tty_termios_copy_hw(tty->termios, old_termios); | 323 | tty_termios_copy_hw(tty->termios, old_termios); |
337 | sierra_send_setup(port); | 324 | sierra_send_setup(port); |
338 | } | 325 | } |
@@ -343,7 +330,7 @@ static int sierra_tiocmget(struct tty_struct *tty, struct file *file) | |||
343 | unsigned int value; | 330 | unsigned int value; |
344 | struct sierra_port_private *portdata; | 331 | struct sierra_port_private *portdata; |
345 | 332 | ||
346 | dev_dbg(&port->dev, "%s", __func__); | 333 | dev_dbg(&port->dev, "%s\n", __func__); |
347 | portdata = usb_get_serial_port_data(port); | 334 | portdata = usb_get_serial_port_data(port); |
348 | 335 | ||
349 | value = ((portdata->rts_state) ? TIOCM_RTS : 0) | | 336 | value = ((portdata->rts_state) ? TIOCM_RTS : 0) | |
@@ -394,14 +381,14 @@ static void sierra_outdat_callback(struct urb *urb) | |||
394 | int status = urb->status; | 381 | int status = urb->status; |
395 | unsigned long flags; | 382 | unsigned long flags; |
396 | 383 | ||
397 | dev_dbg(&port->dev, "%s - port %d", __func__, port->number); | 384 | dev_dbg(&port->dev, "%s - port %d\n", __func__, port->number); |
398 | 385 | ||
399 | /* free up the transfer buffer, as usb_free_urb() does not do this */ | 386 | /* free up the transfer buffer, as usb_free_urb() does not do this */ |
400 | kfree(urb->transfer_buffer); | 387 | kfree(urb->transfer_buffer); |
401 | 388 | ||
402 | if (status) | 389 | if (status) |
403 | dev_dbg(&port->dev, "%s - nonzero write bulk status " | 390 | dev_dbg(&port->dev, "%s - nonzero write bulk status " |
404 | "received: %d", __func__, status); | 391 | "received: %d\n", __func__, status); |
405 | 392 | ||
406 | spin_lock_irqsave(&portdata->lock, flags); | 393 | spin_lock_irqsave(&portdata->lock, flags); |
407 | --portdata->outstanding_urbs; | 394 | --portdata->outstanding_urbs; |
@@ -419,50 +406,61 @@ static int sierra_write(struct tty_struct *tty, struct usb_serial_port *port, | |||
419 | unsigned long flags; | 406 | unsigned long flags; |
420 | unsigned char *buffer; | 407 | unsigned char *buffer; |
421 | struct urb *urb; | 408 | struct urb *urb; |
422 | int status; | 409 | size_t writesize = min((size_t)count, (size_t)MAX_TRANSFER); |
410 | int retval = 0; | ||
411 | |||
412 | /* verify that we actually have some data to write */ | ||
413 | if (count == 0) | ||
414 | return 0; | ||
423 | 415 | ||
424 | portdata = usb_get_serial_port_data(port); | 416 | portdata = usb_get_serial_port_data(port); |
425 | 417 | ||
426 | dev_dbg(&port->dev, "%s: write (%d chars)", __func__, count); | 418 | dev_dbg(&port->dev, "%s: write (%zd bytes)\n", __func__, writesize); |
427 | 419 | ||
428 | spin_lock_irqsave(&portdata->lock, flags); | 420 | spin_lock_irqsave(&portdata->lock, flags); |
421 | dev_dbg(&port->dev, "%s - outstanding_urbs: %d\n", __func__, | ||
422 | portdata->outstanding_urbs); | ||
429 | if (portdata->outstanding_urbs > N_OUT_URB) { | 423 | if (portdata->outstanding_urbs > N_OUT_URB) { |
430 | spin_unlock_irqrestore(&portdata->lock, flags); | 424 | spin_unlock_irqrestore(&portdata->lock, flags); |
431 | dev_dbg(&port->dev, "%s - write limit hit\n", __func__); | 425 | dev_dbg(&port->dev, "%s - write limit hit\n", __func__); |
432 | return 0; | 426 | return 0; |
433 | } | 427 | } |
434 | portdata->outstanding_urbs++; | 428 | portdata->outstanding_urbs++; |
429 | dev_dbg(&port->dev, "%s - 1, outstanding_urbs: %d\n", __func__, | ||
430 | portdata->outstanding_urbs); | ||
435 | spin_unlock_irqrestore(&portdata->lock, flags); | 431 | spin_unlock_irqrestore(&portdata->lock, flags); |
436 | 432 | ||
437 | buffer = kmalloc(count, GFP_ATOMIC); | 433 | buffer = kmalloc(writesize, GFP_ATOMIC); |
438 | if (!buffer) { | 434 | if (!buffer) { |
439 | dev_err(&port->dev, "out of memory\n"); | 435 | dev_err(&port->dev, "out of memory\n"); |
440 | count = -ENOMEM; | 436 | retval = -ENOMEM; |
441 | goto error_no_buffer; | 437 | goto error_no_buffer; |
442 | } | 438 | } |
443 | 439 | ||
444 | urb = usb_alloc_urb(0, GFP_ATOMIC); | 440 | urb = usb_alloc_urb(0, GFP_ATOMIC); |
445 | if (!urb) { | 441 | if (!urb) { |
446 | dev_err(&port->dev, "no more free urbs\n"); | 442 | dev_err(&port->dev, "no more free urbs\n"); |
447 | count = -ENOMEM; | 443 | retval = -ENOMEM; |
448 | goto error_no_urb; | 444 | goto error_no_urb; |
449 | } | 445 | } |
450 | 446 | ||
451 | memcpy(buffer, buf, count); | 447 | memcpy(buffer, buf, writesize); |
452 | 448 | ||
453 | usb_serial_debug_data(debug, &port->dev, __func__, count, buffer); | 449 | usb_serial_debug_data(debug, &port->dev, __func__, writesize, buffer); |
454 | 450 | ||
455 | usb_fill_bulk_urb(urb, serial->dev, | 451 | usb_fill_bulk_urb(urb, serial->dev, |
456 | usb_sndbulkpipe(serial->dev, | 452 | usb_sndbulkpipe(serial->dev, |
457 | port->bulk_out_endpointAddress), | 453 | port->bulk_out_endpointAddress), |
458 | buffer, count, sierra_outdat_callback, port); | 454 | buffer, writesize, sierra_outdat_callback, port); |
455 | |||
456 | /* Handle the need to send a zero length packet */ | ||
457 | urb->transfer_flags |= URB_ZERO_PACKET; | ||
459 | 458 | ||
460 | /* send it down the pipe */ | 459 | /* send it down the pipe */ |
461 | status = usb_submit_urb(urb, GFP_ATOMIC); | 460 | retval = usb_submit_urb(urb, GFP_ATOMIC); |
462 | if (status) { | 461 | if (retval) { |
463 | dev_err(&port->dev, "%s - usb_submit_urb(write bulk) failed " | 462 | dev_err(&port->dev, "%s - usb_submit_urb(write bulk) failed " |
464 | "with status = %d\n", __func__, status); | 463 | "with status = %d\n", __func__, retval); |
465 | count = status; | ||
466 | goto error; | 464 | goto error; |
467 | } | 465 | } |
468 | 466 | ||
@@ -470,7 +468,7 @@ static int sierra_write(struct tty_struct *tty, struct usb_serial_port *port, | |||
470 | * really free it when it is finished with it */ | 468 | * really free it when it is finished with it */ |
471 | usb_free_urb(urb); | 469 | usb_free_urb(urb); |
472 | 470 | ||
473 | return count; | 471 | return writesize; |
474 | error: | 472 | error: |
475 | usb_free_urb(urb); | 473 | usb_free_urb(urb); |
476 | error_no_urb: | 474 | error_no_urb: |
@@ -478,8 +476,10 @@ error_no_urb: | |||
478 | error_no_buffer: | 476 | error_no_buffer: |
479 | spin_lock_irqsave(&portdata->lock, flags); | 477 | spin_lock_irqsave(&portdata->lock, flags); |
480 | --portdata->outstanding_urbs; | 478 | --portdata->outstanding_urbs; |
479 | dev_dbg(&port->dev, "%s - 2. outstanding_urbs: %d\n", __func__, | ||
480 | portdata->outstanding_urbs); | ||
481 | spin_unlock_irqrestore(&portdata->lock, flags); | 481 | spin_unlock_irqrestore(&portdata->lock, flags); |
482 | return count; | 482 | return retval; |
483 | } | 483 | } |
484 | 484 | ||
485 | static void sierra_indat_callback(struct urb *urb) | 485 | static void sierra_indat_callback(struct urb *urb) |
@@ -491,33 +491,39 @@ static void sierra_indat_callback(struct urb *urb) | |||
491 | unsigned char *data = urb->transfer_buffer; | 491 | unsigned char *data = urb->transfer_buffer; |
492 | int status = urb->status; | 492 | int status = urb->status; |
493 | 493 | ||
494 | dbg("%s: %p", __func__, urb); | ||
495 | |||
496 | endpoint = usb_pipeendpoint(urb->pipe); | 494 | endpoint = usb_pipeendpoint(urb->pipe); |
497 | port = urb->context; | 495 | port = urb->context; |
496 | |||
497 | dev_dbg(&port->dev, "%s: %p\n", __func__, urb); | ||
498 | 498 | ||
499 | if (status) { | 499 | if (status) { |
500 | dev_dbg(&port->dev, "%s: nonzero status: %d on" | 500 | dev_dbg(&port->dev, "%s: nonzero status: %d on" |
501 | " endpoint %02x.", __func__, status, endpoint); | 501 | " endpoint %02x\n", __func__, status, endpoint); |
502 | } else { | 502 | } else { |
503 | if (urb->actual_length) { | 503 | if (urb->actual_length) { |
504 | tty = tty_port_tty_get(&port->port); | 504 | tty = tty_port_tty_get(&port->port); |
505 | |||
505 | tty_buffer_request_room(tty, urb->actual_length); | 506 | tty_buffer_request_room(tty, urb->actual_length); |
506 | tty_insert_flip_string(tty, data, urb->actual_length); | 507 | tty_insert_flip_string(tty, data, urb->actual_length); |
507 | tty_flip_buffer_push(tty); | 508 | tty_flip_buffer_push(tty); |
509 | |||
508 | tty_kref_put(tty); | 510 | tty_kref_put(tty); |
509 | } else | 511 | usb_serial_debug_data(debug, &port->dev, __func__, |
512 | urb->actual_length, data); | ||
513 | } else { | ||
510 | dev_dbg(&port->dev, "%s: empty read urb" | 514 | dev_dbg(&port->dev, "%s: empty read urb" |
511 | " received", __func__); | 515 | " received\n", __func__); |
512 | |||
513 | /* Resubmit urb so we continue receiving */ | ||
514 | if (port->port.count && status != -ESHUTDOWN && status != -EPERM) { | ||
515 | err = usb_submit_urb(urb, GFP_ATOMIC); | ||
516 | if (err) | ||
517 | dev_err(&port->dev, "resubmit read urb failed." | ||
518 | "(%d)\n", err); | ||
519 | } | 516 | } |
520 | } | 517 | } |
518 | |||
519 | /* Resubmit urb so we continue receiving */ | ||
520 | if (port->port.count && status != -ESHUTDOWN && status != -EPERM) { | ||
521 | err = usb_submit_urb(urb, GFP_ATOMIC); | ||
522 | if (err) | ||
523 | dev_err(&port->dev, "resubmit read urb failed." | ||
524 | "(%d)\n", err); | ||
525 | } | ||
526 | |||
521 | return; | 527 | return; |
522 | } | 528 | } |
523 | 529 | ||
@@ -529,8 +535,7 @@ static void sierra_instat_callback(struct urb *urb) | |||
529 | struct sierra_port_private *portdata = usb_get_serial_port_data(port); | 535 | struct sierra_port_private *portdata = usb_get_serial_port_data(port); |
530 | struct usb_serial *serial = port->serial; | 536 | struct usb_serial *serial = port->serial; |
531 | 537 | ||
532 | dev_dbg(&port->dev, "%s", __func__); | 538 | dev_dbg(&port->dev, "%s: urb %p port %p has data %p\n", __func__, |
533 | dev_dbg(&port->dev, "%s: urb %p port %p has data %p", __func__, | ||
534 | urb, port, portdata); | 539 | urb, port, portdata); |
535 | 540 | ||
536 | if (status == 0) { | 541 | if (status == 0) { |
@@ -550,7 +555,7 @@ static void sierra_instat_callback(struct urb *urb) | |||
550 | sizeof(struct usb_ctrlrequest)); | 555 | sizeof(struct usb_ctrlrequest)); |
551 | struct tty_struct *tty; | 556 | struct tty_struct *tty; |
552 | 557 | ||
553 | dev_dbg(&port->dev, "%s: signal x%x", __func__, | 558 | dev_dbg(&port->dev, "%s: signal x%x\n", __func__, |
554 | signals); | 559 | signals); |
555 | 560 | ||
556 | old_dcd_state = portdata->dcd_state; | 561 | old_dcd_state = portdata->dcd_state; |
@@ -565,20 +570,20 @@ static void sierra_instat_callback(struct urb *urb) | |||
565 | tty_hangup(tty); | 570 | tty_hangup(tty); |
566 | tty_kref_put(tty); | 571 | tty_kref_put(tty); |
567 | } else { | 572 | } else { |
568 | dev_dbg(&port->dev, "%s: type %x req %x", | 573 | dev_dbg(&port->dev, "%s: type %x req %x\n", |
569 | __func__, req_pkt->bRequestType, | 574 | __func__, req_pkt->bRequestType, |
570 | req_pkt->bRequest); | 575 | req_pkt->bRequest); |
571 | } | 576 | } |
572 | } else | 577 | } else |
573 | dev_dbg(&port->dev, "%s: error %d", __func__, status); | 578 | dev_dbg(&port->dev, "%s: error %d\n", __func__, status); |
574 | 579 | ||
575 | /* Resubmit urb so we continue receiving IRQ data */ | 580 | /* Resubmit urb so we continue receiving IRQ data */ |
576 | if (status != -ESHUTDOWN) { | 581 | if (port->port.count && status != -ESHUTDOWN && status != -ENOENT) { |
577 | urb->dev = serial->dev; | 582 | urb->dev = serial->dev; |
578 | err = usb_submit_urb(urb, GFP_ATOMIC); | 583 | err = usb_submit_urb(urb, GFP_ATOMIC); |
579 | if (err) | 584 | if (err) |
580 | dev_dbg(&port->dev, "%s: resubmit intr urb " | 585 | dev_err(&port->dev, "%s: resubmit intr urb " |
581 | "failed. (%d)", __func__, err); | 586 | "failed. (%d)\n", __func__, err); |
582 | } | 587 | } |
583 | } | 588 | } |
584 | 589 | ||
@@ -588,7 +593,7 @@ static int sierra_write_room(struct tty_struct *tty) | |||
588 | struct sierra_port_private *portdata = usb_get_serial_port_data(port); | 593 | struct sierra_port_private *portdata = usb_get_serial_port_data(port); |
589 | unsigned long flags; | 594 | unsigned long flags; |
590 | 595 | ||
591 | dev_dbg(&port->dev, "%s - port %d", __func__, port->number); | 596 | dev_dbg(&port->dev, "%s - port %d\n", __func__, port->number); |
592 | 597 | ||
593 | /* try to give a good number back based on if we have any free urbs at | 598 | /* try to give a good number back based on if we have any free urbs at |
594 | * this point in time */ | 599 | * this point in time */ |
@@ -729,7 +734,7 @@ static int sierra_open(struct tty_struct *tty, | |||
729 | 734 | ||
730 | portdata = usb_get_serial_port_data(port); | 735 | portdata = usb_get_serial_port_data(port); |
731 | 736 | ||
732 | dev_dbg(&port->dev, "%s", __func__); | 737 | dev_dbg(&port->dev, "%s\n", __func__); |
733 | 738 | ||
734 | /* Set some sane defaults */ | 739 | /* Set some sane defaults */ |
735 | portdata->rts_state = 1; | 740 | portdata->rts_state = 1; |
@@ -782,7 +787,7 @@ static int sierra_startup(struct usb_serial *serial) | |||
782 | struct sierra_port_private *portdata; | 787 | struct sierra_port_private *portdata; |
783 | int i; | 788 | int i; |
784 | 789 | ||
785 | dev_dbg(&serial->dev->dev, "%s", __func__); | 790 | dev_dbg(&serial->dev->dev, "%s\n", __func__); |
786 | 791 | ||
787 | /* Set Device mode to D0 */ | 792 | /* Set Device mode to D0 */ |
788 | sierra_set_power_state(serial->dev, 0x0000); | 793 | sierra_set_power_state(serial->dev, 0x0000); |
@@ -797,7 +802,7 @@ static int sierra_startup(struct usb_serial *serial) | |||
797 | portdata = kzalloc(sizeof(*portdata), GFP_KERNEL); | 802 | portdata = kzalloc(sizeof(*portdata), GFP_KERNEL); |
798 | if (!portdata) { | 803 | if (!portdata) { |
799 | dev_dbg(&port->dev, "%s: kmalloc for " | 804 | dev_dbg(&port->dev, "%s: kmalloc for " |
800 | "sierra_port_private (%d) failed!.", | 805 | "sierra_port_private (%d) failed!.\n", |
801 | __func__, i); | 806 | __func__, i); |
802 | return -ENOMEM; | 807 | return -ENOMEM; |
803 | } | 808 | } |
@@ -809,13 +814,13 @@ static int sierra_startup(struct usb_serial *serial) | |||
809 | return 0; | 814 | return 0; |
810 | } | 815 | } |
811 | 816 | ||
812 | static void sierra_shutdown(struct usb_serial *serial) | 817 | static void sierra_disconnect(struct usb_serial *serial) |
813 | { | 818 | { |
814 | int i; | 819 | int i; |
815 | struct usb_serial_port *port; | 820 | struct usb_serial_port *port; |
816 | struct sierra_port_private *portdata; | 821 | struct sierra_port_private *portdata; |
817 | 822 | ||
818 | dev_dbg(&serial->dev->dev, "%s", __func__); | 823 | dev_dbg(&serial->dev->dev, "%s\n", __func__); |
819 | 824 | ||
820 | for (i = 0; i < serial->num_ports; ++i) { | 825 | for (i = 0; i < serial->num_ports; ++i) { |
821 | port = serial->port[i]; | 826 | port = serial->port[i]; |
@@ -848,7 +853,7 @@ static struct usb_serial_driver sierra_device = { | |||
848 | .tiocmget = sierra_tiocmget, | 853 | .tiocmget = sierra_tiocmget, |
849 | .tiocmset = sierra_tiocmset, | 854 | .tiocmset = sierra_tiocmset, |
850 | .attach = sierra_startup, | 855 | .attach = sierra_startup, |
851 | .shutdown = sierra_shutdown, | 856 | .disconnect = sierra_disconnect, |
852 | .read_int_callback = sierra_instat_callback, | 857 | .read_int_callback = sierra_instat_callback, |
853 | }; | 858 | }; |
854 | 859 | ||