diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-12 19:46:58 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-12 19:46:58 -0400 |
commit | 9374430a52dfae5c013b88f7f030c04a6774d410 (patch) | |
tree | ce1ee8eee4e79fbb9486e810278d1092afc74a44 /drivers/usb/serial/mos7840.c | |
parent | 66f49739fe1591197364f2dad1b67b975e8f5e85 (diff) | |
parent | 13f9966b3ba5b45f47f2ea0eb0a90afceedfbb1f (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/usb-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/usb-2.6: (149 commits)
USB: ohci-pnx4008: Remove unnecessary cast of return value of kzalloc
USB: additions to the quirk list
usb-storage: implement autosuspend
USB: cdc-acm: add new device id to option driver
USB: goku_udc trivial cleanups
USB: usb gadget stack can now -DDEBUG with Kconfig
usb gadget stack: remove usb_ep_*_buffer(), part 2
usb gadget stack: remove usb_ep_*_buffer(), part 1
USB: pxa2xx_udc -- cleanups, mostly removing dma hooks
USB: pxa2xx_udc: use generic gpio layer
USB: quirk for samsung printer
USB: usb/dma doc updates
USB: drivers/usb/storage/unusual_devs.h whitespace cleanup
USB: remove Makefile reference to obsolete OHCI_AT91
USB: io_*: remove bogus termios no change checks
USB: mos7720: remove bogus no termios change check
USB: visor and whiteheat: remove bogus termios change checks
USB: pl2303: remove bogus checks and fix speed support to use tty_get_baud_rate()
USB: mos7840.c: turn this into a serial driver
USB: make the usb_device numa_node get assigned from controller
...
Diffstat (limited to 'drivers/usb/serial/mos7840.c')
-rw-r--r-- | drivers/usb/serial/mos7840.c | 106 |
1 files changed, 19 insertions, 87 deletions
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c index 36620c651079..37f41f576d3d 100644 --- a/drivers/usb/serial/mos7840.c +++ b/drivers/usb/serial/mos7840.c | |||
@@ -434,6 +434,7 @@ static void mos7840_control_callback(struct urb *urb) | |||
434 | struct moschip_port *mos7840_port; | 434 | struct moschip_port *mos7840_port; |
435 | __u8 regval = 0x0; | 435 | __u8 regval = 0x0; |
436 | int result = 0; | 436 | int result = 0; |
437 | int status = urb->status; | ||
437 | 438 | ||
438 | if (!urb) { | 439 | if (!urb) { |
439 | dbg("%s", "Invalid Pointer !!!!:\n"); | 440 | dbg("%s", "Invalid Pointer !!!!:\n"); |
@@ -442,7 +443,7 @@ static void mos7840_control_callback(struct urb *urb) | |||
442 | 443 | ||
443 | mos7840_port = (struct moschip_port *)urb->context; | 444 | mos7840_port = (struct moschip_port *)urb->context; |
444 | 445 | ||
445 | switch (urb->status) { | 446 | switch (status) { |
446 | case 0: | 447 | case 0: |
447 | /* success */ | 448 | /* success */ |
448 | break; | 449 | break; |
@@ -451,11 +452,11 @@ static void mos7840_control_callback(struct urb *urb) | |||
451 | case -ESHUTDOWN: | 452 | case -ESHUTDOWN: |
452 | /* this urb is terminated, clean up */ | 453 | /* this urb is terminated, clean up */ |
453 | dbg("%s - urb shutting down with status: %d", __FUNCTION__, | 454 | dbg("%s - urb shutting down with status: %d", __FUNCTION__, |
454 | urb->status); | 455 | status); |
455 | return; | 456 | return; |
456 | default: | 457 | default: |
457 | dbg("%s - nonzero urb status received: %d", __FUNCTION__, | 458 | dbg("%s - nonzero urb status received: %d", __FUNCTION__, |
458 | urb->status); | 459 | status); |
459 | goto exit; | 460 | goto exit; |
460 | } | 461 | } |
461 | 462 | ||
@@ -521,6 +522,7 @@ static void mos7840_interrupt_callback(struct urb *urb) | |||
521 | __u8 sp[5], st; | 522 | __u8 sp[5], st; |
522 | int i, rv = 0; | 523 | int i, rv = 0; |
523 | __u16 wval, wreg = 0; | 524 | __u16 wval, wreg = 0; |
525 | int status = urb->status; | ||
524 | 526 | ||
525 | dbg("%s", " : Entering\n"); | 527 | dbg("%s", " : Entering\n"); |
526 | if (!urb) { | 528 | if (!urb) { |
@@ -528,7 +530,7 @@ static void mos7840_interrupt_callback(struct urb *urb) | |||
528 | return; | 530 | return; |
529 | } | 531 | } |
530 | 532 | ||
531 | switch (urb->status) { | 533 | switch (status) { |
532 | case 0: | 534 | case 0: |
533 | /* success */ | 535 | /* success */ |
534 | break; | 536 | break; |
@@ -537,11 +539,11 @@ static void mos7840_interrupt_callback(struct urb *urb) | |||
537 | case -ESHUTDOWN: | 539 | case -ESHUTDOWN: |
538 | /* this urb is terminated, clean up */ | 540 | /* this urb is terminated, clean up */ |
539 | dbg("%s - urb shutting down with status: %d", __FUNCTION__, | 541 | dbg("%s - urb shutting down with status: %d", __FUNCTION__, |
540 | urb->status); | 542 | status); |
541 | return; | 543 | return; |
542 | default: | 544 | default: |
543 | dbg("%s - nonzero urb status received: %d", __FUNCTION__, | 545 | dbg("%s - nonzero urb status received: %d", __FUNCTION__, |
544 | urb->status); | 546 | status); |
545 | goto exit; | 547 | goto exit; |
546 | } | 548 | } |
547 | 549 | ||
@@ -666,20 +668,21 @@ static struct usb_serial *mos7840_get_usb_serial(struct usb_serial_port *port, | |||
666 | 668 | ||
667 | static void mos7840_bulk_in_callback(struct urb *urb) | 669 | static void mos7840_bulk_in_callback(struct urb *urb) |
668 | { | 670 | { |
669 | int status; | 671 | int retval; |
670 | unsigned char *data; | 672 | unsigned char *data; |
671 | struct usb_serial *serial; | 673 | struct usb_serial *serial; |
672 | struct usb_serial_port *port; | 674 | struct usb_serial_port *port; |
673 | struct moschip_port *mos7840_port; | 675 | struct moschip_port *mos7840_port; |
674 | struct tty_struct *tty; | 676 | struct tty_struct *tty; |
677 | int status = urb->status; | ||
675 | 678 | ||
676 | if (!urb) { | 679 | if (!urb) { |
677 | dbg("%s", "Invalid Pointer !!!!:\n"); | 680 | dbg("%s", "Invalid Pointer !!!!:\n"); |
678 | return; | 681 | return; |
679 | } | 682 | } |
680 | 683 | ||
681 | if (urb->status) { | 684 | if (status) { |
682 | dbg("nonzero read bulk status received: %d", urb->status); | 685 | dbg("nonzero read bulk status received: %d", status); |
683 | return; | 686 | return; |
684 | } | 687 | } |
685 | 688 | ||
@@ -729,11 +732,11 @@ static void mos7840_bulk_in_callback(struct urb *urb) | |||
729 | 732 | ||
730 | mos7840_port->read_urb->dev = serial->dev; | 733 | mos7840_port->read_urb->dev = serial->dev; |
731 | 734 | ||
732 | status = usb_submit_urb(mos7840_port->read_urb, GFP_ATOMIC); | 735 | retval = usb_submit_urb(mos7840_port->read_urb, GFP_ATOMIC); |
733 | 736 | ||
734 | if (status) { | 737 | if (retval) { |
735 | dbg(" usb_submit_urb(read bulk) failed, status = %d", | 738 | dbg(" usb_submit_urb(read bulk) failed, retval = %d", |
736 | status); | 739 | retval); |
737 | } | 740 | } |
738 | } | 741 | } |
739 | 742 | ||
@@ -747,6 +750,7 @@ static void mos7840_bulk_out_data_callback(struct urb *urb) | |||
747 | { | 750 | { |
748 | struct moschip_port *mos7840_port; | 751 | struct moschip_port *mos7840_port; |
749 | struct tty_struct *tty; | 752 | struct tty_struct *tty; |
753 | int status = urb->status; | ||
750 | int i; | 754 | int i; |
751 | 755 | ||
752 | if (!urb) { | 756 | if (!urb) { |
@@ -764,8 +768,8 @@ static void mos7840_bulk_out_data_callback(struct urb *urb) | |||
764 | } | 768 | } |
765 | spin_unlock(&mos7840_port->pool_lock); | 769 | spin_unlock(&mos7840_port->pool_lock); |
766 | 770 | ||
767 | if (urb->status) { | 771 | if (status) { |
768 | dbg("nonzero write bulk status received:%d\n", urb->status); | 772 | dbg("nonzero write bulk status received:%d\n", status); |
769 | return; | 773 | return; |
770 | } | 774 | } |
771 | 775 | ||
@@ -2185,16 +2189,6 @@ static void mos7840_set_termios(struct usb_serial_port *port, | |||
2185 | return; | 2189 | return; |
2186 | } | 2190 | } |
2187 | 2191 | ||
2188 | /* check that they really want us to change something */ | ||
2189 | if (old_termios) { | ||
2190 | if ((cflag == old_termios->c_cflag) && | ||
2191 | (RELEVANT_IFLAG(tty->termios->c_iflag) == | ||
2192 | RELEVANT_IFLAG(old_termios->c_iflag))) { | ||
2193 | dbg("%s\n", "Nothing to change"); | ||
2194 | return; | ||
2195 | } | ||
2196 | } | ||
2197 | |||
2198 | dbg("%s - clfag %08x iflag %08x", __FUNCTION__, | 2192 | dbg("%s - clfag %08x iflag %08x", __FUNCTION__, |
2199 | tty->termios->c_cflag, RELEVANT_IFLAG(tty->termios->c_iflag)); | 2193 | tty->termios->c_cflag, RELEVANT_IFLAG(tty->termios->c_iflag)); |
2200 | 2194 | ||
@@ -2254,30 +2248,6 @@ static int mos7840_get_lsr_info(struct moschip_port *mos7840_port, | |||
2254 | } | 2248 | } |
2255 | 2249 | ||
2256 | /***************************************************************************** | 2250 | /***************************************************************************** |
2257 | * mos7840_get_bytes_avail - get number of bytes available | ||
2258 | * | ||
2259 | * Purpose: Let user call ioctl to get the count of number of bytes available. | ||
2260 | *****************************************************************************/ | ||
2261 | |||
2262 | static int mos7840_get_bytes_avail(struct moschip_port *mos7840_port, | ||
2263 | unsigned int __user *value) | ||
2264 | { | ||
2265 | unsigned int result = 0; | ||
2266 | struct tty_struct *tty = mos7840_port->port->tty; | ||
2267 | |||
2268 | if (!tty) | ||
2269 | return -ENOIOCTLCMD; | ||
2270 | |||
2271 | result = tty->read_cnt; | ||
2272 | |||
2273 | dbg("%s(%d) = %d", __FUNCTION__, mos7840_port->port->number, result); | ||
2274 | if (copy_to_user(value, &result, sizeof(int))) | ||
2275 | return -EFAULT; | ||
2276 | |||
2277 | return -ENOIOCTLCMD; | ||
2278 | } | ||
2279 | |||
2280 | /***************************************************************************** | ||
2281 | * mos7840_set_modem_info | 2251 | * mos7840_set_modem_info |
2282 | * function to set modem info | 2252 | * function to set modem info |
2283 | *****************************************************************************/ | 2253 | *****************************************************************************/ |
@@ -2425,8 +2395,6 @@ static int mos7840_ioctl(struct usb_serial_port *port, struct file *file, | |||
2425 | struct async_icount cprev; | 2395 | struct async_icount cprev; |
2426 | struct serial_icounter_struct icount; | 2396 | struct serial_icounter_struct icount; |
2427 | int mosret = 0; | 2397 | int mosret = 0; |
2428 | int retval; | ||
2429 | struct tty_ldisc *ld; | ||
2430 | 2398 | ||
2431 | if (mos7840_port_paranoia_check(port, __FUNCTION__)) { | 2399 | if (mos7840_port_paranoia_check(port, __FUNCTION__)) { |
2432 | dbg("%s", "Invalid port \n"); | 2400 | dbg("%s", "Invalid port \n"); |
@@ -2445,42 +2413,6 @@ static int mos7840_ioctl(struct usb_serial_port *port, struct file *file, | |||
2445 | switch (cmd) { | 2413 | switch (cmd) { |
2446 | /* return number of bytes available */ | 2414 | /* return number of bytes available */ |
2447 | 2415 | ||
2448 | case TIOCINQ: | ||
2449 | dbg("%s (%d) TIOCINQ", __FUNCTION__, port->number); | ||
2450 | return mos7840_get_bytes_avail(mos7840_port, argp); | ||
2451 | |||
2452 | case TIOCOUTQ: | ||
2453 | dbg("%s (%d) TIOCOUTQ", __FUNCTION__, port->number); | ||
2454 | return put_user(tty->driver->chars_in_buffer ? | ||
2455 | tty->driver->chars_in_buffer(tty) : 0, | ||
2456 | (int __user *)arg); | ||
2457 | |||
2458 | case TCFLSH: | ||
2459 | retval = tty_check_change(tty); | ||
2460 | if (retval) | ||
2461 | return retval; | ||
2462 | |||
2463 | ld = tty_ldisc_ref(tty); | ||
2464 | switch (arg) { | ||
2465 | case TCIFLUSH: | ||
2466 | if (ld && ld->flush_buffer) | ||
2467 | ld->flush_buffer(tty); | ||
2468 | break; | ||
2469 | case TCIOFLUSH: | ||
2470 | if (ld && ld->flush_buffer) | ||
2471 | ld->flush_buffer(tty); | ||
2472 | /* fall through */ | ||
2473 | case TCOFLUSH: | ||
2474 | if (tty->driver->flush_buffer) | ||
2475 | tty->driver->flush_buffer(tty); | ||
2476 | break; | ||
2477 | default: | ||
2478 | tty_ldisc_deref(ld); | ||
2479 | return -EINVAL; | ||
2480 | } | ||
2481 | tty_ldisc_deref(ld); | ||
2482 | return 0; | ||
2483 | |||
2484 | case TIOCSERGETLSR: | 2416 | case TIOCSERGETLSR: |
2485 | dbg("%s (%d) TIOCSERGETLSR", __FUNCTION__, port->number); | 2417 | dbg("%s (%d) TIOCSERGETLSR", __FUNCTION__, port->number); |
2486 | return mos7840_get_lsr_info(mos7840_port, argp); | 2418 | return mos7840_get_lsr_info(mos7840_port, argp); |