Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 377738
b: refs/heads/master
c: 05d7639
h: refs/heads/master
v: v3
  • Loading branch information
Lisa Nguyen authored and Greg Kroah-Hartman committed May 15, 2013
1 parent a0e4a43 commit c3223da
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 51 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 30c5c649bcfef51156f9543dee4e4688d48f3a9d
refs/heads/master: 05d76399a68c2edbe51d1f12c2556867c521c27b
100 changes: 50 additions & 50 deletions trunk/drivers/usb/misc/adutux.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,10 @@ static void adu_abort_transfers(struct adu_device *dev)
{
unsigned long flags;

dbg(2," %s : enter", __func__);
dbg(2, " %s : enter", __func__);

if (dev->udev == NULL) {
dbg(1," %s : udev is null", __func__);
dbg(1, " %s : udev is null", __func__);
goto exit;
}

Expand All @@ -172,7 +172,7 @@ static void adu_abort_transfers(struct adu_device *dev)
spin_unlock_irqrestore(&dev->buflock, flags);

exit:
dbg(2," %s : leave", __func__);
dbg(2, " %s : leave", __func__);
}

static void adu_delete(struct adu_device *dev)
Expand All @@ -196,7 +196,7 @@ static void adu_interrupt_in_callback(struct urb *urb)
struct adu_device *dev = urb->context;
int status = urb->status;

dbg(4," %s : enter, status %d", __func__, status);
dbg(4, " %s : enter, status %d", __func__, status);
adu_debug_data(5, __func__, urb->actual_length,
urb->transfer_buffer);

Expand All @@ -205,7 +205,7 @@ static void adu_interrupt_in_callback(struct urb *urb)
if (status != 0) {
if ((status != -ENOENT) && (status != -ECONNRESET) &&
(status != -ESHUTDOWN)) {
dbg(1," %s : nonzero status received: %d",
dbg(1, " %s : nonzero status received: %d",
__func__, status);
}
goto exit;
Expand All @@ -220,10 +220,10 @@ static void adu_interrupt_in_callback(struct urb *urb)
dev->interrupt_in_buffer, urb->actual_length);

dev->read_buffer_length += urb->actual_length;
dbg(2," %s reading %d ", __func__,
dbg(2, " %s reading %d ", __func__,
urb->actual_length);
} else {
dbg(1," %s : read_buffer overflow", __func__);
dbg(1, " %s : read_buffer overflow", __func__);
}
}

Expand All @@ -234,16 +234,16 @@ static void adu_interrupt_in_callback(struct urb *urb)
wake_up_interruptible(&dev->read_wait);
adu_debug_data(5, __func__, urb->actual_length,
urb->transfer_buffer);
dbg(4," %s : leave, status %d", __func__, status);
dbg(4, " %s : leave, status %d", __func__, status);
}

