diff options
Diffstat (limited to 'drivers/usb/class/cdc-acm.c')
-rw-r--r-- | drivers/usb/class/cdc-acm.c | 38 |
1 files changed, 30 insertions, 8 deletions
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index 9543b19d410c..b32ccb461019 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c | |||
@@ -39,6 +39,7 @@ | |||
39 | #include <linux/serial.h> | 39 | #include <linux/serial.h> |
40 | #include <linux/tty_driver.h> | 40 | #include <linux/tty_driver.h> |
41 | #include <linux/tty_flip.h> | 41 | #include <linux/tty_flip.h> |
42 | #include <linux/serial.h> | ||
42 | #include <linux/module.h> | 43 | #include <linux/module.h> |
43 | #include <linux/mutex.h> | 44 | #include <linux/mutex.h> |
44 | #include <linux/uaccess.h> | 45 | #include <linux/uaccess.h> |
@@ -508,17 +509,12 @@ static int acm_tty_install(struct tty_driver *driver, struct tty_struct *tty) | |||
508 | if (!acm) | 509 | if (!acm) |
509 | return -ENODEV; | 510 | return -ENODEV; |
510 | 511 | ||
511 | retval = tty_init_termios(tty); | 512 | retval = tty_standard_install(driver, tty); |
512 | if (retval) | 513 | if (retval) |
513 | goto error_init_termios; | 514 | goto error_init_termios; |
514 | 515 | ||
515 | tty->driver_data = acm; | 516 | tty->driver_data = acm; |
516 | 517 | ||
517 | /* Final install (we use the default method) */ | ||
518 | tty_driver_kref_get(driver); | ||
519 | tty->count++; | ||
520 | driver->ttys[tty->index] = tty; | ||
521 | |||
522 | return 0; | 518 | return 0; |
523 | 519 | ||
524 | error_init_termios: | 520 | error_init_termios: |
@@ -773,10 +769,37 @@ static int acm_tty_tiocmset(struct tty_struct *tty, | |||
773 | return acm_set_control(acm, acm->ctrlout = newctrl); | 769 | return acm_set_control(acm, acm->ctrlout = newctrl); |
774 | } | 770 | } |
775 | 771 | ||
772 | static int get_serial_info(struct acm *acm, struct serial_struct __user *info) | ||
773 | { | ||
774 | struct serial_struct tmp; | ||
775 | |||
776 | if (!info) | ||
777 | return -EINVAL; | ||
778 | |||
779 | memset(&tmp, 0, sizeof(tmp)); | ||
780 | tmp.flags = ASYNC_LOW_LATENCY; | ||
781 | tmp.xmit_fifo_size = acm->writesize; | ||
782 | tmp.baud_base = le32_to_cpu(acm->line.dwDTERate); | ||
783 | |||
784 | if (copy_to_user(info, &tmp, sizeof(tmp))) | ||
785 | return -EFAULT; | ||
786 | else | ||
787 | return 0; | ||
788 | } | ||
789 | |||
776 | static int acm_tty_ioctl(struct tty_struct *tty, | 790 | static int acm_tty_ioctl(struct tty_struct *tty, |
777 | unsigned int cmd, unsigned long arg) | 791 | unsigned int cmd, unsigned long arg) |
778 | { | 792 | { |
779 | return -ENOIOCTLCMD; | 793 | struct acm *acm = tty->driver_data; |
794 | int rv = -ENOIOCTLCMD; | ||
795 | |||
796 | switch (cmd) { | ||
797 | case TIOCGSERIAL: /* gets serial port data */ | ||
798 | rv = get_serial_info(acm, (struct serial_struct __user *) arg); | ||
799 | break; | ||
800 | } | ||
801 | |||
802 | return rv; | ||
780 | } | 803 | } |
781 | 804 | ||
782 | static const __u32 acm_tty_speed[] = { | 805 | static const __u32 acm_tty_speed[] = { |
@@ -1675,7 +1698,6 @@ static int __init acm_init(void) | |||
1675 | acm_tty_driver = alloc_tty_driver(ACM_TTY_MINORS); | 1698 | acm_tty_driver = alloc_tty_driver(ACM_TTY_MINORS); |
1676 | if (!acm_tty_driver) | 1699 | if (!acm_tty_driver) |
1677 | return -ENOMEM; | 1700 | return -ENOMEM; |
1678 | acm_tty_driver->owner = THIS_MODULE, | ||
1679 | acm_tty_driver->driver_name = "acm", | 1701 | acm_tty_driver->driver_name = "acm", |
1680 | acm_tty_driver->name = "ttyACM", | 1702 | acm_tty_driver->name = "ttyACM", |
1681 | acm_tty_driver->major = ACM_TTY_MAJOR, | 1703 | acm_tty_driver->major = ACM_TTY_MAJOR, |