|
@@ -24,13 +24,14 @@
|
|
|
* 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>
|
|
@@ -100,7 +101,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 +111,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 +200,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);
|
|
@@ -213,9 +212,7 @@ static void usb_alphatrack_delete(struct usb_alphatrack *dev)
|
|
|
kfree(dev); /* fixme oldi_buffer */
|
|
|
}
|
|
|
|
|
|
-/**
|
|
|
- * usb_alphatrack_interrupt_in_callback
|
|
|
- */
|
|
|
+/** usb_alphatrack_interrupt_in_callback */
|
|
|
|
|
|
static void usb_alphatrack_interrupt_in_callback(struct urb *urb)
|
|
|
{
|
|
@@ -296,9 +293,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 +310,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;
|
|
@@ -398,9 +391,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,9 +438,7 @@ exit:
|
|
|
return retval;
|
|
|
}
|
|
|
|
|
|
-/**
|
|
|
- * usb_alphatrack_poll
|
|
|
- */
|
|
|
+/** usb_alphatrack_poll */
|
|
|
static unsigned int usb_alphatrack_poll(struct file *file, poll_table *wait)
|
|
|
{
|
|
|
struct usb_alphatrack *dev;
|
|
@@ -468,9 +457,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)
|
|
|
{
|
|
@@ -539,9 +526,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)
|
|
@@ -718,8 +703,10 @@ 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? */
|
|
|
+ /*
|
|
|
+ * FIXME - there are more usb_alloc routines for dma correctness.
|
|
|
+ * Needed?
|
|
|
+ */
|
|
|
dev->ring_buffer = kmalloc_array(true_size,
|
|
|
sizeof(struct alphatrack_icmd),
|
|
|
GFP_KERNEL);
|