diff options
Diffstat (limited to 'drivers/staging/frontier')
| -rw-r--r-- | drivers/staging/frontier/Kconfig | 1 | ||||
| -rw-r--r-- | drivers/staging/frontier/alphatrack.c | 14 | ||||
| -rw-r--r-- | drivers/staging/frontier/tranzport.c | 33 |
3 files changed, 22 insertions, 26 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 5590ebf1da1..226b2316310 100644 --- a/drivers/staging/frontier/alphatrack.c +++ b/drivers/staging/frontier/alphatrack.c @@ -35,7 +35,6 @@ #include <linux/kernel.h> #include <linux/errno.h> -#include <linux/init.h> #include <linux/slab.h> #include <linux/module.h> #include <linux/kobject.h> @@ -209,7 +208,9 @@ 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 */ @@ -234,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, @@ -689,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); @@ -827,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", diff --git a/drivers/staging/frontier/tranzport.c b/drivers/staging/frontier/tranzport.c index 6cbf9c7c1d3..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> @@ -177,24 +176,24 @@ 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) \ { \ @@ -206,7 +205,7 @@ static void usb_tranzport_abort_transfers(struct usb_tranzport *dev) t->value = temp; \ return count; \ } \ - static DEVICE_ATTR(value, S_IWUSR | S_IRUGO, show_##value, set_##value); + static DEVICE_ATTR_RW(value) show_int(enable); show_int(offline); @@ -258,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, @@ -273,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; @@ -287,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; @@ -477,6 +475,7 @@ 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); @@ -543,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], @@ -571,8 +569,7 @@ static ssize_t usb_tranzport_read(struct file *file, char __user *buffer, * 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], @@ -831,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); @@ -942,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); |
