]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/usb/serial/keyspan.c
USB: remove info() macro from usb/serial drivers
[linux-2.6-omap-h63xx.git] / drivers / usb / serial / keyspan.c
index 704716f6f6d378c825920c213f3cedd7585b0ab5..9878c0fb3859f201345a2171459d31a55baf8831 100644 (file)
@@ -217,7 +217,8 @@ static int __init keyspan_init(void)
        if (retval)
                goto failed_usb_register;
 
-       info(DRIVER_VERSION ":" DRIVER_DESC);
+       printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ":"
+              DRIVER_DESC "\n");
 
        return 0;
 failed_usb_register:
@@ -430,7 +431,7 @@ static void usa26_indat_callback(struct urb *urb)
        }
 
        port =  urb->context;
-       tty = port->port.tty;
+       tty = tty_port_tty_get(&port->port);
        if (tty && urb->actual_length) {
                /* 0x80 bit is error flag */
                if ((data[0] & 0x80) == 0) {
@@ -459,6 +460,7 @@ static void usa26_indat_callback(struct urb *urb)
                }
                tty_flip_buffer_push(tty);
        }
+       tty_kref_put(tty);
 
        /* Resubmit urb so we continue receiving */
        urb->dev = port->serial->dev;
@@ -513,6 +515,7 @@ static void usa26_instat_callback(struct urb *urb)
        struct usb_serial                       *serial;
        struct usb_serial_port                  *port;
        struct keyspan_port_private             *p_priv;
+       struct tty_struct                       *tty;
        int old_dcd_state, err;
        int status = urb->status;
 
@@ -553,12 +556,11 @@ static void       usa26_instat_callback(struct urb *urb)
        p_priv->dcd_state = ((msg->gpia_dcd) ? 1 : 0);
        p_priv->ri_state = ((msg->ri) ? 1 : 0);
 
-       if (port->port.tty && !C_CLOCAL(port->port.tty)
-           && old_dcd_state != p_priv->dcd_state) {
-               if (old_dcd_state)
-                       tty_hangup(port->port.tty);
-               /*  else */
-               /*      wake_up_interruptible(&p_priv->open_wait); */
+       if (old_dcd_state != p_priv->dcd_state) {
+               tty = tty_port_tty_get(&port->port);
+               if (tty && !C_CLOCAL(tty))
+                       tty_hangup(tty);
+               tty_kref_put(tty);
        }
 
        /* Resubmit urb so we continue receiving */
@@ -604,11 +606,12 @@ static void usa28_indat_callback(struct urb *urb)
                p_priv = usb_get_serial_port_data(port);
                data = urb->transfer_buffer;
 
-               tty = port->port.tty;
-               if (urb->actual_length) {
+               tty =tty_port_tty_get(&port->port);
+               if (tty && urb->actual_length) {
                        tty_insert_flip_string(tty, data, urb->actual_length);
                        tty_flip_buffer_push(tty);
                }
+               tty_kref_put(tty);
 
                /* Resubmit urb so we continue receiving */
                urb->dev = port->serial->dev;
@@ -652,6 +655,7 @@ static void usa28_instat_callback(struct urb *urb)
        struct usb_serial                       *serial;
        struct usb_serial_port                  *port;
        struct keyspan_port_private             *p_priv;
+       struct tty_struct                       *tty;
        int old_dcd_state;
        int status = urb->status;
 
@@ -689,12 +693,11 @@ static void       usa28_instat_callback(struct urb *urb)
        p_priv->dcd_state = ((msg->dcd) ? 1 : 0);
        p_priv->ri_state = ((msg->ri) ? 1 : 0);
 
-       if (port->port.tty && !C_CLOCAL(port->port.tty)
-           && old_dcd_state != p_priv->dcd_state) {
-               if (old_dcd_state)
-                       tty_hangup(port->port.tty);
-               /*  else */
-               /*      wake_up_interruptible(&p_priv->open_wait); */
+       if( old_dcd_state != p_priv->dcd_state && old_dcd_state) {
+               tty = tty_port_tty_get(&port->port);
+               if (tty && !C_CLOCAL(tty)) 
+                       tty_hangup(tty);
+               tty_kref_put(tty);
        }
 
                /* Resubmit urb so we continue receiving */
@@ -785,12 +788,11 @@ static void       usa49_instat_callback(struct urb *urb)
        p_priv->dcd_state = ((msg->dcd) ? 1 : 0);
        p_priv->ri_state = ((msg->ri) ? 1 : 0);
 
-       if (port->port.tty && !C_CLOCAL(port->port.tty)
-           && old_dcd_state != p_priv->dcd_state) {
-               if (old_dcd_state)
-                       tty_hangup(port->port.tty);
-               /*  else */
-               /*      wake_up_interruptible(&p_priv->open_wait); */
+       if (old_dcd_state != p_priv->dcd_state && old_dcd_state) {
+               struct tty_struct *tty = tty_port_tty_get(&port->port);
+               if (tty && !C_CLOCAL(tty))
+                       tty_hangup(tty);
+               tty_kref_put(tty);
        }
 
        /* Resubmit urb so we continue receiving */
@@ -827,7 +829,7 @@ static void usa49_indat_callback(struct urb *urb)
        }
 
        port =  urb->context;
-       tty = port->port.tty;
+       tty = tty_port_tty_get(&port->port);
        if (tty && urb->actual_length) {
                /* 0x80 bit is error flag */
                if ((data[0] & 0x80) == 0) {
@@ -850,6 +852,7 @@ static void usa49_indat_callback(struct urb *urb)
                }
                tty_flip_buffer_push(tty);
        }
+       tty_kref_put(tty);
 
        /* Resubmit urb so we continue receiving */
        urb->dev = port->serial->dev;
@@ -893,7 +896,7 @@ static void usa49wg_indat_callback(struct urb *urb)
                                return;
                        }
                        port = serial->port[data[i++]];
-                       tty = port->port.tty;
+                       tty = tty_port_tty_get(&port->port);
                        len = data[i++];
 
                        /* 0x80 bit is error flag */
@@ -927,6 +930,7 @@ static void usa49wg_indat_callback(struct urb *urb)
                        }
                        if (port->port.count)
                                tty_flip_buffer_push(tty);
+                       tty_kref_put(tty);
                }
        }
 
