diff options
Diffstat (limited to 'drivers/staging/frontier')
| -rw-r--r-- | drivers/staging/frontier/Kconfig | 1 | ||||
| -rw-r--r-- | drivers/staging/frontier/alphatrack.c | 161 | ||||
| -rw-r--r-- | drivers/staging/frontier/alphatrack.h | 6 | ||||
| -rw-r--r-- | drivers/staging/frontier/tranzport.c | 126 |
4 files changed, 111 insertions, 183 deletions
diff --git a/drivers/staging/frontier/Kconfig b/drivers/staging/frontier/Kconfig index 7121853bd39..4da290b2f5b 100644 --- a/drivers/staging/frontier/Kconfig +++ b/drivers/staging/frontier/Kconfig @@ -1,6 +1,5 @@ config TRANZPORT tristate "Frontier Tranzport and Alphatrack support" depends on USB - default N ---help--- Enable support for the Frontier Tranzport and Alphatrack devices. diff --git a/drivers/staging/frontier/alphatrack.c b/drivers/staging/frontier/alphatrack.c index ef7fbf8b069..226b2316310 100644 --- a/drivers/staging/frontier/alphatrack.c +++ b/drivers/staging/frontier/alphatrack.c @@ -24,17 +24,17 @@ * raw interrupt reports. */ -/* Note: this currently uses a dumb ringbuffer for reads and writes. +/* + * Note: this currently uses a dumb ringbuffer for reads and writes. * A more optimal driver would cache and kill off outstanding urbs that are * now invalid, and ignore ones that already were in the queue but valid * as we only have 30 commands for the alphatrack. In particular this is * key for getting lights to flash in time as otherwise many commands * can be buffered up before the light change makes it to the interface. -*/ + */ #include <linux/kernel.h> #include <linux/errno.h> -#include <linux/init.h> #include <linux/slab.h> #include <linux/module.h> #include <linux/kobject.h> @@ -89,7 +89,7 @@ static int debug = ALPHATRACK_DEBUG; /* Use our own dbg macro */ #define dbg_info(dev, format, arg...) do \ - { if (debug) dev_info(dev , format , ## arg); } while (0) + { if (debug) dev_info(dev , format , ## arg); } while (0) #define alphatrack_ocmd_info(dev, cmd, format, arg...) @@ -100,7 +100,8 @@ static int debug = ALPHATRACK_DEBUG; module_param(debug, int, S_IRUGO | S_IWUSR); MODULE_PARM_DESC(debug, "Debug enabled or not"); -/* All interrupt in transfers are collected in a ring buffer to +/* + * All interrupt in transfers are collected in a ring buffer to * avoid racing conditions and get better performance of the driver. */ @@ -109,8 +110,7 @@ static int ring_buffer_size = RING_BUFFER_SIZE; module_param(ring_buffer_size, int, S_IRUGO); MODULE_PARM_DESC(ring_buffer_size, "Read ring buffer size"); -/* The write_buffer can one day contain more than one interrupt out transfer. - */ +/* The write_buffer can one day contain more than one interrupt out transfer.*/ static int write_buffer_size = WRITE_BUFFER_SIZE; module_param(write_buffer_size, int, S_IRUGO); @@ -199,9 +199,7 @@ static void usb_alphatrack_abort_transfers(struct usb_alphatrack *dev) usb_kill_urb(dev->interrupt_out_urb); } -/** - * usb_alphatrack_delete - */ +/** usb_alphatrack_delete */ static void usb_alphatrack_delete(struct usb_alphatrack *dev) { usb_alphatrack_abort_transfers(dev); @@ -210,12 +208,12 @@ static void usb_alphatrack_delete(struct usb_alphatrack *dev) kfree(dev->ring_buffer); kfree(dev->interrupt_in_buffer); kfree(dev->interrupt_out_buffer); - kfree(dev); /* fixme oldi_buffer */ + kfree(dev->oldi_buffer); + kfree(dev->write_buffer); + kfree(dev); } -/** - * usb_alphatrack_interrupt_in_callback - */ +/** usb_alphatrack_interrupt_in_callback */ static void usb_alphatrack_interrupt_in_callback(struct urb *urb) { @@ -237,8 +235,8 @@ static void usb_alphatrack_interrupt_in_callback(struct urb *urb) if (urb->actual_length != INPUT_CMD_SIZE) { dev_warn(&dev->intf->dev, - "Urb length was %d bytes!!" - "Do something intelligent\n", urb->actual_length); + "Urb length was %d bytes!! Do something intelligent\n", + urb->actual_length); } else { alphatrack_ocmd_info(&dev->intf->dev, &(*dev->ring_buffer)[dev->ring_tail].cmd, @@ -296,9 +294,7 @@ exit: wake_up_interruptible(&dev->read_wait); } -/** - * usb_alphatrack_interrupt_out_callback - */ +/** usb_alphatrack_interrupt_out_callback */ static void usb_alphatrack_interrupt_out_callback(struct urb *urb) { struct usb_alphatrack *dev = urb->context; @@ -315,9 +311,7 @@ static void usb_alphatrack_interrupt_out_callback(struct urb *urb) wake_up_interruptible(&dev->write_wait); } -/** - * usb_alphatrack_open - */ +/** usb_alphatrack_open */ static int usb_alphatrack_open(struct inode *inode, struct file *file) { struct usb_alphatrack *dev; @@ -333,8 +327,8 @@ static int usb_alphatrack_open(struct inode *inode, struct file *file) interface = usb_find_interface(&usb_alphatrack_driver, subminor); if (!interface) { - err("%s - error, can't find device for minor %d\n", - __func__, subminor); + pr_err("%s - error, can't find device for minor %d\n", + __func__, subminor); retval = -ENODEV; goto unlock_disconnect_exit; } @@ -398,9 +392,7 @@ unlock_disconnect_exit: return retval; } -/** - * usb_alphatrack_release - */ +/** usb_alphatrack_release */ static int usb_alphatrack_release(struct inode *inode, struct file *file) { struct usb_alphatrack *dev; @@ -447,10 +439,8 @@ exit: return retval; } -/** - * usb_alphatrack_poll - */ -static unsigned int usb_alphatrack_poll(struct file *file, poll_table * wait) +/** usb_alphatrack_poll */ +static unsigned int usb_alphatrack_poll(struct file *file, poll_table *wait) { struct usb_alphatrack *dev; unsigned int mask = 0; @@ -468,9 +458,7 @@ static unsigned int usb_alphatrack_poll(struct file *file, poll_table * wait) return mask; } -/** - * usb_alphatrack_read - */ +/** usb_alphatrack_read */ static ssize_t usb_alphatrack_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) { @@ -494,7 +482,8 @@ static ssize_t usb_alphatrack_read(struct file *file, char __user *buffer, /* verify that the device wasn't unplugged */ if (dev->intf == NULL) { retval = -ENODEV; - err("No device or device unplugged %d\n", retval); + pr_err("%s: No device or device unplugged %d\n", + __func__, retval); goto unlock_exit; } @@ -538,9 +527,7 @@ exit: return retval; } -/** - * usb_alphatrack_write - */ +/** usb_alphatrack_write */ static ssize_t usb_alphatrack_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos) @@ -564,7 +551,8 @@ static ssize_t usb_alphatrack_write(struct file *file, /* verify that the device wasn't unplugged */ if (dev->intf == NULL) { retval = -ENODEV; - err("No device or device unplugged %d\n", retval); + pr_err("%s: No device or device unplugged %d\n", + __func__, retval); goto unlock_exit; } @@ -599,7 +587,7 @@ static ssize_t usb_alphatrack_write(struct file *file, } if (dev->interrupt_out_endpoint == NULL) { - err("Endpoint should not be be null!\n"); + dev_err(&dev->intf->dev, "Endpoint should not be null!\n"); goto unlock_exit; } @@ -619,7 +607,8 @@ static ssize_t usb_alphatrack_write(struct file *file, retval = usb_submit_urb(dev->interrupt_out_urb, GFP_KERNEL); if (retval) { dev->interrupt_out_busy = 0; - err("Couldn't submit interrupt_out_urb %d\n", retval); + dev_err(&dev->intf->dev, + "Couldn't submit interrupt_out_urb %d\n", retval); atomic_dec(&dev->writes_pending); goto unlock_exit; } @@ -675,10 +664,9 @@ static int usb_alphatrack_probe(struct usb_interface *intf, /* allocate memory for our device state and initialize it */ dev = kzalloc(sizeof(*dev), GFP_KERNEL); - if (dev == NULL) { - dev_err(&intf->dev, "Out of memory\n"); + if (dev == NULL) goto exit; - } + mutex_init(&dev->mtx); dev->intf = intf; init_waitqueue_head(&dev->read_wait); @@ -702,8 +690,7 @@ static int usb_alphatrack_probe(struct usb_interface *intf, } if (dev->interrupt_out_endpoint == NULL) dev_warn(&intf->dev, - "Interrupt out endpoint not found" - "(using control endpoint instead)\n"); + "Interrupt out endpoint not found (using control endpoint instead)\n"); dev->interrupt_in_endpoint_size = le16_to_cpu(dev->interrupt_in_endpoint->wMaxPacketSize); @@ -716,30 +703,25 @@ static int usb_alphatrack_probe(struct usb_interface *intf, true_size = min(ring_buffer_size, RING_BUFFER_SIZE); - /* FIXME - there are more usb_alloc routines for dma correctness. - Needed? */ - dev->ring_buffer = - kmalloc((true_size * sizeof(struct alphatrack_icmd)), GFP_KERNEL); - - if (!dev->ring_buffer) { - dev_err(&intf->dev, - "Couldn't allocate input ring_buffer of size %d\n", - true_size); + /* + * FIXME - there are more usb_alloc routines for dma correctness. + * Needed? + */ + dev->ring_buffer = kmalloc_array(true_size, + sizeof(struct alphatrack_icmd), + GFP_KERNEL); + if (!dev->ring_buffer) goto error; - } - - dev->interrupt_in_buffer = - kmalloc(dev->interrupt_in_endpoint_size, GFP_KERNEL); - if (!dev->interrupt_in_buffer) { - dev_err(&intf->dev, "Couldn't allocate interrupt_in_buffer\n"); + dev->interrupt_in_buffer = kmalloc(dev->interrupt_in_endpoint_size, + GFP_KERNEL); + if (!dev->interrupt_in_buffer) goto error; - } + dev->oldi_buffer = kmalloc(dev->interrupt_in_endpoint_size, GFP_KERNEL); - if (!dev->oldi_buffer) { - dev_err(&intf->dev, "Couldn't allocate old buffer\n"); + if (!dev->oldi_buffer) goto error; - } + dev->interrupt_in_urb = usb_alloc_urb(0, GFP_KERNEL); if (!dev->interrupt_in_urb) { dev_err(&intf->dev, "Couldn't allocate interrupt_in_urb\n"); @@ -761,20 +743,17 @@ static int usb_alphatrack_probe(struct usb_interface *intf, true_size = min(write_buffer_size, WRITE_BUFFER_SIZE); dev->interrupt_out_buffer = - kmalloc(true_size * dev->interrupt_out_endpoint_size, GFP_KERNEL); - - if (!dev->interrupt_out_buffer) { - dev_err(&intf->dev, "Couldn't allocate interrupt_out_buffer\n"); + kmalloc_array(true_size, + dev->interrupt_out_endpoint_size, + GFP_KERNEL); + if (!dev->interrupt_out_buffer) goto error; - } - - dev->write_buffer = - kmalloc(sizeof(struct alphatrack_ocmd) * true_size, GFP_KERNEL); - if (!dev->write_buffer) { - dev_err(&intf->dev, "Couldn't allocate write_buffer\n"); + dev->write_buffer = kmalloc_array(true_size, + sizeof(struct alphatrack_ocmd), + GFP_KERNEL); + if (!dev->write_buffer) goto error; - } dev->interrupt_out_urb = usb_alloc_urb(0, GFP_KERNEL); if (!dev->interrupt_out_urb) { @@ -848,11 +827,11 @@ static void usb_alphatrack_disconnect(struct usb_interface *intf) mutex_unlock(&dev->mtx); usb_alphatrack_delete(dev); } else { + atomic_set(&dev->writes_pending, 0); dev->intf = NULL; mutex_unlock(&dev->mtx); } - atomic_set(&dev->writes_pending, 0); mutex_unlock(&disconnect_mutex); dev_info(&intf->dev, "Alphatrack Surface #%d now disconnected\n", @@ -867,30 +846,4 @@ static struct usb_driver usb_alphatrack_driver = { .id_table = usb_alphatrack_table, }; -/** - * usb_alphatrack_init - */ -static int __init usb_alphatrack_init(void) -{ - int retval; - - /* register this driver with the USB subsystem */ - retval = usb_register(&usb_alphatrack_driver); - if (retval) - err("usb_register failed for the " __FILE__ - " driver. Error number %d\n", retval); - - return retval; -} - -/** - * usb_alphatrack_exit - */ -static void __exit usb_alphatrack_exit(void) -{ - /* deregister this driver with the USB subsystem */ - usb_deregister(&usb_alphatrack_driver); -} - -module_init(usb_alphatrack_init); -module_exit(usb_alphatrack_exit); +module_usb_driver(usb_alphatrack_driver); diff --git a/drivers/staging/frontier/alphatrack.h b/drivers/staging/frontier/alphatrack.h index 10a79726359..418c6053c02 100644 --- a/drivers/staging/frontier/alphatrack.h +++ b/drivers/staging/frontier/alphatrack.h @@ -6,7 +6,8 @@ struct alphatrack_ocmd { unsigned char cmd[8]; }; -/* These are unused by the present driver but provide documentation for the +/* + * These are unused by the present driver but provide documentation for the * userspace API. */ enum LightID { @@ -58,7 +59,8 @@ enum LightID { #define BUTTONMASK_PRESS2 0x00008010 #define BUTTONMASK_PRESS3 0x00002020 -/* last 3 bytes are the slider position +/* + * last 3 bytes are the slider position * 40 is the actual slider moving, the most sig bits, and 3 lsb */ diff --git a/drivers/staging/frontier/tranzport.c b/drivers/staging/frontier/tranzport.c index a145a15cfdb..2f86163d701 100644 --- a/drivers/staging/frontier/tranzport.c +++ b/drivers/staging/frontier/tranzport.c @@ -34,7 +34,6 @@ #include <linux/kernel.h> #include <linux/errno.h> -#include <linux/init.h> #include <linux/slab.h> #include <linux/module.h> #include <linux/mutex.h> @@ -86,7 +85,8 @@ static int debug = TRANZPORT_DEBUG; module_param(debug, int, S_IRUGO | S_IWUSR); MODULE_PARM_DESC(debug, "Debug enabled or not"); -/* All interrupt in transfers are collected in a ring buffer to +/* + * All interrupt in transfers are collected in a ring buffer to * avoid racing conditions and get better performance of the driver. */ @@ -95,7 +95,8 @@ static int ring_buffer_size = RING_BUFFER_SIZE; module_param(ring_buffer_size, int, S_IRUGO); MODULE_PARM_DESC(ring_buffer_size, "Read ring buffer size in reports"); -/* The write_buffer can one day contain more than one interrupt out transfer. +/* + * The write_buffer can one day contain more than one interrupt out transfer. */ static int write_buffer_size = WRITE_BUFFER_SIZE; module_param(write_buffer_size, int, S_IRUGO); @@ -175,36 +176,36 @@ static void usb_tranzport_abort_transfers(struct usb_tranzport *dev) } #define show_int(value) \ - static ssize_t show_##value(struct device *dev, \ + static ssize_t value##_show(struct device *dev, \ struct device_attribute *attr, char *buf) \ { \ struct usb_interface *intf = to_usb_interface(dev); \ struct usb_tranzport *t = usb_get_intfdata(intf); \ return sprintf(buf, "%d\n", t->value); \ } \ - static DEVICE_ATTR(value, S_IRUGO, show_##value, NULL); + static DEVICE_ATTR_RO(value) #define show_set_int(value) \ - static ssize_t show_##value(struct device *dev, \ + static ssize_t value##_show(struct device *dev, \ struct device_attribute *attr, char *buf) \ { \ struct usb_interface *intf = to_usb_interface(dev); \ struct usb_tranzport *t = usb_get_intfdata(intf); \ return sprintf(buf, "%d\n", t->value); \ } \ - static ssize_t set_##value(struct device *dev, \ + static ssize_t value##_store(struct device *dev, \ struct device_attribute *attr, \ const char *buf, size_t count) \ { \ struct usb_interface *intf = to_usb_interface(dev); \ struct usb_tranzport *t = usb_get_intfdata(intf); \ unsigned long temp; \ - if (strict_strtoul(buf, 10, &temp)) \ + if (kstrtoul(buf, 10, &temp)) \ return -EINVAL; \ t->value = temp; \ return count; \ } \ - static DEVICE_ATTR(value, S_IWUGO | S_IRUGO, show_##value, set_##value); + static DEVICE_ATTR_RW(value) show_int(enable); show_int(offline); @@ -256,8 +257,7 @@ static void usb_tranzport_interrupt_in_callback(struct urb *urb) if (urb->actual_length != 8) { dev_warn(&dev->intf->dev, - "Urb length was %d bytes!!" - "Do something intelligent\n", + "Urb length was %d bytes!! Do something intelligent\n", urb->actual_length); } else { dbg_info(&dev->intf->dev, @@ -271,8 +271,8 @@ static void usb_tranzport_interrupt_in_callback(struct urb *urb) dev->interrupt_in_buffer[6], dev->interrupt_in_buffer[7]); #if SUPPRESS_EXTRA_OFFLINE_EVENTS - if (dev->offline == 2 && dev->interrupt_in_buffer[1] == 0xff) - goto resubmit; + if (dev->offline == 2 && dev->interrupt_in_buffer[1] == 0xff) + goto resubmit; if (dev->offline == 1 && dev->interrupt_in_buffer[1] == 0xff) { dev->offline = 2; goto resubmit; @@ -285,8 +285,8 @@ static void usb_tranzport_interrupt_in_callback(struct urb *urb) dev->offline = 1; #endif /* SUPPRESS_EXTRA_OFFLINE_EVENTS */ - dbg_info(&dev->intf->dev, "%s: head, tail are %x, %x\n", - __func__, dev->ring_head, dev->ring_tail); + dbg_info(&dev->intf->dev, "%s: head, tail are %x, %x\n", + __func__, dev->ring_head, dev->ring_tail); next_ring_head = (dev->ring_head + 1) % ring_buffer_size; @@ -353,8 +353,8 @@ static int usb_tranzport_open(struct inode *inode, struct file *file) interface = usb_find_interface(&usb_tranzport_driver, subminor); if (!interface) { - err("%s - error, can't find device for minor %d\n", - __func__, subminor); + pr_err("%s - error, can't find device for minor %d\n", + __func__, subminor); retval = -ENODEV; goto unlock_disconnect_exit; } @@ -471,10 +471,11 @@ exit: /** * usb_tranzport_poll */ -static unsigned int usb_tranzport_poll(struct file *file, poll_table * wait) +static unsigned int usb_tranzport_poll(struct file *file, poll_table *wait) { struct usb_tranzport *dev; unsigned int mask = 0; + dev = file->private_data; poll_wait(file, &dev->read_wait, wait); poll_wait(file, &dev->write_wait, wait); @@ -517,9 +518,11 @@ static ssize_t usb_tranzport_read(struct file *file, char __user *buffer, goto exit; } - /* verify that the device wasn't unplugged */ if (dev->intf == NULL) { + /* verify that the device wasn't unplugged */ + if (dev->intf == NULL) { retval = -ENODEV; - err("No device or device unplugged %d\n", retval); + pr_err("%s: No device or device unplugged %d\n", + __func__, retval); goto unlock_exit; } @@ -539,8 +542,7 @@ static ssize_t usb_tranzport_read(struct file *file, char __user *buffer, } dbg_info(&dev->intf->dev, - "%s: copying to userspace: " - "%02x%02x%02x%02x%02x%02x%02x%02x\n", + "%s: copying to userspace: %02x%02x%02x%02x%02x%02x%02x%02x\n", __func__, (*dev->ring_buffer)[dev->ring_tail].cmd[0], (*dev->ring_buffer)[dev->ring_tail].cmd[1], @@ -563,12 +565,11 @@ static ssize_t usb_tranzport_read(struct file *file, char __user *buffer, newwheel = (*dev->ring_buffer)[next_tail].cmd[6]; oldwheel = (*dev->ring_buffer)[dev->ring_tail].cmd[6]; /* if both are wheel events, and - no buttons have changes (FIXME, do I have to check?), - and we are the same sign, we can compress +- 7F - */ + * no buttons have changes (FIXME, do I have to check?), + * and we are the same sign, we can compress +- 7F + */ dbg_info(&dev->intf->dev, - "%s: trying to compress: " - "%02x%02x%02x%02x%02x%02x%02x%02x\n", + "%s: trying to compress: %02x%02x%02x%02x%02x%02x%02x%02x\n", __func__, (*dev->ring_buffer)[dev->ring_tail].cmd[0], (*dev->ring_buffer)[dev->ring_tail].cmd[1], @@ -691,7 +692,8 @@ static ssize_t usb_tranzport_write(struct file *file, /* verify that the device wasn't unplugged */ if (dev->intf == NULL) { retval = -ENODEV; - err("No device or device unplugged %d\n", retval); + pr_err("%s: No device or device unplugged %d\n", + __func__, retval); goto unlock_exit; } @@ -726,7 +728,7 @@ static ssize_t usb_tranzport_write(struct file *file, } if (dev->interrupt_out_endpoint == NULL) { - err("Endpoint should not be be null!\n"); + dev_err(&dev->intf->dev, "Endpoint should not be null!\n"); goto unlock_exit; } @@ -746,7 +748,8 @@ static ssize_t usb_tranzport_write(struct file *file, retval = usb_submit_urb(dev->interrupt_out_urb, GFP_KERNEL); if (retval) { dev->interrupt_out_busy = 0; - err("Couldn't submit interrupt_out_urb %d\n", retval); + dev_err(&dev->intf->dev, + "Couldn't submit interrupt_out_urb %d\n", retval); goto unlock_exit; } retval = bytes_to_write; @@ -799,10 +802,9 @@ static int usb_tranzport_probe(struct usb_interface *intf, /* allocate memory for our device state and initialize it */ dev = kzalloc(sizeof(*dev), GFP_KERNEL); - if (dev == NULL) { - dev_err(&intf->dev, "Out of memory\n"); + if (dev == NULL) goto exit; - } + mutex_init(&dev->mtx); dev->intf = intf; init_waitqueue_head(&dev->read_wait); @@ -826,8 +828,7 @@ static int usb_tranzport_probe(struct usb_interface *intf, } if (dev->interrupt_out_endpoint == NULL) dev_warn(&intf->dev, - "Interrupt out endpoint not found" - "(using control endpoint instead)\n"); + "Interrupt out endpoint not found (using control endpoint instead)\n"); dev->interrupt_in_endpoint_size = le16_to_cpu(dev->interrupt_in_endpoint->wMaxPacketSize); @@ -839,23 +840,21 @@ static int usb_tranzport_probe(struct usb_interface *intf, ring_buffer_size = RING_BUFFER_SIZE; true_size = min(ring_buffer_size, RING_BUFFER_SIZE); - /* FIXME - there are more usb_alloc routines for dma correctness. - Needed? */ + /* + * FIXME - there are more usb_alloc routines for dma correctness. + * Needed? + */ dev->ring_buffer = kmalloc((true_size * sizeof(struct tranzport_cmd)) + 8, GFP_KERNEL); - - if (!dev->ring_buffer) { - dev_err(&intf->dev, - "Couldn't allocate ring_buffer size %d\n", true_size); + if (!dev->ring_buffer) goto error; - } + dev->interrupt_in_buffer = kmalloc(dev->interrupt_in_endpoint_size, GFP_KERNEL); - if (!dev->interrupt_in_buffer) { - dev_err(&intf->dev, "Couldn't allocate interrupt_in_buffer\n"); + if (!dev->interrupt_in_buffer) goto error; - } + dev->interrupt_in_urb = usb_alloc_urb(0, GFP_KERNEL); if (!dev->interrupt_in_urb) { dev_err(&intf->dev, "Couldn't allocate interrupt_in_urb\n"); @@ -871,12 +870,11 @@ static int usb_tranzport_probe(struct usb_interface *intf, "Interrupt out endpoint size is not 8!)\n"); dev->interrupt_out_buffer = - kmalloc(write_buffer_size * dev->interrupt_out_endpoint_size, - GFP_KERNEL); - if (!dev->interrupt_out_buffer) { - dev_err(&intf->dev, "Couldn't allocate interrupt_out_buffer\n"); + kmalloc_array(write_buffer_size, + dev->interrupt_out_endpoint_size, GFP_KERNEL); + if (!dev->interrupt_out_buffer) goto error; - } + dev->interrupt_out_urb = usb_alloc_urb(0, GFP_KERNEL); if (!dev->interrupt_out_urb) { dev_err(&intf->dev, "Couldn't allocate interrupt_out_urb\n"); @@ -940,6 +938,7 @@ static void usb_tranzport_disconnect(struct usb_interface *intf) { struct usb_tranzport *dev; int minor; + mutex_lock(&disconnect_mutex); dev = usb_get_intfdata(intf); usb_set_intfdata(intf, NULL); @@ -971,29 +970,4 @@ static struct usb_driver usb_tranzport_driver = { .id_table = usb_tranzport_table, }; -/** - * usb_tranzport_init - */ -static int __init usb_tranzport_init(void) -{ - int retval; - - /* register this driver with the USB subsystem */ - retval = usb_register(&usb_tranzport_driver); - if (retval) - err("usb_register failed for the " __FILE__ - " driver. Error number %d\n", retval); - return retval; -} -/** - * usb_tranzport_exit - */ - -static void __exit usb_tranzport_exit(void) -{ - /* deregister this driver with the USB subsystem */ - usb_deregister(&usb_tranzport_driver); -} - -module_init(usb_tranzport_init); -module_exit(usb_tranzport_exit); +module_usb_driver(usb_tranzport_driver); |
