diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
commit | c71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch) | |
tree | ecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /drivers/usb/serial/keyspan_pda.c | |
parent | ea53c912f8a86a8567697115b6a0d8152beee5c8 (diff) | |
parent | 6a00f206debf8a5c8899055726ad127dbeeed098 (diff) |
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts:
litmus/sched_cedf.c
Diffstat (limited to 'drivers/usb/serial/keyspan_pda.c')
-rw-r--r-- | drivers/usb/serial/keyspan_pda.c | 37 |
1 files changed, 10 insertions, 27 deletions
diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c index 185fe9a7d4e0..d5c0c6ab4966 100644 --- a/drivers/usb/serial/keyspan_pda.c +++ b/drivers/usb/serial/keyspan_pda.c | |||
@@ -173,7 +173,8 @@ static void keyspan_pda_wakeup_write(struct work_struct *work) | |||
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 | struct tty_struct *tty = tty_port_tty_get(&port->port); | 175 | struct tty_struct *tty = tty_port_tty_get(&port->port); |
176 | tty_wakeup(tty); | 176 | if (tty) |
177 | tty_wakeup(tty); | ||
177 | tty_kref_put(tty); | 178 | tty_kref_put(tty); |
178 | } | 179 | } |
179 | 180 | ||
@@ -206,7 +207,7 @@ static void keyspan_pda_request_unthrottle(struct work_struct *work) | |||
206 | static void keyspan_pda_rx_interrupt(struct urb *urb) | 207 | static void keyspan_pda_rx_interrupt(struct urb *urb) |
207 | { | 208 | { |
208 | struct usb_serial_port *port = urb->context; | 209 | struct usb_serial_port *port = urb->context; |
209 | struct tty_struct *tty = tty_port_tty_get(&port->port); | 210 | struct tty_struct *tty; |
210 | unsigned char *data = urb->transfer_buffer; | 211 | unsigned char *data = urb->transfer_buffer; |
211 | int retval; | 212 | int retval; |
212 | int status = urb->status; | 213 | int status = urb->status; |
@@ -223,7 +224,7 @@ static void keyspan_pda_rx_interrupt(struct urb *urb) | |||
223 | /* this urb is terminated, clean up */ | 224 | /* this urb is terminated, clean up */ |
224 | dbg("%s - urb shutting down with status: %d", | 225 | dbg("%s - urb shutting down with status: %d", |
225 | __func__, status); | 226 | __func__, status); |
226 | goto out; | 227 | return; |
227 | default: | 228 | default: |
228 | dbg("%s - nonzero urb status received: %d", | 229 | dbg("%s - nonzero urb status received: %d", |
229 | __func__, status); | 230 | __func__, status); |
@@ -233,12 +234,14 @@ static void keyspan_pda_rx_interrupt(struct urb *urb) | |||
233 | /* see if the message is data or a status interrupt */ | 234 | /* see if the message is data or a status interrupt */ |
234 | switch (data[0]) { | 235 | switch (data[0]) { |
235 | case 0: | 236 | case 0: |
236 | /* rest of message is rx data */ | 237 | tty = tty_port_tty_get(&port->port); |
237 | if (urb->actual_length) { | 238 | /* rest of message is rx data */ |
239 | if (tty && urb->actual_length) { | ||
238 | tty_insert_flip_string(tty, data + 1, | 240 | tty_insert_flip_string(tty, data + 1, |
239 | urb->actual_length - 1); | 241 | urb->actual_length - 1); |
240 | tty_flip_buffer_push(tty); | 242 | tty_flip_buffer_push(tty); |
241 | } | 243 | } |
244 | tty_kref_put(tty); | ||
242 | break; | 245 | break; |
243 | case 1: | 246 | case 1: |
244 | /* status interrupt */ | 247 | /* status interrupt */ |
@@ -265,8 +268,6 @@ exit: | |||
265 | dev_err(&port->dev, | 268 | dev_err(&port->dev, |
266 | "%s - usb_submit_urb failed with result %d", | 269 | "%s - usb_submit_urb failed with result %d", |
267 | __func__, retval); | 270 | __func__, retval); |
268 | out: | ||
269 | tty_kref_put(tty); | ||
270 | } | 271 | } |
271 | 272 | ||
272 | 273 | ||
@@ -292,7 +293,6 @@ static void keyspan_pda_rx_unthrottle(struct tty_struct *tty) | |||
292 | port->interrupt_in_urb->dev = port->serial->dev; | 293 | port->interrupt_in_urb->dev = port->serial->dev; |
293 | if (usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL)) | 294 | if (usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL)) |
294 | dbg(" usb_submit_urb(read urb) failed"); | 295 | dbg(" usb_submit_urb(read urb) failed"); |
295 | return; | ||
296 | } | 296 | } |
297 | 297 | ||
298 | 298 | ||
@@ -458,7 +458,7 @@ static int keyspan_pda_set_modem_info(struct usb_serial *serial, | |||
458 | return rc; | 458 | return rc; |
459 | } | 459 | } |
460 | 460 | ||
461 | static int keyspan_pda_tiocmget(struct tty_struct *tty, struct file *file) | 461 | static int keyspan_pda_tiocmget(struct tty_struct *tty) |
462 | { | 462 | { |
463 | struct usb_serial_port *port = tty->driver_data; | 463 | struct usb_serial_port *port = tty->driver_data; |
464 | struct usb_serial *serial = port->serial; | 464 | struct usb_serial *serial = port->serial; |
@@ -479,7 +479,7 @@ static int keyspan_pda_tiocmget(struct tty_struct *tty, struct file *file) | |||
479 | return value; | 479 | return value; |
480 | } | 480 | } |
481 | 481 | ||
482 | static int keyspan_pda_tiocmset(struct tty_struct *tty, struct file *file, | 482 | static int keyspan_pda_tiocmset(struct tty_struct *tty, |
483 | unsigned int set, unsigned int clear) | 483 | unsigned int set, unsigned int clear) |
484 | { | 484 | { |
485 | struct usb_serial_port *port = tty->driver_data; | 485 | struct usb_serial_port *port = tty->driver_data; |
@@ -680,22 +680,6 @@ static void keyspan_pda_dtr_rts(struct usb_serial_port *port, int on) | |||
680 | } | 680 | } |
681 | } | 681 | } |
682 | 682 | ||
683 | static int keyspan_pda_carrier_raised(struct usb_serial_port *port) | ||
684 | { | ||
685 | struct usb_serial *serial = port->serial; | ||
686 | unsigned char modembits; | ||
687 | |||
688 | /* If we can read the modem status and the DCD is low then | ||
689 | carrier is not raised yet */ | ||
690 | if (keyspan_pda_get_modem_info(serial, &modembits) >= 0) { | ||
691 | if (!(modembits & (1>>6))) | ||
692 | return 0; | ||
693 | } | ||
694 | /* Carrier raised, or we failed (eg disconnected) so | ||
695 | progress accordingly */ | ||
696 | return 1; | ||
697 | } | ||
698 | |||
699 | 683 | ||
700 | static int keyspan_pda_open(struct tty_struct *tty, | 684 | static int keyspan_pda_open(struct tty_struct *tty, |
701 | struct usb_serial_port *port) | 685 | struct usb_serial_port *port) |
@@ -882,7 +866,6 @@ static struct usb_serial_driver keyspan_pda_device = { | |||
882 | .id_table = id_table_std, | 866 | .id_table = id_table_std, |
883 | .num_ports = 1, | 867 | .num_ports = 1, |
884 | .dtr_rts = keyspan_pda_dtr_rts, | 868 | .dtr_rts = keyspan_pda_dtr_rts, |
885 | .carrier_raised = keyspan_pda_carrier_raised, | ||
886 | .open = keyspan_pda_open, | 869 | .open = keyspan_pda_open, |
887 | .close = keyspan_pda_close, | 870 | .close = keyspan_pda_close, |
888 | .write = keyspan_pda_write, | 871 | .write = keyspan_pda_write, |