diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-09-13 19:30:31 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-09-13 19:30:31 -0400 |
commit | 92931d243b5cafa23de2d693342966bb9133cdbc (patch) | |
tree | d79d3d846cbceced7a85575985ef9f09a25615d1 /drivers/usb/serial/usb-serial.c | |
parent | fee84a54e707d93282f1854a9f712534b6543a5e (diff) |
USB: serial: core: clean up dbg and printk usage.
This cleans up the usb-serial module to remove all old usages of dbg()
and "raw" printk() calls for error reporting (there are some info
messages left for now.)
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/serial/usb-serial.c')
-rw-r--r-- | drivers/usb/serial/usb-serial.c | 146 |
1 files changed, 69 insertions, 77 deletions
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index 5dd48f378a20..8a9352b2c26f 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c | |||
@@ -17,6 +17,8 @@ | |||
17 | * | 17 | * |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
21 | |||
20 | #include <linux/kernel.h> | 22 | #include <linux/kernel.h> |
21 | #include <linux/errno.h> | 23 | #include <linux/errno.h> |
22 | #include <linux/init.h> | 24 | #include <linux/init.h> |
@@ -87,7 +89,7 @@ static struct usb_serial *get_free_serial(struct usb_serial *serial, | |||
87 | unsigned int i, j; | 89 | unsigned int i, j; |
88 | int good_spot; | 90 | int good_spot; |
89 | 91 | ||
90 | dbg("%s %d", __func__, num_ports); | 92 | dev_dbg(&serial->interface->dev, "%s %d\n", __func__, num_ports); |
91 | 93 | ||
92 | *minor = 0; | 94 | *minor = 0; |
93 | mutex_lock(&table_lock); | 95 | mutex_lock(&table_lock); |
@@ -107,7 +109,7 @@ static struct usb_serial *get_free_serial(struct usb_serial *serial, | |||
107 | 109 | ||
108 | *minor = i; | 110 | *minor = i; |
109 | j = 0; | 111 | j = 0; |
110 | dbg("%s - minor base = %d", __func__, *minor); | 112 | dev_dbg(&serial->interface->dev, "%s - minor base = %d\n", __func__, *minor); |
111 | for (i = *minor; (i < (*minor + num_ports)) && (i < SERIAL_TTY_MINORS); ++i) { | 113 | for (i = *minor; (i < (*minor + num_ports)) && (i < SERIAL_TTY_MINORS); ++i) { |
112 | serial_table[i] = serial; | 114 | serial_table[i] = serial; |
113 | serial->port[j++]->number = i; | 115 | serial->port[j++]->number = i; |
@@ -137,8 +139,6 @@ static void destroy_serial(struct kref *kref) | |||
137 | 139 | ||
138 | serial = to_usb_serial(kref); | 140 | serial = to_usb_serial(kref); |
139 | 141 | ||
140 | dbg("%s - %s", __func__, serial->type->description); | ||
141 | |||
142 | /* return the minor range that this device had */ | 142 | /* return the minor range that this device had */ |
143 | if (serial->minor != SERIAL_TTY_NO_MINOR) | 143 | if (serial->minor != SERIAL_TTY_NO_MINOR) |
144 | return_serial(serial); | 144 | return_serial(serial); |
@@ -252,7 +252,7 @@ static int serial_open(struct tty_struct *tty, struct file *filp) | |||
252 | { | 252 | { |
253 | struct usb_serial_port *port = tty->driver_data; | 253 | struct usb_serial_port *port = tty->driver_data; |
254 | 254 | ||
255 | dbg("%s - port %d", __func__, port->number); | 255 | dev_dbg(tty->dev, "%s - port %d\n", __func__, port->number); |
256 | return tty_port_open(&port->port, tty, filp); | 256 | return tty_port_open(&port->port, tty, filp); |
257 | } | 257 | } |
258 | 258 | ||
@@ -283,14 +283,16 @@ static void serial_down(struct tty_port *tport) | |||
283 | static void serial_hangup(struct tty_struct *tty) | 283 | static void serial_hangup(struct tty_struct *tty) |
284 | { | 284 | { |
285 | struct usb_serial_port *port = tty->driver_data; | 285 | struct usb_serial_port *port = tty->driver_data; |
286 | dbg("%s - port %d", __func__, port->number); | 286 | |
287 | dev_dbg(tty->dev, "%s - port %d\n", __func__, port->number); | ||
287 | tty_port_hangup(&port->port); | 288 | tty_port_hangup(&port->port); |
288 | } | 289 | } |
289 | 290 | ||
290 | static void serial_close(struct tty_struct *tty, struct file *filp) | 291 | static void serial_close(struct tty_struct *tty, struct file *filp) |
291 | { | 292 | { |
292 | struct usb_serial_port *port = tty->driver_data; | 293 | struct usb_serial_port *port = tty->driver_data; |
293 | dbg("%s - port %d", __func__, port->number); | 294 | |
295 | dev_dbg(tty->dev, "%s - port %d\n", __func__, port->number); | ||
294 | tty_port_close(&port->port, tty, filp); | 296 | tty_port_close(&port->port, tty, filp); |
295 | } | 297 | } |
296 | 298 | ||
@@ -316,7 +318,7 @@ static void serial_cleanup(struct tty_struct *tty) | |||
316 | if (port->port.console) | 318 | if (port->port.console) |
317 | return; | 319 | return; |
318 | 320 | ||
319 | dbg("%s - port %d", __func__, port->number); | 321 | dev_dbg(tty->dev, "%s - port %d\n", __func__, port->number); |
320 | 322 | ||
321 | tty->driver_data = NULL; | 323 | tty->driver_data = NULL; |
322 | 324 | ||
@@ -341,7 +343,8 @@ static int serial_write(struct tty_struct *tty, const unsigned char *buf, | |||
341 | if (port->serial->dev->state == USB_STATE_NOTATTACHED) | 343 | if (port->serial->dev->state == USB_STATE_NOTATTACHED) |
342 | goto exit; | 344 | goto exit; |
343 | 345 | ||
344 | dbg("%s - port %d, %d byte(s)", __func__, port->number, count); | 346 | dev_dbg(tty->dev, "%s - port %d, %d byte(s)\n", __func__, |
347 | port->number, count); | ||
345 | 348 | ||
346 | /* pass on to the driver specific version of this function */ | 349 | /* pass on to the driver specific version of this function */ |
347 | retval = port->serial->type->write(tty, port, buf, count); | 350 | retval = port->serial->type->write(tty, port, buf, count); |
@@ -354,7 +357,8 @@ exit: | |||
354 | static int serial_write_room(struct tty_struct *tty) | 357 | static int serial_write_room(struct tty_struct *tty) |
355 | { | 358 | { |
356 | struct usb_serial_port *port = tty->driver_data; | 359 | struct usb_serial_port *port = tty->driver_data; |
357 | dbg("%s - port %d", __func__, port->number); | 360 | |
361 | dev_dbg(tty->dev, "%s - port %d\n", __func__, port->number); | ||
358 | /* pass on to the driver specific version of this function */ | 362 | /* pass on to the driver specific version of this function */ |
359 | return port->serial->type->write_room(tty); | 363 | return port->serial->type->write_room(tty); |
360 | } | 364 | } |
@@ -362,7 +366,8 @@ static int serial_write_room(struct tty_struct *tty) | |||
362 | static int serial_chars_in_buffer(struct tty_struct *tty) | 366 | static int serial_chars_in_buffer(struct tty_struct *tty) |
363 | { | 367 | { |
364 | struct usb_serial_port *port = tty->driver_data; | 368 | struct usb_serial_port *port = tty->driver_data; |
365 | dbg("%s - port %d", __func__, port->number); | 369 | |
370 | dev_dbg(tty->dev, "%s - port %d\n", __func__, port->number); | ||
366 | 371 | ||
367 | /* if the device was unplugged then any remaining characters | 372 | /* if the device was unplugged then any remaining characters |
368 | fell out of the connector ;) */ | 373 | fell out of the connector ;) */ |
@@ -375,7 +380,8 @@ static int serial_chars_in_buffer(struct tty_struct *tty) | |||
375 | static void serial_throttle(struct tty_struct *tty) | 380 | static void serial_throttle(struct tty_struct *tty) |
376 | { | 381 | { |
377 | struct usb_serial_port *port = tty->driver_data; | 382 | struct usb_serial_port *port = tty->driver_data; |
378 | dbg("%s - port %d", __func__, port->number); | 383 | |
384 | dev_dbg(tty->dev, "%s - port %d\n", __func__, port->number); | ||
379 | 385 | ||
380 | /* pass on to the driver specific version of this function */ | 386 | /* pass on to the driver specific version of this function */ |
381 | if (port->serial->type->throttle) | 387 | if (port->serial->type->throttle) |
@@ -385,7 +391,8 @@ static void serial_throttle(struct tty_struct *tty) | |||
385 | static void serial_unthrottle(struct tty_struct *tty) | 391 | static void serial_unthrottle(struct tty_struct *tty) |
386 | { | 392 | { |
387 | struct usb_serial_port *port = tty->driver_data; | 393 | struct usb_serial_port *port = tty->driver_data; |
388 | dbg("%s - port %d", __func__, port->number); | 394 | |
395 | dev_dbg(tty->dev, "%s - port %d\n", __func__, port->number); | ||
389 | 396 | ||
390 | /* pass on to the driver specific version of this function */ | 397 | /* pass on to the driver specific version of this function */ |
391 | if (port->serial->type->unthrottle) | 398 | if (port->serial->type->unthrottle) |
@@ -398,7 +405,8 @@ static int serial_ioctl(struct tty_struct *tty, | |||
398 | struct usb_serial_port *port = tty->driver_data; | 405 | struct usb_serial_port *port = tty->driver_data; |
399 | int retval = -ENODEV; | 406 | int retval = -ENODEV; |
400 | 407 | ||
401 | dbg("%s - port %d, cmd 0x%.4x", __func__, port->number, cmd); | 408 | dev_dbg(tty->dev, "%s - port %d, cmd 0x%.4x\n", __func__, |
409 | port->number, cmd); | ||
402 | 410 | ||
403 | /* pass on to the driver specific version of this function | 411 | /* pass on to the driver specific version of this function |
404 | if it is available */ | 412 | if it is available */ |
@@ -412,7 +420,8 @@ static int serial_ioctl(struct tty_struct *tty, | |||
412 | static void serial_set_termios(struct tty_struct *tty, struct ktermios *old) | 420 | static void serial_set_termios(struct tty_struct *tty, struct ktermios *old) |
413 | { | 421 | { |
414 | struct usb_serial_port *port = tty->driver_data; | 422 | struct usb_serial_port *port = tty->driver_data; |
415 | dbg("%s - port %d", __func__, port->number); | 423 | |
424 | dev_dbg(tty->dev, "%s - port %d\n", __func__, port->number); | ||
416 | 425 | ||
417 | /* pass on to the driver specific version of this function | 426 | /* pass on to the driver specific version of this function |
418 | if it is available */ | 427 | if it is available */ |
@@ -426,7 +435,7 @@ static int serial_break(struct tty_struct *tty, int break_state) | |||
426 | { | 435 | { |
427 | struct usb_serial_port *port = tty->driver_data; | 436 | struct usb_serial_port *port = tty->driver_data; |
428 | 437 | ||
429 | dbg("%s - port %d", __func__, port->number); | 438 | dev_dbg(tty->dev, "%s - port %d\n", __func__, port->number); |
430 | 439 | ||
431 | /* pass on to the driver specific version of this function | 440 | /* pass on to the driver specific version of this function |
432 | if it is available */ | 441 | if it is available */ |
@@ -485,7 +494,7 @@ static int serial_tiocmget(struct tty_struct *tty) | |||
485 | { | 494 | { |
486 | struct usb_serial_port *port = tty->driver_data; | 495 | struct usb_serial_port *port = tty->driver_data; |
487 | 496 | ||
488 | dbg("%s - port %d", __func__, port->number); | 497 | dev_dbg(tty->dev, "%s - port %d\n", __func__, port->number); |
489 | 498 | ||
490 | if (port->serial->type->tiocmget) | 499 | if (port->serial->type->tiocmget) |
491 | return port->serial->type->tiocmget(tty); | 500 | return port->serial->type->tiocmget(tty); |
@@ -497,7 +506,7 @@ static int serial_tiocmset(struct tty_struct *tty, | |||
497 | { | 506 | { |
498 | struct usb_serial_port *port = tty->driver_data; | 507 | struct usb_serial_port *port = tty->driver_data; |
499 | 508 | ||
500 | dbg("%s - port %d", __func__, port->number); | 509 | dev_dbg(tty->dev, "%s - port %d\n", __func__, port->number); |
501 | 510 | ||
502 | if (port->serial->type->tiocmset) | 511 | if (port->serial->type->tiocmset) |
503 | return port->serial->type->tiocmset(tty, set, clear); | 512 | return port->serial->type->tiocmset(tty, set, clear); |
@@ -509,7 +518,7 @@ static int serial_get_icount(struct tty_struct *tty, | |||
509 | { | 518 | { |
510 | struct usb_serial_port *port = tty->driver_data; | 519 | struct usb_serial_port *port = tty->driver_data; |
511 | 520 | ||
512 | dbg("%s - port %d", __func__, port->number); | 521 | dev_dbg(tty->dev, "%s - port %d\n", __func__, port->number); |
513 | 522 | ||
514 | if (port->serial->type->get_icount) | 523 | if (port->serial->type->get_icount) |
515 | return port->serial->type->get_icount(tty, icount); | 524 | return port->serial->type->get_icount(tty, icount); |
@@ -533,12 +542,12 @@ static void usb_serial_port_work(struct work_struct *work) | |||
533 | container_of(work, struct usb_serial_port, work); | 542 | container_of(work, struct usb_serial_port, work); |
534 | struct tty_struct *tty; | 543 | struct tty_struct *tty; |
535 | 544 | ||
536 | dbg("%s - port %d", __func__, port->number); | ||
537 | |||
538 | tty = tty_port_tty_get(&port->port); | 545 | tty = tty_port_tty_get(&port->port); |
539 | if (!tty) | 546 | if (!tty) |
540 | return; | 547 | return; |
541 | 548 | ||
549 | dev_dbg(tty->dev, "%s - port %d\n", __func__, port->number); | ||
550 | |||
542 | tty_wakeup(tty); | 551 | tty_wakeup(tty); |
543 | tty_kref_put(tty); | 552 | tty_kref_put(tty); |
544 | } | 553 | } |
@@ -571,7 +580,7 @@ static void port_release(struct device *dev) | |||
571 | struct usb_serial_port *port = to_usb_serial_port(dev); | 580 | struct usb_serial_port *port = to_usb_serial_port(dev); |
572 | int i; | 581 | int i; |
573 | 582 | ||
574 | dbg ("%s - %s", __func__, dev_name(dev)); | 583 | dev_dbg(dev, "%s\n", __func__); |
575 | 584 | ||
576 | /* | 585 | /* |
577 | * Stop all the traffic before cancelling the work, so that | 586 | * Stop all the traffic before cancelling the work, so that |
@@ -640,12 +649,12 @@ static const struct usb_device_id *get_iface_id(struct usb_serial_driver *drv, | |||
640 | 649 | ||
641 | id = usb_match_id(intf, drv->id_table); | 650 | id = usb_match_id(intf, drv->id_table); |
642 | if (id) { | 651 | if (id) { |
643 | dbg("static descriptor matches"); | 652 | dev_dbg(&intf->dev, "static descriptor matches\n"); |
644 | goto exit; | 653 | goto exit; |
645 | } | 654 | } |
646 | id = match_dynamic_id(intf, drv); | 655 | id = match_dynamic_id(intf, drv); |
647 | if (id) | 656 | if (id) |
648 | dbg("dynamic descriptor matches"); | 657 | dev_dbg(&intf->dev, "dynamic descriptor matches\n"); |
649 | exit: | 658 | exit: |
650 | return id; | 659 | return id; |
651 | } | 660 | } |
@@ -699,6 +708,7 @@ static const struct tty_port_operations serial_port_ops = { | |||
699 | static int usb_serial_probe(struct usb_interface *interface, | 708 | static int usb_serial_probe(struct usb_interface *interface, |
700 | const struct usb_device_id *id) | 709 | const struct usb_device_id *id) |
701 | { | 710 | { |
711 | struct device *ddev = &interface->dev; | ||
702 | struct usb_device *dev = interface_to_usbdev(interface); | 712 | struct usb_device *dev = interface_to_usbdev(interface); |
703 | struct usb_serial *serial = NULL; | 713 | struct usb_serial *serial = NULL; |
704 | struct usb_serial_port *port; | 714 | struct usb_serial_port *port; |
@@ -725,13 +735,13 @@ static int usb_serial_probe(struct usb_interface *interface, | |||
725 | type = search_serial_device(interface); | 735 | type = search_serial_device(interface); |
726 | if (!type) { | 736 | if (!type) { |
727 | mutex_unlock(&table_lock); | 737 | mutex_unlock(&table_lock); |
728 | dbg("none matched"); | 738 | dev_dbg(ddev, "none matched\n"); |
729 | return -ENODEV; | 739 | return -ENODEV; |
730 | } | 740 | } |
731 | 741 | ||
732 | if (!try_module_get(type->driver.owner)) { | 742 | if (!try_module_get(type->driver.owner)) { |
733 | mutex_unlock(&table_lock); | 743 | mutex_unlock(&table_lock); |
734 | dev_err(&interface->dev, "module get failed, exiting\n"); | 744 | dev_err(ddev, "module get failed, exiting\n"); |
735 | return -EIO; | 745 | return -EIO; |
736 | } | 746 | } |
737 | mutex_unlock(&table_lock); | 747 | mutex_unlock(&table_lock); |
@@ -739,7 +749,7 @@ static int usb_serial_probe(struct usb_interface *interface, | |||
739 | serial = create_serial(dev, interface, type); | 749 | serial = create_serial(dev, interface, type); |
740 | if (!serial) { | 750 | if (!serial) { |
741 | module_put(type->driver.owner); | 751 | module_put(type->driver.owner); |
742 | dev_err(&interface->dev, "%s - out of memory\n", __func__); | 752 | dev_err(ddev, "%s - out of memory\n", __func__); |
743 | return -ENOMEM; | 753 | return -ENOMEM; |
744 | } | 754 | } |
745 | 755 | ||
@@ -751,7 +761,7 @@ static int usb_serial_probe(struct usb_interface *interface, | |||
751 | retval = type->probe(serial, id); | 761 | retval = type->probe(serial, id); |
752 | 762 | ||
753 | if (retval) { | 763 | if (retval) { |
754 | dbg("sub driver rejected device"); | 764 | dev_dbg(ddev, "sub driver rejected device\n"); |
755 | usb_serial_put(serial); | 765 | usb_serial_put(serial); |
756 | module_put(type->driver.owner); | 766 | module_put(type->driver.owner); |
757 | return retval; | 767 | return retval; |
@@ -766,28 +776,28 @@ static int usb_serial_probe(struct usb_interface *interface, | |||
766 | 776 | ||
767 | if (usb_endpoint_is_bulk_in(endpoint)) { | 777 | if (usb_endpoint_is_bulk_in(endpoint)) { |
768 | /* we found a bulk in endpoint */ | 778 | /* we found a bulk in endpoint */ |
769 | dbg("found bulk in on endpoint %d", i); | 779 | dev_dbg(ddev, "found bulk in on endpoint %d\n", i); |
770 | bulk_in_endpoint[num_bulk_in] = endpoint; | 780 | bulk_in_endpoint[num_bulk_in] = endpoint; |
771 | ++num_bulk_in; | 781 | ++num_bulk_in; |
772 | } | 782 | } |
773 | 783 | ||
774 | if (usb_endpoint_is_bulk_out(endpoint)) { | 784 | if (usb_endpoint_is_bulk_out(endpoint)) { |
775 | /* we found a bulk out endpoint */ | 785 | /* we found a bulk out endpoint */ |
776 | dbg("found bulk out on endpoint %d", i); | 786 | dev_dbg(ddev, "found bulk out on endpoint %d\n", i); |
777 | bulk_out_endpoint[num_bulk_out] = endpoint; | 787 | bulk_out_endpoint[num_bulk_out] = endpoint; |
778 | ++num_bulk_out; | 788 | ++num_bulk_out; |
779 | } | 789 | } |
780 | 790 | ||
781 | if (usb_endpoint_is_int_in(endpoint)) { | 791 | if (usb_endpoint_is_int_in(endpoint)) { |
782 | /* we found a interrupt in endpoint */ | 792 | /* we found a interrupt in endpoint */ |
783 | dbg("found interrupt in on endpoint %d", i); | 793 | dev_dbg(ddev, "found interrupt in on endpoint %d\n", i); |
784 | interrupt_in_endpoint[num_interrupt_in] = endpoint; | 794 | interrupt_in_endpoint[num_interrupt_in] = endpoint; |
785 | ++num_interrupt_in; | 795 | ++num_interrupt_in; |
786 | } | 796 | } |
787 | 797 | ||
788 | if (usb_endpoint_is_int_out(endpoint)) { | 798 | if (usb_endpoint_is_int_out(endpoint)) { |
789 | /* we found an interrupt out endpoint */ | 799 | /* we found an interrupt out endpoint */ |
790 | dbg("found interrupt out on endpoint %d", i); | 800 | dev_dbg(ddev, "found interrupt out on endpoint %d\n", i); |
791 | interrupt_out_endpoint[num_interrupt_out] = endpoint; | 801 | interrupt_out_endpoint[num_interrupt_out] = endpoint; |
792 | ++num_interrupt_out; | 802 | ++num_interrupt_out; |
793 | } | 803 | } |
@@ -811,7 +821,7 @@ static int usb_serial_probe(struct usb_interface *interface, | |||
811 | endpoint = &iface_desc->endpoint[i].desc; | 821 | endpoint = &iface_desc->endpoint[i].desc; |
812 | if (usb_endpoint_is_int_in(endpoint)) { | 822 | if (usb_endpoint_is_int_in(endpoint)) { |
813 | /* we found a interrupt in endpoint */ | 823 | /* we found a interrupt in endpoint */ |
814 | dbg("found interrupt in for Prolific device on separate interface"); | 824 | dev_dbg(ddev, "found interrupt in for Prolific device on separate interface\n"); |
815 | interrupt_in_endpoint[num_interrupt_in] = endpoint; | 825 | interrupt_in_endpoint[num_interrupt_in] = endpoint; |
816 | ++num_interrupt_in; | 826 | ++num_interrupt_in; |
817 | } | 827 | } |
@@ -823,7 +833,7 @@ static int usb_serial_probe(struct usb_interface *interface, | |||
823 | * properly during a later invocation of usb_serial_probe | 833 | * properly during a later invocation of usb_serial_probe |
824 | */ | 834 | */ |
825 | if (num_bulk_in == 0 || num_bulk_out == 0) { | 835 | if (num_bulk_in == 0 || num_bulk_out == 0) { |
826 | dev_info(&interface->dev, "PL-2303 hack: descriptors matched but endpoints did not\n"); | 836 | dev_info(ddev, "PL-2303 hack: descriptors matched but endpoints did not\n"); |
827 | usb_serial_put(serial); | 837 | usb_serial_put(serial); |
828 | module_put(type->driver.owner); | 838 | module_put(type->driver.owner); |
829 | return -ENODEV; | 839 | return -ENODEV; |
@@ -836,14 +846,13 @@ static int usb_serial_probe(struct usb_interface *interface, | |||
836 | if (type == &usb_serial_generic_device) { | 846 | if (type == &usb_serial_generic_device) { |
837 | num_ports = num_bulk_out; | 847 | num_ports = num_bulk_out; |
838 | if (num_ports == 0) { | 848 | if (num_ports == 0) { |
839 | dev_err(&interface->dev, | 849 | dev_err(ddev, "Generic device with no bulk out, not allowed.\n"); |
840 | "Generic device with no bulk out, not allowed.\n"); | ||
841 | usb_serial_put(serial); | 850 | usb_serial_put(serial); |
842 | module_put(type->driver.owner); | 851 | module_put(type->driver.owner); |
843 | return -EIO; | 852 | return -EIO; |
844 | } | 853 | } |
845 | dev_info(&interface->dev, "The \"generic\" usb-serial driver is only for testing and one-off prototypes.\n"); | 854 | dev_info(ddev, "The \"generic\" usb-serial driver is only for testing and one-off prototypes.\n"); |
846 | dev_info(&interface->dev, "Tell linux-usb@vger.kernel.org to add your device to a proper driver.\n"); | 855 | dev_info(ddev, "Tell linux-usb@vger.kernel.org to add your device to a proper driver.\n"); |
847 | } | 856 | } |
848 | #endif | 857 | #endif |
849 | if (!num_ports) { | 858 | if (!num_ports) { |
@@ -861,8 +870,7 @@ static int usb_serial_probe(struct usb_interface *interface, | |||
861 | serial->num_interrupt_out = num_interrupt_out; | 870 | serial->num_interrupt_out = num_interrupt_out; |
862 | 871 | ||
863 | /* found all that we need */ | 872 | /* found all that we need */ |
864 | dev_info(&interface->dev, "%s converter detected\n", | 873 | dev_info(ddev, "%s converter detected\n", type->description); |
865 | type->description); | ||
866 | 874 | ||
867 | /* create our ports, we need as many as the max endpoints */ | 875 | /* create our ports, we need as many as the max endpoints */ |
868 | /* we don't use num_ports here because some devices have more | 876 | /* we don't use num_ports here because some devices have more |
@@ -873,8 +881,7 @@ static int usb_serial_probe(struct usb_interface *interface, | |||
873 | max_endpoints = max(max_endpoints, (int)serial->num_ports); | 881 | max_endpoints = max(max_endpoints, (int)serial->num_ports); |
874 | serial->num_port_pointers = max_endpoints; | 882 | serial->num_port_pointers = max_endpoints; |
875 | 883 | ||
876 | dbg("%s - setting up %d port structures for this device", | 884 | dev_dbg(ddev, "setting up %d port structures for this device", max_endpoints); |
877 | __func__, max_endpoints); | ||
878 | for (i = 0; i < max_endpoints; ++i) { | 885 | for (i = 0; i < max_endpoints; ++i) { |
879 | port = kzalloc(sizeof(struct usb_serial_port), GFP_KERNEL); | 886 | port = kzalloc(sizeof(struct usb_serial_port), GFP_KERNEL); |
880 | if (!port) | 887 | if (!port) |
@@ -907,15 +914,13 @@ static int usb_serial_probe(struct usb_interface *interface, | |||
907 | set_bit(j, &port->read_urbs_free); | 914 | set_bit(j, &port->read_urbs_free); |
908 | port->read_urbs[j] = usb_alloc_urb(0, GFP_KERNEL); | 915 | port->read_urbs[j] = usb_alloc_urb(0, GFP_KERNEL); |
909 | if (!port->read_urbs[j]) { | 916 | if (!port->read_urbs[j]) { |
910 | dev_err(&interface->dev, | 917 | dev_err(ddev, "No free urbs available\n"); |
911 | "No free urbs available\n"); | ||
912 | goto probe_error; | 918 | goto probe_error; |
913 | } | 919 | } |
914 | port->bulk_in_buffers[j] = kmalloc(buffer_size, | 920 | port->bulk_in_buffers[j] = kmalloc(buffer_size, |
915 | GFP_KERNEL); | 921 | GFP_KERNEL); |
916 | if (!port->bulk_in_buffers[j]) { | 922 | if (!port->bulk_in_buffers[j]) { |
917 | dev_err(&interface->dev, | 923 | dev_err(ddev, "Couldn't allocate bulk_in_buffer\n"); |
918 | "Couldn't allocate bulk_in_buffer\n"); | ||
919 | goto probe_error; | 924 | goto probe_error; |
920 | } | 925 | } |
921 | usb_fill_bulk_urb(port->read_urbs[j], dev, | 926 | usb_fill_bulk_urb(port->read_urbs[j], dev, |
@@ -945,15 +950,13 @@ static int usb_serial_probe(struct usb_interface *interface, | |||
945 | set_bit(j, &port->write_urbs_free); | 950 | set_bit(j, &port->write_urbs_free); |
946 | port->write_urbs[j] = usb_alloc_urb(0, GFP_KERNEL); | 951 | port->write_urbs[j] = usb_alloc_urb(0, GFP_KERNEL); |
947 | if (!port->write_urbs[j]) { | 952 | if (!port->write_urbs[j]) { |
948 | dev_err(&interface->dev, | 953 | dev_err(ddev, "No free urbs available\n"); |
949 | "No free urbs available\n"); | ||
950 | goto probe_error; | 954 | goto probe_error; |
951 | } | 955 | } |
952 | port->bulk_out_buffers[j] = kmalloc(buffer_size, | 956 | port->bulk_out_buffers[j] = kmalloc(buffer_size, |
953 | GFP_KERNEL); | 957 | GFP_KERNEL); |
954 | if (!port->bulk_out_buffers[j]) { | 958 | if (!port->bulk_out_buffers[j]) { |
955 | dev_err(&interface->dev, | 959 | dev_err(ddev, "Couldn't allocate bulk_out_buffer\n"); |
956 | "Couldn't allocate bulk_out_buffer\n"); | ||
957 | goto probe_error; | 960 | goto probe_error; |
958 | } | 961 | } |
959 | usb_fill_bulk_urb(port->write_urbs[j], dev, | 962 | usb_fill_bulk_urb(port->write_urbs[j], dev, |
@@ -974,8 +977,7 @@ static int usb_serial_probe(struct usb_interface *interface, | |||
974 | port = serial->port[i]; | 977 | port = serial->port[i]; |
975 | port->interrupt_in_urb = usb_alloc_urb(0, GFP_KERNEL); | 978 | port->interrupt_in_urb = usb_alloc_urb(0, GFP_KERNEL); |
976 | if (!port->interrupt_in_urb) { | 979 | if (!port->interrupt_in_urb) { |
977 | dev_err(&interface->dev, | 980 | dev_err(ddev, "No free urbs available\n"); |
978 | "No free urbs available\n"); | ||
979 | goto probe_error; | 981 | goto probe_error; |
980 | } | 982 | } |
981 | buffer_size = usb_endpoint_maxp(endpoint); | 983 | buffer_size = usb_endpoint_maxp(endpoint); |
@@ -984,8 +986,7 @@ static int usb_serial_probe(struct usb_interface *interface, | |||
984 | port->interrupt_in_buffer = kmalloc(buffer_size, | 986 | port->interrupt_in_buffer = kmalloc(buffer_size, |
985 | GFP_KERNEL); | 987 | GFP_KERNEL); |
986 | if (!port->interrupt_in_buffer) { | 988 | if (!port->interrupt_in_buffer) { |
987 | dev_err(&interface->dev, | 989 | dev_err(ddev, "Couldn't allocate interrupt_in_buffer\n"); |
988 | "Couldn't allocate interrupt_in_buffer\n"); | ||
989 | goto probe_error; | 990 | goto probe_error; |
990 | } | 991 | } |
991 | usb_fill_int_urb(port->interrupt_in_urb, dev, | 992 | usb_fill_int_urb(port->interrupt_in_urb, dev, |
@@ -996,7 +997,7 @@ static int usb_serial_probe(struct usb_interface *interface, | |||
996 | endpoint->bInterval); | 997 | endpoint->bInterval); |
997 | } | 998 | } |
998 | } else if (num_interrupt_in) { | 999 | } else if (num_interrupt_in) { |
999 | dbg("the device claims to support interrupt in transfers, but read_int_callback is not defined"); | 1000 | dev_dbg(ddev, "The device claims to support interrupt in transfers, but read_int_callback is not defined\n"); |
1000 | } | 1001 | } |
1001 | 1002 | ||
1002 | if (serial->type->write_int_callback) { | 1003 | if (serial->type->write_int_callback) { |
@@ -1005,8 +1006,7 @@ static int usb_serial_probe(struct usb_interface *interface, | |||
1005 | port = serial->port[i]; | 1006 | port = serial->port[i]; |
1006 | port->interrupt_out_urb = usb_alloc_urb(0, GFP_KERNEL); | 1007 | port->interrupt_out_urb = usb_alloc_urb(0, GFP_KERNEL); |
1007 | if (!port->interrupt_out_urb) { | 1008 | if (!port->interrupt_out_urb) { |
1008 | dev_err(&interface->dev, | 1009 | dev_err(ddev, "No free urbs available\n"); |
1009 | "No free urbs available\n"); | ||
1010 | goto probe_error; | 1010 | goto probe_error; |
1011 | } | 1011 | } |
1012 | buffer_size = usb_endpoint_maxp(endpoint); | 1012 | buffer_size = usb_endpoint_maxp(endpoint); |
@@ -1016,8 +1016,7 @@ static int usb_serial_probe(struct usb_interface *interface, | |||
1016 | port->interrupt_out_buffer = kmalloc(buffer_size, | 1016 | port->interrupt_out_buffer = kmalloc(buffer_size, |
1017 | GFP_KERNEL); | 1017 | GFP_KERNEL); |
1018 | if (!port->interrupt_out_buffer) { | 1018 | if (!port->interrupt_out_buffer) { |
1019 | dev_err(&interface->dev, | 1019 | dev_err(ddev, "Couldn't allocate interrupt_out_buffer\n"); |
1020 | "Couldn't allocate interrupt_out_buffer\n"); | ||
1021 | goto probe_error; | 1020 | goto probe_error; |
1022 | } | 1021 | } |
1023 | usb_fill_int_urb(port->interrupt_out_urb, dev, | 1022 | usb_fill_int_urb(port->interrupt_out_urb, dev, |
@@ -1028,7 +1027,7 @@ static int usb_serial_probe(struct usb_interface *interface, | |||
1028 | endpoint->bInterval); | 1027 | endpoint->bInterval); |
1029 | } | 1028 | } |
1030 | } else if (num_interrupt_out) { | 1029 | } else if (num_interrupt_out) { |
1031 | dbg("the device claims to support interrupt out transfers, but write_int_callback is not defined"); | 1030 | dev_dbg(ddev, "The device claims to support interrupt out transfers, but write_int_callback is not defined\n"); |
1032 | } | 1031 | } |
1033 | 1032 | ||
1034 | usb_set_intfdata(interface, serial); | 1033 | usb_set_intfdata(interface, serial); |
@@ -1056,7 +1055,7 @@ static int usb_serial_probe(struct usb_interface *interface, | |||
1056 | serial->disconnected = 1; | 1055 | serial->disconnected = 1; |
1057 | 1056 | ||
1058 | if (get_free_serial(serial, num_ports, &minor) == NULL) { | 1057 | if (get_free_serial(serial, num_ports, &minor) == NULL) { |
1059 | dev_err(&interface->dev, "No more free serial devices\n"); | 1058 | dev_err(ddev, "No more free serial devices\n"); |
1060 | goto probe_error; | 1059 | goto probe_error; |
1061 | } | 1060 | } |
1062 | serial->minor = minor; | 1061 | serial->minor = minor; |
@@ -1065,13 +1064,12 @@ static int usb_serial_probe(struct usb_interface *interface, | |||
1065 | for (i = 0; i < num_ports; ++i) { | 1064 | for (i = 0; i < num_ports; ++i) { |
1066 | port = serial->port[i]; | 1065 | port = serial->port[i]; |
1067 | dev_set_name(&port->dev, "ttyUSB%d", port->number); | 1066 | dev_set_name(&port->dev, "ttyUSB%d", port->number); |
1068 | dbg ("%s - registering %s", __func__, dev_name(&port->dev)); | 1067 | dev_dbg(ddev, "registering %s", dev_name(&port->dev)); |
1069 | device_enable_async_suspend(&port->dev); | 1068 | device_enable_async_suspend(&port->dev); |
1070 | 1069 | ||
1071 | retval = device_add(&port->dev); | 1070 | retval = device_add(&port->dev); |
1072 | if (retval) | 1071 | if (retval) |
1073 | dev_err(&port->dev, "Error registering port device, " | 1072 | dev_err(ddev, "Error registering port device, continuing\n"); |
1074 | "continuing\n"); | ||
1075 | } | 1073 | } |
1076 | 1074 | ||
1077 | serial->disconnected = 0; | 1075 | serial->disconnected = 0; |
@@ -1229,8 +1227,7 @@ static int __init usb_serial_init(void) | |||
1229 | 1227 | ||
1230 | result = bus_register(&usb_serial_bus_type); | 1228 | result = bus_register(&usb_serial_bus_type); |
1231 | if (result) { | 1229 | if (result) { |
1232 | printk(KERN_ERR "usb-serial: %s - registering bus driver " | 1230 | pr_err("%s - registering bus driver failed\n", __func__); |
1233 | "failed\n", __func__); | ||
1234 | goto exit_bus; | 1231 | goto exit_bus; |
1235 | } | 1232 | } |
1236 | 1233 | ||
@@ -1250,24 +1247,21 @@ static int __init usb_serial_init(void) | |||
1250 | tty_set_operations(usb_serial_tty_driver, &serial_ops); | 1247 | tty_set_operations(usb_serial_tty_driver, &serial_ops); |
1251 | result = tty_register_driver(usb_serial_tty_driver); | 1248 | result = tty_register_driver(usb_serial_tty_driver); |
1252 | if (result) { | 1249 | if (result) { |
1253 | printk(KERN_ERR "usb-serial: %s - tty_register_driver failed\n", | 1250 | pr_err("%s - tty_register_driver failed\n", __func__); |
1254 | __func__); | ||
1255 | goto exit_reg_driver; | 1251 | goto exit_reg_driver; |
1256 | } | 1252 | } |
1257 | 1253 | ||
1258 | /* register the USB driver */ | 1254 | /* register the USB driver */ |
1259 | result = usb_register(&usb_serial_driver); | 1255 | result = usb_register(&usb_serial_driver); |
1260 | if (result < 0) { | 1256 | if (result < 0) { |
1261 | printk(KERN_ERR "usb-serial: %s - usb_register failed\n", | 1257 | pr_err("%s - usb_register failed\n", __func__); |
1262 | __func__); | ||
1263 | goto exit_tty; | 1258 | goto exit_tty; |
1264 | } | 1259 | } |
1265 | 1260 | ||
1266 | /* register the generic driver, if we should */ | 1261 | /* register the generic driver, if we should */ |
1267 | result = usb_serial_generic_register(debug); | 1262 | result = usb_serial_generic_register(debug); |
1268 | if (result < 0) { | 1263 | if (result < 0) { |
1269 | printk(KERN_ERR "usb-serial: %s - registering generic " | 1264 | pr_err("%s - registering generic driver failed\n", __func__); |
1270 | "driver failed\n", __func__); | ||
1271 | goto exit_generic; | 1265 | goto exit_generic; |
1272 | } | 1266 | } |
1273 | 1267 | ||
@@ -1285,8 +1279,7 @@ exit_reg_driver: | |||
1285 | bus_unregister(&usb_serial_bus_type); | 1279 | bus_unregister(&usb_serial_bus_type); |
1286 | 1280 | ||
1287 | exit_bus: | 1281 | exit_bus: |
1288 | printk(KERN_ERR "usb-serial: %s - returning with error %d\n", | 1282 | pr_err("%s - returning with error %d\n", __func__, result); |
1289 | __func__, result); | ||
1290 | put_tty_driver(usb_serial_tty_driver); | 1283 | put_tty_driver(usb_serial_tty_driver); |
1291 | return result; | 1284 | return result; |
1292 | } | 1285 | } |
@@ -1312,7 +1305,7 @@ module_exit(usb_serial_exit); | |||
1312 | do { \ | 1305 | do { \ |
1313 | if (!type->function) { \ | 1306 | if (!type->function) { \ |
1314 | type->function = usb_serial_generic_##function; \ | 1307 | type->function = usb_serial_generic_##function; \ |
1315 | dbg("Had to override the " #function \ | 1308 | pr_debug("Had to override the " #function \ |
1316 | " usb serial operation with the generic one.");\ | 1309 | " usb serial operation with the generic one.");\ |
1317 | } \ | 1310 | } \ |
1318 | } while (0) | 1311 | } while (0) |
@@ -1355,8 +1348,7 @@ static int usb_serial_register(struct usb_serial_driver *driver) | |||
1355 | 1348 | ||
1356 | retval = usb_serial_bus_register(driver); | 1349 | retval = usb_serial_bus_register(driver); |
1357 | if (retval) { | 1350 | if (retval) { |
1358 | printk(KERN_ERR "usb-serial: problem %d when registering " | 1351 | pr_err("problem %d when registering driver %s\n", retval, driver->description); |
1359 | "driver %s\n", retval, driver->description); | ||
1360 | list_del(&driver->driver_list); | 1352 | list_del(&driver->driver_list); |
1361 | } else | 1353 | } else |
1362 | printk(KERN_INFO "USB Serial support registered for %s\n", | 1354 | printk(KERN_INFO "USB Serial support registered for %s\n", |