@@ -967,8 +971,8 @@ static void usa90_indat_callback(struct urb *urb)
        port =  urb->context;
        p_priv = usb_get_serial_port_data(port);
 
-       tty = port->port.tty;
        if (urb->actual_length) {
+               tty = tty_port_tty_get(&port->port);
                /* if current mode is DMA, looks like usa28 format
                   otherwise looks like usa26 data format */
 
@@ -1004,6 +1008,7 @@ static void usa90_indat_callback(struct urb *urb)
                        }
                }
                tty_flip_buffer_push(tty);
+               tty_kref_put(tty);
        }
 
        /* Resubmit urb so we continue receiving */
@@ -1025,6 +1030,7 @@ static void       usa90_instat_callback(struct urb *urb)
        struct usb_serial                       *serial;
        struct usb_serial_port                  *port;
        struct keyspan_port_private             *p_priv;
+       struct tty_struct                       *tty;
        int old_dcd_state, err;
        int status = urb->status;
 
@@ -1053,12 +1059,11 @@ static void     usa90_instat_callback(struct urb *urb)
        p_priv->dcd_state = ((msg->dcd) ? 1 : 0);
        p_priv->ri_state = ((msg->ri) ? 1 : 0);
 
-       if (port->port.tty && !C_CLOCAL(port->port.tty)
-           && old_dcd_state != p_priv->dcd_state) {
-               if (old_dcd_state)
-                       tty_hangup(port->port.tty);
-               /*  else */
-               /*      wake_up_interruptible(&p_priv->open_wait); */
+       if (old_dcd_state != p_priv->dcd_state && old_dcd_state) {
+               tty = tty_port_tty_get(&port->port);
+               if (tty && !C_CLOCAL(tty))
+                       tty_hangup(tty);
+               tty_kref_put(tty);
        }
 
        /* Resubmit urb so we continue receiving */
@@ -1130,12 +1135,11 @@ static void     usa67_instat_callback(struct urb *urb)
        p_priv->cts_state = ((msg->hskia_cts) ? 1 : 0);
        p_priv->dcd_state = ((msg->gpia_dcd) ? 1 : 0);
 
-       if (port->port.tty && !C_CLOCAL(port->port.tty)
-           && old_dcd_state != p_priv->dcd_state) {
-               if (old_dcd_state)
-                       tty_hangup(port->port.tty);
-               /*  else */
-               /*      wake_up_interruptible(&p_priv->open_wait); */
+       if (old_dcd_state != p_priv->dcd_state && old_dcd_state) {
+               struct tty_struct *tty = tty_port_tty_get(&port->port);
+               if (tty && !C_CLOCAL(tty))
+                       tty_hangup(tty);
+               tty_kref_put(tty);
        }
 
        /* Resubmit urb so we continue receiving */
@@ -1332,7 +1336,7 @@ static void keyspan_close(struct tty_struct *tty,
                        stop_urb(p_priv->out_urbs[i]);
                }
        }
-       port->port.tty = NULL;
+       tty_port_tty_set(&port->port, NULL);
 }
 
 /* download the firmware to a pre-renumeration device */