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/usb-serial.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/usb-serial.c')
-rw-r--r-- | drivers/usb/serial/usb-serial.c | 38 |
1 files changed, 28 insertions, 10 deletions
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index 7a2177c79bde..1c031309ab25 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c | |||
@@ -21,7 +21,6 @@ | |||
21 | #include <linux/errno.h> | 21 | #include <linux/errno.h> |
22 | #include <linux/init.h> | 22 | #include <linux/init.h> |
23 | #include <linux/slab.h> | 23 | #include <linux/slab.h> |
24 | #include <linux/smp_lock.h> | ||
25 | #include <linux/tty.h> | 24 | #include <linux/tty.h> |
26 | #include <linux/tty_driver.h> | 25 | #include <linux/tty_driver.h> |
27 | #include <linux/tty_flip.h> | 26 | #include <linux/tty_flip.h> |
@@ -52,6 +51,7 @@ static struct usb_driver usb_serial_driver = { | |||
52 | .suspend = usb_serial_suspend, | 51 | .suspend = usb_serial_suspend, |
53 | .resume = usb_serial_resume, | 52 | .resume = usb_serial_resume, |
54 | .no_dynamic_id = 1, | 53 | .no_dynamic_id = 1, |
54 | .supports_autosuspend = 1, | ||
55 | }; | 55 | }; |
56 | 56 | ||
57 | /* There is no MODULE_DEVICE_TABLE for usbserial.c. Instead | 57 | /* There is no MODULE_DEVICE_TABLE for usbserial.c. Instead |
@@ -406,7 +406,7 @@ static void serial_unthrottle(struct tty_struct *tty) | |||
406 | port->serial->type->unthrottle(tty); | 406 | port->serial->type->unthrottle(tty); |
407 | } | 407 | } |
408 | 408 | ||
409 | static int serial_ioctl(struct tty_struct *tty, struct file *file, | 409 | static int serial_ioctl(struct tty_struct *tty, |
410 | unsigned int cmd, unsigned long arg) | 410 | unsigned int cmd, unsigned long arg) |
411 | { | 411 | { |
412 | struct usb_serial_port *port = tty->driver_data; | 412 | struct usb_serial_port *port = tty->driver_data; |
@@ -417,7 +417,7 @@ static int serial_ioctl(struct tty_struct *tty, struct file *file, | |||
417 | /* pass on to the driver specific version of this function | 417 | /* pass on to the driver specific version of this function |
418 | if it is available */ | 418 | if it is available */ |
419 | if (port->serial->type->ioctl) { | 419 | if (port->serial->type->ioctl) { |
420 | retval = port->serial->type->ioctl(tty, file, cmd, arg); | 420 | retval = port->serial->type->ioctl(tty, cmd, arg); |
421 | } else | 421 | } else |
422 | retval = -ENOIOCTLCMD; | 422 | retval = -ENOIOCTLCMD; |
423 | return retval; | 423 | return retval; |
@@ -496,18 +496,18 @@ static const struct file_operations serial_proc_fops = { | |||
496 | .release = single_release, | 496 | .release = single_release, |
497 | }; | 497 | }; |
498 | 498 | ||
499 | static int serial_tiocmget(struct tty_struct *tty, struct file *file) | 499 | static int serial_tiocmget(struct tty_struct *tty) |
500 | { | 500 | { |
501 | struct usb_serial_port *port = tty->driver_data; | 501 | struct usb_serial_port *port = tty->driver_data; |
502 | 502 | ||
503 | dbg("%s - port %d", __func__, port->number); | 503 | dbg("%s - port %d", __func__, port->number); |
504 | 504 | ||
505 | if (port->serial->type->tiocmget) | 505 | if (port->serial->type->tiocmget) |
506 | return port->serial->type->tiocmget(tty, file); | 506 | return port->serial->type->tiocmget(tty); |
507 | return -EINVAL; | 507 | return -EINVAL; |
508 | } | 508 | } |
509 | 509 | ||
510 | static int serial_tiocmset(struct tty_struct *tty, struct file *file, | 510 | static int serial_tiocmset(struct tty_struct *tty, |
511 | unsigned int set, unsigned int clear) | 511 | unsigned int set, unsigned int clear) |
512 | { | 512 | { |
513 | struct usb_serial_port *port = tty->driver_data; | 513 | struct usb_serial_port *port = tty->driver_data; |
@@ -515,7 +515,19 @@ static int serial_tiocmset(struct tty_struct *tty, struct file *file, | |||
515 | dbg("%s - port %d", __func__, port->number); | 515 | dbg("%s - port %d", __func__, port->number); |
516 | 516 | ||
517 | if (port->serial->type->tiocmset) | 517 | if (port->serial->type->tiocmset) |
518 | return port->serial->type->tiocmset(tty, file, set, clear); | 518 | return port->serial->type->tiocmset(tty, set, clear); |
519 | return -EINVAL; | ||
520 | } | ||
521 | |||
522 | static int serial_get_icount(struct tty_struct *tty, | ||
523 | struct serial_icounter_struct *icount) | ||
524 | { | ||
525 | struct usb_serial_port *port = tty->driver_data; | ||
526 | |||
527 | dbg("%s - port %d", __func__, port->number); | ||
528 | |||
529 | if (port->serial->type->get_icount) | ||
530 | return port->serial->type->get_icount(tty, icount); | ||
519 | return -EINVAL; | 531 | return -EINVAL; |
520 | } | 532 | } |
521 | 533 | ||
@@ -899,9 +911,8 @@ int usb_serial_probe(struct usb_interface *interface, | |||
899 | dev_err(&interface->dev, "No free urbs available\n"); | 911 | dev_err(&interface->dev, "No free urbs available\n"); |
900 | goto probe_error; | 912 | goto probe_error; |
901 | } | 913 | } |
902 | buffer_size = serial->type->bulk_in_size; | 914 | buffer_size = max_t(int, serial->type->bulk_in_size, |
903 | if (!buffer_size) | 915 | le16_to_cpu(endpoint->wMaxPacketSize)); |
904 | buffer_size = le16_to_cpu(endpoint->wMaxPacketSize); | ||
905 | port->bulk_in_size = buffer_size; | 916 | port->bulk_in_size = buffer_size; |
906 | port->bulk_in_endpointAddress = endpoint->bEndpointAddress; | 917 | port->bulk_in_endpointAddress = endpoint->bEndpointAddress; |
907 | port->bulk_in_buffer = kmalloc(buffer_size, GFP_KERNEL); | 918 | port->bulk_in_buffer = kmalloc(buffer_size, GFP_KERNEL); |
@@ -1195,6 +1206,7 @@ static const struct tty_operations serial_ops = { | |||
1195 | .chars_in_buffer = serial_chars_in_buffer, | 1206 | .chars_in_buffer = serial_chars_in_buffer, |
1196 | .tiocmget = serial_tiocmget, | 1207 | .tiocmget = serial_tiocmget, |
1197 | .tiocmset = serial_tiocmset, | 1208 | .tiocmset = serial_tiocmset, |
1209 | .get_icount = serial_get_icount, | ||
1198 | .cleanup = serial_cleanup, | 1210 | .cleanup = serial_cleanup, |
1199 | .install = serial_install, | 1211 | .install = serial_install, |
1200 | .proc_fops = &serial_proc_fops, | 1212 | .proc_fops = &serial_proc_fops, |
@@ -1334,6 +1346,12 @@ int usb_serial_register(struct usb_serial_driver *driver) | |||
1334 | 1346 | ||
1335 | if (!driver->description) | 1347 | if (!driver->description) |
1336 | driver->description = driver->driver.name; | 1348 | driver->description = driver->driver.name; |
1349 | if (!driver->usb_driver) { | ||
1350 | WARN(1, "Serial driver %s has no usb_driver\n", | ||
1351 | driver->description); | ||
1352 | return -EINVAL; | ||
1353 | } | ||
1354 | driver->usb_driver->supports_autosuspend = 1; | ||
1337 | 1355 | ||
1338 | /* Add this device to our list of devices */ | 1356 | /* Add this device to our list of devices */ |
1339 | mutex_lock(&table_lock); | 1357 | mutex_lock(&table_lock); |