diff options
Diffstat (limited to 'drivers/usb/serial/keyspan_pda.c')
-rw-r--r-- | drivers/usb/serial/keyspan_pda.c | 69 |
1 files changed, 29 insertions, 40 deletions
diff --git a/drivers/usb/serial/keyspan_pda.c b/drivers/usb/serial/keyspan_pda.c index 60b3e22bd633..24a08ac2e4ee 100644 --- a/drivers/usb/serial/keyspan_pda.c +++ b/drivers/usb/serial/keyspan_pda.c | |||
@@ -171,7 +171,7 @@ static void keyspan_pda_wakeup_write(struct work_struct *work) | |||
171 | container_of(work, struct keyspan_pda_private, wakeup_work); | 171 | container_of(work, struct keyspan_pda_private, wakeup_work); |
172 | struct usb_serial_port *port = priv->port; | 172 | struct usb_serial_port *port = priv->port; |
173 | 173 | ||
174 | tty_wakeup(port->tty); | 174 | tty_wakeup(port->port.tty); |
175 | } | 175 | } |
176 | 176 | ||
177 | static void keyspan_pda_request_unthrottle(struct work_struct *work) | 177 | static void keyspan_pda_request_unthrottle(struct work_struct *work) |
@@ -203,7 +203,7 @@ static void keyspan_pda_request_unthrottle(struct work_struct *work) | |||
203 | static void keyspan_pda_rx_interrupt (struct urb *urb) | 203 | static void keyspan_pda_rx_interrupt (struct urb *urb) |
204 | { | 204 | { |
205 | struct usb_serial_port *port = urb->context; | 205 | struct usb_serial_port *port = urb->context; |
206 | struct tty_struct *tty = port->tty; | 206 | struct tty_struct *tty = port->port.tty; |
207 | unsigned char *data = urb->transfer_buffer; | 207 | unsigned char *data = urb->transfer_buffer; |
208 | int i; | 208 | int i; |
209 | int retval; | 209 | int retval; |
@@ -266,7 +266,7 @@ exit: | |||
266 | } | 266 | } |
267 | 267 | ||
268 | 268 | ||
269 | static void keyspan_pda_rx_throttle (struct usb_serial_port *port) | 269 | static void keyspan_pda_rx_throttle(struct tty_struct *tty) |
270 | { | 270 | { |
271 | /* stop receiving characters. We just turn off the URB request, and | 271 | /* stop receiving characters. We just turn off the URB request, and |
272 | let chars pile up in the device. If we're doing hardware | 272 | let chars pile up in the device. If we're doing hardware |
@@ -274,14 +274,15 @@ static void keyspan_pda_rx_throttle (struct usb_serial_port *port) | |||
274 | fills up. If we're doing XON/XOFF, this would be a good time to | 274 | fills up. If we're doing XON/XOFF, this would be a good time to |
275 | send an XOFF, although it might make sense to foist that off | 275 | send an XOFF, although it might make sense to foist that off |
276 | upon the device too. */ | 276 | upon the device too. */ |
277 | 277 | struct usb_serial_port *port = tty->driver_data; | |
278 | dbg("keyspan_pda_rx_throttle port %d", port->number); | 278 | dbg("keyspan_pda_rx_throttle port %d", port->number); |
279 | usb_kill_urb(port->interrupt_in_urb); | 279 | usb_kill_urb(port->interrupt_in_urb); |
280 | } | 280 | } |
281 | 281 | ||
282 | 282 | ||
283 | static void keyspan_pda_rx_unthrottle (struct usb_serial_port *port) | 283 | static void keyspan_pda_rx_unthrottle(struct tty_struct *tty) |
284 | { | 284 | { |
285 | struct usb_serial_port *port = tty->driver_data; | ||
285 | /* just restart the receive interrupt URB */ | 286 | /* just restart the receive interrupt URB */ |
286 | dbg("keyspan_pda_rx_unthrottle port %d", port->number); | 287 | dbg("keyspan_pda_rx_unthrottle port %d", port->number); |
287 | port->interrupt_in_urb->dev = port->serial->dev; | 288 | port->interrupt_in_urb->dev = port->serial->dev; |
@@ -330,8 +331,9 @@ static speed_t keyspan_pda_setbaud (struct usb_serial *serial, speed_t baud) | |||
330 | } | 331 | } |
331 | 332 | ||
332 | 333 | ||
333 | static void keyspan_pda_break_ctl (struct usb_serial_port *port, int break_state) | 334 | static void keyspan_pda_break_ctl(struct tty_struct *tty, int break_state) |
334 | { | 335 | { |
336 | struct usb_serial_port *port = tty->driver_data; | ||
335 | struct usb_serial *serial = port->serial; | 337 | struct usb_serial *serial = port->serial; |
336 | int value; | 338 | int value; |
337 | int result; | 339 | int result; |
@@ -354,8 +356,8 @@ static void keyspan_pda_break_ctl (struct usb_serial_port *port, int break_state | |||
354 | } | 356 | } |
355 | 357 | ||
356 | 358 | ||
357 | static void keyspan_pda_set_termios (struct usb_serial_port *port, | 359 | static void keyspan_pda_set_termios(struct tty_struct *tty, |
358 | struct ktermios *old_termios) | 360 | struct usb_serial_port *port, struct ktermios *old_termios) |
359 | { | 361 | { |
360 | struct usb_serial *serial = port->serial; | 362 | struct usb_serial *serial = port->serial; |
361 | speed_t speed; | 363 | speed_t speed; |
@@ -380,7 +382,7 @@ static void keyspan_pda_set_termios (struct usb_serial_port *port, | |||
380 | 382 | ||
381 | For now, just do baud. */ | 383 | For now, just do baud. */ |
382 | 384 | ||
383 | speed = tty_get_baud_rate(port->tty); | 385 | speed = tty_get_baud_rate(tty); |
384 | speed = keyspan_pda_setbaud(serial, speed); | 386 | speed = keyspan_pda_setbaud(serial, speed); |
385 | 387 | ||
386 | if (speed == 0) { | 388 | if (speed == 0) { |
@@ -390,8 +392,8 @@ static void keyspan_pda_set_termios (struct usb_serial_port *port, | |||
390 | } | 392 | } |
391 | /* Only speed can change so copy the old h/w parameters | 393 | /* Only speed can change so copy the old h/w parameters |
392 | then encode the new speed */ | 394 | then encode the new speed */ |
393 | tty_termios_copy_hw(port->tty->termios, old_termios); | 395 | tty_termios_copy_hw(tty->termios, old_termios); |
394 | tty_encode_baud_rate(port->tty, speed, speed); | 396 | tty_encode_baud_rate(tty, speed, speed); |
395 | } | 397 | } |
396 | 398 | ||
397 | 399 | ||
@@ -425,8 +427,9 @@ static int keyspan_pda_set_modem_info(struct usb_serial *serial, | |||
425 | return rc; | 427 | return rc; |
426 | } | 428 | } |
427 | 429 | ||
428 | static int keyspan_pda_tiocmget(struct usb_serial_port *port, struct file *file) | 430 | static int keyspan_pda_tiocmget(struct tty_struct *tty, struct file *file) |
429 | { | 431 | { |
432 | struct usb_serial_port *port = tty->driver_data; | ||
430 | struct usb_serial *serial = port->serial; | 433 | struct usb_serial *serial = port->serial; |
431 | int rc; | 434 | int rc; |
432 | unsigned char status; | 435 | unsigned char status; |
@@ -445,9 +448,10 @@ static int keyspan_pda_tiocmget(struct usb_serial_port *port, struct file *file) | |||
445 | return value; | 448 | return value; |
446 | } | 449 | } |
447 | 450 | ||
448 | static int keyspan_pda_tiocmset(struct usb_serial_port *port, struct file *file, | 451 | static int keyspan_pda_tiocmset(struct tty_struct *tty, struct file *file, |
449 | unsigned int set, unsigned int clear) | 452 | unsigned int set, unsigned int clear) |
450 | { | 453 | { |
454 | struct usb_serial_port *port = tty->driver_data; | ||
451 | struct usb_serial *serial = port->serial; | 455 | struct usb_serial *serial = port->serial; |
452 | int rc; | 456 | int rc; |
453 | unsigned char status; | 457 | unsigned char status; |
@@ -469,23 +473,8 @@ static int keyspan_pda_tiocmset(struct usb_serial_port *port, struct file *file, | |||
469 | return rc; | 473 | return rc; |
470 | } | 474 | } |
471 | 475 | ||
472 | static int keyspan_pda_ioctl(struct usb_serial_port *port, struct file *file, | 476 | static int keyspan_pda_write(struct tty_struct *tty, |
473 | unsigned int cmd, unsigned long arg) | 477 | struct usb_serial_port *port, const unsigned char *buf, int count) |
474 | { | ||
475 | switch (cmd) { | ||
476 | case TIOCMIWAIT: | ||
477 | /* wait for any of the 4 modem inputs (DCD,RI,DSR,CTS)*/ | ||
478 | /* TODO */ | ||
479 | case TIOCGICOUNT: | ||
480 | /* return count of modemline transitions */ | ||
481 | return 0; /* TODO */ | ||
482 | } | ||
483 | |||
484 | return -ENOIOCTLCMD; | ||
485 | } | ||
486 | |||
487 | static int keyspan_pda_write(struct usb_serial_port *port, | ||
488 | const unsigned char *buf, int count) | ||
489 | { | 478 | { |
490 | struct usb_serial *serial = port->serial; | 479 | struct usb_serial *serial = port->serial; |
491 | int request_unthrottle = 0; | 480 | int request_unthrottle = 0; |
@@ -607,22 +596,21 @@ static void keyspan_pda_write_bulk_callback (struct urb *urb) | |||
607 | } | 596 | } |
608 | 597 | ||
609 | 598 | ||
610 | static int keyspan_pda_write_room (struct usb_serial_port *port) | 599 | static int keyspan_pda_write_room(struct tty_struct *tty) |
611 | { | 600 | { |
601 | struct usb_serial_port *port = tty->driver_data; | ||
612 | struct keyspan_pda_private *priv; | 602 | struct keyspan_pda_private *priv; |
613 | |||
614 | priv = usb_get_serial_port_data(port); | 603 | priv = usb_get_serial_port_data(port); |
615 | |||
616 | /* used by n_tty.c for processing of tabs and such. Giving it our | 604 | /* used by n_tty.c for processing of tabs and such. Giving it our |
617 | conservative guess is probably good enough, but needs testing by | 605 | conservative guess is probably good enough, but needs testing by |
618 | running a console through the device. */ | 606 | running a console through the device. */ |
619 | |||
620 | return (priv->tx_room); | 607 | return (priv->tx_room); |
621 | } | 608 | } |
622 | 609 | ||
623 | 610 | ||
624 | static int keyspan_pda_chars_in_buffer (struct usb_serial_port *port) | 611 | static int keyspan_pda_chars_in_buffer(struct tty_struct *tty) |
625 | { | 612 | { |
613 | struct usb_serial_port *port = tty->driver_data; | ||
626 | struct keyspan_pda_private *priv; | 614 | struct keyspan_pda_private *priv; |
627 | unsigned long flags; | 615 | unsigned long flags; |
628 | int ret = 0; | 616 | int ret = 0; |
@@ -640,7 +628,8 @@ static int keyspan_pda_chars_in_buffer (struct usb_serial_port *port) | |||
640 | } | 628 | } |
641 | 629 | ||
642 | 630 | ||
643 | static int keyspan_pda_open (struct usb_serial_port *port, struct file *filp) | 631 | static int keyspan_pda_open(struct tty_struct *tty, |
632 | struct usb_serial_port *port, struct file *filp) | ||
644 | { | 633 | { |
645 | struct usb_serial *serial = port->serial; | 634 | struct usb_serial *serial = port->serial; |
646 | unsigned char room; | 635 | unsigned char room; |
@@ -672,7 +661,7 @@ static int keyspan_pda_open (struct usb_serial_port *port, struct file *filp) | |||
672 | 661 | ||
673 | /* the normal serial device seems to always turn on DTR and RTS here, | 662 | /* the normal serial device seems to always turn on DTR and RTS here, |
674 | so do the same */ | 663 | so do the same */ |
675 | if (port->tty->termios->c_cflag & CBAUD) | 664 | if (tty && (tty->termios->c_cflag & CBAUD)) |
676 | keyspan_pda_set_modem_info(serial, (1<<7) | (1<<2) ); | 665 | keyspan_pda_set_modem_info(serial, (1<<7) | (1<<2) ); |
677 | else | 666 | else |
678 | keyspan_pda_set_modem_info(serial, 0); | 667 | keyspan_pda_set_modem_info(serial, 0); |
@@ -690,13 +679,14 @@ error: | |||
690 | } | 679 | } |
691 | 680 | ||
692 | 681 | ||
693 | static void keyspan_pda_close(struct usb_serial_port *port, struct file *filp) | 682 | static void keyspan_pda_close(struct tty_struct *tty, |
683 | struct usb_serial_port *port, struct file *filp) | ||
694 | { | 684 | { |
695 | struct usb_serial *serial = port->serial; | 685 | struct usb_serial *serial = port->serial; |
696 | 686 | ||
697 | if (serial->dev) { | 687 | if (serial->dev) { |
698 | /* the normal serial device seems to always shut off DTR and RTS now */ | 688 | /* the normal serial device seems to always shut off DTR and RTS now */ |
699 | if (port->tty->termios->c_cflag & HUPCL) | 689 | if (tty->termios->c_cflag & HUPCL) |
700 | keyspan_pda_set_modem_info(serial, 0); | 690 | keyspan_pda_set_modem_info(serial, 0); |
701 | 691 | ||
702 | /* shutdown our bulk reads and writes */ | 692 | /* shutdown our bulk reads and writes */ |
@@ -832,7 +822,6 @@ static struct usb_serial_driver keyspan_pda_device = { | |||
832 | .chars_in_buffer = keyspan_pda_chars_in_buffer, | 822 | .chars_in_buffer = keyspan_pda_chars_in_buffer, |
833 | .throttle = keyspan_pda_rx_throttle, | 823 | .throttle = keyspan_pda_rx_throttle, |
834 | .unthrottle = keyspan_pda_rx_unthrottle, | 824 | .unthrottle = keyspan_pda_rx_unthrottle, |
835 | .ioctl = keyspan_pda_ioctl, | ||
836 | .set_termios = keyspan_pda_set_termios, | 825 | .set_termios = keyspan_pda_set_termios, |
837 | .break_ctl = keyspan_pda_break_ctl, | 826 | .break_ctl = keyspan_pda_break_ctl, |
838 | .tiocmget = keyspan_pda_tiocmget, | 827 | .tiocmget = keyspan_pda_tiocmget, |