aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/serial')
-rw-r--r--drivers/usb/serial/aircable.c23
-rw-r--r--drivers/usb/serial/belkin_sa.c42
-rw-r--r--drivers/usb/serial/console.c8
-rw-r--r--drivers/usb/serial/cp2101.c3
-rw-r--r--drivers/usb/serial/cyberjack.c31
-rw-r--r--drivers/usb/serial/cypress_m8.c26
-rw-r--r--drivers/usb/serial/digi_acceleport.c87
-rw-r--r--drivers/usb/serial/empeg.c19
-rw-r--r--drivers/usb/serial/ezusb.c3
-rw-r--r--drivers/usb/serial/ftdi_sio.c107
-rw-r--r--drivers/usb/serial/ftdi_sio.h5
-rw-r--r--drivers/usb/serial/garmin_gps.c6
-rw-r--r--drivers/usb/serial/generic.c3
-rw-r--r--drivers/usb/serial/hp4x.c3
-rw-r--r--drivers/usb/serial/io_edgeport.c62
-rw-r--r--drivers/usb/serial/io_ti.c29
-rw-r--r--drivers/usb/serial/ipaq.c33
-rw-r--r--drivers/usb/serial/ipw.c6
-rw-r--r--drivers/usb/serial/ir-usb.c6
-rw-r--r--drivers/usb/serial/iuu_phoenix.c6
-rw-r--r--drivers/usb/serial/keyspan.c80
-rw-r--r--drivers/usb/serial/keyspan_pda.c33
-rw-r--r--drivers/usb/serial/kl5kusb105.c72
-rw-r--r--drivers/usb/serial/kobil_sct.c7
-rw-r--r--drivers/usb/serial/mct_u232.c48
-rw-r--r--drivers/usb/serial/mos7720.c58
-rw-r--r--drivers/usb/serial/mos7840.c36
-rw-r--r--drivers/usb/serial/navman.c3
-rw-r--r--drivers/usb/serial/omninet.c32
-rw-r--r--drivers/usb/serial/option.c60
-rw-r--r--drivers/usb/serial/oti6858.c7
-rw-r--r--drivers/usb/serial/pl2303.c17
-rw-r--r--drivers/usb/serial/safe_serial.c39
-rw-r--r--drivers/usb/serial/sierra.c88
-rw-r--r--drivers/usb/serial/spcp8x5.c13
-rw-r--r--drivers/usb/serial/ti_usb_3410_5052.c48
-rw-r--r--drivers/usb/serial/usb-serial.c50
-rw-r--r--drivers/usb/serial/visor.c35
-rw-r--r--drivers/usb/serial/whiteheat.c129
39 files changed, 775 insertions, 588 deletions
diff --git a/drivers/usb/serial/aircable.c b/drivers/usb/serial/aircable.c
index 79ea98c66fa8..537f953bd7f8 100644
--- a/drivers/usb/serial/aircable.c
+++ b/drivers/usb/serial/aircable.c
@@ -220,8 +220,8 @@ static void aircable_send(struct usb_serial_port *port)
220 220
221 buf = kzalloc(count + HCI_HEADER_LENGTH, GFP_ATOMIC); 221 buf = kzalloc(count + HCI_HEADER_LENGTH, GFP_ATOMIC);
222 if (!buf) { 222 if (!buf) {
223 err("%s- kzalloc(%d) failed.", __func__, 223 dev_err(&port->dev, "%s- kzalloc(%d) failed.\n",
224 count + HCI_HEADER_LENGTH); 224 __func__, count + HCI_HEADER_LENGTH);
225 return; 225 return;
226 } 226 }
227 227
@@ -272,23 +272,24 @@ static void aircable_read(struct work_struct *work)
272 * 64 bytes, to ensure I do not get throttled. 272 * 64 bytes, to ensure I do not get throttled.
273 * Ask USB mailing list for better aproach. 273 * Ask USB mailing list for better aproach.
274 */ 274 */
275 tty = port->port.tty; 275 tty = tty_port_tty_get(&port->port);
276 276
277 if (!tty) { 277 if (!tty) {
278 schedule_work(&priv->rx_work); 278 schedule_work(&priv->rx_work);
279 err("%s - No tty available", __func__); 279 dev_err(&port->dev, "%s - No tty available\n", __func__);
280 return ; 280 return ;
281 } 281 }
282 282
283 count = min(64, serial_buf_data_avail(priv->rx_buf)); 283 count = min(64, serial_buf_data_avail(priv->rx_buf));
284 284
285 if (count <= 0) 285 if (count <= 0)
286 return; /* We have finished sending everything. */ 286 goto out; /* We have finished sending everything. */
287 287
288 tty_prepare_flip_string(tty, &data, count); 288 tty_prepare_flip_string(tty, &data, count);
289 if (!data) { 289 if (!data) {
290 err("%s- kzalloc(%d) failed.", __func__, count); 290 dev_err(&port->dev, "%s- kzalloc(%d) failed.",
291 return; 291 __func__, count);
292 goto out;
292 } 293 }
293 294
294 serial_buf_get(priv->rx_buf, data, count); 295 serial_buf_get(priv->rx_buf, data, count);
@@ -297,7 +298,8 @@ static void aircable_read(struct work_struct *work)
297 298
298 if (serial_buf_data_avail(priv->rx_buf)) 299 if (serial_buf_data_avail(priv->rx_buf))
299 schedule_work(&priv->rx_work); 300 schedule_work(&priv->rx_work);
300 301out:
302 tty_kref_put(tty);
301 return; 303 return;
302} 304}
303/* End of private methods */ 305/* End of private methods */
@@ -334,7 +336,7 @@ static int aircable_attach(struct usb_serial *serial)
334 336
335 priv = kzalloc(sizeof(struct aircable_private), GFP_KERNEL); 337 priv = kzalloc(sizeof(struct aircable_private), GFP_KERNEL);
336 if (!priv) { 338 if (!priv) {
337 err("%s- kmalloc(%Zd) failed.", __func__, 339 dev_err(&port->dev, "%s- kmalloc(%Zd) failed.\n", __func__,
338 sizeof(struct aircable_private)); 340 sizeof(struct aircable_private));
339 return -ENOMEM; 341 return -ENOMEM;
340 } 342 }
@@ -495,7 +497,7 @@ static void aircable_read_bulk_callback(struct urb *urb)
495 usb_serial_debug_data(debug, &port->dev, __func__, 497 usb_serial_debug_data(debug, &port->dev, __func__,
496 urb->actual_length, urb->transfer_buffer); 498 urb->actual_length, urb->transfer_buffer);
497 499
498 tty = port->port.tty; 500 tty = tty_port_tty_get(&port->port);
499 if (tty && urb->actual_length) { 501 if (tty && urb->actual_length) {
500 if (urb->actual_length <= 2) { 502 if (urb->actual_length <= 2) {
501 /* This is an incomplete package */ 503 /* This is an incomplete package */
@@ -527,6 +529,7 @@ static void aircable_read_bulk_callback(struct urb *urb)
527 } 529 }
528 aircable_read(&priv->rx_work); 530 aircable_read(&priv->rx_work);
529 } 531 }
532 tty_kref_put(tty);
530 533
531 /* Schedule the next read _if_ we are still open */ 534 /* Schedule the next read _if_ we are still open */
532 if (port->port.count) { 535 if (port->port.count) {
diff --git a/drivers/usb/serial/belkin_sa.c b/drivers/usb/serial/belkin_sa.c
index 2ebe06c3405a..b7eacad4d48c 100644
--- a/drivers/usb/serial/belkin_sa.c
+++ b/drivers/usb/serial/belkin_sa.c
@@ -187,7 +187,7 @@ static int belkin_sa_startup(struct usb_serial *serial)
187 /* see comments at top of file */ 187 /* see comments at top of file */
188 priv->bad_flow_control = 188 priv->bad_flow_control =
189 (le16_to_cpu(dev->descriptor.bcdDevice) <= 0x0206) ? 1 : 0; 189 (le16_to_cpu(dev->descriptor.bcdDevice) <= 0x0206) ? 1 : 0;
190 info("bcdDevice: %04x, bfc: %d", 190 dev_info(&dev->dev, "bcdDevice: %04x, bfc: %d\n",
191 le16_to_cpu(dev->descriptor.bcdDevice), 191 le16_to_cpu(dev->descriptor.bcdDevice),
192 priv->bad_flow_control); 192 priv->bad_flow_control);
193 193
@@ -228,7 +228,7 @@ static int belkin_sa_open(struct tty_struct *tty,
228 port->read_urb->dev = port->serial->dev; 228 port->read_urb->dev = port->serial->dev;
229 retval = usb_submit_urb(port->read_urb, GFP_KERNEL); 229 retval = usb_submit_urb(port->read_urb, GFP_KERNEL);
230 if (retval) { 230 if (retval) {
231 err("usb_submit_urb(read bulk) failed"); 231 dev_err(&port->dev, "usb_submit_urb(read bulk) failed\n");
232 goto exit; 232 goto exit;
233 } 233 }
234 234
@@ -236,7 +236,7 @@ static int belkin_sa_open(struct tty_struct *tty,
236 retval = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); 236 retval = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL);
237 if (retval) { 237 if (retval) {
238 usb_kill_urb(port->read_urb); 238 usb_kill_urb(port->read_urb);
239 err(" usb_submit_urb(read int) failed"); 239 dev_err(&port->dev, "usb_submit_urb(read int) failed\n");
240 } 240 }
241 241
242exit: 242exit:
@@ -322,7 +322,7 @@ static void belkin_sa_read_int_callback(struct urb *urb)
322 * to look in to this before committing any code. 322 * to look in to this before committing any code.
323 */ 323 */
324 if (priv->last_lsr & BELKIN_SA_LSR_ERR) { 324 if (priv->last_lsr & BELKIN_SA_LSR_ERR) {
325 tty = port->port.tty; 325 tty = tty_port_tty_get(&port->port);
326 /* Overrun Error */ 326 /* Overrun Error */
327 if (priv->last_lsr & BELKIN_SA_LSR_OE) { 327 if (priv->last_lsr & BELKIN_SA_LSR_OE) {
328 } 328 }
@@ -335,14 +335,15 @@ static void belkin_sa_read_int_callback(struct urb *urb)
335 /* Break Indicator */ 335 /* Break Indicator */
336 if (priv->last_lsr & BELKIN_SA_LSR_BI) { 336 if (priv->last_lsr & BELKIN_SA_LSR_BI) {
337 } 337 }
338 tty_kref_put(tty);
338 } 339 }
339#endif 340#endif
340 spin_unlock_irqrestore(&priv->lock, flags); 341 spin_unlock_irqrestore(&priv->lock, flags);
341exit: 342exit:
342 retval = usb_submit_urb(urb, GFP_ATOMIC); 343 retval = usb_submit_urb(urb, GFP_ATOMIC);
343 if (retval) 344 if (retval)
344 err("%s - usb_submit_urb failed with result %d", 345 dev_err(&port->dev, "%s - usb_submit_urb failed with "
345 __func__, retval); 346 "result %d\n", __func__, retval);
346} 347}
347 348
348static void belkin_sa_set_termios(struct tty_struct *tty, 349static void belkin_sa_set_termios(struct tty_struct *tty,
@@ -381,12 +382,12 @@ static void belkin_sa_set_termios(struct tty_struct *tty,
381 if ((old_cflag & CBAUD) == B0) { 382 if ((old_cflag & CBAUD) == B0) {
382 control_state |= (TIOCM_DTR|TIOCM_RTS); 383 control_state |= (TIOCM_DTR|TIOCM_RTS);
383 if (BSA_USB_CMD(BELKIN_SA_SET_DTR_REQUEST, 1) < 0) 384 if (BSA_USB_CMD(BELKIN_SA_SET_DTR_REQUEST, 1) < 0)
384 err("Set DTR error"); 385 dev_err(&port->dev, "Set DTR error\n");
385 /* don't set RTS if using hardware flow control */ 386 /* don't set RTS if using hardware flow control */
386 if (!(old_cflag & CRTSCTS)) 387 if (!(old_cflag & CRTSCTS))
387 if (BSA_USB_CMD(BELKIN_SA_SET_RTS_REQUEST 388 if (BSA_USB_CMD(BELKIN_SA_SET_RTS_REQUEST
388 , 1) < 0) 389 , 1) < 0)
389 err("Set RTS error"); 390 dev_err(&port->dev, "Set RTS error\n");
390 } 391 }
391 } 392 }
392 393
@@ -402,18 +403,18 @@ static void belkin_sa_set_termios(struct tty_struct *tty,
402 /* Report the actual baud rate back to the caller */ 403 /* Report the actual baud rate back to the caller */
403 tty_encode_baud_rate(tty, baud, baud); 404 tty_encode_baud_rate(tty, baud, baud);
404 if (BSA_USB_CMD(BELKIN_SA_SET_BAUDRATE_REQUEST, urb_value) < 0) 405 if (BSA_USB_CMD(BELKIN_SA_SET_BAUDRATE_REQUEST, urb_value) < 0)
405 err("Set baudrate error"); 406 dev_err(&port->dev, "Set baudrate error\n");
406 } else { 407 } else {
407 /* Disable flow control */ 408 /* Disable flow control */
408 if (BSA_USB_CMD(BELKIN_SA_SET_FLOW_CTRL_REQUEST, 409 if (BSA_USB_CMD(BELKIN_SA_SET_FLOW_CTRL_REQUEST,
409 BELKIN_SA_FLOW_NONE) < 0) 410 BELKIN_SA_FLOW_NONE) < 0)
410 err("Disable flowcontrol error"); 411 dev_err(&port->dev, "Disable flowcontrol error\n");
411 /* Drop RTS and DTR */ 412 /* Drop RTS and DTR */
412 control_state &= ~(TIOCM_DTR | TIOCM_RTS); 413 control_state &= ~(TIOCM_DTR | TIOCM_RTS);
413 if (BSA_USB_CMD(BELKIN_SA_SET_DTR_REQUEST, 0) < 0) 414 if (BSA_USB_CMD(BELKIN_SA_SET_DTR_REQUEST, 0) < 0)
414 err("DTR LOW error"); 415 dev_err(&port->dev, "DTR LOW error\n");
415 if (BSA_USB_CMD(BELKIN_SA_SET_RTS_REQUEST, 0) < 0) 416 if (BSA_USB_CMD(BELKIN_SA_SET_RTS_REQUEST, 0) < 0)
416 err("RTS LOW error"); 417 dev_err(&port->dev, "RTS LOW error\n");
417 } 418 }
418 419
419 /* set the parity */ 420 /* set the parity */
@@ -424,7 +425,7 @@ static void belkin_sa_set_termios(struct tty_struct *tty,
424 else 425 else
425 urb_value = BELKIN_SA_PARITY_NONE; 426 urb_value = BELKIN_SA_PARITY_NONE;
426 if (BSA_USB_CMD(BELKIN_SA_SET_PARITY_REQUEST, urb_value) < 0) 427 if (BSA_USB_CMD(BELKIN_SA_SET_PARITY_REQUEST, urb_value) < 0)
427 err("Set parity error"); 428 dev_err(&port->dev, "Set parity error\n");
428 } 429 }
429 430
430 /* set the number of data bits */ 431 /* set the number of data bits */
@@ -447,7 +448,7 @@ static void belkin_sa_set_termios(struct tty_struct *tty,
447 break; 448 break;
448 } 449 }
449 if (BSA_USB_CMD(BELKIN_SA_SET_DATA_BITS_REQUEST, urb_value) < 0) 450 if (BSA_USB_CMD(BELKIN_SA_SET_DATA_BITS_REQUEST, urb_value) < 0)
450 err("Set data bits error"); 451 dev_err(&port->dev, "Set data bits error\n");
451 } 452 }
452 453
453 /* set the number of stop bits */ 454 /* set the number of stop bits */
@@ -456,7 +457,7 @@ static void belkin_sa_set_termios(struct tty_struct *tty,
456 : BELKIN_SA_STOP_BITS(1); 457 : BELKIN_SA_STOP_BITS(1);
457 if (BSA_USB_CMD(BELKIN_SA_SET_STOP_BITS_REQUEST, 458 if (BSA_USB_CMD(BELKIN_SA_SET_STOP_BITS_REQUEST,
458 urb_value) < 0) 459 urb_value) < 0)
459 err("Set stop bits error"); 460 dev_err(&port->dev, "Set stop bits error\n");
460 } 461 }
461 462
462 /* Set flow control */ 463 /* Set flow control */
@@ -477,7 +478,7 @@ static void belkin_sa_set_termios(struct tty_struct *tty,
477 urb_value &= ~(BELKIN_SA_FLOW_IRTS); 478 urb_value &= ~(BELKIN_SA_FLOW_IRTS);
478 479
479 if (BSA_USB_CMD(BELKIN_SA_SET_FLOW_CTRL_REQUEST, urb_value) < 0) 480 if (BSA_USB_CMD(BELKIN_SA_SET_FLOW_CTRL_REQUEST, urb_value) < 0)
480 err("Set flow control error"); 481 dev_err(&port->dev, "Set flow control error\n");
481 } 482 }
482 483
483 /* save off the modified port settings */ 484 /* save off the modified port settings */
@@ -493,7 +494,7 @@ static void belkin_sa_break_ctl(struct tty_struct *tty, int break_state)
493 struct usb_serial *serial = port->serial; 494 struct usb_serial *serial = port->serial;
494 495
495 if (BSA_USB_CMD(BELKIN_SA_SET_BREAK_REQUEST, break_state ? 1 : 0) < 0) 496 if (BSA_USB_CMD(BELKIN_SA_SET_BREAK_REQUEST, break_state ? 1 : 0) < 0)
496 err("Set break_ctl %d", break_state); 497 dev_err(&port->dev, "Set break_ctl %d\n", break_state);
497} 498}
498 499
499 500
@@ -553,13 +554,13 @@ static int belkin_sa_tiocmset(struct tty_struct *tty, struct file *file,
553 554
554 retval = BSA_USB_CMD(BELKIN_SA_SET_RTS_REQUEST, rts); 555 retval = BSA_USB_CMD(BELKIN_SA_SET_RTS_REQUEST, rts);
555 if (retval < 0) { 556 if (retval < 0) {
556 err("Set RTS error %d", retval); 557 dev_err(&port->dev, "Set RTS error %d\n", retval);
557 goto exit; 558 goto exit;
558 } 559 }
559 560
560 retval = BSA_USB_CMD(BELKIN_SA_SET_DTR_REQUEST, dtr); 561 retval = BSA_USB_CMD(BELKIN_SA_SET_DTR_REQUEST, dtr);
561 if (retval < 0) { 562 if (retval < 0) {
562 err("Set DTR error %d", retval); 563 dev_err(&port->dev, "Set DTR error %d\n", retval);
563 goto exit; 564 goto exit;
564 } 565 }
565exit: 566exit:
@@ -576,7 +577,8 @@ static int __init belkin_sa_init(void)
576 retval = usb_register(&belkin_driver); 577 retval = usb_register(&belkin_driver);
577 if (retval) 578 if (retval)
578 goto failed_usb_register; 579 goto failed_usb_register;
579 info(DRIVER_DESC " " DRIVER_VERSION); 580 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
581 DRIVER_DESC "\n");
580 return 0; 582 return 0;
581failed_usb_register: 583failed_usb_register:
582 usb_serial_deregister(&belkin_device); 584 usb_serial_deregister(&belkin_device);
diff --git a/drivers/usb/serial/console.c b/drivers/usb/serial/console.c
index e980766bb84b..5b20de130e08 100644
--- a/drivers/usb/serial/console.c
+++ b/drivers/usb/serial/console.c
@@ -117,7 +117,7 @@ static int usb_console_setup(struct console *co, char *options)
117 } 117 }
118 118
119 port = serial->port[0]; 119 port = serial->port[0];
120 port->port.tty = NULL; 120 tty_port_tty_set(&port->port, NULL);
121 121
122 info->port = port; 122 info->port = port;
123 123
@@ -143,7 +143,7 @@ static int usb_console_setup(struct console *co, char *options)
143 } 143 }
144 memset(&dummy, 0, sizeof(struct ktermios)); 144 memset(&dummy, 0, sizeof(struct ktermios));
145 tty->termios = termios; 145 tty->termios = termios;
146 port->port.tty = tty; 146 tty_port_tty_set(&port->port, tty);
147 } 147 }
148 148
149 /* only call the device specific open if this 149 /* only call the device specific open if this
@@ -163,7 +163,7 @@ static int usb_console_setup(struct console *co, char *options)
163 tty_termios_encode_baud_rate(termios, baud, baud); 163 tty_termios_encode_baud_rate(termios, baud, baud);
164 serial->type->set_termios(tty, port, &dummy); 164 serial->type->set_termios(tty, port, &dummy);
165 165
166 port->port.tty = NULL; 166 tty_port_tty_set(&port->port, NULL);
167 kfree(termios); 167 kfree(termios);
168 kfree(tty); 168 kfree(tty);
169 } 169 }
@@ -176,7 +176,7 @@ out:
176 return retval; 176 return retval;
177free_termios: 177free_termios:
178 kfree(termios); 178 kfree(termios);
179 port->port.tty = NULL; 179 tty_port_tty_set(&port->port, NULL);
180free_tty: 180free_tty:
181 kfree(tty); 181 kfree(tty);
182reset_open_count: 182reset_open_count:
diff --git a/drivers/usb/serial/cp2101.c b/drivers/usb/serial/cp2101.c
index 1279553381e3..8008d0bc80ad 100644
--- a/drivers/usb/serial/cp2101.c
+++ b/drivers/usb/serial/cp2101.c
@@ -753,7 +753,8 @@ static int __init cp2101_init(void)
753 } 753 }
754 754
755 /* Success */ 755 /* Success */
756 info(DRIVER_DESC " " DRIVER_VERSION); 756 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
757 DRIVER_DESC "\n");
757 return 0; 758 return 0;
758} 759}
759 760
diff --git a/drivers/usb/serial/cyberjack.c b/drivers/usb/serial/cyberjack.c
index b4d72351cb96..858bdd038fbc 100644
--- a/drivers/usb/serial/cyberjack.c
+++ b/drivers/usb/serial/cyberjack.c
@@ -141,7 +141,8 @@ static int cyberjack_startup(struct usb_serial *serial)
141 result = usb_submit_urb(serial->port[i]->interrupt_in_urb, 141 result = usb_submit_urb(serial->port[i]->interrupt_in_urb,
142 GFP_KERNEL); 142 GFP_KERNEL);
143 if (result) 143 if (result)
144 err(" usb_submit_urb(read int) failed"); 144 dev_err(&serial->dev->dev,
145 "usb_submit_urb(read int) failed\n");
145 dbg("%s - usb_submit_urb(int urb)", __func__); 146 dbg("%s - usb_submit_urb(int urb)", __func__);
146 } 147 }
147 148
@@ -274,8 +275,9 @@ static int cyberjack_write(struct tty_struct *tty,
274 /* send the data out the bulk port */ 275 /* send the data out the bulk port */
275 result = usb_submit_urb(port->write_urb, GFP_ATOMIC); 276 result = usb_submit_urb(port->write_urb, GFP_ATOMIC);
276 if (result) { 277 if (result) {
277 err("%s - failed submitting write urb, error %d", 278 dev_err(&port->dev,
278 __func__, result); 279 "%s - failed submitting write urb, error %d",
280 __func__, result);
279 /* Throw away data. No better idea what to do with it. */ 281 /* Throw away data. No better idea what to do with it. */
280 priv->wrfilled = 0; 282 priv->wrfilled = 0;
281 priv->wrsent = 0; 283 priv->wrsent = 0;
@@ -351,7 +353,9 @@ static void cyberjack_read_int_callback(struct urb *urb)
351 port->read_urb->dev = port->serial->dev; 353 port->read_urb->dev = port->serial->dev;
352 result = usb_submit_urb(port->read_urb, GFP_ATOMIC); 354 result = usb_submit_urb(port->read_urb, GFP_ATOMIC);
353 if (result) 355 if (result)
354 err("%s - failed resubmitting read urb, error %d", __func__, result); 356 dev_err(&port->dev, "%s - failed resubmitting "
357 "read urb, error %d\n",
358 __func__, result);
355 dbg("%s - usb_submit_urb(read urb)", __func__); 359 dbg("%s - usb_submit_urb(read urb)", __func__);
356 } 360 }
357 } 361 }
@@ -360,7 +364,7 @@ resubmit:
360 port->interrupt_in_urb->dev = port->serial->dev; 364 port->interrupt_in_urb->dev = port->serial->dev;
361 result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC); 365 result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC);
362 if (result) 366 if (result)
363 err(" usb_submit_urb(read int) failed"); 367 dev_err(&port->dev, "usb_submit_urb(read int) failed\n");
364 dbg("%s - usb_submit_urb(int urb)", __func__); 368 dbg("%s - usb_submit_urb(int urb)", __func__);
365} 369}
366 370
@@ -384,7 +388,7 @@ static void cyberjack_read_bulk_callback(struct urb *urb)
384 return; 388 return;
385 } 389 }
386 390
387 tty = port->port.tty; 391 tty = tty_port_tty_get(&port->port);
388 if (!tty) { 392 if (!tty) {
389 dbg("%s - ignoring since device not open\n", __func__); 393 dbg("%s - ignoring since device not open\n", __func__);
390 return; 394 return;
@@ -394,6 +398,7 @@ static void cyberjack_read_bulk_callback(struct urb *urb)
394 tty_insert_flip_string(tty, data, urb->actual_length); 398 tty_insert_flip_string(tty, data, urb->actual_length);
395 tty_flip_buffer_push(tty); 399 tty_flip_buffer_push(tty);
396 } 400 }
401 tty_kref_put(tty);
397 402
398 spin_lock(&priv->lock); 403 spin_lock(&priv->lock);
399 404
@@ -413,8 +418,8 @@ static void cyberjack_read_bulk_callback(struct urb *urb)
413 port->read_urb->dev = port->serial->dev; 418 port->read_urb->dev = port->serial->dev;
414 result = usb_submit_urb(port->read_urb, GFP_ATOMIC); 419 result = usb_submit_urb(port->read_urb, GFP_ATOMIC);
415 if (result) 420 if (result)
416 err("%s - failed resubmitting read urb, error %d", 421 dev_err(&port->dev, "%s - failed resubmitting read "
417 __func__, result); 422 "urb, error %d\n", __func__, result);
418 dbg("%s - usb_submit_urb(read urb)", __func__); 423 dbg("%s - usb_submit_urb(read urb)", __func__);
419 } 424 }
420} 425}
@@ -461,8 +466,9 @@ static void cyberjack_write_bulk_callback(struct urb *urb)
461 /* send the data out the bulk port */ 466 /* send the data out the bulk port */
462 result = usb_submit_urb(port->write_urb, GFP_ATOMIC); 467 result = usb_submit_urb(port->write_urb, GFP_ATOMIC);
463 if (result) { 468 if (result) {
464 err("%s - failed submitting write urb, error %d", 469 dev_err(&port->dev,
465 __func__, result); 470 "%s - failed submitting write urb, error %d\n",
471 __func__, result);
466 /* Throw away data. No better idea what to do with it. */ 472 /* Throw away data. No better idea what to do with it. */
467 priv->wrfilled = 0; 473 priv->wrfilled = 0;
468 priv->wrsent = 0; 474 priv->wrsent = 0;
@@ -498,8 +504,9 @@ static int __init cyberjack_init(void)
498 if (retval) 504 if (retval)
499 goto failed_usb_register; 505 goto failed_usb_register;
500 506
501 info(DRIVER_VERSION " " DRIVER_AUTHOR); 507 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION " "
502 info(DRIVER_DESC); 508 DRIVER_AUTHOR "\n");
509 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_DESC "\n");
503 510
504 return 0; 511 return 0;
505failed_usb_register: 512failed_usb_register:
diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c
index 22837a3f2f89..eae4740d448c 100644
--- a/drivers/usb/serial/cypress_m8.c
+++ b/drivers/usb/serial/cypress_m8.c
@@ -404,8 +404,8 @@ static int cypress_serial_control(struct tty_struct *tty,
404 retval != -ENODEV); 404 retval != -ENODEV);
405 405
406 if (retval != sizeof(feature_buffer)) { 406 if (retval != sizeof(feature_buffer)) {
407 err("%s - failed sending serial line settings - %d", 407 dev_err(&port->dev, "%s - failed sending serial "
408 __func__, retval); 408 "line settings - %d\n", __func__, retval);
409 cypress_set_dead(port); 409 cypress_set_dead(port);
410 } else { 410 } else {
411 spin_lock_irqsave(&priv->lock, flags); 411 spin_lock_irqsave(&priv->lock, flags);
@@ -443,7 +443,8 @@ static int cypress_serial_control(struct tty_struct *tty,
443 && retval != -ENODEV); 443 && retval != -ENODEV);
444 444
445 if (retval != sizeof(feature_buffer)) { 445 if (retval != sizeof(feature_buffer)) {
446 err("%s - failed to retrieve serial line settings - %d", __func__, retval); 446 dev_err(&port->dev, "%s - failed to retrieve serial "
447 "line settings - %d\n", __func__, retval);
447 cypress_set_dead(port); 448 cypress_set_dead(port);
448 return retval; 449 return retval;
449 } else { 450 } else {
@@ -476,8 +477,8 @@ static void cypress_set_dead(struct usb_serial_port *port)
476 priv->comm_is_ok = 0; 477 priv->comm_is_ok = 0;
477 spin_unlock_irqrestore(&priv->lock, flags); 478 spin_unlock_irqrestore(&priv->lock, flags);
478 479
479 err("cypress_m8 suspending failing port %d - interval might be too short", 480 dev_err(&port->dev, "cypress_m8 suspending failing port %d - "
480 port->number); 481 "interval might be too short\n", port->number);
481} 482}
482 483
483 484
@@ -679,7 +680,8 @@ static int cypress_open(struct tty_struct *tty,
679 680
680 /* setup the port and start reading from the device */ 681 /* setup the port and start reading from the device */
681 if (!port->interrupt_in_urb) { 682 if (!port->interrupt_in_urb) {
682 err("%s - interrupt_in_urb is empty!", __func__); 683 dev_err(&port->dev, "%s - interrupt_in_urb is empty!\n",
684 __func__);
683 return -1; 685 return -1;
684 } 686 }
685 687
@@ -1107,8 +1109,8 @@ static void cypress_set_termios(struct tty_struct *tty,
1107 data_bits = 3; 1109 data_bits = 3;
1108 break; 1110 break;
1109 default: 1111 default:
1110 err("%s - CSIZE was set, but not CS5-CS8", 1112 dev_err(&port->dev, "%s - CSIZE was set, but not CS5-CS8\n",
1111 __func__); 1113 __func__);
1112 data_bits = 3; 1114 data_bits = 3;
1113 } 1115 }
1114 spin_lock_irqsave(&priv->lock, flags); 1116 spin_lock_irqsave(&priv->lock, flags);
@@ -1286,7 +1288,7 @@ static void cypress_read_int_callback(struct urb *urb)
1286 } 1288 }
1287 spin_unlock_irqrestore(&priv->lock, flags); 1289 spin_unlock_irqrestore(&priv->lock, flags);
1288 1290
1289 tty = port->port.tty; 1291 tty = tty_port_tty_get(&port->port);
1290 if (!tty) { 1292 if (!tty) {
1291 dbg("%s - bad tty pointer - exiting", __func__); 1293 dbg("%s - bad tty pointer - exiting", __func__);
1292 return; 1294 return;
@@ -1362,7 +1364,7 @@ static void cypress_read_int_callback(struct urb *urb)
1362 data[i]); 1364 data[i]);
1363 tty_insert_flip_char(tty, data[i], tty_flag); 1365 tty_insert_flip_char(tty, data[i], tty_flag);
1364 } 1366 }
1365 tty_flip_buffer_push(port->port.tty); 1367 tty_flip_buffer_push(tty);
1366 } 1368 }
1367 1369
1368 spin_lock_irqsave(&priv->lock, flags); 1370 spin_lock_irqsave(&priv->lock, flags);
@@ -1371,6 +1373,7 @@ static void cypress_read_int_callback(struct urb *urb)
1371 spin_unlock_irqrestore(&priv->lock, flags); 1373 spin_unlock_irqrestore(&priv->lock, flags);
1372 1374
1373continue_read: 1375continue_read:
1376 tty_kref_put(tty);
1374 1377
1375 /* Continue trying to always read... unless the port has closed. */ 1378 /* Continue trying to always read... unless the port has closed. */
1376 1379
@@ -1657,7 +1660,8 @@ static int __init cypress_init(void)
1657 if (retval) 1660 if (retval)
1658 goto failed_usb_register; 1661 goto failed_usb_register;
1659 1662
1660 info(DRIVER_DESC " " DRIVER_VERSION); 1663 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
1664 DRIVER_DESC "\n");
1661 return 0; 1665 return 0;
1662 1666
1663failed_usb_register: 1667failed_usb_register:
diff --git a/drivers/usb/serial/digi_acceleport.c b/drivers/usb/serial/digi_acceleport.c
index 240aad1acaab..69f84f0ea6fe 100644
--- a/drivers/usb/serial/digi_acceleport.c
+++ b/drivers/usb/serial/digi_acceleport.c
@@ -604,7 +604,9 @@ static void digi_wakeup_write_lock(struct work_struct *work)
604 604
605static void digi_wakeup_write(struct usb_serial_port *port) 605static void digi_wakeup_write(struct usb_serial_port *port)
606{ 606{
607 tty_wakeup(port->port.tty); 607 struct tty_struct *tty = tty_port_tty_get(&port->port);
608 tty_wakeup(tty);
609 tty_kref_put(tty);
608} 610}
609 611
610 612
@@ -659,7 +661,8 @@ static int digi_write_oob_command(struct usb_serial_port *port,
659 } 661 }
660 spin_unlock_irqrestore(&oob_priv->dp_port_lock, flags); 662 spin_unlock_irqrestore(&oob_priv->dp_port_lock, flags);
661 if (ret) 663 if (ret)
662 err("%s: usb_submit_urb failed, ret=%d", __func__, ret); 664 dev_err(&port->dev, "%s: usb_submit_urb failed, ret=%d\n",
665 __func__, ret);
663 return ret; 666 return ret;
664 667
665} 668}
@@ -741,7 +744,8 @@ static int digi_write_inb_command(struct usb_serial_port *port,
741 spin_unlock_irqrestore(&priv->dp_port_lock, flags); 744 spin_unlock_irqrestore(&priv->dp_port_lock, flags);
742 745
743 if (ret) 746 if (ret)
744 err("%s: usb_submit_urb failed, ret=%d, port=%d", 747 dev_err(&port->dev,
748 "%s: usb_submit_urb failed, ret=%d, port=%d\n",
745 __func__, ret, priv->dp_port_num); 749 __func__, ret, priv->dp_port_num);
746 return ret; 750 return ret;
747} 751}
@@ -810,7 +814,8 @@ static int digi_set_modem_signals(struct usb_serial_port *port,
810 spin_unlock(&port_priv->dp_port_lock); 814 spin_unlock(&port_priv->dp_port_lock);
811 spin_unlock_irqrestore(&oob_priv->dp_port_lock, flags); 815 spin_unlock_irqrestore(&oob_priv->dp_port_lock, flags);
812 if (ret) 816 if (ret)
813 err("%s: usb_submit_urb failed, ret=%d", __func__, ret); 817 dev_err(&port->dev, "%s: usb_submit_urb failed, ret=%d\n",
818 __func__, ret);
814 return ret; 819 return ret;
815} 820}
816 821
@@ -905,7 +910,8 @@ static void digi_rx_unthrottle(struct tty_struct *tty)
905 spin_unlock_irqrestore(&priv->dp_port_lock, flags); 910 spin_unlock_irqrestore(&priv->dp_port_lock, flags);
906 911
907 if (ret) 912 if (ret)
908 err("%s: usb_submit_urb failed, ret=%d, port=%d", 913 dev_err(&port->dev,
914 "%s: usb_submit_urb failed, ret=%d, port=%d\n",
909 __func__, ret, priv->dp_port_num); 915 __func__, ret, priv->dp_port_num);
910} 916}
911 917
@@ -1212,7 +1218,8 @@ static int digi_write(struct tty_struct *tty, struct usb_serial_port *port,
1212 /* return length of new data written, or error */ 1218 /* return length of new data written, or error */
1213 spin_unlock_irqrestore(&priv->dp_port_lock, flags); 1219 spin_unlock_irqrestore(&priv->dp_port_lock, flags);
1214 if (ret < 0) 1220 if (ret < 0)
1215 err("%s: usb_submit_urb failed, ret=%d, port=%d", 1221 dev_err(&port->dev,
1222 "%s: usb_submit_urb failed, ret=%d, port=%d\n",
1216 __func__, ret, priv->dp_port_num); 1223 __func__, ret, priv->dp_port_num);
1217 dbg("digi_write: returning %d", ret); 1224 dbg("digi_write: returning %d", ret);
1218 return ret; 1225 return ret;
@@ -1233,14 +1240,16 @@ static void digi_write_bulk_callback(struct urb *urb)
1233 1240
1234 /* port and serial sanity check */ 1241 /* port and serial sanity check */
1235 if (port == NULL || (priv = usb_get_serial_port_data(port)) == NULL) { 1242 if (port == NULL || (priv = usb_get_serial_port_data(port)) == NULL) {
1236 err("%s: port or port->private is NULL, status=%d", 1243 dev_err(&port->dev,
1237 __func__, status); 1244 "%s: port or port->private is NULL, status=%d\n",
1245 __func__, status);
1238 return; 1246 return;
1239 } 1247 }
1240 serial = port->serial; 1248 serial = port->serial;
1241 if (serial == NULL || (serial_priv = usb_get_serial_data(serial)) == NULL) { 1249 if (serial == NULL || (serial_priv = usb_get_serial_data(serial)) == NULL) {
1242 err("%s: serial or serial->private is NULL, status=%d", 1250 dev_err(&port->dev,
1243 __func__, status); 1251 "%s: serial or serial->private is NULL, status=%d\n",
1252 __func__, status);
1244 return; 1253 return;
1245 } 1254 }
1246 1255
@@ -1282,7 +1291,8 @@ static void digi_write_bulk_callback(struct urb *urb)
1282 1291
1283 spin_unlock(&priv->dp_port_lock); 1292 spin_unlock(&priv->dp_port_lock);
1284 if (ret) 1293 if (ret)
1285 err("%s: usb_submit_urb failed, ret=%d, port=%d", 1294 dev_err(&port->dev,
1295 "%s: usb_submit_urb failed, ret=%d, port=%d\n",
1286 __func__, ret, priv->dp_port_num); 1296 __func__, ret, priv->dp_port_num);
1287} 1297}
1288 1298
@@ -1516,8 +1526,9 @@ static int digi_startup_device(struct usb_serial *serial)
1516 port->write_urb->dev = port->serial->dev; 1526 port->write_urb->dev = port->serial->dev;
1517 ret = usb_submit_urb(port->read_urb, GFP_KERNEL); 1527 ret = usb_submit_urb(port->read_urb, GFP_KERNEL);
1518 if (ret != 0) { 1528 if (ret != 0) {
1519 err("%s: usb_submit_urb failed, ret=%d, port=%d", 1529 dev_err(&port->dev,
1520 __func__, ret, i); 1530 "%s: usb_submit_urb failed, ret=%d, port=%d\n",
1531 __func__, ret, i);
1521 break; 1532 break;
1522 } 1533 }
1523 } 1534 }
@@ -1616,22 +1627,26 @@ static void digi_read_bulk_callback(struct urb *urb)
1616 dbg("digi_read_bulk_callback: TOP"); 1627 dbg("digi_read_bulk_callback: TOP");
1617 1628
1618 /* port sanity check, do not resubmit if port is not valid */ 1629 /* port sanity check, do not resubmit if port is not valid */
1619 if (port == NULL || (priv = usb_get_serial_port_data(port)) == NULL) { 1630 if (port == NULL)
1620 err("%s: port or port->private is NULL, status=%d", 1631 return;
1621 __func__, status); 1632 priv = usb_get_serial_port_data(port);
1633 if (priv == NULL) {
1634 dev_err(&port->dev, "%s: port->private is NULL, status=%d\n",
1635 __func__, status);
1622 return; 1636 return;
1623 } 1637 }
1624 if (port->serial == NULL || 1638 if (port->serial == NULL ||
1625 (serial_priv = usb_get_serial_data(port->serial)) == NULL) { 1639 (serial_priv = usb_get_serial_data(port->serial)) == NULL) {
1626 err("%s: serial is bad or serial->private is NULL, status=%d", 1640 dev_err(&port->dev, "%s: serial is bad or serial->private "
1627 __func__, status); 1641 "is NULL, status=%d\n", __func__, status);
1628 return; 1642 return;
1629 } 1643 }
1630 1644
1631 /* do not resubmit urb if it has any status error */ 1645 /* do not resubmit urb if it has any status error */
1632 if (status) { 1646 if (status) {
1633 err("%s: nonzero read bulk status: status=%d, port=%d", 1647 dev_err(&port->dev,
1634 __func__, status, priv->dp_port_num); 1648 "%s: nonzero read bulk status: status=%d, port=%d\n",
1649 __func__, status, priv->dp_port_num);
1635 return; 1650 return;
1636 } 1651 }
1637 1652
@@ -1648,8 +1663,9 @@ static void digi_read_bulk_callback(struct urb *urb)
1648 urb->dev = port->serial->dev; 1663 urb->dev = port->serial->dev;
1649 ret = usb_submit_urb(urb, GFP_ATOMIC); 1664 ret = usb_submit_urb(urb, GFP_ATOMIC);
1650 if (ret != 0) { 1665 if (ret != 0) {
1651 err("%s: failed resubmitting urb, ret=%d, port=%d", 1666 dev_err(&port->dev,
1652 __func__, ret, priv->dp_port_num); 1667 "%s: failed resubmitting urb, ret=%d, port=%d\n",
1668 __func__, ret, priv->dp_port_num);
1653 } 1669 }
1654 1670
1655} 1671}
@@ -1668,7 +1684,7 @@ static int digi_read_inb_callback(struct urb *urb)
1668{ 1684{
1669 1685
1670 struct usb_serial_port *port = urb->context; 1686 struct usb_serial_port *port = urb->context;
1671 struct tty_struct *tty = port->port.tty; 1687 struct tty_struct *tty;
1672 struct digi_port *priv = usb_get_serial_port_data(port); 1688 struct digi_port *priv = usb_get_serial_port_data(port);
1673 int opcode = ((unsigned char *)urb->transfer_buffer)[0]; 1689 int opcode = ((unsigned char *)urb->transfer_buffer)[0];
1674 int len = ((unsigned char *)urb->transfer_buffer)[1]; 1690 int len = ((unsigned char *)urb->transfer_buffer)[1];
@@ -1685,13 +1701,15 @@ static int digi_read_inb_callback(struct urb *urb)
1685 1701
1686 /* short/multiple packet check */ 1702 /* short/multiple packet check */
1687 if (urb->actual_length != len + 2) { 1703 if (urb->actual_length != len + 2) {
1688 err("%s: INCOMPLETE OR MULTIPLE PACKET, urb->status=%d, " 1704 dev_err(&port->dev, "%s: INCOMPLETE OR MULTIPLE PACKET, "
1689 "port=%d, opcode=%d, len=%d, actual_length=%d, " 1705 "urb->status=%d, port=%d, opcode=%d, len=%d, "
1690 "status=%d", __func__, status, priv->dp_port_num, 1706 "actual_length=%d, status=%d\n", __func__, status,
1691 opcode, len, urb->actual_length, port_status); 1707 priv->dp_port_num, opcode, len, urb->actual_length,
1708 port_status);
1692 return -1; 1709 return -1;
1693 } 1710 }
1694 1711
1712 tty = tty_port_tty_get(&port->port);
1695 spin_lock(&priv->dp_port_lock); 1713 spin_lock(&priv->dp_port_lock);
1696 1714
1697 /* check for throttle; if set, do not resubmit read urb */ 1715 /* check for throttle; if set, do not resubmit read urb */
@@ -1735,6 +1753,7 @@ static int digi_read_inb_callback(struct urb *urb)
1735 } 1753 }
1736 } 1754 }
1737 spin_unlock(&priv->dp_port_lock); 1755 spin_unlock(&priv->dp_port_lock);
1756 tty_kref_put(tty);
1738 1757
1739 if (opcode == DIGI_CMD_RECEIVE_DISABLE) 1758 if (opcode == DIGI_CMD_RECEIVE_DISABLE)
1740 dbg("%s: got RECEIVE_DISABLE", __func__); 1759 dbg("%s: got RECEIVE_DISABLE", __func__);
@@ -1760,6 +1779,7 @@ static int digi_read_oob_callback(struct urb *urb)
1760 1779
1761 struct usb_serial_port *port = urb->context; 1780 struct usb_serial_port *port = urb->context;
1762 struct usb_serial *serial = port->serial; 1781 struct usb_serial *serial = port->serial;
1782 struct tty_struct *tty;
1763 struct digi_port *priv = usb_get_serial_port_data(port); 1783 struct digi_port *priv = usb_get_serial_port_data(port);
1764 int opcode, line, status, val; 1784 int opcode, line, status, val;
1765 int i; 1785 int i;
@@ -1787,10 +1807,11 @@ static int digi_read_oob_callback(struct urb *urb)
1787 if (priv == NULL) 1807 if (priv == NULL)
1788 return -1; 1808 return -1;
1789 1809
1810 tty = tty_port_tty_get(&port->port);
1790 rts = 0; 1811 rts = 0;
1791 if (port->port.count) 1812 if (port->port.count)
1792 rts = port->port.tty->termios->c_cflag & CRTSCTS; 1813 rts = tty->termios->c_cflag & CRTSCTS;
1793 1814
1794 if (opcode == DIGI_CMD_READ_INPUT_SIGNALS) { 1815 if (opcode == DIGI_CMD_READ_INPUT_SIGNALS) {
1795 spin_lock(&priv->dp_port_lock); 1816 spin_lock(&priv->dp_port_lock);
1796 /* convert from digi flags to termiox flags */ 1817 /* convert from digi flags to termiox flags */
@@ -1798,14 +1819,14 @@ static int digi_read_oob_callback(struct urb *urb)
1798 priv->dp_modem_signals |= TIOCM_CTS; 1819 priv->dp_modem_signals |= TIOCM_CTS;
1799 /* port must be open to use tty struct */ 1820 /* port must be open to use tty struct */
1800 if (rts) { 1821 if (rts) {
1801 port->port.tty->hw_stopped = 0; 1822 tty->hw_stopped = 0;
1802 digi_wakeup_write(port); 1823 digi_wakeup_write(port);
1803 } 1824 }
1804 } else { 1825 } else {
1805 priv->dp_modem_signals &= ~TIOCM_CTS; 1826 priv->dp_modem_signals &= ~TIOCM_CTS;
1806 /* port must be open to use tty struct */ 1827 /* port must be open to use tty struct */
1807 if (rts) 1828 if (rts)
1808 port->port.tty->hw_stopped = 1; 1829 tty->hw_stopped = 1;
1809 } 1830 }
1810 if (val & DIGI_READ_INPUT_SIGNALS_DSR) 1831 if (val & DIGI_READ_INPUT_SIGNALS_DSR)
1811 priv->dp_modem_signals |= TIOCM_DSR; 1832 priv->dp_modem_signals |= TIOCM_DSR;
@@ -1830,6 +1851,7 @@ static int digi_read_oob_callback(struct urb *urb)
1830 } else if (opcode == DIGI_CMD_IFLUSH_FIFO) { 1851 } else if (opcode == DIGI_CMD_IFLUSH_FIFO) {
1831 wake_up_interruptible(&priv->dp_flush_wait); 1852 wake_up_interruptible(&priv->dp_flush_wait);
1832 } 1853 }
1854 tty_kref_put(tty);
1833 } 1855 }
1834 return 0; 1856 return 0;
1835 1857
@@ -1847,7 +1869,8 @@ static int __init digi_init(void)
1847 retval = usb_register(&digi_driver); 1869 retval = usb_register(&digi_driver);
1848 if (retval) 1870 if (retval)
1849 goto failed_usb_register; 1871 goto failed_usb_register;
1850 info(DRIVER_VERSION ":" DRIVER_DESC); 1872 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
1873 DRIVER_DESC "\n");
1851 return 0; 1874 return 0;
1852failed_usb_register: 1875failed_usb_register:
1853 usb_serial_deregister(&digi_acceleport_4_device); 1876 usb_serial_deregister(&digi_acceleport_4_device);
diff --git a/drivers/usb/serial/empeg.c b/drivers/usb/serial/empeg.c
index a6ab5b58d9ca..8a69cce40b6d 100644
--- a/drivers/usb/serial/empeg.c
+++ b/drivers/usb/serial/empeg.c
@@ -33,9 +33,8 @@
33 * Moved MOD_DEC_USE_COUNT to end of empeg_close(). 33 * Moved MOD_DEC_USE_COUNT to end of empeg_close().
34 * 34 *
35 * (12/03/2000) gb 35 * (12/03/2000) gb
36 * Added port->port.tty->ldisc.set_termios(port->port.tty, NULL) to 36 * Added tty->ldisc.set_termios(port, tty, NULL) to empeg_open().
37 * empeg_open(). This notifies the tty driver that the termios have 37 * This notifies the tty driver that the termios have changed.
38 * changed.
39 * 38 *
40 * (11/13/2000) gb 39 * (11/13/2000) gb
41 * Moved tty->low_latency = 1 from empeg_read_bulk_callback() to 40 * Moved tty->low_latency = 1 from empeg_read_bulk_callback() to
@@ -354,7 +353,7 @@ static void empeg_read_bulk_callback(struct urb *urb)
354 353
355 usb_serial_debug_data(debug, &port->dev, __func__, 354 usb_serial_debug_data(debug, &port->dev, __func__,
356 urb->actual_length, data); 355 urb->actual_length, data);
357 tty = port->port.tty; 356 tty = tty_port_tty_get(&port->port);
358 357
359 if (urb->actual_length) { 358 if (urb->actual_length) {
360 tty_buffer_request_room(tty, urb->actual_length); 359 tty_buffer_request_room(tty, urb->actual_length);
@@ -362,6 +361,7 @@ static void empeg_read_bulk_callback(struct urb *urb)
362 tty_flip_buffer_push(tty); 361 tty_flip_buffer_push(tty);
363 bytes_in += urb->actual_length; 362 bytes_in += urb->actual_length;
364 } 363 }
364 tty_kref_put(tty);
365 365
366 /* Continue trying to always read */ 366 /* Continue trying to always read */
367 usb_fill_bulk_urb( 367 usb_fill_bulk_urb(
@@ -416,7 +416,7 @@ static int empeg_startup(struct usb_serial *serial)
416 dbg("%s", __func__); 416 dbg("%s", __func__);
417 417
418 if (serial->dev->actconfig->desc.bConfigurationValue != 1) { 418 if (serial->dev->actconfig->desc.bConfigurationValue != 1) {
419 err("active config #%d != 1 ??", 419 dev_err(&serial->dev->dev, "active config #%d != 1 ??\n",
420 serial->dev->actconfig->desc.bConfigurationValue); 420 serial->dev->actconfig->desc.bConfigurationValue);
421 return -ENODEV; 421 return -ENODEV;
422 } 422 }
@@ -499,15 +499,15 @@ static int __init empeg_init(void)
499 urb = usb_alloc_urb(0, GFP_KERNEL); 499 urb = usb_alloc_urb(0, GFP_KERNEL);
500 write_urb_pool[i] = urb; 500 write_urb_pool[i] = urb;
501 if (urb == NULL) { 501 if (urb == NULL) {
502 err("No more urbs???"); 502 printk(KERN_ERR "empeg: No more urbs???\n");
503 continue; 503 continue;
504 } 504 }
505 505
506 urb->transfer_buffer = kmalloc(URB_TRANSFER_BUFFER_SIZE, 506 urb->transfer_buffer = kmalloc(URB_TRANSFER_BUFFER_SIZE,
507 GFP_KERNEL); 507 GFP_KERNEL);
508 if (!urb->transfer_buffer) { 508 if (!urb->transfer_buffer) {
509 err("%s - out of memory for urb buffers.", 509 printk(KERN_ERR "empeg: %s - out of memory for urb "
510 __func__); 510 "buffers.", __func__);
511 continue; 511 continue;
512 } 512 }
513 } 513 }
@@ -519,7 +519,8 @@ static int __init empeg_init(void)
519 if (retval) 519 if (retval)
520 goto failed_usb_register; 520 goto failed_usb_register;
521 521
522 info(DRIVER_VERSION ":" DRIVER_DESC); 522 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
523 DRIVER_DESC "\n");
523 524
524 return 0; 525 return 0;
525failed_usb_register: 526failed_usb_register:
diff --git a/drivers/usb/serial/ezusb.c b/drivers/usb/serial/ezusb.c
index 711e84f6ed82..3cfc762f5056 100644
--- a/drivers/usb/serial/ezusb.c
+++ b/drivers/usb/serial/ezusb.c
@@ -28,7 +28,8 @@ int ezusb_writememory(struct usb_serial *serial, int address,
28 28
29 /* dbg("ezusb_writememory %x, %d", address, length); */ 29 /* dbg("ezusb_writememory %x, %d", address, length); */
30 if (!serial->dev) { 30 if (!serial->dev) {
31 err("%s - no physical device present, failing.", __func__); 31 printk(KERN_ERR "ezusb: %s - no physical device present, "
32 "failing.\n", __func__);
32 return -ENODEV; 33 return -ENODEV;
33 } 34 }
34 35
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 3dc93b542b30..51d7bdea2869 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -578,6 +578,7 @@ static struct usb_device_id id_table_combined [] = {
578 { USB_DEVICE(FALCOM_VID, FALCOM_TWIST_PID) }, 578 { USB_DEVICE(FALCOM_VID, FALCOM_TWIST_PID) },
579 { USB_DEVICE(FALCOM_VID, FALCOM_SAMBA_PID) }, 579 { USB_DEVICE(FALCOM_VID, FALCOM_SAMBA_PID) },
580 { USB_DEVICE(FTDI_VID, FTDI_SUUNTO_SPORTS_PID) }, 580 { USB_DEVICE(FTDI_VID, FTDI_SUUNTO_SPORTS_PID) },
581 { USB_DEVICE(FTDI_VID, FTDI_OCEANIC_PID) },
581 { USB_DEVICE(TTI_VID, TTI_QL355P_PID) }, 582 { USB_DEVICE(TTI_VID, TTI_QL355P_PID) },
582 { USB_DEVICE(FTDI_VID, FTDI_RM_CANVIEW_PID) }, 583 { USB_DEVICE(FTDI_VID, FTDI_RM_CANVIEW_PID) },
583 { USB_DEVICE(BANDB_VID, BANDB_USOTL4_PID) }, 584 { USB_DEVICE(BANDB_VID, BANDB_USOTL4_PID) },
@@ -860,7 +861,7 @@ static int update_mctrl(struct usb_serial_port *port, unsigned int set,
860 861
861 kfree(buf); 862 kfree(buf);
862 if (rv < 0) { 863 if (rv < 0) {
863 err("%s Error from MODEM_CTRL urb: DTR %s, RTS %s", 864 dbg("%s Error from MODEM_CTRL urb: DTR %s, RTS %s",
864 __func__, 865 __func__,
865 (set & TIOCM_DTR) ? "HIGH" : 866 (set & TIOCM_DTR) ? "HIGH" :
866 (clear & TIOCM_DTR) ? "LOW" : "unchanged", 867 (clear & TIOCM_DTR) ? "LOW" : "unchanged",
@@ -1153,7 +1154,7 @@ static void ftdi_determine_type(struct usb_serial_port *port)
1153 /* Assume its an FT232R */ 1154 /* Assume its an FT232R */
1154 priv->chip_type = FT232RL; 1155 priv->chip_type = FT232RL;
1155 } 1156 }
1156 info("Detected %s", ftdi_chip_name[priv->chip_type]); 1157 dev_info(&udev->dev, "Detected %s\n", ftdi_chip_name[priv->chip_type]);
1157} 1158}
1158 1159
1159 1160
@@ -1326,7 +1327,7 @@ static int ftdi_sio_port_probe(struct usb_serial_port *port)
1326 1327
1327 priv = kzalloc(sizeof(struct ftdi_private), GFP_KERNEL); 1328 priv = kzalloc(sizeof(struct ftdi_private), GFP_KERNEL);
1328 if (!priv) { 1329 if (!priv) {
1329 err("%s- kmalloc(%Zd) failed.", __func__, 1330 dev_err(&port->dev, "%s- kmalloc(%Zd) failed.\n", __func__,
1330 sizeof(struct ftdi_private)); 1331 sizeof(struct ftdi_private));
1331 return -ENOMEM; 1332 return -ENOMEM;
1332 } 1333 }
@@ -1409,7 +1410,8 @@ static int ftdi_jtag_probe(struct usb_serial *serial)
1409 dbg("%s", __func__); 1410 dbg("%s", __func__);
1410 1411
1411 if (interface == udev->actconfig->interface[0]) { 1412 if (interface == udev->actconfig->interface[0]) {
1412 info("Ignoring serial port reserved for JTAG"); 1413 dev_info(&udev->dev,
1414 "Ignoring serial port reserved for JTAG\n");
1413 return -ENODEV; 1415 return -ENODEV;
1414 } 1416 }
1415 1417
@@ -1427,7 +1429,8 @@ static int ftdi_mtxorb_hack_setup(struct usb_serial *serial)
1427 1429
1428 if (ep->enabled && ep_desc->wMaxPacketSize == 0) { 1430 if (ep->enabled && ep_desc->wMaxPacketSize == 0) {
1429 ep_desc->wMaxPacketSize = cpu_to_le16(0x40); 1431 ep_desc->wMaxPacketSize = cpu_to_le16(0x40);
1430 info("Fixing invalid wMaxPacketSize on read pipe"); 1432 dev_info(&serial->dev->dev,
1433 "Fixing invalid wMaxPacketSize on read pipe\n");
1431 } 1434 }
1432 1435
1433 return 0; 1436 return 0;
@@ -1521,8 +1524,9 @@ static int ftdi_open(struct tty_struct *tty,
1521 ftdi_read_bulk_callback, port); 1524 ftdi_read_bulk_callback, port);
1522 result = usb_submit_urb(port->read_urb, GFP_KERNEL); 1525 result = usb_submit_urb(port->read_urb, GFP_KERNEL);
1523 if (result) 1526 if (result)
1524 err("%s - failed submitting read urb, error %d", 1527 dev_err(&port->dev,
1525 __func__, result); 1528 "%s - failed submitting read urb, error %d\n",
1529 __func__, result);
1526 1530
1527 1531
1528 return result; 1532 return result;
@@ -1556,7 +1560,7 @@ static void ftdi_close(struct tty_struct *tty,
1556 FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE, 1560 FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE,
1557 0, priv->interface, buf, 0, 1561 0, priv->interface, buf, 0,
1558 WDR_TIMEOUT) < 0) { 1562 WDR_TIMEOUT) < 0) {
1559 err("error from flowcontrol urb"); 1563 dev_err(&port->dev, "error from flowcontrol urb\n");
1560 } 1564 }
1561 1565
1562 /* drop RTS and DTR */ 1566 /* drop RTS and DTR */
@@ -1621,14 +1625,15 @@ static int ftdi_write(struct tty_struct *tty, struct usb_serial_port *port,
1621 1625
1622 buffer = kmalloc(transfer_size, GFP_ATOMIC); 1626 buffer = kmalloc(transfer_size, GFP_ATOMIC);
1623 if (!buffer) { 1627 if (!buffer) {
1624 err("%s ran out of kernel memory for urb ...", __func__); 1628 dev_err(&port->dev,
1629 "%s ran out of kernel memory for urb ...\n", __func__);
1625 count = -ENOMEM; 1630 count = -ENOMEM;
1626 goto error_no_buffer; 1631 goto error_no_buffer;
1627 } 1632 }
1628 1633
1629 urb = usb_alloc_urb(0, GFP_ATOMIC); 1634 urb = usb_alloc_urb(0, GFP_ATOMIC);
1630 if (!urb) { 1635 if (!urb) {
1631 err("%s - no more free urbs", __func__); 1636 dev_err(&port->dev, "%s - no more free urbs\n", __func__);
1632 count = -ENOMEM; 1637 count = -ENOMEM;
1633 goto error_no_urb; 1638 goto error_no_urb;
1634 } 1639 }
@@ -1672,8 +1677,9 @@ static int ftdi_write(struct tty_struct *tty, struct usb_serial_port *port,
1672 1677
1673 status = usb_submit_urb(urb, GFP_ATOMIC); 1678 status = usb_submit_urb(urb, GFP_ATOMIC);
1674 if (status) { 1679 if (status) {
1675 err("%s - failed submitting write urb, error %d", 1680 dev_err(&port->dev,
1676 __func__, status); 1681 "%s - failed submitting write urb, error %d\n",
1682 __func__, status);
1677 count = status; 1683 count = status;
1678 goto error; 1684 goto error;
1679 } else { 1685 } else {
@@ -1780,7 +1786,8 @@ static int ftdi_chars_in_buffer(struct tty_struct *tty)
1780 buffered = (int)priv->tx_outstanding_bytes; 1786 buffered = (int)priv->tx_outstanding_bytes;
1781 spin_unlock_irqrestore(&priv->tx_lock, flags); 1787 spin_unlock_irqrestore(&priv->tx_lock, flags);
1782 if (buffered < 0) { 1788 if (buffered < 0) {
1783 err("%s outstanding tx bytes is negative!", __func__); 1789 dev_err(&port->dev, "%s outstanding tx bytes is negative!\n",
1790 __func__);
1784 buffered = 0; 1791 buffered = 0;
1785 } 1792 }
1786 return buffered; 1793 return buffered;
@@ -1796,11 +1803,12 @@ static void ftdi_read_bulk_callback(struct urb *urb)
1796 int status = urb->status; 1803 int status = urb->status;
1797 1804
1798 if (urb->number_of_packets > 0) { 1805 if (urb->number_of_packets > 0) {
1799 err("%s transfer_buffer_length %d actual_length %d number of packets %d", 1806 dev_err(&port->dev, "%s transfer_buffer_length %d "
1800 __func__, 1807 "actual_length %d number of packets %d\n", __func__,
1801 urb->transfer_buffer_length, 1808 urb->transfer_buffer_length,
1802 urb->actual_length, urb->number_of_packets); 1809 urb->actual_length, urb->number_of_packets);
1803 err("%s transfer_flags %x ", __func__, urb->transfer_flags); 1810 dev_err(&port->dev, "%s transfer_flags %x\n", __func__,
1811 urb->transfer_flags);
1804 } 1812 }
1805 1813
1806 dbg("%s - port %d", __func__, port->number); 1814 dbg("%s - port %d", __func__, port->number);
@@ -1808,7 +1816,7 @@ static void ftdi_read_bulk_callback(struct urb *urb)
1808 if (port->port.count <= 0) 1816 if (port->port.count <= 0)
1809 return; 1817 return;
1810 1818
1811 tty = port->port.tty; 1819 tty = tty_port_tty_get(&port->port);
1812 if (!tty) { 1820 if (!tty) {
1813 dbg("%s - bad tty pointer - exiting", __func__); 1821 dbg("%s - bad tty pointer - exiting", __func__);
1814 return; 1822 return;
@@ -1817,17 +1825,17 @@ static void ftdi_read_bulk_callback(struct urb *urb)
1817 priv = usb_get_serial_port_data(port); 1825 priv = usb_get_serial_port_data(port);
1818 if (!priv) { 1826 if (!priv) {
1819 dbg("%s - bad port private data pointer - exiting", __func__); 1827 dbg("%s - bad port private data pointer - exiting", __func__);
1820 return; 1828 goto out;
1821 } 1829 }
1822 1830
1823 if (urb != port->read_urb) 1831 if (urb != port->read_urb)
1824 err("%s - Not my urb!", __func__); 1832 dev_err(&port->dev, "%s - Not my urb!\n", __func__);
1825 1833
1826 if (status) { 1834 if (status) {
1827 /* This will happen at close every time so it is a dbg not an 1835 /* This will happen at close every time so it is a dbg not an
1828 err */ 1836 err */
1829 dbg("(this is ok on close) nonzero read bulk status received: %d", status); 1837 dbg("(this is ok on close) nonzero read bulk status received: %d", status);
1830 return; 1838 goto out;
1831 } 1839 }
1832 1840
1833 /* count data bytes, but not status bytes */ 1841 /* count data bytes, but not status bytes */
@@ -1838,7 +1846,8 @@ static void ftdi_read_bulk_callback(struct urb *urb)
1838 spin_unlock_irqrestore(&priv->rx_lock, flags); 1846 spin_unlock_irqrestore(&priv->rx_lock, flags);
1839 1847
1840 ftdi_process_read(&priv->rx_work.work); 1848 ftdi_process_read(&priv->rx_work.work);
1841 1849out:
1850 tty_kref_put(tty);
1842} /* ftdi_read_bulk_callback */ 1851} /* ftdi_read_bulk_callback */
1843 1852
1844 1853
@@ -1863,7 +1872,7 @@ static void ftdi_process_read(struct work_struct *work)
1863 if (port->port.count <= 0) 1872 if (port->port.count <= 0)
1864 return; 1873 return;
1865 1874
1866 tty = port->port.tty; 1875 tty = tty_port_tty_get(&port->port);
1867 if (!tty) { 1876 if (!tty) {
1868 dbg("%s - bad tty pointer - exiting", __func__); 1877 dbg("%s - bad tty pointer - exiting", __func__);
1869 return; 1878 return;
@@ -1872,13 +1881,13 @@ static void ftdi_process_read(struct work_struct *work)
1872 priv = usb_get_serial_port_data(port); 1881 priv = usb_get_serial_port_data(port);
1873 if (!priv) { 1882 if (!priv) {
1874 dbg("%s - bad port private data pointer - exiting", __func__); 1883 dbg("%s - bad port private data pointer - exiting", __func__);
1875 return; 1884 goto out;
1876 } 1885 }
1877 1886
1878 urb = port->read_urb; 1887 urb = port->read_urb;
1879 if (!urb) { 1888 if (!urb) {
1880 dbg("%s - bad read_urb pointer - exiting", __func__); 1889 dbg("%s - bad read_urb pointer - exiting", __func__);
1881 return; 1890 goto out;
1882 } 1891 }
1883 1892
1884 data = urb->transfer_buffer; 1893 data = urb->transfer_buffer;
@@ -1923,7 +1932,8 @@ static void ftdi_process_read(struct work_struct *work)
1923 1932
1924 length = min(PKTSZ, urb->actual_length-packet_offset)-2; 1933 length = min(PKTSZ, urb->actual_length-packet_offset)-2;
1925 if (length < 0) { 1934 if (length < 0) {
1926 err("%s - bad packet length: %d", __func__, length+2); 1935 dev_err(&port->dev, "%s - bad packet length: %d\n",
1936 __func__, length+2);
1927 length = 0; 1937 length = 0;
1928 } 1938 }
1929 1939
@@ -2020,7 +2030,7 @@ static void ftdi_process_read(struct work_struct *work)
2020 schedule_delayed_work(&priv->rx_work, 1); 2030 schedule_delayed_work(&priv->rx_work, 1);
2021 else 2031 else
2022 dbg("%s - port is closed", __func__); 2032 dbg("%s - port is closed", __func__);
2023 return; 2033 goto out;
2024 } 2034 }
2025 2035
2026 /* urb is completely processed */ 2036 /* urb is completely processed */
@@ -2038,9 +2048,12 @@ static void ftdi_process_read(struct work_struct *work)
2038 2048
2039 result = usb_submit_urb(port->read_urb, GFP_ATOMIC); 2049 result = usb_submit_urb(port->read_urb, GFP_ATOMIC);
2040 if (result) 2050 if (result)
2041 err("%s - failed resubmitting read urb, error %d", 2051 dev_err(&port->dev,
2042 __func__, result); 2052 "%s - failed resubmitting read urb, error %d\n",
2053 __func__, result);
2043 } 2054 }
2055out:
2056 tty_kref_put(tty);
2044} /* ftdi_process_read */ 2057} /* ftdi_process_read */
2045 2058
2046 2059
@@ -2066,8 +2079,8 @@ static void ftdi_break_ctl(struct tty_struct *tty, int break_state)
2066 FTDI_SIO_SET_DATA_REQUEST_TYPE, 2079 FTDI_SIO_SET_DATA_REQUEST_TYPE,
2067 urb_value , priv->interface, 2080 urb_value , priv->interface,
2068 buf, 0, WDR_TIMEOUT) < 0) { 2081 buf, 0, WDR_TIMEOUT) < 0) {
2069 err("%s FAILED to enable/disable break state (state was %d)", 2082 dev_err(&port->dev, "%s FAILED to enable/disable break state "
2070 __func__, break_state); 2083 "(state was %d)\n", __func__, break_state);
2071 } 2084 }
2072 2085
2073 dbg("%s break state is %d - urb is %d", __func__, 2086 dbg("%s break state is %d - urb is %d", __func__,
@@ -2139,7 +2152,7 @@ static void ftdi_set_termios(struct tty_struct *tty,
2139 case CS7: urb_value |= 7; dbg("Setting CS7"); break; 2152 case CS7: urb_value |= 7; dbg("Setting CS7"); break;
2140 case CS8: urb_value |= 8; dbg("Setting CS8"); break; 2153 case CS8: urb_value |= 8; dbg("Setting CS8"); break;
2141 default: 2154 default:
2142 err("CSIZE was set but not CS5-CS8"); 2155 dev_err(&port->dev, "CSIZE was set but not CS5-CS8\n");
2143 } 2156 }
2144 } 2157 }
2145 2158
@@ -2152,7 +2165,8 @@ static void ftdi_set_termios(struct tty_struct *tty,
2152 FTDI_SIO_SET_DATA_REQUEST_TYPE, 2165 FTDI_SIO_SET_DATA_REQUEST_TYPE,
2153 urb_value , priv->interface, 2166 urb_value , priv->interface,
2154 buf, 0, WDR_SHORT_TIMEOUT) < 0) { 2167 buf, 0, WDR_SHORT_TIMEOUT) < 0) {
2155 err("%s FAILED to set databits/stopbits/parity", __func__); 2168 dev_err(&port->dev, "%s FAILED to set "
2169 "databits/stopbits/parity\n", __func__);
2156 } 2170 }
2157 2171
2158 /* Now do the baudrate */ 2172 /* Now do the baudrate */
@@ -2163,14 +2177,17 @@ static void ftdi_set_termios(struct tty_struct *tty,
2163 FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE, 2177 FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE,
2164 0, priv->interface, 2178 0, priv->interface,
2165 buf, 0, WDR_TIMEOUT) < 0) { 2179 buf, 0, WDR_TIMEOUT) < 0) {
2166 err("%s error from disable flowcontrol urb", __func__); 2180 dev_err(&port->dev,
2181 "%s error from disable flowcontrol urb\n",
2182 __func__);
2167 } 2183 }
2168 /* Drop RTS and DTR */ 2184 /* Drop RTS and DTR */
2169 clear_mctrl(port, TIOCM_DTR | TIOCM_RTS); 2185 clear_mctrl(port, TIOCM_DTR | TIOCM_RTS);
2170 } else { 2186 } else {
2171 /* set the baudrate determined before */ 2187 /* set the baudrate determined before */
2172 if (change_speed(tty, port)) 2188 if (change_speed(tty, port))
2173 err("%s urb failed to set baudrate", __func__); 2189 dev_err(&port->dev, "%s urb failed to set baudrate\n",
2190 __func__);
2174 /* Ensure RTS and DTR are raised when baudrate changed from 0 */ 2191 /* Ensure RTS and DTR are raised when baudrate changed from 0 */
2175 if (!old_termios || (old_termios->c_cflag & CBAUD) == B0) 2192 if (!old_termios || (old_termios->c_cflag & CBAUD) == B0)
2176 set_mctrl(port, TIOCM_DTR | TIOCM_RTS); 2193 set_mctrl(port, TIOCM_DTR | TIOCM_RTS);
@@ -2186,7 +2203,8 @@ static void ftdi_set_termios(struct tty_struct *tty,
2186 FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE, 2203 FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE,
2187 0 , (FTDI_SIO_RTS_CTS_HS | priv->interface), 2204 0 , (FTDI_SIO_RTS_CTS_HS | priv->interface),
2188 buf, 0, WDR_TIMEOUT) < 0) { 2205 buf, 0, WDR_TIMEOUT) < 0) {
2189 err("urb failed to set to rts/cts flow control"); 2206 dev_err(&port->dev,
2207 "urb failed to set to rts/cts flow control\n");
2190 } 2208 }
2191 2209
2192 } else { 2210 } else {
@@ -2217,7 +2235,8 @@ static void ftdi_set_termios(struct tty_struct *tty,
2217 urb_value , (FTDI_SIO_XON_XOFF_HS 2235 urb_value , (FTDI_SIO_XON_XOFF_HS
2218 | priv->interface), 2236 | priv->interface),
2219 buf, 0, WDR_TIMEOUT) < 0) { 2237 buf, 0, WDR_TIMEOUT) < 0) {
2220 err("urb failed to set to xon/xoff flow control"); 2238 dev_err(&port->dev, "urb failed to set to "
2239 "xon/xoff flow control\n");
2221 } 2240 }
2222 } else { 2241 } else {
2223 /* else clause to only run if cflag ! CRTSCTS and iflag 2242 /* else clause to only run if cflag ! CRTSCTS and iflag
@@ -2230,7 +2249,8 @@ static void ftdi_set_termios(struct tty_struct *tty,
2230 FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE, 2249 FTDI_SIO_SET_FLOW_CTRL_REQUEST_TYPE,
2231 0, priv->interface, 2250 0, priv->interface,
2232 buf, 0, WDR_TIMEOUT) < 0) { 2251 buf, 0, WDR_TIMEOUT) < 0) {
2233 err("urb failed to clear flow control"); 2252 dev_err(&port->dev,
2253 "urb failed to clear flow control\n");
2234 } 2254 }
2235 } 2255 }
2236 2256
@@ -2256,7 +2276,7 @@ static int ftdi_tiocmget(struct tty_struct *tty, struct file *file)
2256 0, 0, 2276 0, 0,
2257 buf, 1, WDR_TIMEOUT); 2277 buf, 1, WDR_TIMEOUT);
2258 if (ret < 0) { 2278 if (ret < 0) {
2259 err("%s Could not get modem status of device - err: %d", __func__, 2279 dbg("%s Could not get modem status of device - err: %d", __func__,
2260 ret); 2280 ret);
2261 return ret; 2281 return ret;
2262 } 2282 }
@@ -2275,7 +2295,7 @@ static int ftdi_tiocmget(struct tty_struct *tty, struct file *file)
2275 0, priv->interface, 2295 0, priv->interface,
2276 buf, 2, WDR_TIMEOUT); 2296 buf, 2, WDR_TIMEOUT);
2277 if (ret < 0) { 2297 if (ret < 0) {
2278 err("%s Could not get modem status of device - err: %d", __func__, 2298 dbg("%s Could not get modem status of device - err: %d", __func__,
2279 ret); 2299 ret);
2280 return ret; 2300 return ret;
2281 } 2301 }
@@ -2422,7 +2442,8 @@ static int __init ftdi_init(void)
2422 if (retval) 2442 if (retval)
2423 goto failed_usb_register; 2443 goto failed_usb_register;
2424 2444
2425 info(DRIVER_VERSION ":" DRIVER_DESC); 2445 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
2446 DRIVER_DESC "\n");
2426 return 0; 2447 return 0;
2427failed_usb_register: 2448failed_usb_register:
2428 usb_serial_deregister(&ftdi_sio_device); 2449 usb_serial_deregister(&ftdi_sio_device);
@@ -2455,5 +2476,5 @@ module_param(vendor, ushort, 0);
2455MODULE_PARM_DESC(vendor, "User specified vendor ID (default=" 2476MODULE_PARM_DESC(vendor, "User specified vendor ID (default="
2456 __MODULE_STRING(FTDI_VID)")"); 2477 __MODULE_STRING(FTDI_VID)")");
2457module_param(product, ushort, 0); 2478module_param(product, ushort, 0);
2458MODULE_PARM_DESC(vendor, "User specified product ID"); 2479MODULE_PARM_DESC(product, "User specified product ID");
2459 2480
diff --git a/drivers/usb/serial/ftdi_sio.h b/drivers/usb/serial/ftdi_sio.h
index 8a5b6df3a976..07a3992abad2 100644
--- a/drivers/usb/serial/ftdi_sio.h
+++ b/drivers/usb/serial/ftdi_sio.h
@@ -628,6 +628,11 @@
628#define FTDI_SUUNTO_SPORTS_PID 0xF680 /* Suunto Sports instrument */ 628#define FTDI_SUUNTO_SPORTS_PID 0xF680 /* Suunto Sports instrument */
629 629
630/* 630/*
631 * Oceanic product ids
632 */
633#define FTDI_OCEANIC_PID 0xF460 /* Oceanic dive instrument */
634
635/*
631 * TTi (Thurlby Thandar Instruments) 636 * TTi (Thurlby Thandar Instruments)
632 */ 637 */
633#define TTI_VID 0x103E /* Vendor Id */ 638#define TTI_VID 0x103E /* Vendor Id */
diff --git a/drivers/usb/serial/garmin_gps.c b/drivers/usb/serial/garmin_gps.c
index d95382088075..8e6a66e38db2 100644
--- a/drivers/usb/serial/garmin_gps.c
+++ b/drivers/usb/serial/garmin_gps.c
@@ -276,7 +276,7 @@ static inline int isAbortTrfCmnd(const unsigned char *buf)
276static void send_to_tty(struct usb_serial_port *port, 276static void send_to_tty(struct usb_serial_port *port,
277 char *data, unsigned int actual_length) 277 char *data, unsigned int actual_length)
278{ 278{
279 struct tty_struct *tty = port->port.tty; 279 struct tty_struct *tty = tty_port_tty_get(&port->port);
280 280
281 if (tty && actual_length) { 281 if (tty && actual_length) {
282 282
@@ -287,6 +287,7 @@ static void send_to_tty(struct usb_serial_port *port,
287 tty_insert_flip_string(tty, data, actual_length); 287 tty_insert_flip_string(tty, data, actual_length);
288 tty_flip_buffer_push(tty); 288 tty_flip_buffer_push(tty);
289 } 289 }
290 tty_kref_put(tty);
290} 291}
291 292
292 293
@@ -1584,7 +1585,8 @@ static int __init garmin_init(void)
1584 retval = usb_register(&garmin_driver); 1585 retval = usb_register(&garmin_driver);
1585 if (retval) 1586 if (retval)
1586 goto failed_usb_register; 1587 goto failed_usb_register;
1587 info(DRIVER_DESC " " DRIVER_VERSION); 1588 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
1589 DRIVER_DESC "\n");
1588 1590
1589 return 0; 1591 return 0;
1590failed_usb_register: 1592failed_usb_register:
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c
index fe84c88ec20c..814909f1ee63 100644
--- a/drivers/usb/serial/generic.c
+++ b/drivers/usb/serial/generic.c
@@ -330,7 +330,7 @@ static void resubmit_read_urb(struct usb_serial_port *port, gfp_t mem_flags)
330static void flush_and_resubmit_read_urb(struct usb_serial_port *port) 330static void flush_and_resubmit_read_urb(struct usb_serial_port *port)
331{ 331{
332 struct urb *urb = port->read_urb; 332 struct urb *urb = port->read_urb;
333 struct tty_struct *tty = port->port.tty; 333 struct tty_struct *tty = tty_port_tty_get(&port->port);
334 int room; 334 int room;
335 335
336 /* Push data to tty */ 336 /* Push data to tty */
@@ -341,6 +341,7 @@ static void flush_and_resubmit_read_urb(struct usb_serial_port *port)
341 tty_flip_buffer_push(tty); 341 tty_flip_buffer_push(tty);
342 } 342 }
343 } 343 }
344 tty_kref_put(tty);
344 345
345 resubmit_read_urb(port, GFP_ATOMIC); 346 resubmit_read_urb(port, GFP_ATOMIC);
346} 347}
diff --git a/drivers/usb/serial/hp4x.c b/drivers/usb/serial/hp4x.c
index ab905869e959..431329275133 100644
--- a/drivers/usb/serial/hp4x.c
+++ b/drivers/usb/serial/hp4x.c
@@ -63,7 +63,8 @@ static int __init hp49gp_init(void)
63 retval = usb_register(&hp49gp_driver); 63 retval = usb_register(&hp49gp_driver);
64 if (retval) 64 if (retval)
65 goto failed_usb_register; 65 goto failed_usb_register;
66 info(DRIVER_DESC " " DRIVER_VERSION); 66 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
67 DRIVER_DESC "\n");
67 return 0; 68 return 0;
68failed_usb_register: 69failed_usb_register:
69 usb_serial_deregister(&hp49gp_device); 70 usb_serial_deregister(&hp49gp_device);
diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c
index bfa508ddb0fe..e85c8c0d1ad9 100644
--- a/drivers/usb/serial/io_edgeport.c
+++ b/drivers/usb/serial/io_edgeport.c
@@ -600,6 +600,7 @@ static void edge_interrupt_callback(struct urb *urb)
600 struct edgeport_serial *edge_serial = urb->context; 600 struct edgeport_serial *edge_serial = urb->context;
601 struct edgeport_port *edge_port; 601 struct edgeport_port *edge_port;
602 struct usb_serial_port *port; 602 struct usb_serial_port *port;
603 struct tty_struct *tty;
603 unsigned char *data = urb->transfer_buffer; 604 unsigned char *data = urb->transfer_buffer;
604 int length = urb->actual_length; 605 int length = urb->actual_length;
605 int bytes_avail; 606 int bytes_avail;
@@ -675,9 +676,12 @@ static void edge_interrupt_callback(struct urb *urb)
675 676
676 /* tell the tty driver that something 677 /* tell the tty driver that something
677 has changed */ 678 has changed */
678 if (edge_port->port->port.tty) 679 tty = tty_port_tty_get(
679 tty_wakeup(edge_port->port->port.tty); 680 &edge_port->port->port);
680 681 if (tty) {
682 tty_wakeup(tty);
683 tty_kref_put(tty);
684 }
681 /* Since we have more credit, check 685 /* Since we have more credit, check
682 if more data can be sent */ 686 if more data can be sent */
683 send_more_port_data(edge_serial, 687 send_more_port_data(edge_serial,
@@ -778,13 +782,14 @@ static void edge_bulk_out_data_callback(struct urb *urb)
778 __func__, status); 782 __func__, status);
779 } 783 }
780 784
781 tty = edge_port->port->port.tty; 785 tty = tty_port_tty_get(&edge_port->port->port);
782 786
783 if (tty && edge_port->open) { 787 if (tty && edge_port->open) {
784 /* let the tty driver wakeup if it has a special 788 /* let the tty driver wakeup if it has a special
785 write_wakeup function */ 789 write_wakeup function */
786 tty_wakeup(tty); 790 tty_wakeup(tty);
787 } 791 }
792 tty_kref_put(tty);
788 793
789 /* Release the Write URB */ 794 /* Release the Write URB */
790 edge_port->write_in_progress = false; 795 edge_port->write_in_progress = false;
@@ -826,11 +831,12 @@ static void edge_bulk_out_cmd_callback(struct urb *urb)
826 } 831 }
827 832
828 /* Get pointer to tty */ 833 /* Get pointer to tty */
829 tty = edge_port->port->port.tty; 834 tty = tty_port_tty_get(&edge_port->port->port);
830 835
831 /* tell the tty driver that something has changed */ 836 /* tell the tty driver that something has changed */
832 if (tty && edge_port->open) 837 if (tty && edge_port->open)
833 tty_wakeup(tty); 838 tty_wakeup(tty);
839 tty_kref_put(tty);
834 840
835 /* we have completed the command */ 841 /* we have completed the command */
836 edge_port->commandPending = false; 842 edge_port->commandPending = false;
@@ -1932,11 +1938,13 @@ static void process_rcvd_data(struct edgeport_serial *edge_serial,
1932 edge_serial->rxPort]; 1938 edge_serial->rxPort];
1933 edge_port = usb_get_serial_port_data(port); 1939 edge_port = usb_get_serial_port_data(port);
1934 if (edge_port->open) { 1940 if (edge_port->open) {
1935 tty = edge_port->port->port.tty; 1941 tty = tty_port_tty_get(
1942 &edge_port->port->port);
1936 if (tty) { 1943 if (tty) {
1937 dbg("%s - Sending %d bytes to TTY for port %d", 1944 dbg("%s - Sending %d bytes to TTY for port %d",
1938 __func__, rxLen, edge_serial->rxPort); 1945 __func__, rxLen, edge_serial->rxPort);
1939 edge_tty_recv(&edge_serial->serial->dev->dev, tty, buffer, rxLen); 1946 edge_tty_recv(&edge_serial->serial->dev->dev, tty, buffer, rxLen);
1947 tty_kref_put(tty);
1940 } 1948 }
1941 edge_port->icount.rx += rxLen; 1949 edge_port->icount.rx += rxLen;
1942 } 1950 }
@@ -1971,6 +1979,7 @@ static void process_rcvd_status(struct edgeport_serial *edge_serial,
1971{ 1979{
1972 struct usb_serial_port *port; 1980 struct usb_serial_port *port;
1973 struct edgeport_port *edge_port; 1981 struct edgeport_port *edge_port;
1982 struct tty_struct *tty;
1974 __u8 code = edge_serial->rxStatusCode; 1983 __u8 code = edge_serial->rxStatusCode;
1975 1984
1976 /* switch the port pointer to the one being currently talked about */ 1985 /* switch the port pointer to the one being currently talked about */
@@ -2020,10 +2029,12 @@ static void process_rcvd_status(struct edgeport_serial *edge_serial,
2020 2029
2021 /* send the current line settings to the port so we are 2030 /* send the current line settings to the port so we are
2022 in sync with any further termios calls */ 2031 in sync with any further termios calls */
2023 /* FIXME: locking on tty */ 2032 tty = tty_port_tty_get(&edge_port->port->port);
2024 if (edge_port->port->port.tty) 2033 if (tty) {
2025 change_port_settings(edge_port->port->port.tty, 2034 change_port_settings(tty,
2026 edge_port, edge_port->port->port.tty->termios); 2035 edge_port, tty->termios);
2036 tty_kref_put(tty);
2037 }
2027 2038
2028 /* we have completed the open */ 2039 /* we have completed the open */
2029 edge_port->openPending = false; 2040 edge_port->openPending = false;
@@ -2163,10 +2174,14 @@ static void handle_new_lsr(struct edgeport_port *edge_port, __u8 lsrData,
2163 } 2174 }
2164 2175
2165 /* Place LSR data byte into Rx buffer */ 2176 /* Place LSR data byte into Rx buffer */
2166 if (lsrData && edge_port->port->port.tty) 2177 if (lsrData) {
2167 edge_tty_recv(&edge_port->port->dev, 2178 struct tty_struct *tty =
2168 edge_port->port->port.tty, &data, 1); 2179 tty_port_tty_get(&edge_port->port->port);
2169 2180 if (tty) {
2181 edge_tty_recv(&edge_port->port->dev, tty, &data, 1);
2182 tty_kref_put(tty);
2183 }
2184 }
2170 /* update input line counters */ 2185 /* update input line counters */
2171 icount = &edge_port->icount; 2186 icount = &edge_port->icount;
2172 if (newLsr & LSR_BREAK) 2187 if (newLsr & LSR_BREAK)
@@ -3094,13 +3109,13 @@ static int edge_startup(struct usb_serial *serial)
3094 edge_serial->interrupt_read_urb = 3109 edge_serial->interrupt_read_urb =
3095 usb_alloc_urb(0, GFP_KERNEL); 3110 usb_alloc_urb(0, GFP_KERNEL);
3096 if (!edge_serial->interrupt_read_urb) { 3111 if (!edge_serial->interrupt_read_urb) {
3097 err("out of memory"); 3112 dev_err(&dev->dev, "out of memory\n");
3098 return -ENOMEM; 3113 return -ENOMEM;
3099 } 3114 }
3100 edge_serial->interrupt_in_buffer = 3115 edge_serial->interrupt_in_buffer =
3101 kmalloc(buffer_size, GFP_KERNEL); 3116 kmalloc(buffer_size, GFP_KERNEL);
3102 if (!edge_serial->interrupt_in_buffer) { 3117 if (!edge_serial->interrupt_in_buffer) {
3103 err("out of memory"); 3118 dev_err(&dev->dev, "out of memory\n");
3104 usb_free_urb(edge_serial->interrupt_read_urb); 3119 usb_free_urb(edge_serial->interrupt_read_urb);
3105 return -ENOMEM; 3120 return -ENOMEM;
3106 } 3121 }
@@ -3131,13 +3146,13 @@ static int edge_startup(struct usb_serial *serial)
3131 edge_serial->read_urb = 3146 edge_serial->read_urb =
3132 usb_alloc_urb(0, GFP_KERNEL); 3147 usb_alloc_urb(0, GFP_KERNEL);
3133 if (!edge_serial->read_urb) { 3148 if (!edge_serial->read_urb) {
3134 err("out of memory"); 3149 dev_err(&dev->dev, "out of memory\n");
3135 return -ENOMEM; 3150 return -ENOMEM;
3136 } 3151 }
3137 edge_serial->bulk_in_buffer = 3152 edge_serial->bulk_in_buffer =
3138 kmalloc(buffer_size, GFP_KERNEL); 3153 kmalloc(buffer_size, GFP_KERNEL);
3139 if (!edge_serial->bulk_in_buffer) { 3154 if (!edge_serial->bulk_in_buffer) {
3140 err("out of memory"); 3155 dev_err(&dev->dev, "out of memory\n");
3141 usb_free_urb(edge_serial->read_urb); 3156 usb_free_urb(edge_serial->read_urb);
3142 return -ENOMEM; 3157 return -ENOMEM;
3143 } 3158 }
@@ -3166,7 +3181,8 @@ static int edge_startup(struct usb_serial *serial)
3166 } 3181 }
3167 3182
3168 if (!interrupt_in_found || !bulk_in_found || !bulk_out_found) { 3183 if (!interrupt_in_found || !bulk_in_found || !bulk_out_found) {
3169 err("Error - the proper endpoints were not found!"); 3184 dev_err(&dev->dev, "Error - the proper endpoints "
3185 "were not found!\n");
3170 return -ENODEV; 3186 return -ENODEV;
3171 } 3187 }
3172 3188
@@ -3175,8 +3191,9 @@ static int edge_startup(struct usb_serial *serial)
3175 response = usb_submit_urb(edge_serial->interrupt_read_urb, 3191 response = usb_submit_urb(edge_serial->interrupt_read_urb,
3176 GFP_KERNEL); 3192 GFP_KERNEL);
3177 if (response) 3193 if (response)
3178 err("%s - Error %d submitting control urb", 3194 dev_err(&dev->dev,
3179 __func__, response); 3195 "%s - Error %d submitting control urb\n",
3196 __func__, response);
3180 } 3197 }
3181 return response; 3198 return response;
3182} 3199}
@@ -3238,7 +3255,8 @@ static int __init edgeport_init(void)
3238 if (retval) 3255 if (retval)
3239 goto failed_usb_register; 3256 goto failed_usb_register;
3240 atomic_set(&CmdUrbs, 0); 3257 atomic_set(&CmdUrbs, 0);
3241 info(DRIVER_DESC " " DRIVER_VERSION); 3258 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
3259 DRIVER_DESC "\n");
3242 return 0; 3260 return 0;
3243 3261
3244failed_usb_register: 3262failed_usb_register:
diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c
index cb4c54316cf5..c3cdd00ddc41 100644
--- a/drivers/usb/serial/io_ti.c
+++ b/drivers/usb/serial/io_ti.c
@@ -572,7 +572,7 @@ static void chase_port(struct edgeport_port *port, unsigned long timeout,
572 int flush) 572 int flush)
573{ 573{
574 int baud_rate; 574 int baud_rate;
575 struct tty_struct *tty = port->port->port.tty; 575 struct tty_struct *tty = tty_port_tty_get(&port->port->port);
576 wait_queue_t wait; 576 wait_queue_t wait;
577 unsigned long flags; 577 unsigned long flags;
578 578
@@ -599,6 +599,7 @@ static void chase_port(struct edgeport_port *port, unsigned long timeout,
599 if (flush) 599 if (flush)
600 edge_buf_clear(port->ep_out_buf); 600 edge_buf_clear(port->ep_out_buf);
601 spin_unlock_irqrestore(&port->ep_lock, flags); 601 spin_unlock_irqrestore(&port->ep_lock, flags);
602 tty_kref_put(tty);
602 603
603 /* wait for data to drain from the device */ 604 /* wait for data to drain from the device */
604 timeout += jiffies; 605 timeout += jiffies;
@@ -1554,7 +1555,7 @@ static void handle_new_msr(struct edgeport_port *edge_port, __u8 msr)
1554 /* Save the new modem status */ 1555 /* Save the new modem status */
1555 edge_port->shadow_msr = msr & 0xf0; 1556 edge_port->shadow_msr = msr & 0xf0;
1556 1557
1557 tty = edge_port->port->port.tty; 1558 tty = tty_port_tty_get(&edge_port->port->port);
1558 /* handle CTS flow control */ 1559 /* handle CTS flow control */
1559 if (tty && C_CRTSCTS(tty)) { 1560 if (tty && C_CRTSCTS(tty)) {
1560 if (msr & EDGEPORT_MSR_CTS) { 1561 if (msr & EDGEPORT_MSR_CTS) {
@@ -1564,6 +1565,7 @@ static void handle_new_msr(struct edgeport_port *edge_port, __u8 msr)
1564 tty->hw_stopped = 1; 1565 tty->hw_stopped = 1;
1565 } 1566 }
1566 } 1567 }
1568 tty_kref_put(tty);
1567 1569
1568 return; 1570 return;
1569} 1571}
@@ -1574,6 +1576,7 @@ static void handle_new_lsr(struct edgeport_port *edge_port, int lsr_data,
1574 struct async_icount *icount; 1576 struct async_icount *icount;
1575 __u8 new_lsr = (__u8)(lsr & (__u8)(LSR_OVER_ERR | LSR_PAR_ERR | 1577 __u8 new_lsr = (__u8)(lsr & (__u8)(LSR_OVER_ERR | LSR_PAR_ERR |
1576 LSR_FRM_ERR | LSR_BREAK)); 1578 LSR_FRM_ERR | LSR_BREAK));
1579 struct tty_struct *tty;
1577 1580
1578 dbg("%s - %02x", __func__, new_lsr); 1581 dbg("%s - %02x", __func__, new_lsr);
1579 1582
@@ -1587,8 +1590,13 @@ static void handle_new_lsr(struct edgeport_port *edge_port, int lsr_data,
1587 new_lsr &= (__u8)(LSR_OVER_ERR | LSR_BREAK); 1590 new_lsr &= (__u8)(LSR_OVER_ERR | LSR_BREAK);
1588 1591
1589 /* Place LSR data byte into Rx buffer */ 1592 /* Place LSR data byte into Rx buffer */
1590 if (lsr_data && edge_port->port->port.tty) 1593 if (lsr_data) {
1591 edge_tty_recv(&edge_port->port->dev, edge_port->port->port.tty, &data, 1); 1594 tty = tty_port_tty_get(&edge_port->port->port);
1595 if (tty) {
1596 edge_tty_recv(&edge_port->port->dev, tty, &data, 1);
1597 tty_kref_put(tty);
1598 }
1599 }
1592 1600
1593 /* update input line counters */ 1601 /* update input line counters */
1594 icount = &edge_port->icount; 1602 icount = &edge_port->icount;
@@ -1749,7 +1757,7 @@ static void edge_bulk_in_callback(struct urb *urb)
1749 ++data; 1757 ++data;
1750 } 1758 }
1751 1759
1752 tty = edge_port->port->port.tty; 1760 tty = tty_port_tty_get(&edge_port->port->port);
1753 if (tty && urb->actual_length) { 1761 if (tty && urb->actual_length) {
1754 usb_serial_debug_data(debug, &edge_port->port->dev, 1762 usb_serial_debug_data(debug, &edge_port->port->dev,
1755 __func__, urb->actual_length, data); 1763 __func__, urb->actual_length, data);
@@ -1761,6 +1769,7 @@ static void edge_bulk_in_callback(struct urb *urb)
1761 urb->actual_length); 1769 urb->actual_length);
1762 edge_port->icount.rx += urb->actual_length; 1770 edge_port->icount.rx += urb->actual_length;
1763 } 1771 }
1772 tty_kref_put(tty);
1764 1773
1765exit: 1774exit:
1766 /* continue read unless stopped */ 1775 /* continue read unless stopped */
@@ -1796,6 +1805,7 @@ static void edge_bulk_out_callback(struct urb *urb)
1796 struct usb_serial_port *port = urb->context; 1805 struct usb_serial_port *port = urb->context;
1797 struct edgeport_port *edge_port = usb_get_serial_port_data(port); 1806 struct edgeport_port *edge_port = usb_get_serial_port_data(port);
1798 int status = urb->status; 1807 int status = urb->status;
1808 struct tty_struct *tty;
1799 1809
1800 dbg("%s - port %d", __func__, port->number); 1810 dbg("%s - port %d", __func__, port->number);
1801 1811
@@ -1818,7 +1828,9 @@ static void edge_bulk_out_callback(struct urb *urb)
1818 } 1828 }
1819 1829
1820 /* send any buffered data */ 1830 /* send any buffered data */
1821 edge_send(port->port.tty); 1831 tty = tty_port_tty_get(&port->port);
1832 edge_send(tty);
1833 tty_kref_put(tty);
1822} 1834}
1823 1835
1824static int edge_open(struct tty_struct *tty, 1836static int edge_open(struct tty_struct *tty,
@@ -1876,7 +1888,7 @@ static int edge_open(struct tty_struct *tty,
1876 1888
1877 /* set up the port settings */ 1889 /* set up the port settings */
1878 if (tty) 1890 if (tty)
1879 edge_set_termios(tty, port, port->port.tty->termios); 1891 edge_set_termios(tty, port, tty->termios);
1880 1892
1881 /* open up the port */ 1893 /* open up the port */
1882 1894
@@ -2966,7 +2978,8 @@ static int __init edgeport_init(void)
2966 retval = usb_register(&io_driver); 2978 retval = usb_register(&io_driver);
2967 if (retval) 2979 if (retval)
2968 goto failed_usb_register; 2980 goto failed_usb_register;
2969 info(DRIVER_DESC " " DRIVER_VERSION); 2981 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
2982 DRIVER_DESC "\n");
2970 return 0; 2983 return 0;
2971failed_usb_register: 2984failed_usb_register:
2972 usb_serial_deregister(&edgeport_2port_device); 2985 usb_serial_deregister(&edgeport_2port_device);
diff --git a/drivers/usb/serial/ipaq.c b/drivers/usb/serial/ipaq.c
index cd9a2e138c8b..132be74d2b89 100644
--- a/drivers/usb/serial/ipaq.c
+++ b/drivers/usb/serial/ipaq.c
@@ -608,7 +608,7 @@ static int ipaq_open(struct tty_struct *tty,
608 bytes_out = 0; 608 bytes_out = 0;
609 priv = kmalloc(sizeof(struct ipaq_private), GFP_KERNEL); 609 priv = kmalloc(sizeof(struct ipaq_private), GFP_KERNEL);
610 if (priv == NULL) { 610 if (priv == NULL) {
611 err("%s - Out of memory", __func__); 611 dev_err(&port->dev, "%s - Out of memory\n", __func__);
612 return -ENOMEM; 612 return -ENOMEM;
613 } 613 }
614 usb_set_serial_port_data(port, priv); 614 usb_set_serial_port_data(port, priv);
@@ -693,8 +693,7 @@ static int ipaq_open(struct tty_struct *tty,
693 } 693 }
694 694
695 if (!retries && result) { 695 if (!retries && result) {
696 err("%s - failed doing control urb, error %d", __func__, 696 dev_err(&port->dev, "%s - failed doing control urb, error %d\n", __func__, result);
697 result);
698 goto error; 697 goto error;
699 } 698 }
700 699
@@ -707,8 +706,9 @@ static int ipaq_open(struct tty_struct *tty,
707 706
708 result = usb_submit_urb(port->read_urb, GFP_KERNEL); 707 result = usb_submit_urb(port->read_urb, GFP_KERNEL);
709 if (result) { 708 if (result) {
710 err("%s - failed submitting read urb, error %d", 709 dev_err(&port->dev,
711 __func__, result); 710 "%s - failed submitting read urb, error %d\n",
711 __func__, result);
712 goto error; 712 goto error;
713 } 713 }
714 714
@@ -716,7 +716,7 @@ static int ipaq_open(struct tty_struct *tty,
716 716
717enomem: 717enomem:
718 result = -ENOMEM; 718 result = -ENOMEM;
719 err("%s - Out of memory", __func__); 719 dev_err(&port->dev, "%s - Out of memory\n", __func__);
720error: 720error:
721 ipaq_destroy_lists(port); 721 ipaq_destroy_lists(port);
722 kfree(priv); 722 kfree(priv);
@@ -764,13 +764,14 @@ static void ipaq_read_bulk_callback(struct urb *urb)
764 usb_serial_debug_data(debug, &port->dev, __func__, 764 usb_serial_debug_data(debug, &port->dev, __func__,
765 urb->actual_length, data); 765 urb->actual_length, data);
766 766
767 tty = port->port.tty; 767 tty = tty_port_tty_get(&port->port);
768 if (tty && urb->actual_length) { 768 if (tty && urb->actual_length) {
769 tty_buffer_request_room(tty, urb->actual_length); 769 tty_buffer_request_room(tty, urb->actual_length);
770 tty_insert_flip_string(tty, data, urb->actual_length); 770 tty_insert_flip_string(tty, data, urb->actual_length);
771 tty_flip_buffer_push(tty); 771 tty_flip_buffer_push(tty);
772 bytes_in += urb->actual_length; 772 bytes_in += urb->actual_length;
773 } 773 }
774 tty_kref_put(tty);
774 775
775 /* Continue trying to always read */ 776 /* Continue trying to always read */
776 usb_fill_bulk_urb(port->read_urb, port->serial->dev, 777 usb_fill_bulk_urb(port->read_urb, port->serial->dev,
@@ -780,8 +781,9 @@ static void ipaq_read_bulk_callback(struct urb *urb)
780 ipaq_read_bulk_callback, port); 781 ipaq_read_bulk_callback, port);
781 result = usb_submit_urb(port->read_urb, GFP_ATOMIC); 782 result = usb_submit_urb(port->read_urb, GFP_ATOMIC);
782 if (result) 783 if (result)
783 err("%s - failed resubmitting read urb, error %d", 784 dev_err(&port->dev,
784 __func__, result); 785 "%s - failed resubmitting read urb, error %d\n",
786 __func__, result);
785 return; 787 return;
786} 788}
787 789
@@ -846,7 +848,8 @@ static int ipaq_write_bulk(struct usb_serial_port *port,
846 spin_unlock_irqrestore(&write_list_lock, flags); 848 spin_unlock_irqrestore(&write_list_lock, flags);
847 result = usb_submit_urb(port->write_urb, GFP_ATOMIC); 849 result = usb_submit_urb(port->write_urb, GFP_ATOMIC);
848 if (result) 850 if (result)
849 err("%s - failed submitting write urb, error %d", 851 dev_err(&port->dev,
852 "%s - failed submitting write urb, error %d\n",
850 __func__, result); 853 __func__, result);
851 } else { 854 } else {
852 spin_unlock_irqrestore(&write_list_lock, flags); 855 spin_unlock_irqrestore(&write_list_lock, flags);
@@ -908,8 +911,9 @@ static void ipaq_write_bulk_callback(struct urb *urb)
908 spin_unlock_irqrestore(&write_list_lock, flags); 911 spin_unlock_irqrestore(&write_list_lock, flags);
909 result = usb_submit_urb(port->write_urb, GFP_ATOMIC); 912 result = usb_submit_urb(port->write_urb, GFP_ATOMIC);
910 if (result) 913 if (result)
911 err("%s - failed submitting write urb, error %d", 914 dev_err(&port->dev,
912 __func__, result); 915 "%s - failed submitting write urb, error %d\n",
916 __func__, result);
913 } else { 917 } else {
914 priv->active = 0; 918 priv->active = 0;
915 spin_unlock_irqrestore(&write_list_lock, flags); 919 spin_unlock_irqrestore(&write_list_lock, flags);
@@ -956,7 +960,7 @@ static int ipaq_startup(struct usb_serial *serial)
956{ 960{
957 dbg("%s", __func__); 961 dbg("%s", __func__);
958 if (serial->dev->actconfig->desc.bConfigurationValue != 1) { 962 if (serial->dev->actconfig->desc.bConfigurationValue != 1) {
959 err("active config #%d != 1 ??", 963 dev_err(&serial->dev->dev, "active config #%d != 1 ??\n",
960 serial->dev->actconfig->desc.bConfigurationValue); 964 serial->dev->actconfig->desc.bConfigurationValue);
961 return -ENODEV; 965 return -ENODEV;
962 } 966 }
@@ -975,7 +979,6 @@ static int __init ipaq_init(void)
975 retval = usb_serial_register(&ipaq_device); 979 retval = usb_serial_register(&ipaq_device);
976 if (retval) 980 if (retval)
977 goto failed_usb_serial_register; 981 goto failed_usb_serial_register;
978 info(DRIVER_DESC " " DRIVER_VERSION);
979 if (vendor) { 982 if (vendor) {
980 ipaq_id_table[0].idVendor = vendor; 983 ipaq_id_table[0].idVendor = vendor;
981 ipaq_id_table[0].idProduct = product; 984 ipaq_id_table[0].idProduct = product;
@@ -984,6 +987,8 @@ static int __init ipaq_init(void)
984 if (retval) 987 if (retval)
985 goto failed_usb_register; 988 goto failed_usb_register;
986 989
990 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
991 DRIVER_DESC "\n");
987 return 0; 992 return 0;
988failed_usb_register: 993failed_usb_register:
989 usb_serial_deregister(&ipaq_device); 994 usb_serial_deregister(&ipaq_device);
diff --git a/drivers/usb/serial/ipw.c b/drivers/usb/serial/ipw.c
index a842025b9b57..3ac59a8a980f 100644
--- a/drivers/usb/serial/ipw.c
+++ b/drivers/usb/serial/ipw.c
@@ -170,12 +170,13 @@ static void ipw_read_bulk_callback(struct urb *urb)
170 usb_serial_debug_data(debug, &port->dev, __func__, 170 usb_serial_debug_data(debug, &port->dev, __func__,
171 urb->actual_length, data); 171 urb->actual_length, data);
172 172
173 tty = port->port.tty; 173 tty = tty_port_tty_get(&port->port);
174 if (tty && urb->actual_length) { 174 if (tty && urb->actual_length) {
175 tty_buffer_request_room(tty, urb->actual_length); 175 tty_buffer_request_room(tty, urb->actual_length);
176 tty_insert_flip_string(tty, data, urb->actual_length); 176 tty_insert_flip_string(tty, data, urb->actual_length);
177 tty_flip_buffer_push(tty); 177 tty_flip_buffer_push(tty);
178 } 178 }
179 tty_kref_put(tty);
179 180
180 /* Continue trying to always read */ 181 /* Continue trying to always read */
181 usb_fill_bulk_urb(port->read_urb, port->serial->dev, 182 usb_fill_bulk_urb(port->read_urb, port->serial->dev,
@@ -484,7 +485,8 @@ static int usb_ipw_init(void)
484 usb_serial_deregister(&ipw_device); 485 usb_serial_deregister(&ipw_device);
485 return retval; 486 return retval;
486 } 487 }
487 info(DRIVER_DESC " " DRIVER_VERSION); 488 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
489 DRIVER_DESC "\n");
488 return 0; 490 return 0;
489} 491}
490 492
diff --git a/drivers/usb/serial/ir-usb.c b/drivers/usb/serial/ir-usb.c
index e59155c6607d..b679a556b98d 100644
--- a/drivers/usb/serial/ir-usb.c
+++ b/drivers/usb/serial/ir-usb.c
@@ -465,11 +465,12 @@ static void ir_read_bulk_callback(struct urb *urb)
465 ir_baud = *data & 0x0f; 465 ir_baud = *data & 0x0f;
466 usb_serial_debug_data(debug, &port->dev, __func__, 466 usb_serial_debug_data(debug, &port->dev, __func__,
467 urb->actual_length, data); 467 urb->actual_length, data);
468 tty = port->port.tty; 468 tty = tty_port_tty_get(&port->port);
469 if (tty_buffer_request_room(tty, urb->actual_length - 1)) { 469 if (tty_buffer_request_room(tty, urb->actual_length - 1)) {
470 tty_insert_flip_string(tty, data+1, urb->actual_length - 1); 470 tty_insert_flip_string(tty, data+1, urb->actual_length - 1);
471 tty_flip_buffer_push(tty); 471 tty_flip_buffer_push(tty);
472 } 472 }
473 tty_kref_put(tty);
473 474
474 /* 475 /*
475 * No break here. 476 * No break here.
@@ -601,7 +602,8 @@ static int __init ir_init(void)
601 if (retval) 602 if (retval)
602 goto failed_usb_register; 603 goto failed_usb_register;
603 604
604 info(DRIVER_DESC " " DRIVER_VERSION); 605 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
606 DRIVER_DESC "\n");
605 607
606 return 0; 608 return 0;
607 609
diff --git a/drivers/usb/serial/iuu_phoenix.c b/drivers/usb/serial/iuu_phoenix.c
index ddff37fa6339..e320972cb227 100644
--- a/drivers/usb/serial/iuu_phoenix.c
+++ b/drivers/usb/serial/iuu_phoenix.c
@@ -629,13 +629,14 @@ static void read_buf_callback(struct urb *urb)
629 } 629 }
630 630
631 dbg("%s - %i chars to write", __func__, urb->actual_length); 631 dbg("%s - %i chars to write", __func__, urb->actual_length);
632 tty = port->port.tty; 632 tty = tty_port_tty_get(&port->port);
633 if (data == NULL) 633 if (data == NULL)
634 dbg("%s - data is NULL !!!", __func__); 634 dbg("%s - data is NULL !!!", __func__);
635 if (tty && urb->actual_length && data) { 635 if (tty && urb->actual_length && data) {
636 tty_insert_flip_string(tty, data, urb->actual_length); 636 tty_insert_flip_string(tty, data, urb->actual_length);
637 tty_flip_buffer_push(tty); 637 tty_flip_buffer_push(tty);
638 } 638 }
639 tty_kref_put(tty);
639 iuu_led_activity_on(urb); 640 iuu_led_activity_on(urb);
640} 641}
641 642
@@ -1184,7 +1185,8 @@ static int __init iuu_init(void)
1184 retval = usb_register(&iuu_driver); 1185 retval = usb_register(&iuu_driver);
1185 if (retval) 1186 if (retval)
1186 goto failed_usb_register; 1187 goto failed_usb_register;
1187 info(DRIVER_DESC " " DRIVER_VERSION); 1188 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
1189 DRIVER_DESC "\n");
1188 return 0; 1190 return 0;
1189failed_usb_register: 1191failed_usb_register:
1190 usb_serial_deregister(&iuu_device); 1192 usb_serial_deregister(&iuu_device);
diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c
index 704716f6f6d3..9878c0fb3859 100644
--- a/drivers/usb/serial/keyspan.c
+++ b/drivers/usb/serial/keyspan.c
@@ -217,7 +217,8 @@ static int __init keyspan_init(void)
217 if (retval) 217 if (retval)
218 goto failed_usb_register; 218 goto failed_usb_register;
219 219
220 info(DRIVER_VERSION ":" DRIVER_DESC); 220 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
221 DRIVER_DESC "\n");
221 222
222 return 0; 223 return 0;
223failed_usb_register: 224failed_usb_register:
@@ -430,7 +431,7 @@ static void usa26_indat_callback(struct urb *urb)
430 } 431 }
431 432
432 port = urb->context; 433 port = urb->context;
433 tty = port->port.tty; 434 tty = tty_port_tty_get(&port->port);
434 if (tty && urb->actual_length) { 435 if (tty && urb->actual_length) {
435 /* 0x80 bit is error flag */ 436 /* 0x80 bit is error flag */
436 if ((data[0] & 0x80) == 0) { 437 if ((data[0] & 0x80) == 0) {
@@ -459,6 +460,7 @@ static void usa26_indat_callback(struct urb *urb)
459 } 460 }
460 tty_flip_buffer_push(tty); 461 tty_flip_buffer_push(tty);
461 } 462 }
463 tty_kref_put(tty);
462 464
463 /* Resubmit urb so we continue receiving */ 465 /* Resubmit urb so we continue receiving */
464 urb->dev = port->serial->dev; 466 urb->dev = port->serial->dev;
@@ -513,6 +515,7 @@ static void usa26_instat_callback(struct urb *urb)
513 struct usb_serial *serial; 515 struct usb_serial *serial;
514 struct usb_serial_port *port; 516 struct usb_serial_port *port;
515 struct keyspan_port_private *p_priv; 517 struct keyspan_port_private *p_priv;
518 struct tty_struct *tty;
516 int old_dcd_state, err; 519 int old_dcd_state, err;
517 int status = urb->status; 520 int status = urb->status;
518 521
@@ -553,12 +556,11 @@ static void usa26_instat_callback(struct urb *urb)
553 p_priv->dcd_state = ((msg->gpia_dcd) ? 1 : 0); 556 p_priv->dcd_state = ((msg->gpia_dcd) ? 1 : 0);
554 p_priv->ri_state = ((msg->ri) ? 1 : 0); 557 p_priv->ri_state = ((msg->ri) ? 1 : 0);
555 558
556 if (port->port.tty && !C_CLOCAL(port->port.tty) 559 if (old_dcd_state != p_priv->dcd_state) {
557 && old_dcd_state != p_priv->dcd_state) { 560 tty = tty_port_tty_get(&port->port);
558 if (old_dcd_state) 561 if (tty && !C_CLOCAL(tty))
559 tty_hangup(port->port.tty); 562 tty_hangup(tty);
560 /* else */ 563 tty_kref_put(tty);
561 /* wake_up_interruptible(&p_priv->open_wait); */
562 } 564 }
563 565
564 /* Resubmit urb so we continue receiving */ 566 /* Resubmit urb so we continue receiving */
@@ -604,11 +606,12 @@ static void usa28_indat_callback(struct urb *urb)
604 p_priv = usb_get_serial_port_data(port); 606 p_priv = usb_get_serial_port_data(port);
605 data = urb->transfer_buffer; 607 data = urb->transfer_buffer;
606 608
607 tty = port->port.tty; 609 tty =tty_port_tty_get(&port->port);
608 if (urb->actual_length) { 610 if (tty && urb->actual_length) {
609 tty_insert_flip_string(tty, data, urb->actual_length); 611 tty_insert_flip_string(tty, data, urb->actual_length);
610 tty_flip_buffer_push(tty); 612 tty_flip_buffer_push(tty);
611 } 613 }
614 tty_kref_put(tty);
612 615
613 /* Resubmit urb so we continue receiving */ 616 /* Resubmit urb so we continue receiving */
614 urb->dev = port->serial->dev; 617 urb->dev = port->serial->dev;
@@ -652,6 +655,7 @@ static void usa28_instat_callback(struct urb *urb)
652 struct usb_serial *serial; 655 struct usb_serial *serial;
653 struct usb_serial_port *port; 656 struct usb_serial_port *port;
654 struct keyspan_port_private *p_priv; 657 struct keyspan_port_private *p_priv;
658 struct tty_struct *tty;
655 int old_dcd_state; 659 int old_dcd_state;
656 int status = urb->status; 660 int status = urb->status;
657 661
@@ -689,12 +693,11 @@ static void usa28_instat_callback(struct urb *urb)
689 p_priv->dcd_state = ((msg->dcd) ? 1 : 0); 693 p_priv->dcd_state = ((msg->dcd) ? 1 : 0);
690 p_priv->ri_state = ((msg->ri) ? 1 : 0); 694 p_priv->ri_state = ((msg->ri) ? 1 : 0);
691 695
692 if (port->port.tty && !C_CLOCAL(port->port.tty) 696 if( old_dcd_state != p_priv->dcd_state && old_dcd_state) {
693 && old_dcd_state != p_priv->dcd_state) { 697 tty = tty_port_tty_get(&port->port);
694 if (old_dcd_state) 698 if (tty && !C_CLOCAL(tty))
695 tty_hangup(port->port.tty); 699 tty_hangup(tty);
696 /* else */ 700 tty_kref_put(tty);
697 /* wake_up_interruptible(&p_priv->open_wait); */
698 } 701 }
699 702
700 /* Resubmit urb so we continue receiving */ 703 /* Resubmit urb so we continue receiving */
@@ -785,12 +788,11 @@ static void usa49_instat_callback(struct urb *urb)
785 p_priv->dcd_state = ((msg->dcd) ? 1 : 0); 788 p_priv->dcd_state = ((msg->dcd) ? 1 : 0);
786 p_priv->ri_state = ((msg->ri) ? 1 : 0); 789 p_priv->ri_state = ((msg->ri) ? 1 : 0);
787 790
788 if (port->port.tty && !C_CLOCAL(port->port.tty) 791 if (old_dcd_state != p_priv->dcd_state && old_dcd_state) {
789 && old_dcd_state != p_priv->dcd_state) { 792 struct tty_struct *tty = tty_port_tty_get(&port->port);
790 if (old_dcd_state) 793 if (tty && !C_CLOCAL(tty))
791 tty_hangup(port->port.tty); 794 tty_hangup(tty);
792 /* else */ 795 tty_kref_put(tty);
793 /* wake_up_interruptible(&p_priv->open_wait); */
794 } 796 }
795 797
796 /* Resubmit urb so we continue receiving */ 798 /* Resubmit urb so we continue receiving */
@@ -827,7 +829,7 @@ static void usa49_indat_callback(struct urb *urb)
827 } 829 }
828 830
829 port = urb->context; 831 port = urb->context;
830 tty = port->port.tty; 832 tty = tty_port_tty_get(&port->port);
831 if (tty && urb->actual_length) { 833 if (tty && urb->actual_length) {
832 /* 0x80 bit is error flag */ 834 /* 0x80 bit is error flag */
833 if ((data[0] & 0x80) == 0) { 835 if ((data[0] & 0x80) == 0) {
@@ -850,6 +852,7 @@ static void usa49_indat_callback(struct urb *urb)
850 } 852 }
851 tty_flip_buffer_push(tty); 853 tty_flip_buffer_push(tty);
852 } 854 }
855 tty_kref_put(tty);
853 856
854 /* Resubmit urb so we continue receiving */ 857 /* Resubmit urb so we continue receiving */
855 urb->dev = port->serial->dev; 858 urb->dev = port->serial->dev;
@@ -893,7 +896,7 @@ static void usa49wg_indat_callback(struct urb *urb)
893 return; 896 return;
894 } 897 }
895 port = serial->port[data[i++]]; 898 port = serial->port[data[i++]];
896 tty = port->port.tty; 899 tty = tty_port_tty_get(&port->port);
897 len = data[i++]; 900 len = data[i++];
898 901
899 /* 0x80 bit is error flag */ 902 /* 0x80 bit is error flag */
@@ -927,6 +930,7 @@ static void usa49wg_indat_callback(struct urb *urb)
927 } 930 }
928 if (port->port.count) 931 if (port->port.count)
929 tty_flip_buffer_push(tty); 932 tty_flip_buffer_push(tty);
933 tty_kref_put(tty);
930 } 934 }
931 } 935 }
932 936
@@ -967,8 +971,8 @@ static void usa90_indat_callback(struct urb *urb)
967 port = urb->context; 971 port = urb->context;
968 p_priv = usb_get_serial_port_data(port); 972 p_priv = usb_get_serial_port_data(port);
969 973
970 tty = port->port.tty;
971 if (urb->actual_length) { 974 if (urb->actual_length) {
975 tty = tty_port_tty_get(&port->port);
972 /* if current mode is DMA, looks like usa28 format 976 /* if current mode is DMA, looks like usa28 format
973 otherwise looks like usa26 data format */ 977 otherwise looks like usa26 data format */
974 978
@@ -1004,6 +1008,7 @@ static void usa90_indat_callback(struct urb *urb)
1004 } 1008 }
1005 } 1009 }
1006 tty_flip_buffer_push(tty); 1010 tty_flip_buffer_push(tty);
1011 tty_kref_put(tty);
1007 } 1012 }
1008 1013
1009 /* Resubmit urb so we continue receiving */ 1014 /* Resubmit urb so we continue receiving */
@@ -1025,6 +1030,7 @@ static void usa90_instat_callback(struct urb *urb)
1025 struct usb_serial *serial; 1030 struct usb_serial *serial;
1026 struct usb_serial_port *port; 1031 struct usb_serial_port *port;
1027 struct keyspan_port_private *p_priv; 1032 struct keyspan_port_private *p_priv;
1033 struct tty_struct *tty;
1028 int old_dcd_state, err; 1034 int old_dcd_state, err;
1029 int status = urb->status; 1035 int status = urb->status;
1030 1036
@@ -1053,12 +1059,11 @@ static void usa90_instat_callback(struct urb *urb)
1053 p_priv->dcd_state = ((msg->dcd) ? 1 : 0); 1059 p_priv->dcd_state = ((msg->dcd) ? 1 : 0);
1054 p_priv->ri_state = ((msg->ri) ? 1 : 0); 1060 p_priv->ri_state = ((msg->ri) ? 1 : 0);
1055 1061
1056 if (port->port.tty && !C_CLOCAL(port->port.tty) 1062 if (old_dcd_state != p_priv->dcd_state && old_dcd_state) {
1057 && old_dcd_state != p_priv->dcd_state) { 1063 tty = tty_port_tty_get(&port->port);
1058 if (old_dcd_state) 1064 if (tty && !C_CLOCAL(tty))
1059 tty_hangup(port->port.tty); 1065 tty_hangup(tty);
1060 /* else */ 1066 tty_kref_put(tty);
1061 /* wake_up_interruptible(&p_priv->open_wait); */
1062 } 1067 }
1063 1068
1064 /* Resubmit urb so we continue receiving */ 1069 /* Resubmit urb so we continue receiving */
@@ -1130,12 +1135,11 @@ static void usa67_instat_callback(struct urb *urb)
1130 p_priv->cts_state = ((msg->hskia_cts) ? 1 : 0); 1135 p_priv->cts_state = ((msg->hskia_cts) ? 1 : 0);
1131 p_priv->dcd_state = ((msg->gpia_dcd) ? 1 : 0); 1136 p_priv->dcd_state = ((msg->gpia_dcd) ? 1 : 0);
1132 1137
1133 if (port->port.tty && !C_CLOCAL(port->port.tty) 1138 if (old_dcd_state != p_priv->dcd_state && old_dcd_state) {
1134 && old_dcd_state != p_priv->dcd_state) { 1139 struct tty_struct *tty = tty_port_tty_get(&port->port);
1135 if (old_dcd_state) 1140 if (tty && !C_CLOCAL(tty))
1136 tty_hangup(port->port.tty); 1141 tty_hangup(tty);
1137 /* else */ 1142 tty_kref_put(tty);
1138 /* wake_up_interruptible(&p_priv->open_wait); */
1139 } 1143 }
1140 1144
1141 /* Resubmit urb so we continue receiving */ 1145 /* Resubmit urb so we continue receiving */
@@ -1332,7 +1336,7 @@ static void keyspan_close(struct tty_struct *tty,
1332 stop_urb(p_priv->out_urbs[i]); 1336 stop_urb(p_priv->out_urbs[i]);
1333 } 1337 }
1334 } 1338 }
1335 port->port.tty = NULL; 1339 tty_port_tty_set(&port->port, NULL);
1336} 1340}
1337 1341
1338/* download the firmware to a pre-renumeration device */ 1342/* download the firmware to a pre-renumeration device */
diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c
index 040040a267d9..bf1ae247da66 100644
--- a/drivers/usb/serial/keyspan_pda.c
+++ b/drivers/usb/serial/keyspan_pda.c
@@ -172,8 +172,9 @@ static void keyspan_pda_wakeup_write(struct work_struct *work)
172 struct keyspan_pda_private *priv = 172 struct keyspan_pda_private *priv =
173 container_of(work, struct keyspan_pda_private, wakeup_work); 173 container_of(work, struct keyspan_pda_private, wakeup_work);
174 struct usb_serial_port *port = priv->port; 174 struct usb_serial_port *port = priv->port;
175 175 struct tty_struct *tty = tty_port_tty_get(&port->port);
176 tty_wakeup(port->port.tty); 176 tty_wakeup(tty);
177 tty_kref_put(tty);
177} 178}
178 179
179static void keyspan_pda_request_unthrottle(struct work_struct *work) 180static void keyspan_pda_request_unthrottle(struct work_struct *work)
@@ -205,7 +206,7 @@ static void keyspan_pda_request_unthrottle(struct work_struct *work)
205static void keyspan_pda_rx_interrupt(struct urb *urb) 206static void keyspan_pda_rx_interrupt(struct urb *urb)
206{ 207{
207 struct usb_serial_port *port = urb->context; 208 struct usb_serial_port *port = urb->context;
208 struct tty_struct *tty = port->port.tty; 209 struct tty_struct *tty = tty_port_tty_get(&port->port);
209 unsigned char *data = urb->transfer_buffer; 210 unsigned char *data = urb->transfer_buffer;
210 int retval; 211 int retval;
211 int status = urb->status; 212 int status = urb->status;
@@ -222,7 +223,7 @@ static void keyspan_pda_rx_interrupt(struct urb *urb)
222 /* this urb is terminated, clean up */ 223 /* this urb is terminated, clean up */
223 dbg("%s - urb shutting down with status: %d", 224 dbg("%s - urb shutting down with status: %d",
224 __func__, status); 225 __func__, status);
225 return; 226 goto out;
226 default: 227 default:
227 dbg("%s - nonzero urb status received: %d", 228 dbg("%s - nonzero urb status received: %d",
228 __func__, status); 229 __func__, status);
@@ -261,8 +262,11 @@ static void keyspan_pda_rx_interrupt(struct urb *urb)
261exit: 262exit:
262 retval = usb_submit_urb(urb, GFP_ATOMIC); 263 retval = usb_submit_urb(urb, GFP_ATOMIC);
263 if (retval) 264 if (retval)
264 err("%s - usb_submit_urb failed with result %d", 265 dev_err(&port->dev,
265 __func__, retval); 266 "%s - usb_submit_urb failed with result %d",
267 __func__, retval);
268out:
269 tty_kref_put(tty);
266} 270}
267 271
268 272
@@ -738,11 +742,13 @@ static int keyspan_pda_fake_startup(struct usb_serial *serial)
738 fw_name = "keyspan_pda/xircom_pgs.fw"; 742 fw_name = "keyspan_pda/xircom_pgs.fw";
739#endif 743#endif
740 else { 744 else {
741 err("%s: unknown vendor, aborting.", __func__); 745 dev_err(&serial->dev->dev, "%s: unknown vendor, aborting.\n",
746 __func__);
742 return -ENODEV; 747 return -ENODEV;
743 } 748 }
744 if (request_ihex_firmware(&fw, fw_name, &serial->dev->dev)) { 749 if (request_ihex_firmware(&fw, fw_name, &serial->dev->dev)) {
745 err("failed to load firmware \"%s\"\n", fw_name); 750 dev_err(&serial->dev->dev, "failed to load firmware \"%s\"\n",
751 fw_name);
746 return -ENOENT; 752 return -ENOENT;
747 } 753 }
748 record = (const struct ihex_binrec *)fw->data; 754 record = (const struct ihex_binrec *)fw->data;
@@ -752,10 +758,10 @@ static int keyspan_pda_fake_startup(struct usb_serial *serial)
752 (unsigned char *)record->data, 758 (unsigned char *)record->data,
753 be16_to_cpu(record->len), 0xa0); 759 be16_to_cpu(record->len), 0xa0);
754 if (response < 0) { 760 if (response < 0) {
755 err("ezusb_writememory failed for Keyspan PDA " 761 dev_err(&serial->dev->dev, "ezusb_writememory failed "
756 "firmware (%d %04X %p %d)", 762 "for Keyspan PDA firmware (%d %04X %p %d)\n",
757 response, be32_to_cpu(record->addr), 763 response, be32_to_cpu(record->addr),
758 record->data, be16_to_cpu(record->len)); 764 record->data, be16_to_cpu(record->len));
759 break; 765 break;
760 } 766 }
761 record = ihex_next_binrec(record); 767 record = ihex_next_binrec(record);
@@ -870,7 +876,8 @@ static int __init keyspan_pda_init(void)
870 retval = usb_register(&keyspan_pda_driver); 876 retval = usb_register(&keyspan_pda_driver);
871 if (retval) 877 if (retval)
872 goto failed_usb_register; 878 goto failed_usb_register;
873 info(DRIVER_DESC " " DRIVER_VERSION); 879 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
880 DRIVER_DESC "\n");
874 return 0; 881 return 0;
875failed_usb_register: 882failed_usb_register:
876#ifdef XIRCOM 883#ifdef XIRCOM
diff --git a/drivers/usb/serial/kl5kusb105.c b/drivers/usb/serial/kl5kusb105.c
index b84dddc71124..dc36a052766f 100644
--- a/drivers/usb/serial/kl5kusb105.c
+++ b/drivers/usb/serial/kl5kusb105.c
@@ -182,12 +182,12 @@ static int klsi_105_chg_port_settings(struct usb_serial_port *port,
182 sizeof(struct klsi_105_port_settings), 182 sizeof(struct klsi_105_port_settings),
183 KLSI_TIMEOUT); 183 KLSI_TIMEOUT);
184 if (rc < 0) 184 if (rc < 0)
185 err("Change port settings failed (error = %d)", rc); 185 dev_err(&port->dev,
186 info("%s - %d byte block, baudrate %x, databits %d, u1 %d, u2 %d", 186 "Change port settings failed (error = %d)\n", rc);
187 __func__, 187 dev_info(&port->serial->dev->dev,
188 settings->pktlen, 188 "%d byte block, baudrate %x, databits %d, u1 %d, u2 %d\n",
189 settings->baudrate, settings->databits, 189 settings->pktlen, settings->baudrate, settings->databits,
190 settings->unknown1, settings->unknown2); 190 settings->unknown1, settings->unknown2);
191 return rc; 191 return rc;
192} /* klsi_105_chg_port_settings */ 192} /* klsi_105_chg_port_settings */
193 193
@@ -215,7 +215,7 @@ static int klsi_105_get_line_state(struct usb_serial_port *port,
215 __u8 status_buf[KLSI_STATUSBUF_LEN] = { -1, -1}; 215 __u8 status_buf[KLSI_STATUSBUF_LEN] = { -1, -1};
216 __u16 status; 216 __u16 status;
217 217
218 info("%s - sending SIO Poll request", __func__); 218 dev_info(&port->serial->dev->dev, "sending SIO Poll request\n");
219 rc = usb_control_msg(port->serial->dev, 219 rc = usb_control_msg(port->serial->dev,
220 usb_rcvctrlpipe(port->serial->dev, 0), 220 usb_rcvctrlpipe(port->serial->dev, 0),
221 KL5KUSB105A_SIO_POLL, 221 KL5KUSB105A_SIO_POLL,
@@ -226,12 +226,13 @@ static int klsi_105_get_line_state(struct usb_serial_port *port,
226 10000 226 10000
227 ); 227 );
228 if (rc < 0) 228 if (rc < 0)
229 err("Reading line status failed (error = %d)", rc); 229 dev_err(&port->dev, "Reading line status failed (error = %d)\n",
230 rc);
230 else { 231 else {
231 status = get_unaligned_le16(status_buf); 232 status = get_unaligned_le16(status_buf);
232 233
233 info("%s - read status %x %x", __func__, 234 dev_info(&port->serial->dev->dev, "read status %x %x",
234 status_buf[0], status_buf[1]); 235 status_buf[0], status_buf[1]);
235 236
236 *line_state_p = klsi_105_status2linestate(status); 237 *line_state_p = klsi_105_status2linestate(status);
237 } 238 }
@@ -280,15 +281,16 @@ static int klsi_105_startup(struct usb_serial *serial)
280 281
281 priv->write_urb_pool[j] = urb; 282 priv->write_urb_pool[j] = urb;
282 if (urb == NULL) { 283 if (urb == NULL) {
283 err("No more urbs???"); 284 dev_err(&serial->dev->dev, "No more urbs???\n");
284 goto err_cleanup; 285 goto err_cleanup;
285 } 286 }
286 287
287 urb->transfer_buffer = 288 urb->transfer_buffer =
288 kmalloc(URB_TRANSFER_BUFFER_SIZE, GFP_KERNEL); 289 kmalloc(URB_TRANSFER_BUFFER_SIZE, GFP_KERNEL);
289 if (!urb->transfer_buffer) { 290 if (!urb->transfer_buffer) {
290 err("%s - out of memory for urb buffers.", 291 dev_err(&serial->dev->dev,
291 __func__); 292 "%s - out of memory for urb buffers.\n",
293 __func__);
292 goto err_cleanup; 294 goto err_cleanup;
293 } 295 }
294 } 296 }
@@ -409,7 +411,8 @@ static int klsi_105_open(struct tty_struct *tty,
409 411
410 rc = usb_submit_urb(port->read_urb, GFP_KERNEL); 412 rc = usb_submit_urb(port->read_urb, GFP_KERNEL);
411 if (rc) { 413 if (rc) {
412 err("%s - failed submitting read urb, error %d", __func__, rc); 414 dev_err(&port->dev, "%s - failed submitting read urb, "
415 "error %d\n", __func__, rc);
413 retval = rc; 416 retval = rc;
414 goto exit; 417 goto exit;
415 } 418 }
@@ -424,7 +427,7 @@ static int klsi_105_open(struct tty_struct *tty,
424 0, 427 0,
425 KLSI_TIMEOUT); 428 KLSI_TIMEOUT);
426 if (rc < 0) { 429 if (rc < 0) {
427 err("Enabling read failed (error = %d)", rc); 430 dev_err(&port->dev, "Enabling read failed (error = %d)\n", rc);
428 retval = rc; 431 retval = rc;
429 } else 432 } else
430 dbg("%s - enabled reading", __func__); 433 dbg("%s - enabled reading", __func__);
@@ -464,7 +467,8 @@ static void klsi_105_close(struct tty_struct *tty,
464 NULL, 0, 467 NULL, 0,
465 KLSI_TIMEOUT); 468 KLSI_TIMEOUT);
466 if (rc < 0) 469 if (rc < 0)
467 err("Disabling read failed (error = %d)", rc); 470 dev_err(&port->dev,
471 "Disabling read failed (error = %d)\n", rc);
468 } 472 }
469 mutex_unlock(&port->serial->disc_mutex); 473 mutex_unlock(&port->serial->disc_mutex);
470 474
@@ -475,8 +479,9 @@ static void klsi_105_close(struct tty_struct *tty,
475 /* FIXME */ 479 /* FIXME */
476 /* wgg - do I need this? I think so. */ 480 /* wgg - do I need this? I think so. */
477 usb_kill_urb(port->interrupt_in_urb); 481 usb_kill_urb(port->interrupt_in_urb);
478 info("kl5kusb105 port stats: %ld bytes in, %ld bytes out", 482 dev_info(&port->serial->dev->dev,
479 priv->bytes_in, priv->bytes_out); 483 "port stats: %ld bytes in, %ld bytes out\n",
484 priv->bytes_in, priv->bytes_out);
480} /* klsi_105_close */ 485} /* klsi_105_close */
481 486
482 487
@@ -522,7 +527,9 @@ static int klsi_105_write(struct tty_struct *tty,
522 urb->transfer_buffer = 527 urb->transfer_buffer =
523 kmalloc(URB_TRANSFER_BUFFER_SIZE, GFP_ATOMIC); 528 kmalloc(URB_TRANSFER_BUFFER_SIZE, GFP_ATOMIC);
524 if (urb->transfer_buffer == NULL) { 529 if (urb->transfer_buffer == NULL) {
525 err("%s - no more kernel memory...", __func__); 530 dev_err(&port->dev,
531 "%s - no more kernel memory...\n",
532 __func__);
526 goto exit; 533 goto exit;
527 } 534 }
528 } 535 }
@@ -549,8 +556,9 @@ static int klsi_105_write(struct tty_struct *tty,
549 /* send the data out the bulk port */ 556 /* send the data out the bulk port */
550 result = usb_submit_urb(urb, GFP_ATOMIC); 557 result = usb_submit_urb(urb, GFP_ATOMIC);
551 if (result) { 558 if (result) {
552 err("%s - failed submitting write urb, error %d", 559 dev_err(&port->dev,
553 __func__, result); 560 "%s - failed submitting write urb, error %d\n",
561 __func__, result);
554 goto exit; 562 goto exit;
555 } 563 }
556 buf += size; 564 buf += size;
@@ -658,7 +666,7 @@ static void klsi_105_read_bulk_callback(struct urb *urb)
658 } else { 666 } else {
659 int bytes_sent = ((__u8 *) data)[0] + 667 int bytes_sent = ((__u8 *) data)[0] +
660 ((unsigned int) ((__u8 *) data)[1] << 8); 668 ((unsigned int) ((__u8 *) data)[1] << 8);
661 tty = port->port.tty; 669 tty = tty_port_tty_get(&port->port);
662 /* we should immediately resubmit the URB, before attempting 670 /* we should immediately resubmit the URB, before attempting
663 * to pass the data on to the tty layer. But that needs locking 671 * to pass the data on to the tty layer. But that needs locking
664 * against re-entry an then mixed-up data because of 672 * against re-entry an then mixed-up data because of
@@ -679,6 +687,7 @@ static void klsi_105_read_bulk_callback(struct urb *urb)
679 tty_buffer_request_room(tty, bytes_sent); 687 tty_buffer_request_room(tty, bytes_sent);
680 tty_insert_flip_string(tty, data + 2, bytes_sent); 688 tty_insert_flip_string(tty, data + 2, bytes_sent);
681 tty_flip_buffer_push(tty); 689 tty_flip_buffer_push(tty);
690 tty_kref_put(tty);
682 691
683 /* again lockless, but debug info only */ 692 /* again lockless, but debug info only */
684 priv->bytes_in += bytes_sent; 693 priv->bytes_in += bytes_sent;
@@ -693,8 +702,9 @@ static void klsi_105_read_bulk_callback(struct urb *urb)
693 port); 702 port);
694 rc = usb_submit_urb(port->read_urb, GFP_ATOMIC); 703 rc = usb_submit_urb(port->read_urb, GFP_ATOMIC);
695 if (rc) 704 if (rc)
696 err("%s - failed resubmitting read urb, error %d", 705 dev_err(&port->dev,
697 __func__, rc); 706 "%s - failed resubmitting read urb, error %d\n",
707 __func__, rc);
698} /* klsi_105_read_bulk_callback */ 708} /* klsi_105_read_bulk_callback */
699 709
700 710
@@ -798,7 +808,8 @@ static void klsi_105_set_termios(struct tty_struct *tty,
798 priv->cfg.databits = kl5kusb105a_dtb_8; 808 priv->cfg.databits = kl5kusb105a_dtb_8;
799 break; 809 break;
800 default: 810 default:
801 err("CSIZE was not CS5-CS8, using default of 8"); 811 dev_err(&port->dev,
812 "CSIZE was not CS5-CS8, using default of 8\n");
802 priv->cfg.databits = kl5kusb105a_dtb_8; 813 priv->cfg.databits = kl5kusb105a_dtb_8;
803 break; 814 break;
804 } 815 }
@@ -885,7 +896,8 @@ static int klsi_105_tiocmget(struct tty_struct *tty, struct file *file)
885 896
886 rc = klsi_105_get_line_state(port, &line_state); 897 rc = klsi_105_get_line_state(port, &line_state);
887 if (rc < 0) { 898 if (rc < 0) {
888 err("Reading line control failed (error = %d)", rc); 899 dev_err(&port->dev,
900 "Reading line control failed (error = %d)\n", rc);
889 /* better return value? EAGAIN? */ 901 /* better return value? EAGAIN? */
890 return rc; 902 return rc;
891 } 903 }
@@ -943,8 +955,9 @@ static void klsi_105_unthrottle(struct tty_struct *tty)
943 port->read_urb->dev = port->serial->dev; 955 port->read_urb->dev = port->serial->dev;
944 result = usb_submit_urb(port->read_urb, GFP_ATOMIC); 956 result = usb_submit_urb(port->read_urb, GFP_ATOMIC);
945 if (result) 957 if (result)
946 err("%s - failed submitting read urb, error %d", __func__, 958 dev_err(&port->dev,
947 result); 959 "%s - failed submitting read urb, error %d\n",
960 __func__, result);
948} 961}
949 962
950 963
@@ -959,7 +972,8 @@ static int __init klsi_105_init(void)
959 if (retval) 972 if (retval)
960 goto failed_usb_register; 973 goto failed_usb_register;
961 974
962 info(DRIVER_DESC " " DRIVER_VERSION); 975 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
976 DRIVER_DESC "\n");
963 return 0; 977 return 0;
964failed_usb_register: 978failed_usb_register:
965 usb_serial_deregister(&kl5kusb105d_device); 979 usb_serial_deregister(&kl5kusb105d_device);
diff --git a/drivers/usb/serial/kobil_sct.c b/drivers/usb/serial/kobil_sct.c
index deba28ec77e8..6286baad9392 100644
--- a/drivers/usb/serial/kobil_sct.c
+++ b/drivers/usb/serial/kobil_sct.c
@@ -383,7 +383,7 @@ static void kobil_read_int_callback(struct urb *urb)
383 return; 383 return;
384 } 384 }
385 385
386 tty = port->port.tty; 386 tty = tty_port_tty_get(&port->port);
387 if (urb->actual_length) { 387 if (urb->actual_length) {
388 388
389 /* BEGIN DEBUG */ 389 /* BEGIN DEBUG */
@@ -405,6 +405,7 @@ static void kobil_read_int_callback(struct urb *urb)
405 tty_insert_flip_string(tty, data, urb->actual_length); 405 tty_insert_flip_string(tty, data, urb->actual_length);
406 tty_flip_buffer_push(tty); 406 tty_flip_buffer_push(tty);
407 } 407 }
408 tty_kref_put(tty);
408 /* someone sets the dev to 0 if the close method has been called */ 409 /* someone sets the dev to 0 if the close method has been called */
409 port->interrupt_in_urb->dev = port->serial->dev; 410 port->interrupt_in_urb->dev = port->serial->dev;
410 411
@@ -743,8 +744,8 @@ static int __init kobil_init(void)
743 if (retval) 744 if (retval)
744 goto failed_usb_register; 745 goto failed_usb_register;
745 746
746 info(DRIVER_VERSION " " DRIVER_AUTHOR); 747 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
747 info(DRIVER_DESC); 748 DRIVER_DESC "\n");
748 749
749 return 0; 750 return 0;
750failed_usb_register: 751failed_usb_register:
diff --git a/drivers/usb/serial/mct_u232.c b/drivers/usb/serial/mct_u232.c
index 0ded8bd6ec85..07710cf31d0d 100644
--- a/drivers/usb/serial/mct_u232.c
+++ b/drivers/usb/serial/mct_u232.c
@@ -246,7 +246,8 @@ static int mct_u232_set_baud_rate(struct tty_struct *tty,
246 0, 0, &divisor, MCT_U232_SET_BAUD_RATE_SIZE, 246 0, 0, &divisor, MCT_U232_SET_BAUD_RATE_SIZE,
247 WDR_TIMEOUT); 247 WDR_TIMEOUT);
248 if (rc < 0) /*FIXME: What value speed results */ 248 if (rc < 0) /*FIXME: What value speed results */
249 err("Set BAUD RATE %d failed (error = %d)", value, rc); 249 dev_err(&port->dev, "Set BAUD RATE %d failed (error = %d)\n",
250 value, rc);
250 else 251 else
251 tty_encode_baud_rate(tty, speed, speed); 252 tty_encode_baud_rate(tty, speed, speed);
252 dbg("set_baud_rate: value: 0x%x, divisor: 0x%x", value, divisor); 253 dbg("set_baud_rate: value: 0x%x, divisor: 0x%x", value, divisor);
@@ -274,8 +275,9 @@ static int mct_u232_set_baud_rate(struct tty_struct *tty,
274 0, 0, &zero_byte, MCT_U232_SET_UNKNOWN1_SIZE, 275 0, 0, &zero_byte, MCT_U232_SET_UNKNOWN1_SIZE,
275 WDR_TIMEOUT); 276 WDR_TIMEOUT);
276 if (rc < 0) 277 if (rc < 0)
277 err("Sending USB device request code %d failed (error = %d)", 278 dev_err(&port->dev, "Sending USB device request code %d "
278 MCT_U232_SET_UNKNOWN1_REQUEST, rc); 279 "failed (error = %d)\n", MCT_U232_SET_UNKNOWN1_REQUEST,
280 rc);
279 281
280 if (port && C_CRTSCTS(tty)) 282 if (port && C_CRTSCTS(tty))
281 cts_enable_byte = 1; 283 cts_enable_byte = 1;
@@ -288,8 +290,8 @@ static int mct_u232_set_baud_rate(struct tty_struct *tty,
288 0, 0, &cts_enable_byte, MCT_U232_SET_CTS_SIZE, 290 0, 0, &cts_enable_byte, MCT_U232_SET_CTS_SIZE,
289 WDR_TIMEOUT); 291 WDR_TIMEOUT);
290 if (rc < 0) 292 if (rc < 0)
291 err("Sending USB device request code %d failed (error = %d)", 293 dev_err(&port->dev, "Sending USB device request code %d "
292 MCT_U232_SET_CTS_REQUEST, rc); 294 "failed (error = %d)\n", MCT_U232_SET_CTS_REQUEST, rc);
293 295
294 return rc; 296 return rc;
295} /* mct_u232_set_baud_rate */ 297} /* mct_u232_set_baud_rate */
@@ -303,7 +305,8 @@ static int mct_u232_set_line_ctrl(struct usb_serial *serial, unsigned char lcr)
303 0, 0, &lcr, MCT_U232_SET_LINE_CTRL_SIZE, 305 0, 0, &lcr, MCT_U232_SET_LINE_CTRL_SIZE,
304 WDR_TIMEOUT); 306 WDR_TIMEOUT);
305 if (rc < 0) 307 if (rc < 0)
306 err("Set LINE CTRL 0x%x failed (error = %d)", lcr, rc); 308 dev_err(&serial->dev->dev,
309 "Set LINE CTRL 0x%x failed (error = %d)\n", lcr, rc);
307 dbg("set_line_ctrl: 0x%x", lcr); 310 dbg("set_line_ctrl: 0x%x", lcr);
308 return rc; 311 return rc;
309} /* mct_u232_set_line_ctrl */ 312} /* mct_u232_set_line_ctrl */
@@ -325,7 +328,8 @@ static int mct_u232_set_modem_ctrl(struct usb_serial *serial,
325 0, 0, &mcr, MCT_U232_SET_MODEM_CTRL_SIZE, 328 0, 0, &mcr, MCT_U232_SET_MODEM_CTRL_SIZE,
326 WDR_TIMEOUT); 329 WDR_TIMEOUT);
327 if (rc < 0) 330 if (rc < 0)
328 err("Set MODEM CTRL 0x%x failed (error = %d)", mcr, rc); 331 dev_err(&serial->dev->dev,
332 "Set MODEM CTRL 0x%x failed (error = %d)\n", mcr, rc);
329 dbg("set_modem_ctrl: state=0x%x ==> mcr=0x%x", control_state, mcr); 333 dbg("set_modem_ctrl: state=0x%x ==> mcr=0x%x", control_state, mcr);
330 334
331 return rc; 335 return rc;
@@ -341,7 +345,8 @@ static int mct_u232_get_modem_stat(struct usb_serial *serial,
341 0, 0, msr, MCT_U232_GET_MODEM_STAT_SIZE, 345 0, 0, msr, MCT_U232_GET_MODEM_STAT_SIZE,
342 WDR_TIMEOUT); 346 WDR_TIMEOUT);
343 if (rc < 0) { 347 if (rc < 0) {
344 err("Get MODEM STATus failed (error = %d)", rc); 348 dev_err(&serial->dev->dev,
349 "Get MODEM STATus failed (error = %d)\n", rc);
345 *msr = 0; 350 *msr = 0;
346 } 351 }
347 dbg("get_modem_stat: 0x%x", *msr); 352 dbg("get_modem_stat: 0x%x", *msr);
@@ -470,8 +475,9 @@ static int mct_u232_open(struct tty_struct *tty,
470 port->read_urb->dev = port->serial->dev; 475 port->read_urb->dev = port->serial->dev;
471 retval = usb_submit_urb(port->read_urb, GFP_KERNEL); 476 retval = usb_submit_urb(port->read_urb, GFP_KERNEL);
472 if (retval) { 477 if (retval) {
473 err("usb_submit_urb(read bulk) failed pipe 0x%x err %d", 478 dev_err(&port->dev,
474 port->read_urb->pipe, retval); 479 "usb_submit_urb(read bulk) failed pipe 0x%x err %d\n",
480 port->read_urb->pipe, retval);
475 goto error; 481 goto error;
476 } 482 }
477 483
@@ -479,8 +485,9 @@ static int mct_u232_open(struct tty_struct *tty,
479 retval = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL); 485 retval = usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL);
480 if (retval) { 486 if (retval) {
481 usb_kill_urb(port->read_urb); 487 usb_kill_urb(port->read_urb);
482 err(" usb_submit_urb(read int) failed pipe 0x%x err %d", 488 dev_err(&port->dev,
483 port->interrupt_in_urb->pipe, retval); 489 "usb_submit_urb(read int) failed pipe 0x%x err %d",
490 port->interrupt_in_urb->pipe, retval);
484 goto error; 491 goto error;
485 } 492 }
486 return 0; 493 return 0;
@@ -563,10 +570,11 @@ static void mct_u232_read_int_callback(struct urb *urb)
563 * Work-a-round: handle the 'usual' bulk-in pipe here 570 * Work-a-round: handle the 'usual' bulk-in pipe here
564 */ 571 */
565 if (urb->transfer_buffer_length > 2) { 572 if (urb->transfer_buffer_length > 2) {
566 tty = port->port.tty; 573 tty = tty_port_tty_get(&port->port);
567 if (urb->actual_length) { 574 if (urb->actual_length) {
568 tty_insert_flip_string(tty, data, urb->actual_length); 575 tty_insert_flip_string(tty, data, urb->actual_length);
569 tty_flip_buffer_push(tty); 576 tty_flip_buffer_push(tty);
577 tty_kref_put(tty);
570 } 578 }
571 goto exit; 579 goto exit;
572 } 580 }
@@ -591,7 +599,7 @@ static void mct_u232_read_int_callback(struct urb *urb)
591 * to look in to this before committing any code. 599 * to look in to this before committing any code.
592 */ 600 */
593 if (priv->last_lsr & MCT_U232_LSR_ERR) { 601 if (priv->last_lsr & MCT_U232_LSR_ERR) {
594 tty = port->port.tty; 602 tty = tty_port_tty_get(&port->port);
595 /* Overrun Error */ 603 /* Overrun Error */
596 if (priv->last_lsr & MCT_U232_LSR_OE) { 604 if (priv->last_lsr & MCT_U232_LSR_OE) {
597 } 605 }
@@ -604,14 +612,16 @@ static void mct_u232_read_int_callback(struct urb *urb)
604 /* Break Indicator */ 612 /* Break Indicator */
605 if (priv->last_lsr & MCT_U232_LSR_BI) { 613 if (priv->last_lsr & MCT_U232_LSR_BI) {
606 } 614 }
615 tty_kref_put(tty);
607 } 616 }
608#endif 617#endif
609 spin_unlock_irqrestore(&priv->lock, flags); 618 spin_unlock_irqrestore(&priv->lock, flags);
610exit: 619exit:
611 retval = usb_submit_urb(urb, GFP_ATOMIC); 620 retval = usb_submit_urb(urb, GFP_ATOMIC);
612 if (retval) 621 if (retval)
613 err("%s - usb_submit_urb failed with result %d", 622 dev_err(&port->dev,
614 __func__, retval); 623 "%s - usb_submit_urb failed with result %d\n",
624 __func__, retval);
615} /* mct_u232_read_int_callback */ 625} /* mct_u232_read_int_callback */
616 626
617static void mct_u232_set_termios(struct tty_struct *tty, 627static void mct_u232_set_termios(struct tty_struct *tty,
@@ -678,7 +688,8 @@ static void mct_u232_set_termios(struct tty_struct *tty,
678 case CS8: 688 case CS8:
679 last_lcr |= MCT_U232_DATA_BITS_8; break; 689 last_lcr |= MCT_U232_DATA_BITS_8; break;
680 default: 690 default:
681 err("CSIZE was not CS5-CS8, using default of 8"); 691 dev_err(&port->dev,
692 "CSIZE was not CS5-CS8, using default of 8\n");
682 last_lcr |= MCT_U232_DATA_BITS_8; 693 last_lcr |= MCT_U232_DATA_BITS_8;
683 break; 694 break;
684 } 695 }
@@ -815,7 +826,8 @@ static int __init mct_u232_init(void)
815 retval = usb_register(&mct_u232_driver); 826 retval = usb_register(&mct_u232_driver);
816 if (retval) 827 if (retval)
817 goto failed_usb_register; 828 goto failed_usb_register;
818 info(DRIVER_DESC " " DRIVER_VERSION); 829 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
830 DRIVER_DESC "\n");
819 return 0; 831 return 0;
820failed_usb_register: 832failed_usb_register:
821 usb_serial_deregister(&mct_u232_device); 833 usb_serial_deregister(&mct_u232_device);
diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c
index 7c4917d77c0a..e772cc0a97fd 100644
--- a/drivers/usb/serial/mos7720.c
+++ b/drivers/usb/serial/mos7720.c
@@ -216,12 +216,13 @@ static void mos7720_bulk_in_callback(struct urb *urb)
216 216
217 data = urb->transfer_buffer; 217 data = urb->transfer_buffer;
218 218
219 tty = port->port.tty; 219 tty = tty_port_tty_get(&port->port);
220 if (tty && urb->actual_length) { 220 if (tty && urb->actual_length) {
221 tty_buffer_request_room(tty, urb->actual_length); 221 tty_buffer_request_room(tty, urb->actual_length);
222 tty_insert_flip_string(tty, data, urb->actual_length); 222 tty_insert_flip_string(tty, data, urb->actual_length);
223 tty_flip_buffer_push(tty); 223 tty_flip_buffer_push(tty);
224 } 224 }
225 tty_kref_put(tty);
225 226
226 if (!port->read_urb) { 227 if (!port->read_urb) {
227 dbg("URB KILLED !!!"); 228 dbg("URB KILLED !!!");
@@ -262,10 +263,11 @@ static void mos7720_bulk_out_data_callback(struct urb *urb)
262 263
263 dbg("Entering ........."); 264 dbg("Entering .........");
264 265
265 tty = mos7720_port->port->port.tty; 266 tty = tty_port_tty_get(&mos7720_port->port->port);
266 267
267 if (tty && mos7720_port->open) 268 if (tty && mos7720_port->open)
268 tty_wakeup(tty); 269 tty_wakeup(tty);
270 tty_kref_put(tty);
269} 271}
270 272
271/* 273/*
@@ -353,14 +355,16 @@ static int mos7720_open(struct tty_struct *tty,
353 mos7720_port->write_urb_pool[j] = urb; 355 mos7720_port->write_urb_pool[j] = urb;
354 356
355 if (urb == NULL) { 357 if (urb == NULL) {
356 err("No more urbs???"); 358 dev_err(&port->dev, "No more urbs???\n");
357 continue; 359 continue;
358 } 360 }
359 361
360 urb->transfer_buffer = kmalloc(URB_TRANSFER_BUFFER_SIZE, 362 urb->transfer_buffer = kmalloc(URB_TRANSFER_BUFFER_SIZE,
361 GFP_KERNEL); 363 GFP_KERNEL);
362 if (!urb->transfer_buffer) { 364 if (!urb->transfer_buffer) {
363 err("%s-out of memory for urb buffers.", __func__); 365 dev_err(&port->dev,
366 "%s-out of memory for urb buffers.\n",
367 __func__);
364 usb_free_urb(mos7720_port->write_urb_pool[j]); 368 usb_free_urb(mos7720_port->write_urb_pool[j]);
365 mos7720_port->write_urb_pool[j] = NULL; 369 mos7720_port->write_urb_pool[j] = NULL;
366 continue; 370 continue;
@@ -692,7 +696,8 @@ static int mos7720_write(struct tty_struct *tty, struct usb_serial_port *port,
692 urb->transfer_buffer = kmalloc(URB_TRANSFER_BUFFER_SIZE, 696 urb->transfer_buffer = kmalloc(URB_TRANSFER_BUFFER_SIZE,
693 GFP_KERNEL); 697 GFP_KERNEL);
694 if (urb->transfer_buffer == NULL) { 698 if (urb->transfer_buffer == NULL) {
695 err("%s no more kernel memory...", __func__); 699 dev_err(&port->dev, "%s no more kernel memory...\n",
700 __func__);
696 goto exit; 701 goto exit;
697 } 702 }
698 } 703 }
@@ -712,8 +717,8 @@ static int mos7720_write(struct tty_struct *tty, struct usb_serial_port *port,
712 /* send it down the pipe */ 717 /* send it down the pipe */
713 status = usb_submit_urb(urb, GFP_ATOMIC); 718 status = usb_submit_urb(urb, GFP_ATOMIC);
714 if (status) { 719 if (status) {
715 err("%s - usb_submit_urb(write bulk) failed with status = %d", 720 dev_err(&port->dev, "%s - usb_submit_urb(write bulk) failed "
716 __func__, status); 721 "with status = %d\n", __func__, status);
717 bytes_sent = status; 722 bytes_sent = status;
718 goto exit; 723 goto exit;
719 } 724 }
@@ -973,7 +978,7 @@ static int send_cmd_write_baud_rate(struct moschip_port *mos7720_port,
973 /* Calculate the Divisor */ 978 /* Calculate the Divisor */
974 status = calc_baud_rate_divisor(baudrate, &divisor); 979 status = calc_baud_rate_divisor(baudrate, &divisor);
975 if (status) { 980 if (status) {
976 err("%s - bad baud rate", __func__); 981 dev_err(&port->dev, "%s - bad baud rate\n", __func__);
977 return status; 982 return status;
978 } 983 }
979 984
@@ -1267,29 +1272,6 @@ static int get_lsr_info(struct tty_struct *tty,
1267 return 0; 1272 return 0;
1268} 1273}
1269 1274
1270/*
1271 * get_number_bytes_avail - get number of bytes available
1272 *
1273 * Purpose: Let user call ioctl to get the count of number of bytes available.
1274 */
1275static int get_number_bytes_avail(struct moschip_port *mos7720_port,
1276 unsigned int __user *value)
1277{
1278 unsigned int result = 0;
1279 struct tty_struct *tty = mos7720_port->port->port.tty;
1280
1281 if (!tty)
1282 return -ENOIOCTLCMD;
1283
1284 result = tty->read_cnt;
1285
1286 dbg("%s(%d) = %d", __func__, mos7720_port->port->number, result);
1287 if (copy_to_user(value, &result, sizeof(int)))
1288 return -EFAULT;
1289
1290 return -ENOIOCTLCMD;
1291}
1292
1293static int set_modem_info(struct moschip_port *mos7720_port, unsigned int cmd, 1275static int set_modem_info(struct moschip_port *mos7720_port, unsigned int cmd,
1294 unsigned int __user *value) 1276 unsigned int __user *value)
1295{ 1277{
@@ -1409,13 +1391,6 @@ static int mos7720_ioctl(struct tty_struct *tty, struct file *file,
1409 dbg("%s - port %d, cmd = 0x%x", __func__, port->number, cmd); 1391 dbg("%s - port %d, cmd = 0x%x", __func__, port->number, cmd);
1410 1392
1411 switch (cmd) { 1393 switch (cmd) {
1412 case TIOCINQ:
1413 /* return number of bytes available */
1414 dbg("%s (%d) TIOCINQ", __func__, port->number);
1415 return get_number_bytes_avail(mos7720_port,
1416 (unsigned int __user *)arg);
1417 break;
1418
1419 case TIOCSERGETLSR: 1394 case TIOCSERGETLSR:
1420 dbg("%s (%d) TIOCSERGETLSR", __func__, port->number); 1395 dbg("%s (%d) TIOCSERGETLSR", __func__, port->number);
1421 return get_lsr_info(tty, mos7720_port, 1396 return get_lsr_info(tty, mos7720_port,
@@ -1506,7 +1481,7 @@ static int mos7720_startup(struct usb_serial *serial)
1506 /* create our private serial structure */ 1481 /* create our private serial structure */
1507 mos7720_serial = kzalloc(sizeof(struct moschip_serial), GFP_KERNEL); 1482 mos7720_serial = kzalloc(sizeof(struct moschip_serial), GFP_KERNEL);
1508 if (mos7720_serial == NULL) { 1483 if (mos7720_serial == NULL) {
1509 err("%s - Out of memory", __func__); 1484 dev_err(&dev->dev, "%s - Out of memory\n", __func__);
1510 return -ENOMEM; 1485 return -ENOMEM;
1511 } 1486 }
1512 1487
@@ -1519,7 +1494,7 @@ static int mos7720_startup(struct usb_serial *serial)
1519 for (i = 0; i < serial->num_ports; ++i) { 1494 for (i = 0; i < serial->num_ports; ++i) {
1520 mos7720_port = kzalloc(sizeof(struct moschip_port), GFP_KERNEL); 1495 mos7720_port = kzalloc(sizeof(struct moschip_port), GFP_KERNEL);
1521 if (mos7720_port == NULL) { 1496 if (mos7720_port == NULL) {
1522 err("%s - Out of memory", __func__); 1497 dev_err(&dev->dev, "%s - Out of memory\n", __func__);
1523 usb_set_serial_data(serial, NULL); 1498 usb_set_serial_data(serial, NULL);
1524 kfree(mos7720_serial); 1499 kfree(mos7720_serial);
1525 return -ENOMEM; 1500 return -ENOMEM;
@@ -1613,7 +1588,8 @@ static int __init moschip7720_init(void)
1613 if (retval) 1588 if (retval)
1614 goto failed_port_device_register; 1589 goto failed_port_device_register;
1615 1590
1616 info(DRIVER_DESC " " DRIVER_VERSION); 1591 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
1592 DRIVER_DESC "\n");
1617 1593
1618 /* Register with the usb */ 1594 /* Register with the usb */
1619 retval = usb_register(&usb_driver); 1595 retval = usb_register(&usb_driver);
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
index 09d82062b973..fda4a6421c44 100644
--- a/drivers/usb/serial/mos7840.c
+++ b/drivers/usb/serial/mos7840.c
@@ -709,12 +709,13 @@ static void mos7840_bulk_in_callback(struct urb *urb)
709 dbg("%s", "Entering ........... \n"); 709 dbg("%s", "Entering ........... \n");
710 710
711 if (urb->actual_length) { 711 if (urb->actual_length) {
712 tty = mos7840_port->port->port.tty; 712 tty = tty_port_tty_get(&mos7840_port->port->port);
713 if (tty) { 713 if (tty) {
714 tty_buffer_request_room(tty, urb->actual_length); 714 tty_buffer_request_room(tty, urb->actual_length);
715 tty_insert_flip_string(tty, data, urb->actual_length); 715 tty_insert_flip_string(tty, data, urb->actual_length);
716 dbg(" %s \n", data); 716 dbg(" %s \n", data);
717 tty_flip_buffer_push(tty); 717 tty_flip_buffer_push(tty);
718 tty_kref_put(tty);
718 } 719 }
719 mos7840_port->icount.rx += urb->actual_length; 720 mos7840_port->icount.rx += urb->actual_length;
720 smp_wmb(); 721 smp_wmb();
@@ -773,10 +774,10 @@ static void mos7840_bulk_out_data_callback(struct urb *urb)
773 774
774 dbg("%s \n", "Entering ........."); 775 dbg("%s \n", "Entering .........");
775 776
776 tty = mos7840_port->port->port.tty; 777 tty = tty_port_tty_get(&mos7840_port->port->port);
777
778 if (tty && mos7840_port->open) 778 if (tty && mos7840_port->open)
779 tty_wakeup(tty); 779 tty_wakeup(tty);
780 tty_kref_put(tty);
780 781
781} 782}
782 783
@@ -843,7 +844,7 @@ static int mos7840_open(struct tty_struct *tty,
843 mos7840_port->write_urb_pool[j] = urb; 844 mos7840_port->write_urb_pool[j] = urb;
844 845
845 if (urb == NULL) { 846 if (urb == NULL) {
846 err("No more urbs???"); 847 dev_err(&port->dev, "No more urbs???\n");
847 continue; 848 continue;
848 } 849 }
849 850
@@ -852,7 +853,9 @@ static int mos7840_open(struct tty_struct *tty,
852 if (!urb->transfer_buffer) { 853 if (!urb->transfer_buffer) {
853 usb_free_urb(urb); 854 usb_free_urb(urb);
854 mos7840_port->write_urb_pool[j] = NULL; 855 mos7840_port->write_urb_pool[j] = NULL;
855 err("%s-out of memory for urb buffers.", __func__); 856 dev_err(&port->dev,
857 "%s-out of memory for urb buffers.\n",
858 __func__);
856 continue; 859 continue;
857 } 860 }
858 } 861 }
@@ -1020,8 +1023,8 @@ static int mos7840_open(struct tty_struct *tty,
1020 usb_submit_urb(serial->port[0]->interrupt_in_urb, 1023 usb_submit_urb(serial->port[0]->interrupt_in_urb,
1021 GFP_KERNEL); 1024 GFP_KERNEL);
1022 if (response) { 1025 if (response) {
1023 err("%s - Error %d submitting interrupt urb", 1026 dev_err(&port->dev, "%s - Error %d submitting "
1024 __func__, response); 1027 "interrupt urb\n", __func__, response);
1025 } 1028 }
1026 1029
1027 } 1030 }
@@ -1054,8 +1057,8 @@ static int mos7840_open(struct tty_struct *tty,
1054 port->bulk_in_endpointAddress); 1057 port->bulk_in_endpointAddress);
1055 response = usb_submit_urb(mos7840_port->read_urb, GFP_KERNEL); 1058 response = usb_submit_urb(mos7840_port->read_urb, GFP_KERNEL);
1056 if (response) { 1059 if (response) {
1057 err("%s - Error %d submitting control urb", __func__, 1060 dev_err(&port->dev, "%s - Error %d submitting control urb\n",
1058 response); 1061 __func__, response);
1059 } 1062 }
1060 1063
1061 /* initialize our wait queues */ 1064 /* initialize our wait queues */
@@ -1491,7 +1494,8 @@ static int mos7840_write(struct tty_struct *tty, struct usb_serial_port *port,
1491 kmalloc(URB_TRANSFER_BUFFER_SIZE, GFP_KERNEL); 1494 kmalloc(URB_TRANSFER_BUFFER_SIZE, GFP_KERNEL);
1492 1495
1493 if (urb->transfer_buffer == NULL) { 1496 if (urb->transfer_buffer == NULL) {
1494 err("%s no more kernel memory...", __func__); 1497 dev_err(&port->dev, "%s no more kernel memory...\n",
1498 __func__);
1495 goto exit; 1499 goto exit;
1496 } 1500 }
1497 } 1501 }
@@ -1516,8 +1520,8 @@ static int mos7840_write(struct tty_struct *tty, struct usb_serial_port *port,
1516 1520
1517 if (status) { 1521 if (status) {
1518 mos7840_port->busy[i] = 0; 1522 mos7840_port->busy[i] = 0;
1519 err("%s - usb_submit_urb(write bulk) failed with status = %d", 1523 dev_err(&port->dev, "%s - usb_submit_urb(write bulk) failed "
1520 __func__, status); 1524 "with status = %d\n", __func__, status);
1521 bytes_sent = status; 1525 bytes_sent = status;
1522 goto exit; 1526 goto exit;
1523 } 1527 }
@@ -1855,8 +1859,7 @@ static int mos7840_send_cmd_write_baud_rate(struct moschip_port *mos7840_port,
1855 /* Calculate the Divisor */ 1859 /* Calculate the Divisor */
1856 1860
1857 if (status) { 1861 if (status) {
1858 err("%s - bad baud rate", __func__); 1862 dev_err(&port->dev, "%s - bad baud rate\n", __func__);
1859 dbg("%s\n", "bad baud rate");
1860 return status; 1863 return status;
1861 } 1864 }
1862 /* Enable access to divisor latch */ 1865 /* Enable access to divisor latch */
@@ -2445,7 +2448,7 @@ static int mos7840_startup(struct usb_serial *serial)
2445 for (i = 0; i < serial->num_ports; ++i) { 2448 for (i = 0; i < serial->num_ports; ++i) {
2446 mos7840_port = kzalloc(sizeof(struct moschip_port), GFP_KERNEL); 2449 mos7840_port = kzalloc(sizeof(struct moschip_port), GFP_KERNEL);
2447 if (mos7840_port == NULL) { 2450 if (mos7840_port == NULL) {
2448 err("%s - Out of memory", __func__); 2451 dev_err(&dev->dev, "%s - Out of memory\n", __func__);
2449 status = -ENOMEM; 2452 status = -ENOMEM;
2450 i--; /* don't follow NULL pointer cleaning up */ 2453 i--; /* don't follow NULL pointer cleaning up */
2451 goto error; 2454 goto error;
@@ -2742,7 +2745,8 @@ static int __init moschip7840_init(void)
2742 goto failed_port_device_register; 2745 goto failed_port_device_register;
2743 2746
2744 dbg("%s\n", "Entring..."); 2747 dbg("%s\n", "Entring...");
2745 info(DRIVER_DESC " " DRIVER_VERSION); 2748 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
2749 DRIVER_DESC "\n");
2746 2750
2747 /* Register with the usb */ 2751 /* Register with the usb */
2748 retval = usb_register(&io_driver); 2752 retval = usb_register(&io_driver);
diff --git a/drivers/usb/serial/navman.c b/drivers/usb/serial/navman.c
index d6736531a0fa..bcdcbb822705 100644
--- a/drivers/usb/serial/navman.c
+++ b/drivers/usb/serial/navman.c
@@ -64,12 +64,13 @@ static void navman_read_int_callback(struct urb *urb)
64 usb_serial_debug_data(debug, &port->dev, __func__, 64 usb_serial_debug_data(debug, &port->dev, __func__,
65 urb->actual_length, data); 65 urb->actual_length, data);
66 66
67 tty = port->port.tty; 67 tty = tty_port_tty_get(&port->port);
68 if (tty && urb->actual_length) { 68 if (tty && urb->actual_length) {
69 tty_buffer_request_room(tty, urb->actual_length); 69 tty_buffer_request_room(tty, urb->actual_length);
70 tty_insert_flip_string(tty, data, urb->actual_length); 70 tty_insert_flip_string(tty, data, urb->actual_length);
71 tty_flip_buffer_push(tty); 71 tty_flip_buffer_push(tty);
72 } 72 }
73 tty_kref_put(tty);
73 74
74exit: 75exit:
75 result = usb_submit_urb(urb, GFP_ATOMIC); 76 result = usb_submit_urb(urb, GFP_ATOMIC);
diff --git a/drivers/usb/serial/omninet.c b/drivers/usb/serial/omninet.c
index ae8e227f3db2..df6539712726 100644
--- a/drivers/usb/serial/omninet.c
+++ b/drivers/usb/serial/omninet.c
@@ -154,8 +154,8 @@ static int omninet_attach(struct usb_serial *serial)
154 154
155 od = kmalloc(sizeof(struct omninet_data), GFP_KERNEL); 155 od = kmalloc(sizeof(struct omninet_data), GFP_KERNEL);
156 if (!od) { 156 if (!od) {
157 err("%s- kmalloc(%Zd) failed.", 157 dev_err(&port->dev, "%s- kmalloc(%Zd) failed.\n",
158 __func__, sizeof(struct omninet_data)); 158 __func__, sizeof(struct omninet_data));
159 return -ENOMEM; 159 return -ENOMEM;
160 } 160 }
161 usb_set_serial_port_data(port, od); 161 usb_set_serial_port_data(port, od);
@@ -172,7 +172,7 @@ static int omninet_open(struct tty_struct *tty,
172 dbg("%s - port %d", __func__, port->number); 172 dbg("%s - port %d", __func__, port->number);
173 173
174 wport = serial->port[1]; 174 wport = serial->port[1];
175 wport->port.tty = tty; /* FIXME */ 175 tty_port_tty_set(&wport->port, tty);
176 176
177 /* Start reading from the device */ 177 /* Start reading from the device */
178 usb_fill_bulk_urb(port->read_urb, serial->dev, 178 usb_fill_bulk_urb(port->read_urb, serial->dev,
@@ -183,8 +183,9 @@ static int omninet_open(struct tty_struct *tty,
183 omninet_read_bulk_callback, port); 183 omninet_read_bulk_callback, port);
184 result = usb_submit_urb(port->read_urb, GFP_KERNEL); 184 result = usb_submit_urb(port->read_urb, GFP_KERNEL);
185 if (result) 185 if (result)
186 err("%s - failed submitting read urb, error %d", 186 dev_err(&port->dev,
187 __func__, result); 187 "%s - failed submitting read urb, error %d\n",
188 __func__, result);
188 return result; 189 return result;
189} 190}
190 191
@@ -229,9 +230,11 @@ static void omninet_read_bulk_callback(struct urb *urb)
229 } 230 }
230 231
231 if (urb->actual_length && header->oh_len) { 232 if (urb->actual_length && header->oh_len) {
232 tty_insert_flip_string(port->port.tty, 233 struct tty_struct *tty = tty_port_tty_get(&port->port);
233 data + OMNINET_DATAOFFSET, header->oh_len); 234 tty_insert_flip_string(tty, data + OMNINET_DATAOFFSET,
234 tty_flip_buffer_push(port->port.tty); 235 header->oh_len);
236 tty_flip_buffer_push(tty);
237 tty_kref_put(tty);
235 } 238 }
236 239
237 /* Continue trying to always read */ 240 /* Continue trying to always read */
@@ -242,8 +245,9 @@ static void omninet_read_bulk_callback(struct urb *urb)
242 omninet_read_bulk_callback, port); 245 omninet_read_bulk_callback, port);
243 result = usb_submit_urb(urb, GFP_ATOMIC); 246 result = usb_submit_urb(urb, GFP_ATOMIC);
244 if (result) 247 if (result)
245 err("%s - failed resubmitting read urb, error %d", 248 dev_err(&port->dev,
246 __func__, result); 249 "%s - failed resubmitting read urb, error %d\n",
250 __func__, result);
247 251
248 return; 252 return;
249} 253}
@@ -296,8 +300,9 @@ static int omninet_write(struct tty_struct *tty, struct usb_serial_port *port,
296 result = usb_submit_urb(wport->write_urb, GFP_ATOMIC); 300 result = usb_submit_urb(wport->write_urb, GFP_ATOMIC);
297 if (result) { 301 if (result) {
298 wport->write_urb_busy = 0; 302 wport->write_urb_busy = 0;
299 err("%s - failed submitting write urb, error %d", 303 dev_err(&port->dev,
300 __func__, result); 304 "%s - failed submitting write urb, error %d\n",
305 __func__, result);
301 } else 306 } else
302 result = count; 307 result = count;
303 308
@@ -362,7 +367,8 @@ static int __init omninet_init(void)
362 retval = usb_register(&omninet_driver); 367 retval = usb_register(&omninet_driver);
363 if (retval) 368 if (retval)
364 goto failed_usb_register; 369 goto failed_usb_register;
365 info(DRIVER_VERSION ":" DRIVER_DESC); 370 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
371 DRIVER_DESC "\n");
366 return 0; 372 return 0;
367failed_usb_register: 373failed_usb_register:
368 usb_serial_deregister(&zyxel_omninet_device); 374 usb_serial_deregister(&zyxel_omninet_device);
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 73f8277f88f2..3d87eabcd922 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -79,27 +79,16 @@ static int option_send_setup(struct tty_struct *tty, struct usb_serial_port *po
79#define OPTION_PRODUCT_VIPER 0x6600 79#define OPTION_PRODUCT_VIPER 0x6600
80#define OPTION_PRODUCT_VIPER_BUS 0x6601 80#define OPTION_PRODUCT_VIPER_BUS 0x6601
81#define OPTION_PRODUCT_GT_MAX_READY 0x6701 81#define OPTION_PRODUCT_GT_MAX_READY 0x6701
82#define OPTION_PRODUCT_GT_MAX 0x6711
83#define OPTION_PRODUCT_FUJI_MODEM_LIGHT 0x6721 82#define OPTION_PRODUCT_FUJI_MODEM_LIGHT 0x6721
84#define OPTION_PRODUCT_FUJI_MODEM_GT 0x6741 83#define OPTION_PRODUCT_FUJI_MODEM_GT 0x6741
85#define OPTION_PRODUCT_FUJI_MODEM_EX 0x6761 84#define OPTION_PRODUCT_FUJI_MODEM_EX 0x6761
86#define OPTION_PRODUCT_FUJI_NETWORK_LIGHT 0x6731
87#define OPTION_PRODUCT_FUJI_NETWORK_GT 0x6751
88#define OPTION_PRODUCT_FUJI_NETWORK_EX 0x6771
89#define OPTION_PRODUCT_KOI_MODEM 0x6800 85#define OPTION_PRODUCT_KOI_MODEM 0x6800
90#define OPTION_PRODUCT_KOI_NETWORK 0x6811
91#define OPTION_PRODUCT_SCORPION_MODEM 0x6901 86#define OPTION_PRODUCT_SCORPION_MODEM 0x6901
92#define OPTION_PRODUCT_SCORPION_NETWORK 0x6911
93#define OPTION_PRODUCT_ETNA_MODEM 0x7001 87#define OPTION_PRODUCT_ETNA_MODEM 0x7001
94#define OPTION_PRODUCT_ETNA_NETWORK 0x7011
95#define OPTION_PRODUCT_ETNA_MODEM_LITE 0x7021 88#define OPTION_PRODUCT_ETNA_MODEM_LITE 0x7021
96#define OPTION_PRODUCT_ETNA_MODEM_GT 0x7041 89#define OPTION_PRODUCT_ETNA_MODEM_GT 0x7041
97#define OPTION_PRODUCT_ETNA_MODEM_EX 0x7061 90#define OPTION_PRODUCT_ETNA_MODEM_EX 0x7061
98#define OPTION_PRODUCT_ETNA_NETWORK_LITE 0x7031
99#define OPTION_PRODUCT_ETNA_NETWORK_GT 0x7051
100#define OPTION_PRODUCT_ETNA_NETWORK_EX 0x7071
101#define OPTION_PRODUCT_ETNA_KOI_MODEM 0x7100 91#define OPTION_PRODUCT_ETNA_KOI_MODEM 0x7100
102#define OPTION_PRODUCT_ETNA_KOI_NETWORK 0x7111
103 92
104#define HUAWEI_VENDOR_ID 0x12D1 93#define HUAWEI_VENDOR_ID 0x12D1
105#define HUAWEI_PRODUCT_E600 0x1001 94#define HUAWEI_PRODUCT_E600 0x1001
@@ -220,6 +209,16 @@ static int option_send_setup(struct tty_struct *tty, struct usb_serial_port *po
220#define ZTE_PRODUCT_MF628 0x0015 209#define ZTE_PRODUCT_MF628 0x0015
221#define ZTE_PRODUCT_CDMA_TECH 0xfffe 210#define ZTE_PRODUCT_CDMA_TECH 0xfffe
222 211
212/* Ericsson products */
213#define ERICSSON_VENDOR_ID 0x0bdb
214#define ERICSSON_PRODUCT_F3507G 0x1900
215
216/* Pantech products */
217#define PANTECH_VENDOR_ID 0x106c
218#define PANTECH_PRODUCT_PC5740 0x3701
219#define PANTECH_PRODUCT_PC5750 0x3702 /* PX-500 */
220#define PANTECH_PRODUCT_UM150 0x3711
221
223static struct usb_device_id option_ids[] = { 222static struct usb_device_id option_ids[] = {
224 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) }, 223 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },
225 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) }, 224 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) },
@@ -235,27 +234,16 @@ static struct usb_device_id option_ids[] = {
235 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_VIPER) }, 234 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_VIPER) },
236 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_VIPER_BUS) }, 235 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_VIPER_BUS) },
237 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_GT_MAX_READY) }, 236 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_GT_MAX_READY) },
238 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_GT_MAX) },
239 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_FUJI_MODEM_LIGHT) }, 237 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_FUJI_MODEM_LIGHT) },
240 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_FUJI_MODEM_GT) }, 238 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_FUJI_MODEM_GT) },
241 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_FUJI_MODEM_EX) }, 239 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_FUJI_MODEM_EX) },
242 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_FUJI_NETWORK_LIGHT) },
243 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_FUJI_NETWORK_GT) },
244 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_FUJI_NETWORK_EX) },
245 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_KOI_MODEM) }, 240 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_KOI_MODEM) },
246 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_KOI_NETWORK) },
247 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_SCORPION_MODEM) }, 241 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_SCORPION_MODEM) },
248 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_SCORPION_NETWORK) },
249 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_MODEM) }, 242 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_MODEM) },
250 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_NETWORK) },
251 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_MODEM_LITE) }, 243 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_MODEM_LITE) },
252 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_MODEM_GT) }, 244 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_MODEM_GT) },
253 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_MODEM_EX) }, 245 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_MODEM_EX) },
254 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_NETWORK_LITE) },
255 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_NETWORK_GT) },
256 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_NETWORK_EX) },
257 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_KOI_MODEM) }, 246 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_KOI_MODEM) },
258 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_ETNA_KOI_NETWORK) },
259 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E600, 0xff, 0xff, 0xff) }, 247 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E600, 0xff, 0xff, 0xff) },
260 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E220, 0xff, 0xff, 0xff) }, 248 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E220, 0xff, 0xff, 0xff) },
261 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E220BIS, 0xff, 0xff, 0xff) }, 249 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E220BIS, 0xff, 0xff, 0xff) },
@@ -318,7 +306,8 @@ static struct usb_device_id option_ids[] = {
318 { USB_DEVICE(DELL_VENDOR_ID, 0x8136) }, /* Dell Wireless HSDPA 5520 == Novatel Expedite EU860D */ 306 { USB_DEVICE(DELL_VENDOR_ID, 0x8136) }, /* Dell Wireless HSDPA 5520 == Novatel Expedite EU860D */
319 { USB_DEVICE(DELL_VENDOR_ID, 0x8137) }, /* Dell Wireless HSDPA 5520 */ 307 { USB_DEVICE(DELL_VENDOR_ID, 0x8137) }, /* Dell Wireless HSDPA 5520 */
320 { USB_DEVICE(DELL_VENDOR_ID, 0x8138) }, /* Dell Wireless 5520 Voda I Mobile Broadband (3G HSDPA) Minicard */ 308 { USB_DEVICE(DELL_VENDOR_ID, 0x8138) }, /* Dell Wireless 5520 Voda I Mobile Broadband (3G HSDPA) Minicard */
321 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_E100A) }, 309 { USB_DEVICE(DELL_VENDOR_ID, 0x8147) }, /* Dell Wireless 5530 Mobile Broadband (3G HSPA) Mini-Card */
310 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_E100A) }, /* ADU-E100, ADU-310 */
322 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_500A) }, 311 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_500A) },
323 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_620UW) }, 312 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_620UW) },
324 { USB_DEVICE(AXESSTEL_VENDOR_ID, AXESSTEL_PRODUCT_MV110H) }, 313 { USB_DEVICE(AXESSTEL_VENDOR_ID, AXESSTEL_PRODUCT_MV110H) },
@@ -349,6 +338,10 @@ static struct usb_device_id option_ids[] = {
349 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_UC864E) }, 338 { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_UC864E) },
350 { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_MF628) }, 339 { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_MF628) },
351 { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_CDMA_TECH) }, 340 { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_CDMA_TECH) },
341 { USB_DEVICE(ERICSSON_VENDOR_ID, ERICSSON_PRODUCT_F3507G) },
342 { USB_DEVICE(PANTECH_VENDOR_ID, PANTECH_PRODUCT_PC5740) },
343 { USB_DEVICE(PANTECH_VENDOR_ID, PANTECH_PRODUCT_PC5750) },
344 { USB_DEVICE(PANTECH_VENDOR_ID, PANTECH_PRODUCT_UM150) },
352 { } /* Terminating entry */ 345 { } /* Terminating entry */
353}; 346};
354MODULE_DEVICE_TABLE(usb, option_ids); 347MODULE_DEVICE_TABLE(usb, option_ids);
@@ -427,7 +420,8 @@ static int __init option_init(void)
427 if (retval) 420 if (retval)
428 goto failed_driver_register; 421 goto failed_driver_register;
429 422
430 info(DRIVER_DESC ": " DRIVER_VERSION); 423 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
424 DRIVER_DESC "\n");
431 425
432 return 0; 426 return 0;
433 427
@@ -571,14 +565,14 @@ static void option_indat_callback(struct urb *urb)
571 dbg("%s: nonzero status: %d on endpoint %02x.", 565 dbg("%s: nonzero status: %d on endpoint %02x.",
572 __func__, status, endpoint); 566 __func__, status, endpoint);
573 } else { 567 } else {
574 tty = port->port.tty; 568 tty = tty_port_tty_get(&port->port);
575 if (urb->actual_length) { 569 if (urb->actual_length) {
576 tty_buffer_request_room(tty, urb->actual_length); 570 tty_buffer_request_room(tty, urb->actual_length);
577 tty_insert_flip_string(tty, data, urb->actual_length); 571 tty_insert_flip_string(tty, data, urb->actual_length);
578 tty_flip_buffer_push(tty); 572 tty_flip_buffer_push(tty);
579 } else { 573 } else
580 dbg("%s: empty read urb received", __func__); 574 dbg("%s: empty read urb received", __func__);
581 } 575 tty_kref_put(tty);
582 576
583 /* Resubmit urb so we continue receiving */ 577 /* Resubmit urb so we continue receiving */
584 if (port->port.count && status != -ESHUTDOWN) { 578 if (port->port.count && status != -ESHUTDOWN) {
@@ -647,9 +641,13 @@ static void option_instat_callback(struct urb *urb)
647 portdata->dsr_state = ((signals & 0x02) ? 1 : 0); 641 portdata->dsr_state = ((signals & 0x02) ? 1 : 0);
648 portdata->ri_state = ((signals & 0x08) ? 1 : 0); 642 portdata->ri_state = ((signals & 0x08) ? 1 : 0);
649 643
650 if (port->port.tty && !C_CLOCAL(port->port.tty) && 644 if (old_dcd_state && !portdata->dcd_state) {
651 old_dcd_state && !portdata->dcd_state) 645 struct tty_struct *tty =
652 tty_hangup(port->port.tty); 646 tty_port_tty_get(&port->port);
647 if (tty && !C_CLOCAL(tty))
648 tty_hangup(tty);
649 tty_kref_put(tty);
650 }
653 } else { 651 } else {
654 dbg("%s: type %x req %x", __func__, 652 dbg("%s: type %x req %x", __func__,
655 req_pkt->bRequestType, req_pkt->bRequest); 653 req_pkt->bRequestType, req_pkt->bRequest);
@@ -793,7 +791,7 @@ static void option_close(struct tty_struct *tty,
793 for (i = 0; i < N_OUT_URB; i++) 791 for (i = 0; i < N_OUT_URB; i++)
794 usb_kill_urb(portdata->out_urbs[i]); 792 usb_kill_urb(portdata->out_urbs[i]);
795 } 793 }
796 port->port.tty = NULL; /* FIXME */ 794 tty_port_tty_set(&port->port, NULL);
797} 795}
798 796
799/* Helper functions used by option_setup_urbs */ 797/* Helper functions used by option_setup_urbs */
diff --git a/drivers/usb/serial/oti6858.c b/drivers/usb/serial/oti6858.c
index 81db5715ee25..ba551f00f16f 100644
--- a/drivers/usb/serial/oti6858.c
+++ b/drivers/usb/serial/oti6858.c
@@ -224,10 +224,6 @@ struct oti6858_private {
224 struct usb_serial_port *port; /* USB port with which associated */ 224 struct usb_serial_port *port; /* USB port with which associated */
225}; 225};
226 226
227#undef dbg
228/* #define dbg(format, arg...) printk(KERN_INFO "%s: " format "\n", __FILE__, ## arg) */
229#define dbg(format, arg...) printk(KERN_INFO "" format "\n", ## arg)
230
231static void setup_line(struct work_struct *work) 227static void setup_line(struct work_struct *work)
232{ 228{
233 struct oti6858_private *priv = container_of(work, 229 struct oti6858_private *priv = container_of(work,
@@ -1002,11 +998,12 @@ static void oti6858_read_bulk_callback(struct urb *urb)
1002 return; 998 return;
1003 } 999 }
1004 1000
1005 tty = port->port.tty; 1001 tty = tty_port_tty_get(&port->port);
1006 if (tty != NULL && urb->actual_length > 0) { 1002 if (tty != NULL && urb->actual_length > 0) {
1007 tty_insert_flip_string(tty, data, urb->actual_length); 1003 tty_insert_flip_string(tty, data, urb->actual_length);
1008 tty_flip_buffer_push(tty); 1004 tty_flip_buffer_push(tty);
1009 } 1005 }
1006 tty_kref_put(tty);
1010 1007
1011 /* schedule the interrupt urb if we are still open */ 1008 /* schedule the interrupt urb if we are still open */
1012 if (port->port.count != 0) { 1009 if (port->port.count != 0) {
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
index 1ede1441cb1b..491c8857b644 100644
--- a/drivers/usb/serial/pl2303.c
+++ b/drivers/usb/serial/pl2303.c
@@ -154,7 +154,6 @@ struct pl2303_private {
154 wait_queue_head_t delta_msr_wait; 154 wait_queue_head_t delta_msr_wait;
155 u8 line_control; 155 u8 line_control;
156 u8 line_status; 156 u8 line_status;
157 u8 termios_initialized;
158 enum pl2303_type type; 157 enum pl2303_type type;
159}; 158};
160 159
@@ -526,16 +525,6 @@ static void pl2303_set_termios(struct tty_struct *tty,
526 525
527 dbg("%s - port %d", __func__, port->number); 526 dbg("%s - port %d", __func__, port->number);
528 527
529 spin_lock_irqsave(&priv->lock, flags);
530 if (!priv->termios_initialized) {
531 *(tty->termios) = tty_std_termios;
532 tty->termios->c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL;
533 tty->termios->c_ispeed = 9600;
534 tty->termios->c_ospeed = 9600;
535 priv->termios_initialized = 1;
536 }
537 spin_unlock_irqrestore(&priv->lock, flags);
538
539 /* The PL2303 is reported to lose bytes if you change 528 /* The PL2303 is reported to lose bytes if you change
540 serial settings even to the same values as before. Thus 529 serial settings even to the same values as before. Thus
541 we actually need to filter in this specific case */ 530 we actually need to filter in this specific case */
@@ -1057,7 +1046,7 @@ static void pl2303_read_bulk_callback(struct urb *urb)
1057 tty_flag = TTY_FRAME; 1046 tty_flag = TTY_FRAME;
1058 dbg("%s - tty_flag = %d", __func__, tty_flag); 1047 dbg("%s - tty_flag = %d", __func__, tty_flag);
1059 1048
1060 tty = port->port.tty; 1049 tty = tty_port_tty_get(&port->port);
1061 if (tty && urb->actual_length) { 1050 if (tty && urb->actual_length) {
1062 tty_buffer_request_room(tty, urb->actual_length + 1); 1051 tty_buffer_request_room(tty, urb->actual_length + 1);
1063 /* overrun is special, not associated with a char */ 1052 /* overrun is special, not associated with a char */
@@ -1067,7 +1056,7 @@ static void pl2303_read_bulk_callback(struct urb *urb)
1067 tty_insert_flip_char(tty, data[i], tty_flag); 1056 tty_insert_flip_char(tty, data[i], tty_flag);
1068 tty_flip_buffer_push(tty); 1057 tty_flip_buffer_push(tty);
1069 } 1058 }
1070 1059 tty_kref_put(tty);
1071 /* Schedule the next read _if_ we are still open */ 1060 /* Schedule the next read _if_ we are still open */
1072 if (port->port.count) { 1061 if (port->port.count) {
1073 urb->dev = port->serial->dev; 1062 urb->dev = port->serial->dev;
@@ -1158,7 +1147,7 @@ static int __init pl2303_init(void)
1158 retval = usb_register(&pl2303_driver); 1147 retval = usb_register(&pl2303_driver);
1159 if (retval) 1148 if (retval)
1160 goto failed_usb_register; 1149 goto failed_usb_register;
1161 info(DRIVER_DESC); 1150 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_DESC "\n");
1162 return 0; 1151 return 0;
1163failed_usb_register: 1152failed_usb_register:
1164 usb_serial_deregister(&pl2303_device); 1153 usb_serial_deregister(&pl2303_device);
diff --git a/drivers/usb/serial/safe_serial.c b/drivers/usb/serial/safe_serial.c
index def52d07a4ea..4b463cd140ef 100644
--- a/drivers/usb/serial/safe_serial.c
+++ b/drivers/usb/serial/safe_serial.c
@@ -217,6 +217,7 @@ static void safe_read_bulk_callback(struct urb *urb)
217 struct usb_serial_port *port = urb->context; 217 struct usb_serial_port *port = urb->context;
218 unsigned char *data = urb->transfer_buffer; 218 unsigned char *data = urb->transfer_buffer;
219 unsigned char length = urb->actual_length; 219 unsigned char length = urb->actual_length;
220 struct tty_struct *tty;
220 int result; 221 int result;
221 int status = urb->status; 222 int status = urb->status;
222 223
@@ -242,28 +243,31 @@ static void safe_read_bulk_callback(struct urb *urb)
242 printk("\n"); 243 printk("\n");
243 } 244 }
244#endif 245#endif
246 tty = tty_port_tty_get(&port->port);
245 if (safe) { 247 if (safe) {
246 __u16 fcs; 248 __u16 fcs;
247 fcs = fcs_compute10(data, length, CRC10_INITFCS); 249 fcs = fcs_compute10(data, length, CRC10_INITFCS);
248 if (!fcs) { 250 if (!fcs) {
249 int actual_length = data[length - 2] >> 2; 251 int actual_length = data[length - 2] >> 2;
250 if (actual_length <= (length - 2)) { 252 if (actual_length <= (length - 2)) {
251 info("%s - actual: %d", __func__, 253 dev_info(&urb->dev->dev, "%s - actual: %d\n",
252 actual_length); 254 __func__, actual_length);
253 tty_insert_flip_string(port->port.tty, 255 tty_insert_flip_string(tty,
254 data, actual_length); 256 data, actual_length);
255 tty_flip_buffer_push(port->port.tty); 257 tty_flip_buffer_push(tty);
256 } else { 258 } else {
257 err("%s - inconsistent lengths %d:%d", 259 dev_err(&port->dev,
260 "%s - inconsistent lengths %d:%d\n",
258 __func__, actual_length, length); 261 __func__, actual_length, length);
259 } 262 }
260 } else { 263 } else {
261 err("%s - bad CRC %x", __func__, fcs); 264 dev_err(&port->dev, "%s - bad CRC %x\n", __func__, fcs);
262 } 265 }
263 } else { 266 } else {
264 tty_insert_flip_string(port->port.tty, data, length); 267 tty_insert_flip_string(tty, data, length);
265 tty_flip_buffer_push(port->port.tty); 268 tty_flip_buffer_push(tty);
266 } 269 }
270 tty_kref_put(tty);
267 271
268 /* Continue trying to always read */ 272 /* Continue trying to always read */
269 usb_fill_bulk_urb(urb, port->serial->dev, 273 usb_fill_bulk_urb(urb, port->serial->dev,
@@ -274,8 +278,9 @@ static void safe_read_bulk_callback(struct urb *urb)
274 278
275 result = usb_submit_urb(urb, GFP_ATOMIC); 279 result = usb_submit_urb(urb, GFP_ATOMIC);
276 if (result) 280 if (result)
277 err("%s - failed resubmitting read urb, error %d", 281 dev_err(&port->dev,
278 __func__, result); 282 "%s - failed resubmitting read urb, error %d\n",
283 __func__, result);
279 /* FIXME: Need a mechanism to retry later if this happens */ 284 /* FIXME: Need a mechanism to retry later if this happens */
280} 285}
281 286
@@ -366,8 +371,9 @@ static int safe_write(struct tty_struct *tty, struct usb_serial_port *port,
366 result = usb_submit_urb(port->write_urb, GFP_KERNEL); 371 result = usb_submit_urb(port->write_urb, GFP_KERNEL);
367 if (result) { 372 if (result) {
368 port->write_urb_busy = 0; 373 port->write_urb_busy = 0;
369 err("%s - failed submitting write urb, error %d", 374 dev_err(&port->dev,
370 __func__, result); 375 "%s - failed submitting write urb, error %d\n",
376 __func__, result);
371 return 0; 377 return 0;
372 } 378 }
373 dbg("%s urb: %p submitted", __func__, port->write_urb); 379 dbg("%s urb: %p submitted", __func__, port->write_urb);
@@ -425,14 +431,13 @@ static int __init safe_init(void)
425{ 431{
426 int i, retval; 432 int i, retval;
427 433
428 info(DRIVER_VERSION " " DRIVER_AUTHOR); 434 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
429 info(DRIVER_DESC); 435 DRIVER_DESC "\n");
430 info("vendor: %x product: %x safe: %d padded: %d\n",
431 vendor, product, safe, padded);
432 436
433 /* if we have vendor / product parameters patch them into id list */ 437 /* if we have vendor / product parameters patch them into id list */
434 if (vendor || product) { 438 if (vendor || product) {
435 info("vendor: %x product: %x\n", vendor, product); 439 printk(KERN_INFO KBUILD_MODNAME ": vendor: %x product: %x\n",
440 vendor, product);
436 441
437 for (i = 0; i < ARRAY_SIZE(id_table); i++) { 442 for (i = 0; i < ARRAY_SIZE(id_table); i++) {
438 if (!id_table[i].idVendor && !id_table[i].idProduct) { 443 if (!id_table[i].idVendor && !id_table[i].idProduct) {
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c
index ea1a103c99be..0f2b67244af6 100644
--- a/drivers/usb/serial/sierra.c
+++ b/drivers/usb/serial/sierra.c
@@ -247,7 +247,7 @@ static int sierra_send_setup(struct tty_struct *tty,
247 struct sierra_port_private *portdata; 247 struct sierra_port_private *portdata;
248 __u16 interface = 0; 248 __u16 interface = 0;
249 249
250 dbg("%s", __func__); 250 dev_dbg(&port->dev, "%s", __func__);
251 251
252 portdata = usb_get_serial_port_data(port); 252 portdata = usb_get_serial_port_data(port);
253 253
@@ -284,7 +284,7 @@ static int sierra_send_setup(struct tty_struct *tty,
284static void sierra_set_termios(struct tty_struct *tty, 284static void sierra_set_termios(struct tty_struct *tty,
285 struct usb_serial_port *port, struct ktermios *old_termios) 285 struct usb_serial_port *port, struct ktermios *old_termios)
286{ 286{
287 dbg("%s", __func__); 287 dev_dbg(&port->dev, "%s", __func__);
288 tty_termios_copy_hw(tty->termios, old_termios); 288 tty_termios_copy_hw(tty->termios, old_termios);
289 sierra_send_setup(tty, port); 289 sierra_send_setup(tty, port);
290} 290}
@@ -295,6 +295,7 @@ static int sierra_tiocmget(struct tty_struct *tty, struct file *file)
295 unsigned int value; 295 unsigned int value;
296 struct sierra_port_private *portdata; 296 struct sierra_port_private *portdata;
297 297
298 dev_dbg(&port->dev, "%s", __func__);
298 portdata = usb_get_serial_port_data(port); 299 portdata = usb_get_serial_port_data(port);
299 300
300 value = ((portdata->rts_state) ? TIOCM_RTS : 0) | 301 value = ((portdata->rts_state) ? TIOCM_RTS : 0) |
@@ -334,14 +335,14 @@ static void sierra_outdat_callback(struct urb *urb)
334 int status = urb->status; 335 int status = urb->status;
335 unsigned long flags; 336 unsigned long flags;
336 337
337 dbg("%s - port %d", __func__, port->number); 338 dev_dbg(&port->dev, "%s - port %d", __func__, port->number);
338 339
339 /* free up the transfer buffer, as usb_free_urb() does not do this */ 340 /* free up the transfer buffer, as usb_free_urb() does not do this */
340 kfree(urb->transfer_buffer); 341 kfree(urb->transfer_buffer);
341 342
342 if (status) 343 if (status)
343 dbg("%s - nonzero write bulk status received: %d", 344 dev_dbg(&port->dev, "%s - nonzero write bulk status "
344 __func__, status); 345 "received: %d", __func__, status);
345 346
346 spin_lock_irqsave(&portdata->lock, flags); 347 spin_lock_irqsave(&portdata->lock, flags);
347 --portdata->outstanding_urbs; 348 --portdata->outstanding_urbs;
@@ -363,12 +364,12 @@ static int sierra_write(struct tty_struct *tty, struct usb_serial_port *port,
363 364
364 portdata = usb_get_serial_port_data(port); 365 portdata = usb_get_serial_port_data(port);
365 366
366 dbg("%s: write (%d chars)", __func__, count); 367 dev_dbg(&port->dev, "%s: write (%d chars)", __func__, count);
367 368
368 spin_lock_irqsave(&portdata->lock, flags); 369 spin_lock_irqsave(&portdata->lock, flags);
369 if (portdata->outstanding_urbs > N_OUT_URB) { 370 if (portdata->outstanding_urbs > N_OUT_URB) {
370 spin_unlock_irqrestore(&portdata->lock, flags); 371 spin_unlock_irqrestore(&portdata->lock, flags);
371 dbg("%s - write limit hit\n", __func__); 372 dev_dbg(&port->dev, "%s - write limit hit\n", __func__);
372 return 0; 373 return 0;
373 } 374 }
374 portdata->outstanding_urbs++; 375 portdata->outstanding_urbs++;
@@ -437,17 +438,18 @@ static void sierra_indat_callback(struct urb *urb)
437 port = urb->context; 438 port = urb->context;
438 439
439 if (status) { 440 if (status) {
440 dbg("%s: nonzero status: %d on endpoint %02x.", 441 dev_dbg(&port->dev, "%s: nonzero status: %d on"
441 __func__, status, endpoint); 442 " endpoint %02x.", __func__, status, endpoint);
442 } else { 443 } else {
443 tty = port->port.tty;
444 if (urb->actual_length) { 444 if (urb->actual_length) {
445 tty = tty_port_tty_get(&port->port);
445 tty_buffer_request_room(tty, urb->actual_length); 446 tty_buffer_request_room(tty, urb->actual_length);
446 tty_insert_flip_string(tty, data, urb->actual_length); 447 tty_insert_flip_string(tty, data, urb->actual_length);
447 tty_flip_buffer_push(tty); 448 tty_flip_buffer_push(tty);
448 } else { 449 tty_kref_put(tty);
449 dbg("%s: empty read urb received", __func__); 450 } else
450 } 451 dev_dbg(&port->dev, "%s: empty read urb"
452 " received", __func__);
451 453
452 /* Resubmit urb so we continue receiving */ 454 /* Resubmit urb so we continue receiving */
453 if (port->port.count && status != -ESHUTDOWN) { 455 if (port->port.count && status != -ESHUTDOWN) {
@@ -468,15 +470,17 @@ static void sierra_instat_callback(struct urb *urb)
468 struct sierra_port_private *portdata = usb_get_serial_port_data(port); 470 struct sierra_port_private *portdata = usb_get_serial_port_data(port);
469 struct usb_serial *serial = port->serial; 471 struct usb_serial *serial = port->serial;
470 472
471 dbg("%s", __func__); 473 dev_dbg(&port->dev, "%s", __func__);
472 dbg("%s: urb %p port %p has data %p", __func__, urb, port, portdata); 474 dev_dbg(&port->dev, "%s: urb %p port %p has data %p", __func__,
475 urb, port, portdata);
473 476
474 if (status == 0) { 477 if (status == 0) {
475 struct usb_ctrlrequest *req_pkt = 478 struct usb_ctrlrequest *req_pkt =
476 (struct usb_ctrlrequest *)urb->transfer_buffer; 479 (struct usb_ctrlrequest *)urb->transfer_buffer;
477 480
478 if (!req_pkt) { 481 if (!req_pkt) {
479 dbg("%s: NULL req_pkt\n", __func__); 482 dev_dbg(&port->dev, "%s: NULL req_pkt\n",
483 __func__);
480 return; 484 return;
481 } 485 }
482 if ((req_pkt->bRequestType == 0xA1) && 486 if ((req_pkt->bRequestType == 0xA1) &&
@@ -485,8 +489,10 @@ static void sierra_instat_callback(struct urb *urb)
485 unsigned char signals = *((unsigned char *) 489 unsigned char signals = *((unsigned char *)
486 urb->transfer_buffer + 490 urb->transfer_buffer +
487 sizeof(struct usb_ctrlrequest)); 491 sizeof(struct usb_ctrlrequest));
492 struct tty_struct *tty;
488 493
489 dbg("%s: signal x%x", __func__, signals); 494 dev_dbg(&port->dev, "%s: signal x%x", __func__,
495 signals);
490 496
491 old_dcd_state = portdata->dcd_state; 497 old_dcd_state = portdata->dcd_state;
492 portdata->cts_state = 1; 498 portdata->cts_state = 1;
@@ -494,23 +500,26 @@ static void sierra_instat_callback(struct urb *urb)
494 portdata->dsr_state = ((signals & 0x02) ? 1 : 0); 500 portdata->dsr_state = ((signals & 0x02) ? 1 : 0);
495 portdata->ri_state = ((signals & 0x08) ? 1 : 0); 501 portdata->ri_state = ((signals & 0x08) ? 1 : 0);
496 502
497 if (port->port.tty && !C_CLOCAL(port->port.tty) && 503 tty = tty_port_tty_get(&port->port);
504 if (tty && !C_CLOCAL(tty) &&
498 old_dcd_state && !portdata->dcd_state) 505 old_dcd_state && !portdata->dcd_state)
499 tty_hangup(port->port.tty); 506 tty_hangup(tty);
507 tty_kref_put(tty);
500 } else { 508 } else {
501 dbg("%s: type %x req %x", __func__, 509 dev_dbg(&port->dev, "%s: type %x req %x",
502 req_pkt->bRequestType, req_pkt->bRequest); 510 __func__, req_pkt->bRequestType,
511 req_pkt->bRequest);
503 } 512 }
504 } else 513 } else
505 dbg("%s: error %d", __func__, status); 514 dev_dbg(&port->dev, "%s: error %d", __func__, status);
506 515
507 /* Resubmit urb so we continue receiving IRQ data */ 516 /* Resubmit urb so we continue receiving IRQ data */
508 if (status != -ESHUTDOWN) { 517 if (status != -ESHUTDOWN) {
509 urb->dev = serial->dev; 518 urb->dev = serial->dev;
510 err = usb_submit_urb(urb, GFP_ATOMIC); 519 err = usb_submit_urb(urb, GFP_ATOMIC);
511 if (err) 520 if (err)
512 dbg("%s: resubmit intr urb failed. (%d)", 521 dev_dbg(&port->dev, "%s: resubmit intr urb "
513 __func__, err); 522 "failed. (%d)", __func__, err);
514 } 523 }
515} 524}
516 525
@@ -520,14 +529,14 @@ static int sierra_write_room(struct tty_struct *tty)
520 struct sierra_port_private *portdata = usb_get_serial_port_data(port); 529 struct sierra_port_private *portdata = usb_get_serial_port_data(port);
521 unsigned long flags; 530 unsigned long flags;
522 531
523 dbg("%s - port %d", __func__, port->number); 532 dev_dbg(&port->dev, "%s - port %d", __func__, port->number);
524 533
525 /* try to give a good number back based on if we have any free urbs at 534 /* try to give a good number back based on if we have any free urbs at
526 * this point in time */ 535 * this point in time */
527 spin_lock_irqsave(&portdata->lock, flags); 536 spin_lock_irqsave(&portdata->lock, flags);
528 if (portdata->outstanding_urbs > N_OUT_URB * 2 / 3) { 537 if (portdata->outstanding_urbs > N_OUT_URB * 2 / 3) {
529 spin_unlock_irqrestore(&portdata->lock, flags); 538 spin_unlock_irqrestore(&portdata->lock, flags);
530 dbg("%s - write limit hit\n", __func__); 539 dev_dbg(&port->dev, "%s - write limit hit\n", __func__);
531 return 0; 540 return 0;
532 } 541 }
533 spin_unlock_irqrestore(&portdata->lock, flags); 542 spin_unlock_irqrestore(&portdata->lock, flags);
@@ -546,7 +555,7 @@ static int sierra_open(struct tty_struct *tty,
546 555
547 portdata = usb_get_serial_port_data(port); 556 portdata = usb_get_serial_port_data(port);
548 557
549 dbg("%s", __func__); 558 dev_dbg(&port->dev, "%s", __func__);
550 559
551 /* Set some sane defaults */ 560 /* Set some sane defaults */
552 portdata->rts_state = 1; 561 portdata->rts_state = 1;
@@ -558,8 +567,8 @@ static int sierra_open(struct tty_struct *tty,
558 if (!urb) 567 if (!urb)
559 continue; 568 continue;
560 if (urb->dev != serial->dev) { 569 if (urb->dev != serial->dev) {
561 dbg("%s: dev %p != %p", __func__, 570 dev_dbg(&port->dev, "%s: dev %p != %p",
562 urb->dev, serial->dev); 571 __func__, urb->dev, serial->dev);
563 continue; 572 continue;
564 } 573 }
565 574
@@ -598,7 +607,7 @@ static void sierra_close(struct tty_struct *tty,
598 struct usb_serial *serial = port->serial; 607 struct usb_serial *serial = port->serial;
599 struct sierra_port_private *portdata; 608 struct sierra_port_private *portdata;
600 609
601 dbg("%s", __func__); 610 dev_dbg(&port->dev, "%s", __func__);
602 portdata = usb_get_serial_port_data(port); 611 portdata = usb_get_serial_port_data(port);
603 612
604 portdata->rts_state = 0; 613 portdata->rts_state = 0;
@@ -616,8 +625,7 @@ static void sierra_close(struct tty_struct *tty,
616 } 625 }
617 626
618 usb_kill_urb(port->interrupt_in_urb); 627 usb_kill_urb(port->interrupt_in_urb);
619 628 tty_port_tty_set(&port->port, NULL);
620 port->port.tty = NULL; /* FIXME */
621} 629}
622 630
623static int sierra_startup(struct usb_serial *serial) 631static int sierra_startup(struct usb_serial *serial)
@@ -628,7 +636,7 @@ static int sierra_startup(struct usb_serial *serial)
628 int i; 636 int i;
629 int j; 637 int j;
630 638
631 dbg("%s", __func__); 639 dev_dbg(&serial->dev->dev, "%s", __func__);
632 640
633 /* Set Device mode to D0 */ 641 /* Set Device mode to D0 */
634 sierra_set_power_state(serial->dev, 0x0000); 642 sierra_set_power_state(serial->dev, 0x0000);
@@ -642,8 +650,9 @@ static int sierra_startup(struct usb_serial *serial)
642 port = serial->port[i]; 650 port = serial->port[i];
643 portdata = kzalloc(sizeof(*portdata), GFP_KERNEL); 651 portdata = kzalloc(sizeof(*portdata), GFP_KERNEL);
644 if (!portdata) { 652 if (!portdata) {
645 dbg("%s: kmalloc for sierra_port_private (%d) failed!.", 653 dev_dbg(&port->dev, "%s: kmalloc for "
646 __func__, i); 654 "sierra_port_private (%d) failed!.",
655 __func__, i);
647 return -ENOMEM; 656 return -ENOMEM;
648 } 657 }
649 spin_lock_init(&portdata->lock); 658 spin_lock_init(&portdata->lock);
@@ -663,8 +672,8 @@ static int sierra_startup(struct usb_serial *serial)
663 for (j = 0; j < N_IN_URB; ++j) { 672 for (j = 0; j < N_IN_URB; ++j) {
664 urb = usb_alloc_urb(0, GFP_KERNEL); 673 urb = usb_alloc_urb(0, GFP_KERNEL);
665 if (urb == NULL) { 674 if (urb == NULL) {
666 dbg("%s: alloc for in port failed.", 675 dev_dbg(&port->dev, "%s: alloc for in "
667 __func__); 676 "port failed.", __func__);
668 continue; 677 continue;
669 } 678 }
670 /* Fill URB using supplied data. */ 679 /* Fill URB using supplied data. */
@@ -686,7 +695,7 @@ static void sierra_shutdown(struct usb_serial *serial)
686 struct usb_serial_port *port; 695 struct usb_serial_port *port;
687 struct sierra_port_private *portdata; 696 struct sierra_port_private *portdata;
688 697
689 dbg("%s", __func__); 698 dev_dbg(&serial->dev->dev, "%s", __func__);
690 699
691 for (i = 0; i < serial->num_ports; ++i) { 700 for (i = 0; i < serial->num_ports; ++i) {
692 port = serial->port[i]; 701 port = serial->port[i];
@@ -741,7 +750,8 @@ static int __init sierra_init(void)
741 if (retval) 750 if (retval)
742 goto failed_driver_register; 751 goto failed_driver_register;
743 752
744 info(DRIVER_DESC ": " DRIVER_VERSION); 753 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
754 DRIVER_DESC "\n");
745 755
746 return 0; 756 return 0;
747 757
diff --git a/drivers/usb/serial/spcp8x5.c b/drivers/usb/serial/spcp8x5.c
index 283cf6b36b2c..a65bc2bd8e71 100644
--- a/drivers/usb/serial/spcp8x5.c
+++ b/drivers/usb/serial/spcp8x5.c
@@ -589,8 +589,8 @@ static void spcp8x5_set_termios(struct tty_struct *tty,
589 case 1000000: 589 case 1000000:
590 buf[0] = 0x0b; break; 590 buf[0] = 0x0b; break;
591 default: 591 default:
592 err("spcp825 driver does not support the baudrate " 592 dev_err(&port->dev, "spcp825 driver does not support the "
593 "requested, using default of 9600."); 593 "baudrate requested, using default of 9600.\n");
594 } 594 }
595 595
596 /* Set Data Length : 00:5bit, 01:6bit, 10:7bit, 11:8bit */ 596 /* Set Data Length : 00:5bit, 01:6bit, 10:7bit, 11:8bit */
@@ -629,7 +629,8 @@ static void spcp8x5_set_termios(struct tty_struct *tty,
629 SET_UART_FORMAT_TYPE, SET_UART_FORMAT, 629 SET_UART_FORMAT_TYPE, SET_UART_FORMAT,
630 uartdata, 0, NULL, 0, 100); 630 uartdata, 0, NULL, 0, 100);
631 if (i < 0) 631 if (i < 0)
632 err("Set UART format %#x failed (error = %d)", uartdata, i); 632 dev_err(&port->dev, "Set UART format %#x failed (error = %d)\n",
633 uartdata, i);
633 dbg("0x21:0x40:0:0 %d\n", i); 634 dbg("0x21:0x40:0:0 %d\n", i);
634 635
635 if (cflag & CRTSCTS) { 636 if (cflag & CRTSCTS) {
@@ -755,7 +756,7 @@ static void spcp8x5_read_bulk_callback(struct urb *urb)
755 tty_flag = TTY_FRAME; 756 tty_flag = TTY_FRAME;
756 dev_dbg(&port->dev, "tty_flag = %d\n", tty_flag); 757 dev_dbg(&port->dev, "tty_flag = %d\n", tty_flag);
757 758
758 tty = port->port.tty; 759 tty = tty_port_tty_get(&port->port);
759 if (tty && urb->actual_length) { 760 if (tty && urb->actual_length) {
760 tty_buffer_request_room(tty, urb->actual_length + 1); 761 tty_buffer_request_room(tty, urb->actual_length + 1);
761 /* overrun is special, not associated with a char */ 762 /* overrun is special, not associated with a char */
@@ -765,6 +766,7 @@ static void spcp8x5_read_bulk_callback(struct urb *urb)
765 tty_insert_flip_char(tty, data[i], tty_flag); 766 tty_insert_flip_char(tty, data[i], tty_flag);
766 tty_flip_buffer_push(tty); 767 tty_flip_buffer_push(tty);
767 } 768 }
769 tty_kref_put(tty);
768 770
769 /* Schedule the next read _if_ we are still open */ 771 /* Schedule the next read _if_ we are still open */
770 if (port->port.count) { 772 if (port->port.count) {
@@ -1053,7 +1055,8 @@ static int __init spcp8x5_init(void)
1053 retval = usb_register(&spcp8x5_driver); 1055 retval = usb_register(&spcp8x5_driver);
1054 if (retval) 1056 if (retval)
1055 goto failed_usb_register; 1057 goto failed_usb_register;
1056 info(DRIVER_DESC " " DRIVER_VERSION); 1058 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
1059 DRIVER_DESC "\n");
1057 return 0; 1060 return 0;
1058failed_usb_register: 1061failed_usb_register:
1059 usb_serial_deregister(&spcp8x5_device); 1062 usb_serial_deregister(&spcp8x5_device);
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c
index 9a3e495c769c..31c42d1cae13 100644
--- a/drivers/usb/serial/ti_usb_3410_5052.c
+++ b/drivers/usb/serial/ti_usb_3410_5052.c
@@ -85,7 +85,6 @@
85#include <linux/uaccess.h> 85#include <linux/uaccess.h>
86#include <linux/usb.h> 86#include <linux/usb.h>
87#include <linux/usb/serial.h> 87#include <linux/usb/serial.h>
88#include <linux/firmware.h>
89 88
90#include "ti_usb_3410_5052.h" 89#include "ti_usb_3410_5052.h"
91 90
@@ -179,7 +178,7 @@ static int ti_set_mcr(struct ti_port *tport, unsigned int mcr);
179static int ti_get_lsr(struct ti_port *tport); 178static int ti_get_lsr(struct ti_port *tport);
180static int ti_get_serial_info(struct ti_port *tport, 179static int ti_get_serial_info(struct ti_port *tport,
181 struct serial_struct __user *ret_arg); 180 struct serial_struct __user *ret_arg);
182static int ti_set_serial_info(struct ti_port *tport, 181static int ti_set_serial_info(struct tty_struct *tty, struct ti_port *tport,
183 struct serial_struct __user *new_arg); 182 struct serial_struct __user *new_arg);
184static void ti_handle_new_msr(struct ti_port *tport, __u8 msr); 183static void ti_handle_new_msr(struct ti_port *tport, __u8 msr);
185 184
@@ -383,7 +382,8 @@ static int __init ti_init(void)
383 if (ret) 382 if (ret)
384 goto failed_usb; 383 goto failed_usb;
385 384
386 info(TI_DRIVER_DESC " " TI_DRIVER_VERSION); 385 printk(KERN_INFO KBUILD_MODNAME ": " TI_DRIVER_VERSION ":"
386 TI_DRIVER_DESC "\n");
387 387
388 return 0; 388 return 0;
389 389
@@ -857,8 +857,8 @@ static int ti_ioctl(struct tty_struct *tty, struct file *file,
857 (struct serial_struct __user *)arg); 857 (struct serial_struct __user *)arg);
858 case TIOCSSERIAL: 858 case TIOCSSERIAL:
859 dbg("%s - (%d) TIOCSSERIAL", __func__, port->number); 859 dbg("%s - (%d) TIOCSSERIAL", __func__, port->number);
860 return ti_set_serial_info(tport, 860 return ti_set_serial_info(tty, tport,
861 (struct serial_struct __user *)arg); 861 (struct serial_struct __user *)arg);
862 case TIOCMIWAIT: 862 case TIOCMIWAIT:
863 dbg("%s - (%d) TIOCMIWAIT", __func__, port->number); 863 dbg("%s - (%d) TIOCMIWAIT", __func__, port->number);
864 cprev = tport->tp_icount; 864 cprev = tport->tp_icount;
@@ -1211,6 +1211,7 @@ static void ti_bulk_in_callback(struct urb *urb)
1211 struct device *dev = &urb->dev->dev; 1211 struct device *dev = &urb->dev->dev;
1212 int status = urb->status; 1212 int status = urb->status;
1213 int retval = 0; 1213 int retval = 0;
1214 struct tty_struct *tty;
1214 1215
1215 dbg("%s", __func__); 1216 dbg("%s", __func__);
1216 1217
@@ -1239,20 +1240,22 @@ static void ti_bulk_in_callback(struct urb *urb)
1239 return; 1240 return;
1240 } 1241 }
1241 1242
1242 if (port->port.tty && urb->actual_length) { 1243 tty = tty_port_tty_get(&port->port);
1244 if (tty && urb->actual_length) {
1243 usb_serial_debug_data(debug, dev, __func__, 1245 usb_serial_debug_data(debug, dev, __func__,
1244 urb->actual_length, urb->transfer_buffer); 1246 urb->actual_length, urb->transfer_buffer);
1245 1247
1246 if (!tport->tp_is_open) 1248 if (!tport->tp_is_open)
1247 dbg("%s - port closed, dropping data", __func__); 1249 dbg("%s - port closed, dropping data", __func__);
1248 else 1250 else
1249 ti_recv(&urb->dev->dev, port->port.tty, 1251 ti_recv(&urb->dev->dev, tty,
1250 urb->transfer_buffer, 1252 urb->transfer_buffer,
1251 urb->actual_length); 1253 urb->actual_length);
1252 1254
1253 spin_lock(&tport->tp_lock); 1255 spin_lock(&tport->tp_lock);
1254 tport->tp_icount.rx += urb->actual_length; 1256 tport->tp_icount.rx += urb->actual_length;
1255 spin_unlock(&tport->tp_lock); 1257 spin_unlock(&tport->tp_lock);
1258 tty_kref_put(tty);
1256 } 1259 }
1257 1260
1258exit: 1261exit:
@@ -1330,7 +1333,7 @@ static void ti_send(struct ti_port *tport)
1330{ 1333{
1331 int count, result; 1334 int count, result;
1332 struct usb_serial_port *port = tport->tp_port; 1335 struct usb_serial_port *port = tport->tp_port;
1333 struct tty_struct *tty = port->port.tty; /* FIXME */ 1336 struct tty_struct *tty = tty_port_tty_get(&port->port); /* FIXME */
1334 unsigned long flags; 1337 unsigned long flags;
1335 1338
1336 1339
@@ -1338,19 +1341,15 @@ static void ti_send(struct ti_port *tport)
1338 1341
1339 spin_lock_irqsave(&tport->tp_lock, flags); 1342 spin_lock_irqsave(&tport->tp_lock, flags);
1340 1343
1341 if (tport->tp_write_urb_in_use) { 1344 if (tport->tp_write_urb_in_use)
1342 spin_unlock_irqrestore(&tport->tp_lock, flags); 1345 goto unlock;
1343 return;
1344 }
1345 1346
1346 count = ti_buf_get(tport->tp_write_buf, 1347 count = ti_buf_get(tport->tp_write_buf,
1347 port->write_urb->transfer_buffer, 1348 port->write_urb->transfer_buffer,
1348 port->bulk_out_size); 1349 port->bulk_out_size);
1349 1350
1350 if (count == 0) { 1351 if (count == 0)
1351 spin_unlock_irqrestore(&tport->tp_lock, flags); 1352 goto unlock;
1352 return;
1353 }
1354 1353
1355 tport->tp_write_urb_in_use = 1; 1354 tport->tp_write_urb_in_use = 1;
1356 1355
@@ -1380,7 +1379,13 @@ static void ti_send(struct ti_port *tport)
1380 /* more room in the buffer for new writes, wakeup */ 1379 /* more room in the buffer for new writes, wakeup */
1381 if (tty) 1380 if (tty)
1382 tty_wakeup(tty); 1381 tty_wakeup(tty);
1382 tty_kref_put(tty);
1383 wake_up_interruptible(&tport->tp_write_wait); 1383 wake_up_interruptible(&tport->tp_write_wait);
1384 return;
1385unlock:
1386 spin_unlock_irqrestore(&tport->tp_lock, flags);
1387 tty_kref_put(tty);
1388 return;
1384} 1389}
1385 1390
1386 1391
@@ -1464,20 +1469,16 @@ static int ti_get_serial_info(struct ti_port *tport,
1464} 1469}
1465 1470
1466 1471
1467static int ti_set_serial_info(struct ti_port *tport, 1472static int ti_set_serial_info(struct tty_struct *tty, struct ti_port *tport,
1468 struct serial_struct __user *new_arg) 1473 struct serial_struct __user *new_arg)
1469{ 1474{
1470 struct usb_serial_port *port = tport->tp_port;
1471 struct serial_struct new_serial; 1475 struct serial_struct new_serial;
1472 1476
1473 if (copy_from_user(&new_serial, new_arg, sizeof(new_serial))) 1477 if (copy_from_user(&new_serial, new_arg, sizeof(new_serial)))
1474 return -EFAULT; 1478 return -EFAULT;
1475 1479
1476 tport->tp_flags = new_serial.flags & TI_SET_SERIAL_FLAGS; 1480 tport->tp_flags = new_serial.flags & TI_SET_SERIAL_FLAGS;
1477 /* FIXME */ 1481 tty->low_latency = (tport->tp_flags & ASYNC_LOW_LATENCY) ? 1 : 0;
1478 if (port->port.tty)
1479 port->port.tty->low_latency =
1480 (tport->tp_flags & ASYNC_LOW_LATENCY) ? 1 : 0;
1481 tport->tp_closing_wait = new_serial.closing_wait; 1482 tport->tp_closing_wait = new_serial.closing_wait;
1482 1483
1483 return 0; 1484 return 0;
@@ -1510,7 +1511,7 @@ static void ti_handle_new_msr(struct ti_port *tport, __u8 msr)
1510 tport->tp_msr = msr & TI_MSR_MASK; 1511 tport->tp_msr = msr & TI_MSR_MASK;
1511 1512
1512 /* handle CTS flow control */ 1513 /* handle CTS flow control */
1513 tty = tport->tp_port->port.tty; 1514 tty = tty_port_tty_get(&tport->tp_port->port);
1514 if (tty && C_CRTSCTS(tty)) { 1515 if (tty && C_CRTSCTS(tty)) {
1515 if (msr & TI_MSR_CTS) { 1516 if (msr & TI_MSR_CTS) {
1516 tty->hw_stopped = 0; 1517 tty->hw_stopped = 0;
@@ -1519,6 +1520,7 @@ static void ti_handle_new_msr(struct ti_port *tport, __u8 msr)
1519 tty->hw_stopped = 1; 1520 tty->hw_stopped = 1;
1520 } 1521 }
1521 } 1522 }
1523 tty_kref_put(tty);
1522} 1524}
1523 1525
1524 1526
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index 4f7f9e3ae0a4..8be3f39891c7 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -214,7 +214,7 @@ static int serial_open (struct tty_struct *tty, struct file *filp)
214 /* set up our port structure making the tty driver 214 /* set up our port structure making the tty driver
215 * remember our port object, and us it */ 215 * remember our port object, and us it */
216 tty->driver_data = port; 216 tty->driver_data = port;
217 port->port.tty = tty; 217 tty_port_tty_set(&port->port, tty);
218 218
219 if (port->port.count == 1) { 219 if (port->port.count == 1) {
220 220
@@ -246,7 +246,7 @@ bailout_module_put:
246bailout_mutex_unlock: 246bailout_mutex_unlock:
247 port->port.count = 0; 247 port->port.count = 0;
248 tty->driver_data = NULL; 248 tty->driver_data = NULL;
249 port->port.tty = NULL; 249 tty_port_tty_set(&port->port, NULL);
250 mutex_unlock(&port->mutex); 250 mutex_unlock(&port->mutex);
251bailout_kref_put: 251bailout_kref_put:
252 usb_serial_put(serial); 252 usb_serial_put(serial);
@@ -276,10 +276,11 @@ static void serial_close(struct tty_struct *tty, struct file *filp)
276 port->serial->type->close(tty, port, filp); 276 port->serial->type->close(tty, port, filp);
277 277
278 if (port->port.count == (port->console? 1 : 0)) { 278 if (port->port.count == (port->console? 1 : 0)) {
279 if (port->port.tty) { 279 struct tty_struct *tty = tty_port_tty_get(&port->port);
280 if (port->port.tty->driver_data) 280 if (tty) {
281 port->port.tty->driver_data = NULL; 281 if (tty->driver_data)
282 port->port.tty = NULL; 282 tty->driver_data = NULL;
283 tty_port_tty_set(&port->port, NULL);
283 } 284 }
284 } 285 }
285 286
@@ -508,11 +509,12 @@ static void usb_serial_port_work(struct work_struct *work)
508 if (!port) 509 if (!port)
509 return; 510 return;
510 511
511 tty = port->port.tty; 512 tty = tty_port_tty_get(&port->port);
512 if (!tty) 513 if (!tty)
513 return; 514 return;
514 515
515 tty_wakeup(tty); 516 tty_wakeup(tty);
517 tty_kref_put(tty);
516} 518}
517 519
518static void port_release(struct device *dev) 520static void port_release(struct device *dev)
@@ -819,6 +821,7 @@ int usb_serial_probe(struct usb_interface *interface,
819 port = kzalloc(sizeof(struct usb_serial_port), GFP_KERNEL); 821 port = kzalloc(sizeof(struct usb_serial_port), GFP_KERNEL);
820 if (!port) 822 if (!port)
821 goto probe_error; 823 goto probe_error;
824 tty_port_init(&port->port);
822 port->serial = serial; 825 port->serial = serial;
823 spin_lock_init(&port->lock); 826 spin_lock_init(&port->lock);
824 mutex_init(&port->mutex); 827 mutex_init(&port->mutex);
@@ -1040,8 +1043,11 @@ void usb_serial_disconnect(struct usb_interface *interface)
1040 for (i = 0; i < serial->num_ports; ++i) { 1043 for (i = 0; i < serial->num_ports; ++i) {
1041 port = serial->port[i]; 1044 port = serial->port[i];
1042 if (port) { 1045 if (port) {
1043 if (port->port.tty) 1046 struct tty_struct *tty = tty_port_tty_get(&port->port);
1044 tty_hangup(port->port.tty); 1047 if (tty) {
1048 tty_hangup(tty);
1049 tty_kref_put(tty);
1050 }
1045 kill_traffic(port); 1051 kill_traffic(port);
1046 } 1052 }
1047 } 1053 }
@@ -1115,7 +1121,8 @@ static int __init usb_serial_init(void)
1115 1121
1116 result = bus_register(&usb_serial_bus_type); 1122 result = bus_register(&usb_serial_bus_type);
1117 if (result) { 1123 if (result) {
1118 err("%s - registering bus driver failed", __func__); 1124 printk(KERN_ERR "usb-serial: %s - registering bus driver "
1125 "failed\n", __func__);
1119 goto exit_bus; 1126 goto exit_bus;
1120 } 1127 }
1121 1128
@@ -1136,25 +1143,28 @@ static int __init usb_serial_init(void)
1136 tty_set_operations(usb_serial_tty_driver, &serial_ops); 1143 tty_set_operations(usb_serial_tty_driver, &serial_ops);
1137 result = tty_register_driver(usb_serial_tty_driver); 1144 result = tty_register_driver(usb_serial_tty_driver);
1138 if (result) { 1145 if (result) {
1139 err("%s - tty_register_driver failed", __func__); 1146 printk(KERN_ERR "usb-serial: %s - tty_register_driver failed\n",
1147 __func__);
1140 goto exit_reg_driver; 1148 goto exit_reg_driver;
1141 } 1149 }
1142 1150
1143 /* register the USB driver */ 1151 /* register the USB driver */
1144 result = usb_register(&usb_serial_driver); 1152 result = usb_register(&usb_serial_driver);
1145 if (result < 0) { 1153 if (result < 0) {
1146 err("%s - usb_register failed", __func__); 1154 printk(KERN_ERR "usb-serial: %s - usb_register failed\n",
1155 __func__);
1147 goto exit_tty; 1156 goto exit_tty;
1148 } 1157 }
1149 1158
1150 /* register the generic driver, if we should */ 1159 /* register the generic driver, if we should */
1151 result = usb_serial_generic_register(debug); 1160 result = usb_serial_generic_register(debug);
1152 if (result < 0) { 1161 if (result < 0) {
1153 err("%s - registering generic driver failed", __func__); 1162 printk(KERN_ERR "usb-serial: %s - registering generic "
1163 "driver failed\n", __func__);
1154 goto exit_generic; 1164 goto exit_generic;
1155 } 1165 }
1156 1166
1157 info(DRIVER_DESC); 1167 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_DESC "\n");
1158 1168
1159 return result; 1169 return result;
1160 1170
@@ -1168,7 +1178,8 @@ exit_reg_driver:
1168 bus_unregister(&usb_serial_bus_type); 1178 bus_unregister(&usb_serial_bus_type);
1169 1179
1170exit_bus: 1180exit_bus:
1171 err("%s - returning with error %d", __func__, result); 1181 printk(KERN_ERR "usb-serial: %s - returning with error %d\n",
1182 __func__, result);
1172 put_tty_driver(usb_serial_tty_driver); 1183 put_tty_driver(usb_serial_tty_driver);
1173 return result; 1184 return result;
1174} 1185}
@@ -1227,11 +1238,11 @@ int usb_serial_register(struct usb_serial_driver *driver)
1227 1238
1228 retval = usb_serial_bus_register(driver); 1239 retval = usb_serial_bus_register(driver);
1229 if (retval) { 1240 if (retval) {
1230 err("problem %d when registering driver %s", 1241 printk(KERN_ERR "usb-serial: problem %d when registering "
1231 retval, driver->description); 1242 "driver %s\n", retval, driver->description);
1232 list_del(&driver->driver_list); 1243 list_del(&driver->driver_list);
1233 } else 1244 } else
1234 info("USB Serial support registered for %s", 1245 printk(KERN_INFO "USB Serial support registered for %s\n",
1235 driver->description); 1246 driver->description);
1236 1247
1237 return retval; 1248 return retval;
@@ -1242,7 +1253,8 @@ EXPORT_SYMBOL_GPL(usb_serial_register);
1242void usb_serial_deregister(struct usb_serial_driver *device) 1253void usb_serial_deregister(struct usb_serial_driver *device)
1243{ 1254{
1244 /* must be called with BKL held */ 1255 /* must be called with BKL held */
1245 info("USB Serial deregistering driver %s", device->description); 1256 printk(KERN_INFO "USB Serial deregistering driver %s\n",
1257 device->description);
1246 list_del(&device->driver_list); 1258 list_del(&device->driver_list);
1247 usb_serial_bus_deregister(device); 1259 usb_serial_bus_deregister(device);
1248} 1260}
diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c
index cf8924f9a2cc..4facce3d9364 100644
--- a/drivers/usb/serial/visor.c
+++ b/drivers/usb/serial/visor.c
@@ -499,7 +499,7 @@ static void visor_read_bulk_callback(struct urb *urb)
499 int status = urb->status; 499 int status = urb->status;
500 struct tty_struct *tty; 500 struct tty_struct *tty;
501 int result; 501 int result;
502 int available_room; 502 int available_room = 0;
503 503
504 dbg("%s - port %d", __func__, port->number); 504 dbg("%s - port %d", __func__, port->number);
505 505
@@ -512,13 +512,17 @@ static void visor_read_bulk_callback(struct urb *urb)
512 usb_serial_debug_data(debug, &port->dev, __func__, 512 usb_serial_debug_data(debug, &port->dev, __func__,
513 urb->actual_length, data); 513 urb->actual_length, data);
514 514
515 tty = port->port.tty; 515 if (urb->actual_length) {
516 if (tty && urb->actual_length) { 516 tty = tty_port_tty_get(&port->port);
517 available_room = tty_buffer_request_room(tty, 517 if (tty) {
518 available_room = tty_buffer_request_room(tty,
518 urb->actual_length); 519 urb->actual_length);
519 if (available_room) { 520 if (available_room) {
520 tty_insert_flip_string(tty, data, available_room); 521 tty_insert_flip_string(tty, data,
521 tty_flip_buffer_push(tty); 522 available_room);
523 tty_flip_buffer_push(tty);
524 }
525 tty_kref_put(tty);
522 } 526 }
523 spin_lock(&priv->lock); 527 spin_lock(&priv->lock);
524 priv->bytes_in += available_room; 528 priv->bytes_in += available_room;
@@ -764,7 +768,7 @@ static int visor_probe(struct usb_serial *serial,
764 dbg("%s", __func__); 768 dbg("%s", __func__);
765 769
766 if (serial->dev->actconfig->desc.bConfigurationValue != 1) { 770 if (serial->dev->actconfig->desc.bConfigurationValue != 1) {
767 err("active config #%d != 1 ??", 771 dev_err(&serial->dev->dev, "active config #%d != 1 ??\n",
768 serial->dev->actconfig->desc.bConfigurationValue); 772 serial->dev->actconfig->desc.bConfigurationValue);
769 return -ENODEV; 773 return -ENODEV;
770 } 774 }
@@ -967,11 +971,14 @@ static int __init visor_init(void)
967 break; 971 break;
968 } 972 }
969 } 973 }
970 info( 974 printk(KERN_INFO KBUILD_MODNAME
971 "Untested USB device specified at time of module insertion"); 975 ": Untested USB device specified at time of module insertion\n");
972 info("Warning: This is not guaranteed to work"); 976 printk(KERN_INFO KBUILD_MODNAME
973 info("Using a newer kernel is preferred to this method"); 977 ": Warning: This is not guaranteed to work\n");
974 info("Adding Palm OS protocol 4.x support for unknown device: 0x%x/0x%x", 978 printk(KERN_INFO KBUILD_MODNAME
979 ": Using a newer kernel is preferred to this method\n");
980 printk(KERN_INFO KBUILD_MODNAME
981 ": Adding Palm OS protocol 4.x support for unknown device: 0x%x/0x%x\n",
975 vendor, product); 982 vendor, product);
976 } 983 }
977 retval = usb_serial_register(&handspring_device); 984 retval = usb_serial_register(&handspring_device);
@@ -986,7 +993,7 @@ static int __init visor_init(void)
986 retval = usb_register(&visor_driver); 993 retval = usb_register(&visor_driver);
987 if (retval) 994 if (retval)
988 goto failed_usb_register; 995 goto failed_usb_register;
989 info(DRIVER_DESC); 996 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_DESC "\n");
990 997
991 return 0; 998 return 0;
992failed_usb_register: 999failed_usb_register:
diff --git a/drivers/usb/serial/whiteheat.c b/drivers/usb/serial/whiteheat.c
index 3a9d14384a43..5335d3211c07 100644
--- a/drivers/usb/serial/whiteheat.c
+++ b/drivers/usb/serial/whiteheat.c
@@ -303,12 +303,15 @@ static int whiteheat_firmware_download(struct usb_serial *serial,
303 303
304 if (request_ihex_firmware(&firmware_fw, "whiteheat.fw", 304 if (request_ihex_firmware(&firmware_fw, "whiteheat.fw",
305 &serial->dev->dev)) { 305 &serial->dev->dev)) {
306 err("%s - request \"whiteheat.fw\" failed", __func__); 306 dev_err(&serial->dev->dev,
307 "%s - request \"whiteheat.fw\" failed\n", __func__);
307 goto out; 308 goto out;
308 } 309 }
309 if (request_ihex_firmware(&loader_fw, "whiteheat_loader.fw", 310 if (request_ihex_firmware(&loader_fw, "whiteheat_loader.fw",
310 &serial->dev->dev)) { 311 &serial->dev->dev)) {
311 err("%s - request \"whiteheat_loader.fw\" failed", __func__); 312 dev_err(&serial->dev->dev,
313 "%s - request \"whiteheat_loader.fw\" failed\n",
314 __func__);
312 goto out; 315 goto out;
313 } 316 }
314 ret = 0; 317 ret = 0;
@@ -320,9 +323,10 @@ static int whiteheat_firmware_download(struct usb_serial *serial,
320 (unsigned char *)record->data, 323 (unsigned char *)record->data,
321 be16_to_cpu(record->len), 0xa0); 324 be16_to_cpu(record->len), 0xa0);
322 if (response < 0) { 325 if (response < 0) {
323 err("%s - ezusb_writememory failed for loader (%d %04X %p %d)", 326 dev_err(&serial->dev->dev, "%s - ezusb_writememory "
324 __func__, response, be32_to_cpu(record->addr), 327 "failed for loader (%d %04X %p %d)\n",
325 record->data, be16_to_cpu(record->len)); 328 __func__, response, be32_to_cpu(record->addr),
329 record->data, be16_to_cpu(record->len));
326 break; 330 break;
327 } 331 }
328 record = ihex_next_binrec(record); 332 record = ihex_next_binrec(record);
@@ -338,9 +342,11 @@ static int whiteheat_firmware_download(struct usb_serial *serial,
338 (unsigned char *)record->data, 342 (unsigned char *)record->data,
339 be16_to_cpu(record->len), 0xa3); 343 be16_to_cpu(record->len), 0xa3);
340 if (response < 0) { 344 if (response < 0) {
341 err("%s - ezusb_writememory failed for first firmware step (%d %04X %p %d)", 345 dev_err(&serial->dev->dev, "%s - ezusb_writememory "
342 __func__, response, be32_to_cpu(record->addr), 346 "failed for first firmware step "
343 record->data, be16_to_cpu(record->len)); 347 "(%d %04X %p %d)\n", __func__, response,
348 be32_to_cpu(record->addr), record->data,
349 be16_to_cpu(record->len));
344 break; 350 break;
345 } 351 }
346 ++record; 352 ++record;
@@ -354,9 +360,11 @@ static int whiteheat_firmware_download(struct usb_serial *serial,
354 (unsigned char *)record->data, 360 (unsigned char *)record->data,
355 be16_to_cpu(record->len), 0xa0); 361 be16_to_cpu(record->len), 0xa0);
356 if (response < 0) { 362 if (response < 0) {
357 err("%s - ezusb_writememory failed for second firmware step (%d %04X %p %d)", 363 dev_err(&serial->dev->dev, "%s - ezusb_writememory "
358 __func__, response, be32_to_cpu(record->addr), 364 "failed for second firmware step "
359 record->data, be16_to_cpu(record->len)); 365 "(%d %04X %p %d)\n", __func__, response,
366 be32_to_cpu(record->addr), record->data,
367 be16_to_cpu(record->len));
360 break; 368 break;
361 } 369 }
362 ++record; 370 ++record;
@@ -421,12 +429,12 @@ static int whiteheat_attach(struct usb_serial *serial)
421 ret = usb_bulk_msg(serial->dev, pipe, command, 2, 429 ret = usb_bulk_msg(serial->dev, pipe, command, 2,
422 &alen, COMMAND_TIMEOUT_MS); 430 &alen, COMMAND_TIMEOUT_MS);
423 if (ret) { 431 if (ret) {
424 err("%s: Couldn't send command [%d]", 432 dev_err(&serial->dev->dev, "%s: Couldn't send command [%d]\n",
425 serial->type->description, ret); 433 serial->type->description, ret);
426 goto no_firmware; 434 goto no_firmware;
427 } else if (alen != 2) { 435 } else if (alen != 2) {
428 err("%s: Send command incomplete [%d]", 436 dev_err(&serial->dev->dev, "%s: Send command incomplete [%d]\n",
429 serial->type->description, alen); 437 serial->type->description, alen);
430 goto no_firmware; 438 goto no_firmware;
431 } 439 }
432 440
@@ -437,31 +445,33 @@ static int whiteheat_attach(struct usb_serial *serial)
437 ret = usb_bulk_msg(serial->dev, pipe, result, 445 ret = usb_bulk_msg(serial->dev, pipe, result,
438 sizeof(*hw_info) + 1, &alen, COMMAND_TIMEOUT_MS); 446 sizeof(*hw_info) + 1, &alen, COMMAND_TIMEOUT_MS);
439 if (ret) { 447 if (ret) {
440 err("%s: Couldn't get results [%d]", 448 dev_err(&serial->dev->dev, "%s: Couldn't get results [%d]\n",
441 serial->type->description, ret); 449 serial->type->description, ret);
442 goto no_firmware; 450 goto no_firmware;
443 } else if (alen != sizeof(*hw_info) + 1) { 451 } else if (alen != sizeof(*hw_info) + 1) {
444 err("%s: Get results incomplete [%d]", 452 dev_err(&serial->dev->dev, "%s: Get results incomplete [%d]\n",
445 serial->type->description, alen); 453 serial->type->description, alen);
446 goto no_firmware; 454 goto no_firmware;
447 } else if (result[0] != command[0]) { 455 } else if (result[0] != command[0]) {
448 err("%s: Command failed [%d]", 456 dev_err(&serial->dev->dev, "%s: Command failed [%d]\n",
449 serial->type->description, result[0]); 457 serial->type->description, result[0]);
450 goto no_firmware; 458 goto no_firmware;
451 } 459 }
452 460
453 hw_info = (struct whiteheat_hw_info *)&result[1]; 461 hw_info = (struct whiteheat_hw_info *)&result[1];
454 462
455 info("%s: Driver %s: Firmware v%d.%02d", serial->type->description, 463 dev_info(&serial->dev->dev, "%s: Driver %s: Firmware v%d.%02d\n",
456 DRIVER_VERSION, hw_info->sw_major_rev, hw_info->sw_minor_rev); 464 serial->type->description, DRIVER_VERSION,
465 hw_info->sw_major_rev, hw_info->sw_minor_rev);
457 466
458 for (i = 0; i < serial->num_ports; i++) { 467 for (i = 0; i < serial->num_ports; i++) {
459 port = serial->port[i]; 468 port = serial->port[i];
460 469
461 info = kmalloc(sizeof(struct whiteheat_private), GFP_KERNEL); 470 info = kmalloc(sizeof(struct whiteheat_private), GFP_KERNEL);
462 if (info == NULL) { 471 if (info == NULL) {
463 err("%s: Out of memory for port structures\n", 472 dev_err(&port->dev,
464 serial->type->description); 473 "%s: Out of memory for port structures\n",
474 serial->type->description);
465 goto no_private; 475 goto no_private;
466 } 476 }
467 477
@@ -481,18 +491,20 @@ static int whiteheat_attach(struct usb_serial *serial)
481 for (j = 0; j < urb_pool_size; j++) { 491 for (j = 0; j < urb_pool_size; j++) {
482 urb = usb_alloc_urb(0, GFP_KERNEL); 492 urb = usb_alloc_urb(0, GFP_KERNEL);
483 if (!urb) { 493 if (!urb) {
484 err("No free urbs available"); 494 dev_err(&port->dev, "No free urbs available\n");
485 goto no_rx_urb; 495 goto no_rx_urb;
486 } 496 }
487 buf_size = port->read_urb->transfer_buffer_length; 497 buf_size = port->read_urb->transfer_buffer_length;
488 urb->transfer_buffer = kmalloc(buf_size, GFP_KERNEL); 498 urb->transfer_buffer = kmalloc(buf_size, GFP_KERNEL);
489 if (!urb->transfer_buffer) { 499 if (!urb->transfer_buffer) {
490 err("Couldn't allocate urb buffer"); 500 dev_err(&port->dev,
501 "Couldn't allocate urb buffer\n");
491 goto no_rx_buf; 502 goto no_rx_buf;
492 } 503 }
493 wrap = kmalloc(sizeof(*wrap), GFP_KERNEL); 504 wrap = kmalloc(sizeof(*wrap), GFP_KERNEL);
494 if (!wrap) { 505 if (!wrap) {
495 err("Couldn't allocate urb wrapper"); 506 dev_err(&port->dev,
507 "Couldn't allocate urb wrapper\n");
496 goto no_rx_wrap; 508 goto no_rx_wrap;
497 } 509 }
498 usb_fill_bulk_urb(urb, serial->dev, 510 usb_fill_bulk_urb(urb, serial->dev,
@@ -505,18 +517,20 @@ static int whiteheat_attach(struct usb_serial *serial)
505 517
506 urb = usb_alloc_urb(0, GFP_KERNEL); 518 urb = usb_alloc_urb(0, GFP_KERNEL);
507 if (!urb) { 519 if (!urb) {
508 err("No free urbs available"); 520 dev_err(&port->dev, "No free urbs available\n");
509 goto no_tx_urb; 521 goto no_tx_urb;
510 } 522 }
511 buf_size = port->write_urb->transfer_buffer_length; 523 buf_size = port->write_urb->transfer_buffer_length;
512 urb->transfer_buffer = kmalloc(buf_size, GFP_KERNEL); 524 urb->transfer_buffer = kmalloc(buf_size, GFP_KERNEL);
513 if (!urb->transfer_buffer) { 525 if (!urb->transfer_buffer) {
514 err("Couldn't allocate urb buffer"); 526 dev_err(&port->dev,
527 "Couldn't allocate urb buffer\n");
515 goto no_tx_buf; 528 goto no_tx_buf;
516 } 529 }
517 wrap = kmalloc(sizeof(*wrap), GFP_KERNEL); 530 wrap = kmalloc(sizeof(*wrap), GFP_KERNEL);
518 if (!wrap) { 531 if (!wrap) {
519 err("Couldn't allocate urb wrapper"); 532 dev_err(&port->dev,
533 "Couldn't allocate urb wrapper\n");
520 goto no_tx_wrap; 534 goto no_tx_wrap;
521 } 535 }
522 usb_fill_bulk_urb(urb, serial->dev, 536 usb_fill_bulk_urb(urb, serial->dev,
@@ -534,8 +548,9 @@ static int whiteheat_attach(struct usb_serial *serial)
534 command_info = kmalloc(sizeof(struct whiteheat_command_private), 548 command_info = kmalloc(sizeof(struct whiteheat_command_private),
535 GFP_KERNEL); 549 GFP_KERNEL);
536 if (command_info == NULL) { 550 if (command_info == NULL) {
537 err("%s: Out of memory for port structures\n", 551 dev_err(&serial->dev->dev,
538 serial->type->description); 552 "%s: Out of memory for port structures\n",
553 serial->type->description);
539 goto no_command_private; 554 goto no_command_private;
540 } 555 }
541 556
@@ -552,12 +567,15 @@ static int whiteheat_attach(struct usb_serial *serial)
552 567
553no_firmware: 568no_firmware:
554 /* Firmware likely not running */ 569 /* Firmware likely not running */
555 err("%s: Unable to retrieve firmware version, try replugging\n", 570 dev_err(&serial->dev->dev,
556 serial->type->description); 571 "%s: Unable to retrieve firmware version, try replugging\n",
557 err("%s: If the firmware is not running (status led not blinking)\n", 572 serial->type->description);
558 serial->type->description); 573 dev_err(&serial->dev->dev,
559 err("%s: please contact support@connecttech.com\n", 574 "%s: If the firmware is not running (status led not blinking)\n",
560 serial->type->description); 575 serial->type->description);
576 dev_err(&serial->dev->dev,
577 "%s: please contact support@connecttech.com\n",
578 serial->type->description);
561 kfree(result); 579 kfree(result);
562 return -ENODEV; 580 return -ENODEV;
563 581
@@ -680,8 +698,9 @@ static int whiteheat_open(struct tty_struct *tty,
680 /* Start reading from the device */ 698 /* Start reading from the device */
681 retval = start_port_read(port); 699 retval = start_port_read(port);
682 if (retval) { 700 if (retval) {
683 err("%s - failed submitting read urb, error %d", 701 dev_err(&port->dev,
684 __func__, retval); 702 "%s - failed submitting read urb, error %d\n",
703 __func__, retval);
685 firm_close(port); 704 firm_close(port);
686 stop_command_port(port->serial); 705 stop_command_port(port->serial);
687 goto exit; 706 goto exit;
@@ -806,8 +825,9 @@ static int whiteheat_write(struct tty_struct *tty,
806 urb->transfer_buffer_length = bytes; 825 urb->transfer_buffer_length = bytes;
807 result = usb_submit_urb(urb, GFP_ATOMIC); 826 result = usb_submit_urb(urb, GFP_ATOMIC);
808 if (result) { 827 if (result) {
809 err("%s - failed submitting write urb, error %d", 828 dev_err(&port->dev,
810 __func__, result); 829 "%s - failed submitting write urb, error %d\n",
830 __func__, result);
811 sent = result; 831 sent = result;
812 spin_lock_irqsave(&info->lock, flags); 832 spin_lock_irqsave(&info->lock, flags);
813 list_add(tmp, &info->tx_urbs_free); 833 list_add(tmp, &info->tx_urbs_free);
@@ -1075,7 +1095,7 @@ static void whiteheat_read_callback(struct urb *urb)
1075 wrap = urb_to_wrap(urb, &info->rx_urbs_submitted); 1095 wrap = urb_to_wrap(urb, &info->rx_urbs_submitted);
1076 if (!wrap) { 1096 if (!wrap) {
1077 spin_unlock(&info->lock); 1097 spin_unlock(&info->lock);
1078 err("%s - Not my urb!", __func__); 1098 dev_err(&port->dev, "%s - Not my urb!\n", __func__);
1079 return; 1099 return;
1080 } 1100 }
1081 list_del(&wrap->list); 1101 list_del(&wrap->list);
@@ -1119,7 +1139,7 @@ static void whiteheat_write_callback(struct urb *urb)
1119 wrap = urb_to_wrap(urb, &info->tx_urbs_submitted); 1139 wrap = urb_to_wrap(urb, &info->tx_urbs_submitted);
1120 if (!wrap) { 1140 if (!wrap) {
1121 spin_unlock(&info->lock); 1141 spin_unlock(&info->lock);
1122 err("%s - Not my urb!", __func__); 1142 dev_err(&port->dev, "%s - Not my urb!\n", __func__);
1123 return; 1143 return;
1124 } 1144 }
1125 list_move(&wrap->list, &info->tx_urbs_free); 1145 list_move(&wrap->list, &info->tx_urbs_free);
@@ -1383,8 +1403,9 @@ static int start_command_port(struct usb_serial *serial)
1383 command_port->read_urb->dev = serial->dev; 1403 command_port->read_urb->dev = serial->dev;
1384 retval = usb_submit_urb(command_port->read_urb, GFP_KERNEL); 1404 retval = usb_submit_urb(command_port->read_urb, GFP_KERNEL);
1385 if (retval) { 1405 if (retval) {
1386 err("%s - failed submitting read urb, error %d", 1406 dev_err(&serial->dev->dev,
1387 __func__, retval); 1407 "%s - failed submitting read urb, error %d\n",
1408 __func__, retval);
1388 goto exit; 1409 goto exit;
1389 } 1410 }
1390 } 1411 }
@@ -1481,7 +1502,7 @@ static void rx_data_softint(struct work_struct *work)
1481 struct whiteheat_private *info = 1502 struct whiteheat_private *info =
1482 container_of(work, struct whiteheat_private, rx_work); 1503 container_of(work, struct whiteheat_private, rx_work);
1483 struct usb_serial_port *port = info->port; 1504 struct usb_serial_port *port = info->port;
1484 struct tty_struct *tty = port->port.tty; 1505 struct tty_struct *tty = tty_port_tty_get(&port->port);
1485 struct whiteheat_urb_wrap *wrap; 1506 struct whiteheat_urb_wrap *wrap;
1486 struct urb *urb; 1507 struct urb *urb;
1487 unsigned long flags; 1508 unsigned long flags;
@@ -1493,7 +1514,7 @@ static void rx_data_softint(struct work_struct *work)
1493 spin_lock_irqsave(&info->lock, flags); 1514 spin_lock_irqsave(&info->lock, flags);
1494 if (info->flags & THROTTLED) { 1515 if (info->flags & THROTTLED) {
1495 spin_unlock_irqrestore(&info->lock, flags); 1516 spin_unlock_irqrestore(&info->lock, flags);
1496 return; 1517 goto out;
1497 } 1518 }
1498 1519
1499 list_for_each_safe(tmp, tmp2, &info->rx_urb_q) { 1520 list_for_each_safe(tmp, tmp2, &info->rx_urb_q) {
@@ -1513,7 +1534,7 @@ static void rx_data_softint(struct work_struct *work)
1513 spin_unlock_irqrestore(&info->lock, flags); 1534 spin_unlock_irqrestore(&info->lock, flags);
1514 tty_flip_buffer_push(tty); 1535 tty_flip_buffer_push(tty);
1515 schedule_work(&info->rx_work); 1536 schedule_work(&info->rx_work);
1516 return; 1537 goto out;
1517 } 1538 }
1518 tty_insert_flip_string(tty, urb->transfer_buffer, len); 1539 tty_insert_flip_string(tty, urb->transfer_buffer, len);
1519 sent += len; 1540 sent += len;
@@ -1522,7 +1543,8 @@ static void rx_data_softint(struct work_struct *work)
1522 urb->dev = port->serial->dev; 1543 urb->dev = port->serial->dev;
1523 result = usb_submit_urb(urb, GFP_ATOMIC); 1544 result = usb_submit_urb(urb, GFP_ATOMIC);
1524 if (result) { 1545 if (result) {
1525 err("%s - failed resubmitting read urb, error %d", 1546 dev_err(&port->dev,
1547 "%s - failed resubmitting read urb, error %d\n",
1526 __func__, result); 1548 __func__, result);
1527 spin_lock_irqsave(&info->lock, flags); 1549 spin_lock_irqsave(&info->lock, flags);
1528 list_add(tmp, &info->rx_urbs_free); 1550 list_add(tmp, &info->rx_urbs_free);
@@ -1536,6 +1558,8 @@ static void rx_data_softint(struct work_struct *work)
1536 1558
1537 if (sent) 1559 if (sent)
1538 tty_flip_buffer_push(tty); 1560 tty_flip_buffer_push(tty);
1561out:
1562 tty_kref_put(tty);
1539} 1563}
1540 1564
1541 1565
@@ -1554,7 +1578,8 @@ static int __init whiteheat_init(void)
1554 retval = usb_register(&whiteheat_driver); 1578 retval = usb_register(&whiteheat_driver);
1555 if (retval) 1579 if (retval)
1556 goto failed_usb_register; 1580 goto failed_usb_register;
1557 info(DRIVER_DESC " " DRIVER_VERSION); 1581 printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
1582 DRIVER_DESC "\n");
1558 return 0; 1583 return 0;
1559failed_usb_register: 1584failed_usb_register:
1560 usb_serial_deregister(&whiteheat_device); 1585 usb_serial_deregister(&whiteheat_device);