diff options
Diffstat (limited to 'drivers/usb/serial/mos7840.c')
-rw-r--r-- | drivers/usb/serial/mos7840.c | 36 |
1 files changed, 20 insertions, 16 deletions
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); |