static void adu_interrupt_out_callback(struct urb *urb)
{
struct adu_device *dev = urb->context;
int status = urb->status;

dbg(4," %s : enter, status %d", __func__, status);
adu_debug_data(5,__func__, urb->actual_length, urb->transfer_buffer);
dbg(4, " %s : enter, status %d", __func__, status);
adu_debug_data(5, __func__, urb->actual_length, urb->transfer_buffer);

if (status != 0) {
if ((status != -ENOENT) &&
Expand All @@ -262,7 +262,7 @@ static void adu_interrupt_out_callback(struct urb *urb)

adu_debug_data(5, __func__, urb->actual_length,
urb->transfer_buffer);
dbg(4," %s : leave, status %d", __func__, status);
dbg(4, " %s : leave, status %d", __func__, status);
}

static int adu_open(struct inode *inode, struct file *file)
Expand All @@ -272,7 +272,7 @@ static int adu_open(struct inode *inode, struct file *file)
int subminor;
int retval;

dbg(2,"%s : enter", __func__);
dbg(2, "%s : enter", __func__);

subminor = iminor(inode);

Expand Down Expand Up @@ -302,7 +302,7 @@ static int adu_open(struct inode *inode, struct file *file)
}

++dev->open_count;
dbg(2,"%s : open count %d", __func__, dev->open_count);
dbg(2, "%s : open count %d", __func__, dev->open_count);

/* save device in the file's private structure */
file->private_data = dev;
Expand All @@ -311,7 +311,7 @@ static int adu_open(struct inode *inode, struct file *file)
dev->read_buffer_length = 0;

/* fixup first read by having urb waiting for it */
usb_fill_int_urb(dev->interrupt_in_urb,dev->udev,
usb_fill_int_urb(dev->interrupt_in_urb, dev->udev,
usb_rcvintpipe(dev->udev,
dev->interrupt_in_endpoint->bEndpointAddress),
dev->interrupt_in_buffer,
Expand All @@ -332,49 +332,49 @@ static int adu_open(struct inode *inode, struct file *file)
exit_no_device:
mutex_unlock(&adutux_mutex);
exit_no_lock:
dbg(2,"%s : leave, return value %d ", __func__, retval);
dbg(2, "%s : leave, return value %d ", __func__, retval);
return retval;
}

static void adu_release_internal(struct adu_device *dev)
{
dbg(2," %s : enter", __func__);
dbg(2, " %s : enter", __func__);

/* decrement our usage count for the device */
--dev->open_count;
dbg(2," %s : open count %d", __func__, dev->open_count);
dbg(2, " %s : open count %d", __func__, dev->open_count);
if (dev->open_count <= 0) {
adu_abort_transfers(dev);
dev->open_count = 0;
}

dbg(2," %s : leave", __func__);
dbg(2, " %s : leave", __func__);
}

static int adu_release(struct inode *inode, struct file *file)
{
struct adu_device *dev;
int retval = 0;

dbg(2," %s : enter", __func__);
dbg(2, " %s : enter", __func__);

if (file == NULL) {
dbg(1," %s : file is NULL", __func__);
dbg(1, " %s : file is NULL", __func__);
retval = -ENODEV;
goto exit;
}

dev = file->private_data;
if (dev == NULL) {
dbg(1," %s : object is NULL", __func__);
dbg(1, " %s : object is NULL", __func__);
retval = -ENODEV;
goto exit;
}

mutex_lock(&adutux_mutex); /* not interruptible */

if (dev->open_count <= 0) {
dbg(1," %s : device not opened", __func__);
dbg(1, " %s : device not opened", __func__);
retval = -ENODEV;
goto unlock;
}
Expand All @@ -388,7 +388,7 @@ static int adu_release(struct inode *inode, struct file *file)
unlock:
mutex_unlock(&adutux_mutex);
exit:
dbg(2," %s : leave, return value %d", __func__, retval);
dbg(2, " %s : leave, return value %d", __func__, retval);
return retval;
}

Expand All @@ -405,10 +405,10 @@ static ssize_t adu_read(struct file *file, __user char *buffer, size_t count,
unsigned long flags;
DECLARE_WAITQUEUE(wait, current);

dbg(2," %s : enter, count = %Zd, file=%p", __func__, count, file);
dbg(2, " %s : enter, count = %Zd, file=%p", __func__, count, file);

dev = file->private_data;
dbg(2," %s : dev=%p", __func__, dev);
dbg(2, " %s : dev=%p", __func__, dev);

if (mutex_lock_interruptible(&dev->mtx))
return -ERESTARTSYS;
Expand All @@ -423,15 +423,15 @@ static ssize_t adu_read(struct file *file, __user char *buffer, size_t count,

/* verify that some data was requested */
if (count == 0) {
dbg(1," %s : read request of 0 bytes", __func__);
dbg(1, " %s : read request of 0 bytes", __func__);
goto exit;
}

timeout = COMMAND_TIMEOUT;
dbg(2," %s : about to start looping", __func__);
dbg(2, " %s : about to start looping", __func__);
while (bytes_to_read) {
int data_in_secondary = dev->secondary_tail - dev->secondary_head;
dbg(2," %s : while, data_in_secondary=%d, status=%d",
dbg(2, " %s : while, data_in_secondary=%d, status=%d",
__func__, data_in_secondary,
dev->interrupt_in_urb->status);

Expand All @@ -456,7 +456,7 @@ static ssize_t adu_read(struct file *file, __user char *buffer, size_t count,
if (dev->read_buffer_length) {
/* we secure access to the primary */
char *tmp;
dbg(2," %s : swap, read_buffer_length = %d",
dbg(2, " %s : swap, read_buffer_length = %d",
__func__, dev->read_buffer_length);
tmp = dev->read_buffer_secondary;
dev->read_buffer_secondary = dev->read_buffer_primary;
Expand All @@ -472,14 +472,14 @@ static ssize_t adu_read(struct file *file, __user char *buffer, size_t count,
if (!dev->read_urb_finished) {
/* somebody is doing IO */
spin_unlock_irqrestore(&dev->buflock, flags);
dbg(2," %s : submitted already", __func__);
dbg(2, " %s : submitted already", __func__);
} else {
/* we must initiate input */
dbg(2," %s : initiate input", __func__);
dbg(2, " %s : initiate input", __func__);
dev->read_urb_finished = 0;
spin_unlock_irqrestore(&dev->buflock, flags);

usb_fill_int_urb(dev->interrupt_in_urb,dev->udev,
usb_fill_int_urb(dev->interrupt_in_urb, dev->udev,
usb_rcvintpipe(dev->udev,
dev->interrupt_in_endpoint->bEndpointAddress),
dev->interrupt_in_buffer,
Expand All @@ -493,7 +493,7 @@ static ssize_t adu_read(struct file *file, __user char *buffer, size_t count,
if (retval == -ENOMEM) {
retval = bytes_read ? bytes_read : -ENOMEM;
}
dbg(2," %s : submit failed", __func__);
dbg(2, " %s : submit failed", __func__);
goto exit;
}
}
Expand All @@ -512,13 +512,13 @@ static ssize_t adu_read(struct file *file, __user char *buffer, size_t count,
remove_wait_queue(&dev->read_wait, &wait);

if (timeout <= 0) {
dbg(2," %s : timeout", __func__);
dbg(2, " %s : timeout", __func__);
retval = bytes_read ? bytes_read : -ETIMEDOUT;
goto exit;
}

if (signal_pending(current)) {
dbg(2," %s : signal pending", __func__);
dbg(2, " %s : signal pending", __func__);
retval = bytes_read ? bytes_read : -EINTR;
goto exit;
}
Expand All @@ -532,7 +532,7 @@ static ssize_t adu_read(struct file *file, __user char *buffer, size_t count,
if (should_submit && dev->read_urb_finished) {
dev->read_urb_finished = 0;
spin_unlock_irqrestore(&dev->buflock, flags);
usb_fill_int_urb(dev->interrupt_in_urb,dev->udev,
usb_fill_int_urb(dev->interrupt_in_urb, dev->udev,
usb_rcvintpipe(dev->udev,
dev->interrupt_in_endpoint->bEndpointAddress),
dev->interrupt_in_buffer,
Expand All @@ -551,7 +551,7 @@ static ssize_t adu_read(struct file *file, __user char *buffer, size_t count,
/* unlock the device */
mutex_unlock(&dev->mtx);

dbg(2," %s : leave, return value %d", __func__, retval);
dbg(2, " %s : leave, return value %d", __func__, retval);
return retval;
}

Expand All @@ -566,7 +566,7 @@ static ssize_t adu_write(struct file *file, const __user char *buffer,
unsigned long flags;
int retval;

dbg(2," %s : enter, count = %Zd", __func__, count);
dbg(2, " %s : enter, count = %Zd", __func__, count);

dev = file->private_data;

Expand All @@ -584,7 +584,7 @@ static ssize_t adu_write(struct file *file, const __user char *buffer,

/* verify that we actually have some data to write */
if (count == 0) {
dbg(1," %s : write request of 0 bytes", __func__);
dbg(1, " %s : write request of 0 bytes", __func__);
goto exit;
}

Expand All @@ -597,7 +597,7 @@ static ssize_t adu_write(struct file *file, const __user char *buffer,

mutex_unlock(&dev->mtx);
if (signal_pending(current)) {
dbg(1," %s : interrupted", __func__);
dbg(1, " %s : interrupted", __func__);
set_current_state(TASK_RUNNING);
retval = -EINTR;
goto exit_onqueue;
Expand All @@ -614,17 +614,17 @@ static ssize_t adu_write(struct file *file, const __user char *buffer,
goto exit_nolock;
}

dbg(4," %s : in progress, count = %Zd", __func__, count);
dbg(4, " %s : in progress, count = %Zd", __func__, count);
} else {
spin_unlock_irqrestore(&dev->buflock, flags);
set_current_state(TASK_RUNNING);
remove_wait_queue(&dev->write_wait, &waita);
dbg(4," %s : sending, count = %Zd", __func__, count);
dbg(4, " %s : sending, count = %Zd", __func__, count);

/* write the data into interrupt_out_buffer from userspace */
buffer_size = usb_endpoint_maxp(dev->interrupt_out_endpoint);
bytes_to_write = count > buffer_size ? buffer_size : count;
dbg(4," %s : buffer_size = %Zd, count = %Zd, bytes_to_write = %Zd",
dbg(4, " %s : buffer_size = %Zd, count = %Zd, bytes_to_write = %Zd",
__func__, buffer_size, count, bytes_to_write);

if (copy_from_user(dev->interrupt_out_buffer, buffer, bytes_to_write) != 0) {
Expand Down Expand Up @@ -664,7 +664,7 @@ static ssize_t adu_write(struct file *file, const __user char *buffer,
exit:
mutex_unlock(&dev->mtx);
exit_nolock:
dbg(2," %s : leave, return value %d", __func__, retval);
dbg(2, " %s : leave, return value %d", __func__, retval);
return retval;

exit_onqueue:
Expand Down Expand Up @@ -710,7 +710,7 @@ static int adu_probe(struct usb_interface *interface,
int out_end_size;
int i;

dbg(2," %s : enter", __func__);
dbg(2, " %s : enter", __func__);

if (udev == NULL) {
dev_err(&interface->dev, "udev is NULL.\n");
Expand Down Expand Up @@ -811,7 +811,7 @@ static int adu_probe(struct usb_interface *interface,
dev_err(&interface->dev, "Could not retrieve serial number\n");
goto error;
}
dbg(2," %s : serial_number=%s", __func__, dev->serial_number);
dbg(2, " %s : serial_number=%s", __func__, dev->serial_number);

/* we can register the device now, as it is ready */
usb_set_intfdata(interface, dev);
Expand All @@ -832,7 +832,7 @@ static int adu_probe(struct usb_interface *interface,
udev->descriptor.idProduct, dev->serial_number,
(dev->minor - ADU_MINOR_BASE));
exit:
dbg(2," %s : leave, return value %p (dev)", __func__, dev);
dbg(2, " %s : leave, return value %p (dev)", __func__, dev);

return retval;

Expand All @@ -851,7 +851,7 @@ static void adu_disconnect(struct usb_interface *interface)
struct adu_device *dev;
int minor;

dbg(2," %s : enter", __func__);
dbg(2, " %s : enter", __func__);

dev = usb_get_intfdata(interface);

Expand All @@ -865,7 +865,7 @@ static void adu_disconnect(struct usb_interface *interface)
usb_set_intfdata(interface, NULL);

/* if the device is not opened, then we clean up right now */
dbg(2," %s : open count %d", __func__, dev->open_count);
dbg(2, " %s : open count %d", __func__, dev->open_count);
if (!dev->open_count)
adu_delete(dev);

Expand All @@ -874,7 +874,7 @@ static void adu_disconnect(struct usb_interface *interface)
dev_info(&interface->dev, "ADU device adutux%d now disconnected\n",
(minor - ADU_MINOR_BASE));

dbg(2," %s : leave", __func__);
dbg(2, " %s : leave", __func__);
}

/* usb specific object needed to register this driver with the usb subsystem */
Expand Down

0 comments on commit c3223da

Please sign in to comment.