diff options
author | bart.hartgers@gmail.com <bart.hartgers@gmail.com> | 2009-10-28 05:43:27 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-12-11 14:55:21 -0500 |
commit | 1f719105131010cdb9a4b5a3bace21f6b2e095ea (patch) | |
tree | 20c0f5be3b92da6b8e974147a11af3940c7a4385 /drivers/usb/serial/ark3116.c | |
parent | f4c1e8d597d1a440175db0d709c921cf3a49cfe7 (diff) |
USB: ark3116: Replace cmget
Signed-off-by: Bart Hartgers <bart.hartgers@gmail.com>
Cc: Mike McCormack <mikem@ring3k.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/serial/ark3116.c')
-rw-r--r-- | drivers/usb/serial/ark3116.c | 43 |
1 files changed, 19 insertions, 24 deletions
diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c index d12df9484677..d8f0267a2d56 100644 --- a/drivers/usb/serial/ark3116.c +++ b/drivers/usb/serial/ark3116.c | |||
@@ -528,32 +528,27 @@ static int ark3116_ioctl(struct tty_struct *tty, struct file *file, | |||
528 | static int ark3116_tiocmget(struct tty_struct *tty, struct file *file) | 528 | static int ark3116_tiocmget(struct tty_struct *tty, struct file *file) |
529 | { | 529 | { |
530 | struct usb_serial_port *port = tty->driver_data; | 530 | struct usb_serial_port *port = tty->driver_data; |
531 | struct usb_serial *serial = port->serial; | 531 | struct ark3116_private *priv = usb_get_serial_port_data(port); |
532 | char *buf; | 532 | __u32 status; |
533 | char temp; | 533 | __u32 ctrl; |
534 | 534 | unsigned long flags; | |
535 | /* seems like serial port status info (RTS, CTS, ...) is stored | ||
536 | * in reg(?) 0x0006 | ||
537 | * pcb connection point 11 = GND -> sets bit4 of response | ||
538 | * pcb connection point 7 = GND -> sets bit6 of response | ||
539 | */ | ||
540 | |||
541 | buf = kmalloc(1, GFP_KERNEL); | ||
542 | if (!buf) { | ||
543 | dbg("error kmalloc"); | ||
544 | return -ENOMEM; | ||
545 | } | ||
546 | 535 | ||
547 | /* read register */ | 536 | mutex_lock(&priv->hw_lock); |
548 | ARK3116_RCV_QUIET(serial, 0xFE, 0xC0, 0x0000, 0x0006, buf); | 537 | ctrl = priv->mcr; |
549 | temp = buf[0]; | 538 | mutex_unlock(&priv->hw_lock); |
550 | kfree(buf); | ||
551 | 539 | ||
552 | /* i do not really know if bit4=CTS and bit6=DSR... just a | 540 | spin_lock_irqsave(&priv->status_lock, flags); |
553 | * quick guess! | 541 | status = priv->msr; |
554 | */ | 542 | spin_unlock_irqrestore(&priv->status_lock, flags); |
555 | return (temp & (1<<4) ? TIOCM_CTS : 0) | 543 | |
556 | | (temp & (1<<6) ? TIOCM_DSR : 0); | 544 | return (status & UART_MSR_DSR ? TIOCM_DSR : 0) | |
545 | (status & UART_MSR_CTS ? TIOCM_CTS : 0) | | ||
546 | (status & UART_MSR_RI ? TIOCM_RI : 0) | | ||
547 | (status & UART_MSR_DCD ? TIOCM_CD : 0) | | ||
548 | (ctrl & UART_MCR_DTR ? TIOCM_DTR : 0) | | ||
549 | (ctrl & UART_MCR_RTS ? TIOCM_RTS : 0) | | ||
550 | (ctrl & UART_MCR_OUT1 ? TIOCM_OUT1 : 0) | | ||
551 | (ctrl & UART_MCR_OUT2 ? TIOCM_OUT2 : 0); | ||
557 | } | 552 | } |
558 | 553 | ||
559 | static struct usb_driver ark3116_driver = { | 554 | static struct usb_driver ark3116_driver = { |