diff options
Diffstat (limited to 'drivers/usb/misc')
-rw-r--r-- | drivers/usb/misc/Kconfig | 20 | ||||
-rw-r--r-- | drivers/usb/misc/adutux.c | 120 | ||||
-rw-r--r-- | drivers/usb/misc/appledisplay.c | 6 | ||||
-rw-r--r-- | drivers/usb/misc/auerswald.c | 135 | ||||
-rw-r--r-- | drivers/usb/misc/emi26.c | 30 | ||||
-rw-r--r-- | drivers/usb/misc/emi62.c | 32 | ||||
-rw-r--r-- | drivers/usb/misc/ftdi-elan.c | 2 | ||||
-rw-r--r-- | drivers/usb/misc/iowarrior.c | 10 | ||||
-rw-r--r-- | drivers/usb/misc/ldusb.c | 10 | ||||
-rw-r--r-- | drivers/usb/misc/legousbtower.c | 92 | ||||
-rw-r--r-- | drivers/usb/misc/phidgetkit.c | 6 | ||||
-rw-r--r-- | drivers/usb/misc/phidgetmotorcontrol.c | 2 | ||||
-rw-r--r-- | drivers/usb/misc/phidgetservo.c | 6 | ||||
-rw-r--r-- | drivers/usb/misc/usblcd.c | 8 | ||||
-rw-r--r-- | drivers/usb/misc/usbtest.c | 13 |
15 files changed, 248 insertions, 244 deletions
diff --git a/drivers/usb/misc/Kconfig b/drivers/usb/misc/Kconfig index 9c7eb6144d02..a53db1d4e07a 100644 --- a/drivers/usb/misc/Kconfig +++ b/drivers/usb/misc/Kconfig @@ -33,8 +33,8 @@ config USB_EMI26 module will be called emi26. config USB_ADUTUX - tristate "ADU devices from Ontrak Control Systems (EXPERIMENTAL)" - depends on USB && EXPERIMENTAL + tristate "ADU devices from Ontrak Control Systems" + depends on USB help Say Y if you want to use an ADU device from Ontrak Control Systems. @@ -43,8 +43,8 @@ config USB_ADUTUX will be called adutux. config USB_AUERSWALD - tristate "USB Auerswald ISDN support (EXPERIMENTAL)" - depends on USB && EXPERIMENTAL + tristate "USB Auerswald ISDN support" + depends on USB help Say Y here if you want to connect an Auerswald USB ISDN Device to your computer's USB port. @@ -53,8 +53,8 @@ config USB_AUERSWALD module will be called auerswald. config USB_RIO500 - tristate "USB Diamond Rio500 support (EXPERIMENTAL)" - depends on USB && EXPERIMENTAL + tristate "USB Diamond Rio500 support" + depends on USB help Say Y here if you want to connect a USB Rio500 mp3 player to your computer's USB port. Please read <file:Documentation/usb/rio.txt> @@ -64,8 +64,8 @@ config USB_RIO500 module will be called rio500. config USB_LEGOTOWER - tristate "USB Lego Infrared Tower support (EXPERIMENTAL)" - depends on USB && EXPERIMENTAL + tristate "USB Lego Infrared Tower support" + depends on USB help Say Y here if you want to connect a USB Lego Infrared Tower to your computer's USB port. @@ -259,8 +259,8 @@ config USB_IOWARRIOR module will be called iowarrior. config USB_TEST - tristate "USB testing driver (DEVELOPMENT)" - depends on USB && USB_DEVICEFS && EXPERIMENTAL + tristate "USB testing driver" + depends on USB && USB_DEVICEFS help This driver is for testing host controller software. It is used with specialized device firmware for regression and stress testing, diff --git a/drivers/usb/misc/adutux.c b/drivers/usb/misc/adutux.c index 5a2c44e4c1f7..965f6eaea6a0 100644 --- a/drivers/usb/misc/adutux.c +++ b/drivers/usb/misc/adutux.c @@ -147,10 +147,10 @@ static void adu_abort_transfers(struct adu_device *dev) { unsigned long flags; - dbg(2," %s : enter", __FUNCTION__); + dbg(2," %s : enter", __func__); if (dev->udev == NULL) { - dbg(1," %s : udev is null", __FUNCTION__); + dbg(1," %s : udev is null", __func__); goto exit; } @@ -172,12 +172,12 @@ static void adu_abort_transfers(struct adu_device *dev) spin_unlock_irqrestore(&dev->buflock, flags); exit: - dbg(2," %s : leave", __FUNCTION__); + dbg(2," %s : leave", __func__); } static void adu_delete(struct adu_device *dev) { - dbg(2, "%s enter", __FUNCTION__); + dbg(2, "%s enter", __func__); /* free data structures */ usb_free_urb(dev->interrupt_in_urb); @@ -188,7 +188,7 @@ static void adu_delete(struct adu_device *dev) kfree(dev->interrupt_out_buffer); kfree(dev); - dbg(2, "%s : leave", __FUNCTION__); + dbg(2, "%s : leave", __func__); } static void adu_interrupt_in_callback(struct urb *urb) @@ -196,8 +196,8 @@ 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", __FUNCTION__, status); - adu_debug_data(5, __FUNCTION__, urb->actual_length, + dbg(4," %s : enter, status %d", __func__, status); + adu_debug_data(5, __func__, urb->actual_length, urb->transfer_buffer); spin_lock(&dev->buflock); @@ -206,7 +206,7 @@ static void adu_interrupt_in_callback(struct urb *urb) if ((status != -ENOENT) && (status != -ECONNRESET) && (status != -ESHUTDOWN)) { dbg(1," %s : nonzero status received: %d", - __FUNCTION__, status); + __func__, status); } goto exit; } @@ -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 ", __FUNCTION__, + dbg(2," %s reading %d ", __func__, urb->actual_length); } else { - dbg(1," %s : read_buffer overflow", __FUNCTION__); + dbg(1," %s : read_buffer overflow", __func__); } } @@ -232,9 +232,9 @@ exit: spin_unlock(&dev->buflock); /* always wake up so we recover from errors */ wake_up_interruptible(&dev->read_wait); - adu_debug_data(5, __FUNCTION__, urb->actual_length, + adu_debug_data(5, __func__, urb->actual_length, urb->transfer_buffer); - dbg(4," %s : leave, status %d", __FUNCTION__, status); + dbg(4," %s : leave, status %d", __func__, status); } static void adu_interrupt_out_callback(struct urb *urb) @@ -242,14 +242,14 @@ 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", __FUNCTION__, status); - adu_debug_data(5,__FUNCTION__, 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) && (status != -ECONNRESET)) { dbg(1, " %s :nonzero status received: %d", - __FUNCTION__, status); + __func__, status); } goto exit; } @@ -260,9 +260,9 @@ static void adu_interrupt_out_callback(struct urb *urb) spin_unlock(&dev->buflock); exit: - adu_debug_data(5, __FUNCTION__, urb->actual_length, + adu_debug_data(5, __func__, urb->actual_length, urb->transfer_buffer); - dbg(4," %s : leave, status %d", __FUNCTION__, status); + dbg(4," %s : leave, status %d", __func__, status); } static int adu_open(struct inode *inode, struct file *file) @@ -272,19 +272,19 @@ static int adu_open(struct inode *inode, struct file *file) int subminor; int retval; - dbg(2,"%s : enter", __FUNCTION__); + dbg(2,"%s : enter", __func__); subminor = iminor(inode); if ((retval = mutex_lock_interruptible(&adutux_mutex))) { - dbg(2, "%s : mutex lock failed", __FUNCTION__); + dbg(2, "%s : mutex lock failed", __func__); goto exit_no_lock; } interface = usb_find_interface(&adu_driver, subminor); if (!interface) { err("%s - error, can't find device for minor %d", - __FUNCTION__, subminor); + __func__, subminor); retval = -ENODEV; goto exit_no_device; } @@ -302,7 +302,7 @@ static int adu_open(struct inode *inode, struct file *file) } ++dev->open_count; - dbg(2,"%s : open count %d", __FUNCTION__, 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; @@ -332,23 +332,23 @@ 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 ", __FUNCTION__, 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", __FUNCTION__); + dbg(2," %s : enter", __func__); /* decrement our usage count for the device */ --dev->open_count; - dbg(2," %s : open count %d", __FUNCTION__, 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", __FUNCTION__); + dbg(2," %s : leave", __func__); } static int adu_release(struct inode *inode, struct file *file) @@ -356,17 +356,17 @@ static int adu_release(struct inode *inode, struct file *file) struct adu_device *dev; int retval = 0; - dbg(2," %s : enter", __FUNCTION__); + dbg(2," %s : enter", __func__); if (file == NULL) { - dbg(1," %s : file is NULL", __FUNCTION__); + dbg(1," %s : file is NULL", __func__); retval = -ENODEV; goto exit; } dev = file->private_data; if (dev == NULL) { - dbg(1," %s : object is NULL", __FUNCTION__); + dbg(1," %s : object is NULL", __func__); retval = -ENODEV; goto exit; } @@ -374,7 +374,7 @@ static int adu_release(struct inode *inode, struct file *file) mutex_lock(&adutux_mutex); /* not interruptible */ if (dev->open_count <= 0) { - dbg(1," %s : device not opened", __FUNCTION__); + dbg(1," %s : device not opened", __func__); retval = -ENODEV; goto exit; } @@ -388,7 +388,7 @@ static int adu_release(struct inode *inode, struct file *file) exit: mutex_unlock(&adutux_mutex); - dbg(2," %s : leave, return value %d", __FUNCTION__, retval); + dbg(2," %s : leave, return value %d", __func__, retval); return retval; } @@ -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", __FUNCTION__, count, file); + dbg(2," %s : enter, count = %Zd, file=%p", __func__, count, file); dev = file->private_data; - dbg(2," %s : dev=%p", __FUNCTION__, dev); + dbg(2," %s : dev=%p", __func__, dev); if (mutex_lock_interruptible(&dev->mtx)) return -ERESTARTSYS; @@ -422,16 +422,16 @@ 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", __FUNCTION__); + dbg(1," %s : read request of 0 bytes", __func__); goto exit; } timeout = COMMAND_TIMEOUT; - dbg(2," %s : about to start looping", __FUNCTION__); + 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", - __FUNCTION__, data_in_secondary, + __func__, data_in_secondary, dev->interrupt_in_urb->status); if (data_in_secondary) { @@ -456,7 +456,7 @@ static ssize_t adu_read(struct file *file, __user char *buffer, size_t count, /* we secure access to the primary */ char *tmp; dbg(2," %s : swap, read_buffer_length = %d", - __FUNCTION__, dev->read_buffer_length); + __func__, dev->read_buffer_length); tmp = dev->read_buffer_secondary; dev->read_buffer_secondary = dev->read_buffer_primary; dev->read_buffer_primary = tmp; @@ -471,10 +471,10 @@ 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", __FUNCTION__); + dbg(2," %s : submitted already", __func__); } else { /* we must initiate input */ - dbg(2," %s : initiate input", __FUNCTION__); + dbg(2," %s : initiate input", __func__); dev->read_urb_finished = 0; spin_unlock_irqrestore(&dev->buflock, flags); @@ -492,7 +492,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", __FUNCTION__); + dbg(2," %s : submit failed", __func__); goto exit; } } @@ -511,13 +511,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", __FUNCTION__); + dbg(2," %s : timeout", __func__); retval = bytes_read ? bytes_read : -ETIMEDOUT; goto exit; } if (signal_pending(current)) { - dbg(2," %s : signal pending", __FUNCTION__); + dbg(2," %s : signal pending", __func__); retval = bytes_read ? bytes_read : -EINTR; goto exit; } @@ -550,7 +550,7 @@ exit: /* unlock the device */ mutex_unlock(&dev->mtx); - dbg(2," %s : leave, return value %d", __FUNCTION__, retval); + dbg(2," %s : leave, return value %d", __func__, retval); return retval; } @@ -565,7 +565,7 @@ static ssize_t adu_write(struct file *file, const __user char *buffer, unsigned long flags; int retval; - dbg(2," %s : enter, count = %Zd", __FUNCTION__, count); + dbg(2," %s : enter, count = %Zd", __func__, count); dev = file->private_data; @@ -582,7 +582,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", __FUNCTION__); + dbg(1," %s : write request of 0 bytes", __func__); goto exit; } @@ -595,13 +595,13 @@ static ssize_t adu_write(struct file *file, const __user char *buffer, mutex_unlock(&dev->mtx); if (signal_pending(current)) { - dbg(1," %s : interrupted", __FUNCTION__); + dbg(1," %s : interrupted", __func__); set_current_state(TASK_RUNNING); retval = -EINTR; goto exit_onqueue; } if (schedule_timeout(COMMAND_TIMEOUT) == 0) { - dbg(1, "%s - command timed out.", __FUNCTION__); + dbg(1, "%s - command timed out.", __func__); retval = -ETIMEDOUT; goto exit_onqueue; } @@ -612,18 +612,18 @@ static ssize_t adu_write(struct file *file, const __user char *buffer, goto exit_nolock; } - dbg(4," %s : in progress, count = %Zd", __FUNCTION__, 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", __FUNCTION__, count); + dbg(4," %s : sending, count = %Zd", __func__, count); /* write the data into interrupt_out_buffer from userspace */ buffer_size = le16_to_cpu(dev->interrupt_out_endpoint->wMaxPacketSize); bytes_to_write = count > buffer_size ? buffer_size : count; dbg(4," %s : buffer_size = %Zd, count = %Zd, bytes_to_write = %Zd", - __FUNCTION__, buffer_size, count, bytes_to_write); + __func__, buffer_size, count, bytes_to_write); if (copy_from_user(dev->interrupt_out_buffer, buffer, bytes_to_write) != 0) { retval = -EFAULT; @@ -661,7 +661,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", __FUNCTION__, retval); + dbg(2," %s : leave, return value %d", __func__, retval); return retval; exit_onqueue: @@ -706,7 +706,7 @@ static int adu_probe(struct usb_interface *interface, int out_end_size; int i; - dbg(2," %s : enter", __FUNCTION__); + dbg(2," %s : enter", __func__); if (udev == NULL) { dev_err(&interface->dev, "udev is NULL.\n"); @@ -807,7 +807,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", __FUNCTION__, 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); @@ -828,7 +828,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)", __FUNCTION__, dev); + dbg(2," %s : leave, return value %p (dev)", __func__, dev); return retval; @@ -847,7 +847,7 @@ static void adu_disconnect(struct usb_interface *interface) struct adu_device *dev; int minor; - dbg(2," %s : enter", __FUNCTION__); + dbg(2," %s : enter", __func__); dev = usb_get_intfdata(interface); @@ -861,7 +861,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", __FUNCTION__, dev->open_count); + dbg(2," %s : open count %d", __func__, dev->open_count); if (!dev->open_count) adu_delete(dev); @@ -870,7 +870,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", __FUNCTION__); + dbg(2," %s : leave", __func__); } /* usb specific object needed to register this driver with the usb subsystem */ @@ -885,7 +885,7 @@ static int __init adu_init(void) { int result; - dbg(2," %s : enter", __FUNCTION__); + dbg(2," %s : enter", __func__); /* register this driver with the USB subsystem */ result = usb_register(&adu_driver); @@ -899,17 +899,17 @@ static int __init adu_init(void) info("adutux is an experimental driver. Use at your own risk"); exit: - dbg(2," %s : leave, return value %d", __FUNCTION__, result); + dbg(2," %s : leave, return value %d", __func__, result); return result; } static void __exit adu_exit(void) { - dbg(2," %s : enter", __FUNCTION__); + dbg(2," %s : enter", __func__); /* deregister this driver with the USB subsystem */ usb_deregister(&adu_driver); - dbg(2," %s : leave", __FUNCTION__); + dbg(2," %s : leave", __func__); } module_init(adu_init); diff --git a/drivers/usb/misc/appledisplay.c b/drivers/usb/misc/appledisplay.c index a5e4c3545c72..a076c24a312a 100644 --- a/drivers/usb/misc/appledisplay.c +++ b/drivers/usb/misc/appledisplay.c @@ -103,11 +103,11 @@ static void appledisplay_complete(struct urb *urb) case -ESHUTDOWN: /* This urb is terminated, clean up */ dbg("%s - urb shuttingdown with status: %d", - __FUNCTION__, status); + __func__, status); return; default: dbg("%s - nonzero urb status received: %d", - __FUNCTION__, status); + __func__, status); goto exit; } @@ -131,7 +131,7 @@ exit: retval = usb_submit_urb(pdata->urb, GFP_ATOMIC); if (retval) { err("%s - usb_submit_urb failed with result %d", - __FUNCTION__, retval); + __func__, retval); } } diff --git a/drivers/usb/misc/auerswald.c b/drivers/usb/misc/auerswald.c index df7e1ecc810a..093938697426 100644 --- a/drivers/usb/misc/auerswald.c +++ b/drivers/usb/misc/auerswald.c @@ -31,6 +31,7 @@ #include <linux/init.h> #include <linux/wait.h> #include <linux/usb.h> +#include <linux/mutex.h> /*-------------------------------------------------------------------*/ /* Debug support */ @@ -232,7 +233,7 @@ typedef struct auerscon /* USB device context */ typedef struct { - struct semaphore mutex; /* protection in user context */ + struct mutex mutex; /* protection in user context */ char name[20]; /* name of the /dev/usb entry */ unsigned int dtindex; /* index in the device table */ struct usb_device * usbdev; /* USB device handle */ @@ -253,12 +254,12 @@ typedef struct /* character device context */ typedef struct { - struct semaphore mutex; /* protection in user context */ + struct mutex mutex; /* protection in user context */ pauerswald_t auerdev; /* context pointer of assigned device */ auerbufctl_t bufctl; /* controls the buffer chain */ auerscon_t scontext; /* service context */ wait_queue_head_t readwait; /* for synchronous reading */ - struct semaphore readmutex; /* protection against multiple reads */ + struct mutex readmutex; /* protection against multiple reads */ pauerbuf_t readbuf; /* buffer held for partial reading */ unsigned int readoffset; /* current offset in readbuf */ unsigned int removed; /* is != 0 if device is removed */ @@ -283,7 +284,7 @@ static void auerchain_complete (struct urb * urb) int result; /* get pointer to element and to chain */ - pauerchainelement_t acep = (pauerchainelement_t) urb->context; + pauerchainelement_t acep = urb->context; pauerchain_t acp = acep->chain; /* restore original entries in urb */ @@ -593,7 +594,7 @@ ac_fail:/* free the elements */ /* completion handler for synchronous chained URBs */ static void auerchain_blocking_completion (struct urb *urb) { - pauerchain_chs_t pchs = (pauerchain_chs_t)urb->context; + pauerchain_chs_t pchs = urb->context; pchs->done = 1; wmb(); wake_up (&pchs->wqh); @@ -846,7 +847,7 @@ static int auerswald_status_retry (int status) /* Completion of asynchronous write block */ static void auerchar_ctrlwrite_complete (struct urb * urb) { - pauerbuf_t bp = (pauerbuf_t) urb->context; + pauerbuf_t bp = urb->context; pauerswald_t cp = ((pauerswald_t)((char *)(bp->list)-(unsigned long)(&((pauerswald_t)0)->bufctl))); dbg ("auerchar_ctrlwrite_complete called"); @@ -859,7 +860,7 @@ static void auerchar_ctrlwrite_complete (struct urb * urb) /* Completion handler for dummy retry packet */ static void auerswald_ctrlread_wretcomplete (struct urb * urb) { - pauerbuf_t bp = (pauerbuf_t) urb->context; + pauerbuf_t bp = urb->context; pauerswald_t cp; int ret; int status = urb->status; @@ -903,7 +904,7 @@ static void auerswald_ctrlread_complete (struct urb * urb) unsigned int serviceid; pauerswald_t cp; pauerscon_t scp; - pauerbuf_t bp = (pauerbuf_t) urb->context; + pauerbuf_t bp = urb->context; int status = urb->status; int ret; @@ -980,9 +981,9 @@ static void auerswald_int_complete (struct urb * urb) int ret; int status = urb->status; pauerbuf_t bp = NULL; - pauerswald_t cp = (pauerswald_t) urb->context; + pauerswald_t cp = urb->context; - dbg ("%s called", __FUNCTION__); + dbg ("%s called", __func__); switch (status) { case 0: @@ -992,10 +993,10 @@ static void auerswald_int_complete (struct urb * urb) case -ENOENT: case -ESHUTDOWN: /* this urb is terminated, clean up */ - dbg("%s - urb shutting down with status: %d", __FUNCTION__, status); + dbg("%s - urb shutting down with status: %d", __func__, status); return; default: - dbg("%s - nonzero urb status received: %d", __FUNCTION__, status); + dbg("%s - nonzero urb status received: %d", __func__, status); goto exit; } @@ -1080,7 +1081,7 @@ exit: ret = usb_submit_urb (urb, GFP_ATOMIC); if (ret) err ("%s - usb_submit_urb failed with result %d", - __FUNCTION__, ret); + __func__, ret); } /* int memory deallocation @@ -1376,7 +1377,7 @@ static int auerchar_open (struct inode *inode, struct file *file) if (cp == NULL) { return -ENODEV; } - if (down_interruptible (&cp->mutex)) { + if (mutex_lock_interruptible(&cp->mutex)) { return -ERESTARTSYS; } @@ -1389,8 +1390,8 @@ static int auerchar_open (struct inode *inode, struct file *file) } /* Initialize device descriptor */ - init_MUTEX( &ccp->mutex); - init_MUTEX( &ccp->readmutex); + mutex_init(&ccp->mutex); + mutex_init(&ccp->readmutex); auerbuf_init (&ccp->bufctl); ccp->scontext.id = AUH_UNASSIGNED; ccp->scontext.dispatch = auerchar_ctrlread_dispatch; @@ -1405,7 +1406,7 @@ static int auerchar_open (struct inode *inode, struct file *file) cp->open_count++; ccp->auerdev = cp; dbg("open %s as /dev/%s", cp->dev_desc, cp->name); - up (&cp->mutex); + mutex_unlock(&cp->mutex); /* file IO stuff */ file->f_pos = 0; @@ -1413,7 +1414,7 @@ static int auerchar_open (struct inode *inode, struct file *file) return nonseekable_open(inode, file); /* Error exit */ -ofail: up (&cp->mutex); +ofail: mutex_unlock(&cp->mutex); auerchar_delete (ccp); return ret; } @@ -1432,23 +1433,23 @@ static int auerchar_ioctl (struct inode *inode, struct file *file, unsigned int dbg ("ioctl"); /* get the mutexes */ - if (down_interruptible (&ccp->mutex)) { + if (mutex_lock_interruptible(&ccp->mutex)) { return -ERESTARTSYS; } cp = ccp->auerdev; if (!cp) { - up (&ccp->mutex); + mutex_unlock(&ccp->mutex); return -ENODEV; } - if (down_interruptible (&cp->mutex)) { - up(&ccp->mutex); + if (mutex_lock_interruptible(&cp->mutex)) { + mutex_unlock(&ccp->mutex); return -ERESTARTSYS; } /* Check for removal */ if (!cp->usbdev) { - up(&cp->mutex); - up(&ccp->mutex); + mutex_unlock(&cp->mutex); + mutex_unlock(&ccp->mutex); return -ENODEV; } @@ -1550,8 +1551,8 @@ static int auerchar_ioctl (struct inode *inode, struct file *file, unsigned int break; } /* release the mutexes */ - up(&cp->mutex); - up(&ccp->mutex); + mutex_unlock(&cp->mutex); + mutex_unlock(&ccp->mutex); return ret; } @@ -1574,18 +1575,18 @@ static ssize_t auerchar_read (struct file *file, char __user *buf, size_t count, return 0; /* get the mutex */ - if (down_interruptible (&ccp->mutex)) + if (mutex_lock_interruptible(&ccp->mutex)) return -ERESTARTSYS; /* Can we expect to read something? */ if (ccp->scontext.id == AUH_UNASSIGNED) { - up (&ccp->mutex); + mutex_unlock(&ccp->mutex); return -EIO; } /* only one reader per device allowed */ - if (down_interruptible (&ccp->readmutex)) { - up (&ccp->mutex); + if (mutex_lock_interruptible(&ccp->readmutex)) { + mutex_unlock(&ccp->mutex); return -ERESTARTSYS; } @@ -1602,8 +1603,8 @@ doreadbuf: if (count) { if (copy_to_user (buf, bp->bufp+ccp->readoffset, count)) { dbg ("auerswald_read: copy_to_user failed"); - up (&ccp->readmutex); - up (&ccp->mutex); + mutex_unlock(&ccp->readmutex); + mutex_unlock(&ccp->mutex); return -EFAULT; } } @@ -1617,8 +1618,8 @@ doreadbuf: } /* return with number of bytes read */ if (count) { - up (&ccp->readmutex); - up (&ccp->mutex); + mutex_unlock(&ccp->readmutex); + mutex_unlock(&ccp->mutex); return count; } } @@ -1654,29 +1655,29 @@ doreadlist: dbg ("No read buffer available, returning -EAGAIN"); set_current_state (TASK_RUNNING); remove_wait_queue (&ccp->readwait, &wait); - up (&ccp->readmutex); - up (&ccp->mutex); + mutex_unlock(&ccp->readmutex); + mutex_unlock(&ccp->mutex); return -EAGAIN; /* nonblocking, no data available */ } /* yes, we should wait! */ - up (&ccp->mutex); /* allow other operations while we wait */ + mutex_unlock(&ccp->mutex); /* allow other operations while we wait */ schedule(); remove_wait_queue (&ccp->readwait, &wait); if (signal_pending (current)) { /* waked up by a signal */ - up (&ccp->readmutex); + mutex_unlock(&ccp->readmutex); return -ERESTARTSYS; } /* Anything left to read? */ if ((ccp->scontext.id == AUH_UNASSIGNED) || ccp->removed) { - up (&ccp->readmutex); + mutex_unlock(&ccp->readmutex); return -EIO; } - if (down_interruptible (&ccp->mutex)) { - up (&ccp->readmutex); + if (mutex_lock_interruptible(&ccp->mutex)) { + mutex_unlock(&ccp->readmutex); return -ERESTARTSYS; } @@ -1707,27 +1708,27 @@ static ssize_t auerchar_write (struct file *file, const char __user *buf, size_t write_again: /* get the mutex */ - if (down_interruptible (&ccp->mutex)) + if (mutex_lock_interruptible(&ccp->mutex)) return -ERESTARTSYS; /* Can we expect to write something? */ if (ccp->scontext.id == AUH_UNASSIGNED) { - up (&ccp->mutex); + mutex_unlock(&ccp->mutex); return -EIO; } cp = ccp->auerdev; if (!cp) { - up (&ccp->mutex); + mutex_unlock(&ccp->mutex); return -ERESTARTSYS; } - if (down_interruptible (&cp->mutex)) { - up (&ccp->mutex); + if (mutex_lock_interruptible(&cp->mutex)) { + mutex_unlock(&ccp->mutex); return -ERESTARTSYS; } if (!cp->usbdev) { - up (&cp->mutex); - up (&ccp->mutex); + mutex_unlock(&cp->mutex); + mutex_unlock(&ccp->mutex); return -EIO; } /* Prepare for sleep */ @@ -1750,8 +1751,8 @@ write_again: /* are there any buffers left? */ if (!bp) { - up (&cp->mutex); - up (&ccp->mutex); + mutex_unlock(&cp->mutex); + mutex_unlock(&ccp->mutex); /* NONBLOCK: don't wait */ if (file->f_flags & O_NONBLOCK) { @@ -1783,8 +1784,8 @@ write_again: auerbuf_releasebuf (bp); /* Wake up all processes waiting for a buffer */ wake_up (&cp->bufferwait); - up (&cp->mutex); - up (&ccp->mutex); + mutex_unlock(&cp->mutex); + mutex_unlock(&ccp->mutex); return -EFAULT; } @@ -1803,18 +1804,18 @@ write_again: auerchar_ctrlwrite_complete, bp); /* up we go */ ret = auerchain_submit_urb (&cp->controlchain, bp->urbp); - up (&cp->mutex); + mutex_unlock(&cp->mutex); if (ret) { dbg ("auerchar_write: nonzero result of auerchain_submit_urb %d", ret); auerbuf_releasebuf (bp); /* Wake up all processes waiting for a buffer */ wake_up (&cp->bufferwait); - up (&ccp->mutex); + mutex_unlock(&ccp->mutex); return -EIO; } else { dbg ("auerchar_write: Write OK"); - up (&ccp->mutex); + mutex_unlock(&ccp->mutex); return len; } } @@ -1827,24 +1828,24 @@ static int auerchar_release (struct inode *inode, struct file *file) pauerswald_t cp; dbg("release"); - down(&ccp->mutex); + mutex_lock(&ccp->mutex); cp = ccp->auerdev; if (cp) { - down(&cp->mutex); + mutex_lock(&cp->mutex); /* remove an open service */ auerswald_removeservice (cp, &ccp->scontext); /* detach from device */ if ((--cp->open_count <= 0) && (cp->usbdev == NULL)) { /* usb device waits for removal */ - up (&cp->mutex); + mutex_unlock(&cp->mutex); auerswald_delete (cp); } else { - up (&cp->mutex); + mutex_unlock(&cp->mutex); } cp = NULL; ccp->auerdev = NULL; } - up (&ccp->mutex); + mutex_unlock(&ccp->mutex); auerchar_delete (ccp); return 0; @@ -1917,7 +1918,7 @@ static int auerswald_probe (struct usb_interface *intf, } /* Initialize device descriptor */ - init_MUTEX (&cp->mutex); + mutex_init(&cp->mutex); cp->usbdev = usbdev; auerchain_init (&cp->controlchain); auerbuf_init (&cp->bufctl); @@ -2042,7 +2043,7 @@ static void auerswald_disconnect (struct usb_interface *intf) /* give back our USB minor number */ usb_deregister_dev(intf, &auerswald_class); - down (&cp->mutex); + mutex_lock(&cp->mutex); info ("device /dev/%s now disconnecting", cp->name); /* Stop the interrupt endpoint */ @@ -2057,16 +2058,18 @@ static void auerswald_disconnect (struct usb_interface *intf) if (cp->open_count == 0) { /* nobody is using this device. So we can clean up now */ - up (&cp->mutex);/* up() is possible here because no other task - can open the device (see above). I don't want - to kfree() a locked mutex. */ + mutex_unlock(&cp->mutex); + /* mutex_unlock() is possible here because no other task + can open the device (see above). I don't want + to kfree() a locked mutex. */ + auerswald_delete (cp); } else { /* device is used. Remove the pointer to the usb device (it's not valid any more). The last release() will do the clean up */ cp->usbdev = NULL; - up (&cp->mutex); + mutex_unlock(&cp->mutex); /* Terminate waiting writers */ wake_up (&cp->bufferwait); /* Inform all waiting readers */ diff --git a/drivers/usb/misc/emi26.c b/drivers/usb/misc/emi26.c index 4a09b87bdd28..4b9dc81b8453 100644 --- a/drivers/usb/misc/emi26.c +++ b/drivers/usb/misc/emi26.c @@ -70,8 +70,8 @@ static int emi26_writememory (struct usb_device *dev, int address, unsigned char static int emi26_set_reset (struct usb_device *dev, unsigned char reset_bit) { int response; - info("%s - %d", __FUNCTION__, reset_bit); - /* printk(KERN_DEBUG "%s - %d", __FUNCTION__, reset_bit); */ + info("%s - %d", __func__, reset_bit); + /* printk(KERN_DEBUG "%s - %d", __func__, reset_bit); */ response = emi26_writememory (dev, CPUCS_REG, &reset_bit, 1, 0xa0); if (response < 0) { err("emi26: set_reset (%d) failed", reset_bit); @@ -91,7 +91,7 @@ static int emi26_load_firmware (struct usb_device *dev) buf = kmalloc(FW_LOAD_SIZE, GFP_KERNEL); if (!buf) { - err( "%s - error loading firmware: error = %d", __FUNCTION__, -ENOMEM); + err( "%s - error loading firmware: error = %d", __func__, -ENOMEM); err = -ENOMEM; goto wraperr; } @@ -99,7 +99,7 @@ static int emi26_load_firmware (struct usb_device *dev) /* Assert reset (stop the CPU in the EMI) */ err = emi26_set_reset(dev,1); if (err < 0) { - err( "%s - error loading firmware: error = %d", __FUNCTION__, err); + err( "%s - error loading firmware: error = %d", __func__, err); goto wraperr; } @@ -107,7 +107,7 @@ static int emi26_load_firmware (struct usb_device *dev) for (i=0; g_Loader[i].type == 0; i++) { err = emi26_writememory(dev, g_Loader[i].address, g_Loader[i].data, g_Loader[i].length, ANCHOR_LOAD_INTERNAL); if (err < 0) { - err("%s - error loading firmware: error = %d", __FUNCTION__, err); + err("%s - error loading firmware: error = %d", __func__, err); goto wraperr; } } @@ -115,7 +115,7 @@ static int emi26_load_firmware (struct usb_device *dev) /* De-assert reset (let the CPU run) */ err = emi26_set_reset(dev,0); if (err < 0) { - err("%s - error loading firmware: error = %d", __FUNCTION__, err); + err("%s - error loading firmware: error = %d", __func__, err); goto wraperr; } msleep(250); /* let device settle */ @@ -135,7 +135,7 @@ static int emi26_load_firmware (struct usb_device *dev) } err = emi26_writememory(dev, addr, buf, i, ANCHOR_LOAD_FPGA); if (err < 0) { - err("%s - error loading firmware: error = %d", __FUNCTION__, err); + err("%s - error loading firmware: error = %d", __func__, err); goto wraperr; } } while (i > 0); @@ -143,7 +143,7 @@ static int emi26_load_firmware (struct usb_device *dev) /* Assert reset (stop the CPU in the EMI) */ err = emi26_set_reset(dev,1); if (err < 0) { - err("%s - error loading firmware: error = %d", __FUNCTION__, err); + err("%s - error loading firmware: error = %d", __func__, err); goto wraperr; } @@ -151,7 +151,7 @@ static int emi26_load_firmware (struct usb_device *dev) for (i=0; g_Loader[i].type == 0; i++) { err = emi26_writememory(dev, g_Loader[i].address, g_Loader[i].data, g_Loader[i].length, ANCHOR_LOAD_INTERNAL); if (err < 0) { - err("%s - error loading firmware: error = %d", __FUNCTION__, err); + err("%s - error loading firmware: error = %d", __func__, err); goto wraperr; } } @@ -160,7 +160,7 @@ static int emi26_load_firmware (struct usb_device *dev) /* De-assert reset (let the CPU run) */ err = emi26_set_reset(dev,0); if (err < 0) { - err("%s - error loading firmware: error = %d", __FUNCTION__, err); + err("%s - error loading firmware: error = %d", __func__, err); goto wraperr; } @@ -169,7 +169,7 @@ static int emi26_load_firmware (struct usb_device *dev) if (!INTERNAL_RAM(g_Firmware[i].address)) { err = emi26_writememory(dev, g_Firmware[i].address, g_Firmware[i].data, g_Firmware[i].length, ANCHOR_LOAD_EXTERNAL); if (err < 0) { - err("%s - error loading firmware: error = %d", __FUNCTION__, err); + err("%s - error loading firmware: error = %d", __func__, err); goto wraperr; } } @@ -178,7 +178,7 @@ static int emi26_load_firmware (struct usb_device *dev) /* Assert reset (stop the CPU in the EMI) */ err = emi26_set_reset(dev,1); if (err < 0) { - err("%s - error loading firmware: error = %d", __FUNCTION__, err); + err("%s - error loading firmware: error = %d", __func__, err); goto wraperr; } @@ -186,7 +186,7 @@ static int emi26_load_firmware (struct usb_device *dev) if (INTERNAL_RAM(g_Firmware[i].address)) { err = emi26_writememory(dev, g_Firmware[i].address, g_Firmware[i].data, g_Firmware[i].length, ANCHOR_LOAD_INTERNAL); if (err < 0) { - err("%s - error loading firmware: error = %d", __FUNCTION__, err); + err("%s - error loading firmware: error = %d", __func__, err); goto wraperr; } } @@ -195,7 +195,7 @@ static int emi26_load_firmware (struct usb_device *dev) /* De-assert reset (let the CPU run) */ err = emi26_set_reset(dev,0); if (err < 0) { - err("%s - error loading firmware: error = %d", __FUNCTION__, err); + err("%s - error loading firmware: error = %d", __func__, err); goto wraperr; } msleep(250); /* let device settle */ @@ -221,7 +221,7 @@ static int emi26_probe(struct usb_interface *intf, const struct usb_device_id *i { struct usb_device *dev = interface_to_usbdev(intf); - info("%s start", __FUNCTION__); + info("%s start", __func__); emi26_load_firmware(dev); diff --git a/drivers/usb/misc/emi62.c b/drivers/usb/misc/emi62.c index d1362415922c..1a2b79ac5e10 100644 --- a/drivers/usb/misc/emi62.c +++ b/drivers/usb/misc/emi62.c @@ -78,7 +78,7 @@ static int emi62_writememory (struct usb_device *dev, int address, unsigned char static int emi62_set_reset (struct usb_device *dev, unsigned char reset_bit) { int response; - info("%s - %d", __FUNCTION__, reset_bit); + info("%s - %d", __func__, reset_bit); response = emi62_writememory (dev, CPUCS_REG, &reset_bit, 1, 0xa0); if (response < 0) { @@ -100,7 +100,7 @@ static int emi62_load_firmware (struct usb_device *dev) dev_dbg(&dev->dev, "load_firmware\n"); buf = kmalloc(FW_LOAD_SIZE, GFP_KERNEL); if (!buf) { - err( "%s - error loading firmware: error = %d", __FUNCTION__, -ENOMEM); + err( "%s - error loading firmware: error = %d", __func__, -ENOMEM); err = -ENOMEM; goto wraperr; } @@ -108,7 +108,7 @@ static int emi62_load_firmware (struct usb_device *dev) /* Assert reset (stop the CPU in the EMI) */ err = emi62_set_reset(dev,1); if (err < 0) { - err("%s - error loading firmware: error = %d", __FUNCTION__, err); + err("%s - error loading firmware: error = %d", __func__, err); goto wraperr; } @@ -116,7 +116,7 @@ static int emi62_load_firmware (struct usb_device *dev) for (i=0; g_emi62_loader[i].type == 0; i++) { err = emi62_writememory(dev, g_emi62_loader[i].address, g_emi62_loader[i].data, g_emi62_loader[i].length, ANCHOR_LOAD_INTERNAL); if (err < 0) { - err("%s - error loading firmware: error = %d", __FUNCTION__, err); + err("%s - error loading firmware: error = %d", __func__, err); goto wraperr; } } @@ -124,7 +124,7 @@ static int emi62_load_firmware (struct usb_device *dev) /* De-assert reset (let the CPU run) */ err = emi62_set_reset(dev,0); if (err < 0) { - err("%s - error loading firmware: error = %d", __FUNCTION__, err); + err("%s - error loading firmware: error = %d", __func__, err); goto wraperr; } msleep(250); /* let device settle */ @@ -144,7 +144,7 @@ static int emi62_load_firmware (struct usb_device *dev) } err = emi62_writememory(dev, addr, buf, i, ANCHOR_LOAD_FPGA); if (err < 0) { - err("%s - error loading firmware: error = %d", __FUNCTION__, err); + err("%s - error loading firmware: error = %d", __func__, err); goto wraperr; } } while (i > 0); @@ -152,7 +152,7 @@ static int emi62_load_firmware (struct usb_device *dev) /* Assert reset (stop the CPU in the EMI) */ err = emi62_set_reset(dev,1); if (err < 0) { - err("%s - error loading firmware: error = %d", __FUNCTION__, err); + err("%s - error loading firmware: error = %d", __func__, err); goto wraperr; } @@ -160,7 +160,7 @@ static int emi62_load_firmware (struct usb_device *dev) for (i=0; g_emi62_loader[i].type == 0; i++) { err = emi62_writememory(dev, g_emi62_loader[i].address, g_emi62_loader[i].data, g_emi62_loader[i].length, ANCHOR_LOAD_INTERNAL); if (err < 0) { - err("%s - error loading firmware: error = %d", __FUNCTION__, err); + err("%s - error loading firmware: error = %d", __func__, err); goto wraperr; } } @@ -168,7 +168,7 @@ static int emi62_load_firmware (struct usb_device *dev) /* De-assert reset (let the CPU run) */ err = emi62_set_reset(dev,0); if (err < 0) { - err("%s - error loading firmware: error = %d", __FUNCTION__, err); + err("%s - error loading firmware: error = %d", __func__, err); goto wraperr; } msleep(250); /* let device settle */ @@ -181,7 +181,7 @@ static int emi62_load_firmware (struct usb_device *dev) if (!INTERNAL_RAM(g_HexSpdifFw62[i].address)) { err = emi62_writememory(dev, g_HexSpdifFw62[i].address, g_HexSpdifFw62[i].data, g_HexSpdifFw62[i].length, ANCHOR_LOAD_EXTERNAL); if (err < 0) { - err("%s - error loading firmware: error = %d", __FUNCTION__, err); + err("%s - error loading firmware: error = %d", __func__, err); goto wraperr; } } @@ -191,7 +191,7 @@ static int emi62_load_firmware (struct usb_device *dev) if (!INTERNAL_RAM(g_HexMidiFw62[i].address)) { err = emi62_writememory(dev, g_HexMidiFw62[i].address, g_HexMidiFw62[i].data, g_HexMidiFw62[i].length, ANCHOR_LOAD_EXTERNAL); if (err < 0) { - err("%s - error loading firmware: error = %d\n", __FUNCTION__, err); + err("%s - error loading firmware: error = %d\n", __func__, err); goto wraperr; return err; } @@ -201,7 +201,7 @@ static int emi62_load_firmware (struct usb_device *dev) /* Assert reset (stop the CPU in the EMI) */ err = emi62_set_reset(dev,1); if (err < 0) { - err("%s - error loading firmware: error = %d", __FUNCTION__, err); + err("%s - error loading firmware: error = %d", __func__, err); goto wraperr; } @@ -211,7 +211,7 @@ static int emi62_load_firmware (struct usb_device *dev) if (INTERNAL_RAM(g_HexSpdifFw62[i].address)) { err = emi62_writememory(dev, g_HexSpdifFw62[i].address, g_HexSpdifFw62[i].data, g_HexSpdifFw62[i].length, ANCHOR_LOAD_INTERNAL); if (err < 0) { - err("%s - error loading firmware: error = %d", __FUNCTION__, err); + err("%s - error loading firmware: error = %d", __func__, err); goto wraperr; } } @@ -221,7 +221,7 @@ static int emi62_load_firmware (struct usb_device *dev) if (INTERNAL_RAM(g_HexMidiFw62[i].address)) { err = emi62_writememory(dev, g_HexMidiFw62[i].address, g_HexMidiFw62[i].data, g_HexMidiFw62[i].length, ANCHOR_LOAD_INTERNAL); if (err < 0) { - err("%s - error loading firmware: error = %d\n", __FUNCTION__, err); + err("%s - error loading firmware: error = %d\n", __func__, err); goto wraperr; } } @@ -231,7 +231,7 @@ static int emi62_load_firmware (struct usb_device *dev) /* De-assert reset (let the CPU run) */ err = emi62_set_reset(dev,0); if (err < 0) { - err("%s - error loading firmware: error = %d", __FUNCTION__, err); + err("%s - error loading firmware: error = %d", __func__, err); goto wraperr; } msleep(250); /* let device settle */ @@ -260,7 +260,7 @@ static int emi62_probe(struct usb_interface *intf, const struct usb_device_id *i struct usb_device *dev = interface_to_usbdev(intf); dev_dbg(&intf->dev, "emi62_probe\n"); - info("%s start", __FUNCTION__); + info("%s start", __func__); emi62_load_firmware(dev); diff --git a/drivers/usb/misc/ftdi-elan.c b/drivers/usb/misc/ftdi-elan.c index 148b7fe639b2..ec88b3bfee46 100644 --- a/drivers/usb/misc/ftdi-elan.c +++ b/drivers/usb/misc/ftdi-elan.c @@ -746,7 +746,7 @@ static ssize_t ftdi_elan_read(struct file *file, char __user *buffer, static void ftdi_elan_write_bulk_callback(struct urb *urb) { - struct usb_ftdi *ftdi = (struct usb_ftdi *)urb->context; + struct usb_ftdi *ftdi = urb->context; int status = urb->status; if (status && !(status == -ENOENT || status == -ECONNRESET || diff --git a/drivers/usb/misc/iowarrior.c b/drivers/usb/misc/iowarrior.c index 801070502cc1..1cb54a28347f 100644 --- a/drivers/usb/misc/iowarrior.c +++ b/drivers/usb/misc/iowarrior.c @@ -154,7 +154,7 @@ MODULE_DEVICE_TABLE(usb, iowarrior_ids); */ static void iowarrior_callback(struct urb *urb) { - struct iowarrior *dev = (struct iowarrior *)urb->context; + struct iowarrior *dev = urb->context; int intr_idx; int read_idx; int aux_idx; @@ -218,7 +218,7 @@ exit: retval = usb_submit_urb(urb, GFP_ATOMIC); if (retval) dev_err(&dev->interface->dev, "%s - usb_submit_urb failed with result %d\n", - __FUNCTION__, retval); + __func__, retval); } @@ -230,7 +230,7 @@ static void iowarrior_write_callback(struct urb *urb) struct iowarrior *dev; int status = urb->status; - dev = (struct iowarrior *)urb->context; + dev = urb->context; /* sync/async unlink faults aren't errors */ if (status && !(status == -ENOENT || @@ -453,7 +453,7 @@ static ssize_t iowarrior_write(struct file *file, default: /* what do we have here ? An unsupported Product-ID ? */ dev_err(&dev->interface->dev, "%s - not supported for product=0x%x\n", - __FUNCTION__, dev->product_id); + __func__, dev->product_id); retval = -EFAULT; goto exit; break; @@ -604,7 +604,7 @@ static int iowarrior_open(struct inode *inode, struct file *file) interface = usb_find_interface(&iowarrior_driver, subminor); if (!interface) { - err("%s - error, can't find device for minor %d", __FUNCTION__, + err("%s - error, can't find device for minor %d", __func__, subminor); return -ENODEV; } diff --git a/drivers/usb/misc/ldusb.c b/drivers/usb/misc/ldusb.c index c730d20eec66..11580e81e2c6 100644 --- a/drivers/usb/misc/ldusb.c +++ b/drivers/usb/misc/ldusb.c @@ -231,7 +231,7 @@ static void ld_usb_interrupt_in_callback(struct urb *urb) goto exit; } else { dbg_info(&dev->intf->dev, "%s: nonzero status received: %d\n", - __FUNCTION__, status); + __func__, status); spin_lock(&dev->rbsl); goto resubmit; /* maybe we can recover */ } @@ -247,7 +247,7 @@ static void ld_usb_interrupt_in_callback(struct urb *urb) memcpy(actual_buffer+1, dev->interrupt_in_buffer, urb->actual_length); dev->ring_head = next_ring_head; dbg_info(&dev->intf->dev, "%s: received %d bytes\n", - __FUNCTION__, urb->actual_length); + __func__, urb->actual_length); } else { dev_warn(&dev->intf->dev, "Ring buffer overflow, %d bytes dropped\n", @@ -286,7 +286,7 @@ static void ld_usb_interrupt_out_callback(struct urb *urb) status == -ESHUTDOWN)) dbg_info(&dev->intf->dev, "%s - nonzero write interrupt status received: %d\n", - __FUNCTION__, status); + __func__, status); dev->interrupt_out_busy = 0; wake_up_interruptible(&dev->write_wait); @@ -309,7 +309,7 @@ static int ld_usb_open(struct inode *inode, struct file *file) if (!interface) { err("%s - error, can't find device for minor %d\n", - __FUNCTION__, subminor); + __func__, subminor); return -ENODEV; } @@ -556,7 +556,7 @@ static ssize_t ld_usb_write(struct file *file, const char __user *buffer, bytes_to_write = min(count, write_buffer_size*dev->interrupt_out_endpoint_size); if (bytes_to_write < count) dev_warn(&dev->intf->dev, "Write buffer overflow, %zd bytes dropped\n",count-bytes_to_write); - dbg_info(&dev->intf->dev, "%s: count = %zd, bytes_to_write = %zd\n", __FUNCTION__, count, bytes_to_write); + dbg_info(&dev->intf->dev, "%s: count = %zd, bytes_to_write = %zd\n", __func__, count, bytes_to_write); if (copy_from_user(dev->interrupt_out_buffer, buffer, bytes_to_write)) { retval = -EFAULT; diff --git a/drivers/usb/misc/legousbtower.c b/drivers/usb/misc/legousbtower.c index 6664043f4645..9370326a5940 100644 --- a/drivers/usb/misc/legousbtower.c +++ b/drivers/usb/misc/legousbtower.c @@ -31,7 +31,7 @@ * - imported into lejos project * - changed wake_up to wake_up_interruptible * - changed to use lego0 rather than tower0 - * - changed dbg() to use __func__ rather than deprecated __FUNCTION__ + * - changed dbg() to use __func__ rather than deprecated __func__ * 2003-01-12 - 0.53 david (david@csse.uwa.edu.au) * - changed read and write to write everything or * timeout (from a patch by Chris Riesen and Brett Thaeler driver) @@ -49,7 +49,7 @@ * - added poll * - forbid seeking * - added nonblocking I/O - * - changed back __func__ to __FUNCTION__ + * - changed back __func__ to __func__ * - read and log tower firmware version * - reset tower on probe, avoids failure of first write * 2004-03-09 - 0.7 Juergen Stuber <starblue@users.sourceforge.net> @@ -309,7 +309,7 @@ static inline void lego_usb_tower_debug_data (int level, const char *function, i */ static inline void tower_delete (struct lego_usb_tower *dev) { - dbg(2, "%s: enter", __FUNCTION__); + dbg(2, "%s: enter", __func__); tower_abort_transfers (dev); @@ -321,7 +321,7 @@ static inline void tower_delete (struct lego_usb_tower *dev) kfree (dev->interrupt_out_buffer); kfree (dev); - dbg(2, "%s: leave", __FUNCTION__); + dbg(2, "%s: leave", __func__); } @@ -337,7 +337,7 @@ static int tower_open (struct inode *inode, struct file *file) struct tower_reset_reply reset_reply; int result; - dbg(2, "%s: enter", __FUNCTION__); + dbg(2, "%s: enter", __func__); nonseekable_open(inode, file); subminor = iminor(inode); @@ -346,7 +346,7 @@ static int tower_open (struct inode *inode, struct file *file) if (!interface) { err ("%s - error, can't find device for minor %d", - __FUNCTION__, subminor); + __func__, subminor); retval = -ENODEV; goto exit; } @@ -424,7 +424,7 @@ unlock_exit: mutex_unlock(&dev->lock); exit: - dbg(2, "%s: leave, return value %d ", __FUNCTION__, retval); + dbg(2, "%s: leave, return value %d ", __func__, retval); return retval; } @@ -437,12 +437,12 @@ static int tower_release (struct inode *inode, struct file *file) struct lego_usb_tower *dev; int retval = 0; - dbg(2, "%s: enter", __FUNCTION__); + dbg(2, "%s: enter", __func__); dev = (struct lego_usb_tower *)file->private_data; if (dev == NULL) { - dbg(1, "%s: object is NULL", __FUNCTION__); + dbg(1, "%s: object is NULL", __func__); retval = -ENODEV; goto exit_nolock; } @@ -454,7 +454,7 @@ static int tower_release (struct inode *inode, struct file *file) } if (dev->open_count != 1) { - dbg(1, "%s: device not opened exactly once", __FUNCTION__); + dbg(1, "%s: device not opened exactly once", __func__); retval = -ENODEV; goto unlock_exit; } @@ -480,7 +480,7 @@ unlock_exit: exit: mutex_unlock(&open_disc_mutex); exit_nolock: - dbg(2, "%s: leave, return value %d", __FUNCTION__, retval); + dbg(2, "%s: leave, return value %d", __func__, retval); return retval; } @@ -491,10 +491,10 @@ exit_nolock: */ static void tower_abort_transfers (struct lego_usb_tower *dev) { - dbg(2, "%s: enter", __FUNCTION__); + dbg(2, "%s: enter", __func__); if (dev == NULL) { - dbg(1, "%s: dev is null", __FUNCTION__); + dbg(1, "%s: dev is null", __func__); goto exit; } @@ -509,7 +509,7 @@ static void tower_abort_transfers (struct lego_usb_tower *dev) usb_kill_urb(dev->interrupt_out_urb); exit: - dbg(2, "%s: leave", __FUNCTION__); + dbg(2, "%s: leave", __func__); } @@ -542,7 +542,7 @@ static unsigned int tower_poll (struct file *file, poll_table *wait) struct lego_usb_tower *dev; unsigned int mask = 0; - dbg(2, "%s: enter", __FUNCTION__); + dbg(2, "%s: enter", __func__); dev = file->private_data; @@ -557,7 +557,7 @@ static unsigned int tower_poll (struct file *file, poll_table *wait) mask |= POLLOUT | POLLWRNORM; } - dbg(2, "%s: leave, mask = %d", __FUNCTION__, mask); + dbg(2, "%s: leave, mask = %d", __func__, mask); return mask; } @@ -583,7 +583,7 @@ static ssize_t tower_read (struct file *file, char __user *buffer, size_t count, int retval = 0; unsigned long timeout = 0; - dbg(2, "%s: enter, count = %Zd", __FUNCTION__, count); + dbg(2, "%s: enter, count = %Zd", __func__, count); dev = (struct lego_usb_tower *)file->private_data; @@ -602,7 +602,7 @@ static ssize_t tower_read (struct file *file, char __user *buffer, size_t count, /* verify that we actually have some data to read */ if (count == 0) { - dbg(1, "%s: read request of 0 bytes", __FUNCTION__); + dbg(1, "%s: read request of 0 bytes", __func__); goto unlock_exit; } @@ -658,7 +658,7 @@ unlock_exit: mutex_unlock(&dev->lock); exit: - dbg(2, "%s: leave, return value %d", __FUNCTION__, retval); + dbg(2, "%s: leave, return value %d", __func__, retval); return retval; } @@ -672,7 +672,7 @@ static ssize_t tower_write (struct file *file, const char __user *buffer, size_t size_t bytes_to_write; int retval = 0; - dbg(2, "%s: enter, count = %Zd", __FUNCTION__, count); + dbg(2, "%s: enter, count = %Zd", __func__, count); dev = (struct lego_usb_tower *)file->private_data; @@ -691,7 +691,7 @@ static ssize_t tower_write (struct file *file, const char __user *buffer, size_t /* verify that we actually have some data to write */ if (count == 0) { - dbg(1, "%s: write request of 0 bytes", __FUNCTION__); + dbg(1, "%s: write request of 0 bytes", __func__); goto unlock_exit; } @@ -709,7 +709,7 @@ static ssize_t tower_write (struct file *file, const char __user *buffer, size_t /* write the data into interrupt_out_buffer from userspace */ bytes_to_write = min_t(int, count, write_buffer_size); - dbg(4, "%s: count = %Zd, bytes_to_write = %Zd", __FUNCTION__, count, bytes_to_write); + dbg(4, "%s: count = %Zd, bytes_to_write = %Zd", __func__, count, bytes_to_write); if (copy_from_user (dev->interrupt_out_buffer, buffer, bytes_to_write)) { retval = -EFAULT; @@ -742,7 +742,7 @@ unlock_exit: mutex_unlock(&dev->lock); exit: - dbg(2, "%s: leave, return value %d", __FUNCTION__, retval); + dbg(2, "%s: leave, return value %d", __func__, retval); return retval; } @@ -753,13 +753,13 @@ exit: */ static void tower_interrupt_in_callback (struct urb *urb) { - struct lego_usb_tower *dev = (struct lego_usb_tower *)urb->context; + struct lego_usb_tower *dev = urb->context; int status = urb->status; int retval; - dbg(4, "%s: enter, status %d", __FUNCTION__, status); + dbg(4, "%s: enter, status %d", __func__, status); - lego_usb_tower_debug_data(5, __FUNCTION__, urb->actual_length, urb->transfer_buffer); + lego_usb_tower_debug_data(5, __func__, urb->actual_length, urb->transfer_buffer); if (status) { if (status == -ENOENT || @@ -767,7 +767,7 @@ static void tower_interrupt_in_callback (struct urb *urb) status == -ESHUTDOWN) { goto exit; } else { - dbg(1, "%s: nonzero status received: %d", __FUNCTION__, status); + dbg(1, "%s: nonzero status received: %d", __func__, status); goto resubmit; /* maybe we can recover */ } } @@ -780,9 +780,9 @@ static void tower_interrupt_in_callback (struct urb *urb) urb->actual_length); dev->read_buffer_length += urb->actual_length; dev->read_last_arrival = jiffies; - dbg(3, "%s: received %d bytes", __FUNCTION__, urb->actual_length); + dbg(3, "%s: received %d bytes", __func__, urb->actual_length); } else { - printk(KERN_WARNING "%s: read_buffer overflow, %d bytes dropped", __FUNCTION__, urb->actual_length); + printk(KERN_WARNING "%s: read_buffer overflow, %d bytes dropped", __func__, urb->actual_length); } spin_unlock (&dev->read_buffer_lock); } @@ -792,7 +792,7 @@ resubmit: if (dev->interrupt_in_running && dev->udev) { retval = usb_submit_urb (dev->interrupt_in_urb, GFP_ATOMIC); if (retval) { - err("%s: usb_submit_urb failed (%d)", __FUNCTION__, retval); + err("%s: usb_submit_urb failed (%d)", __func__, retval); } } @@ -800,8 +800,8 @@ exit: dev->interrupt_in_done = 1; wake_up_interruptible (&dev->read_wait); - lego_usb_tower_debug_data(5, __FUNCTION__, urb->actual_length, urb->transfer_buffer); - dbg(4, "%s: leave, status %d", __FUNCTION__, status); + lego_usb_tower_debug_data(5, __func__, urb->actual_length, urb->transfer_buffer); + dbg(4, "%s: leave, status %d", __func__, status); } @@ -810,25 +810,25 @@ exit: */ static void tower_interrupt_out_callback (struct urb *urb) { - struct lego_usb_tower *dev = (struct lego_usb_tower *)urb->context; + struct lego_usb_tower *dev = urb->context; int status = urb->status; - dbg(4, "%s: enter, status %d", __FUNCTION__, status); - lego_usb_tower_debug_data(5, __FUNCTION__, urb->actual_length, urb->transfer_buffer); + dbg(4, "%s: enter, status %d", __func__, status); + lego_usb_tower_debug_data(5, __func__, urb->actual_length, urb->transfer_buffer); /* sync/async unlink faults aren't errors */ if (status && !(status == -ENOENT || status == -ECONNRESET || status == -ESHUTDOWN)) { dbg(1, "%s - nonzero write bulk status received: %d", - __FUNCTION__, status); + __func__, status); } dev->interrupt_out_busy = 0; wake_up_interruptible(&dev->write_wait); - lego_usb_tower_debug_data(5, __FUNCTION__, urb->actual_length, urb->transfer_buffer); - dbg(4, "%s: leave, status %d", __FUNCTION__, status); + lego_usb_tower_debug_data(5, __func__, urb->actual_length, urb->transfer_buffer); + dbg(4, "%s: leave, status %d", __func__, status); } @@ -849,7 +849,7 @@ static int tower_probe (struct usb_interface *interface, const struct usb_device int retval = -ENOMEM; int result; - dbg(2, "%s: enter", __FUNCTION__); + dbg(2, "%s: enter", __func__); if (udev == NULL) { info ("udev is NULL."); @@ -978,7 +978,7 @@ static int tower_probe (struct usb_interface *interface, const struct usb_device exit: - dbg(2, "%s: leave, return value 0x%.8lx (dev)", __FUNCTION__, (long) dev); + dbg(2, "%s: leave, return value 0x%.8lx (dev)", __func__, (long) dev); return retval; @@ -998,7 +998,7 @@ static void tower_disconnect (struct usb_interface *interface) struct lego_usb_tower *dev; int minor; - dbg(2, "%s: enter", __FUNCTION__); + dbg(2, "%s: enter", __func__); dev = usb_get_intfdata (interface); mutex_lock(&open_disc_mutex); @@ -1023,7 +1023,7 @@ static void tower_disconnect (struct usb_interface *interface) info("LEGO USB Tower #%d now disconnected", (minor - LEGO_USB_TOWER_MINOR_BASE)); - dbg(2, "%s: leave", __FUNCTION__); + dbg(2, "%s: leave", __func__); } @@ -1036,7 +1036,7 @@ static int __init lego_usb_tower_init(void) int result; int retval = 0; - dbg(2, "%s: enter", __FUNCTION__); + dbg(2, "%s: enter", __func__); /* register this driver with the USB subsystem */ result = usb_register(&tower_driver); @@ -1049,7 +1049,7 @@ static int __init lego_usb_tower_init(void) info(DRIVER_DESC " " DRIVER_VERSION); exit: - dbg(2, "%s: leave, return value %d", __FUNCTION__, retval); + dbg(2, "%s: leave, return value %d", __func__, retval); return retval; } @@ -1060,12 +1060,12 @@ exit: */ static void __exit lego_usb_tower_exit(void) { - dbg(2, "%s: enter", __FUNCTION__); + dbg(2, "%s: enter", __func__); /* deregister this driver with the USB subsystem */ usb_deregister (&tower_driver); - dbg(2, "%s: leave", __FUNCTION__); + dbg(2, "%s: leave", __func__); } module_init (lego_usb_tower_init); diff --git a/drivers/usb/misc/phidgetkit.c b/drivers/usb/misc/phidgetkit.c index aa9bcceabe74..24230c638b8e 100644 --- a/drivers/usb/misc/phidgetkit.c +++ b/drivers/usb/misc/phidgetkit.c @@ -113,7 +113,7 @@ static int set_outputs(struct interfacekit *kit) buffer = kzalloc(4, GFP_KERNEL); if (!buffer) { - dev_err(&kit->udev->dev, "%s - out of memory\n", __FUNCTION__); + dev_err(&kit->udev->dev, "%s - out of memory\n", __func__); return -ENOMEM; } buffer[0] = (u8)kit->outputs; @@ -146,7 +146,7 @@ static int change_string(struct interfacekit *kit, const char *display, unsigned buffer = kmalloc(8, GFP_KERNEL); form_buffer = kmalloc(30, GFP_KERNEL); if ((!buffer) || (!form_buffer)) { - dev_err(&kit->udev->dev, "%s - out of memory\n", __FUNCTION__); + dev_err(&kit->udev->dev, "%s - out of memory\n", __func__); goto exit; } @@ -216,7 +216,7 @@ static ssize_t set_backlight(struct device *dev, struct device_attribute *attr, buffer = kzalloc(8, GFP_KERNEL); if (!buffer) { - dev_err(&kit->udev->dev, "%s - out of memory\n", __FUNCTION__); + dev_err(&kit->udev->dev, "%s - out of memory\n", __func__); goto exit; } diff --git a/drivers/usb/misc/phidgetmotorcontrol.c b/drivers/usb/misc/phidgetmotorcontrol.c index 2ad09b1f4848..f0113c17cc5a 100644 --- a/drivers/usb/misc/phidgetmotorcontrol.c +++ b/drivers/usb/misc/phidgetmotorcontrol.c @@ -61,7 +61,7 @@ static int set_motor(struct motorcontrol *mc, int motor) buffer = kzalloc(8, GFP_KERNEL); if (!buffer) { - dev_err(&mc->intf->dev, "%s - out of memory\n", __FUNCTION__); + dev_err(&mc->intf->dev, "%s - out of memory\n", __func__); return -ENOMEM; } diff --git a/drivers/usb/misc/phidgetservo.c b/drivers/usb/misc/phidgetservo.c index 0d9de2f73930..7d590c09434a 100644 --- a/drivers/usb/misc/phidgetservo.c +++ b/drivers/usb/misc/phidgetservo.c @@ -89,7 +89,7 @@ change_position_v30(struct phidget_servo *servo, int servo_no, int degrees, buffer = kmalloc(6, GFP_KERNEL); if (!buffer) { dev_err(&servo->udev->dev, "%s - out of memory\n", - __FUNCTION__); + __func__); return -ENOMEM; } @@ -162,7 +162,7 @@ change_position_v20(struct phidget_servo *servo, int servo_no, int degrees, buffer = kmalloc(2, GFP_KERNEL); if (!buffer) { dev_err(&servo->udev->dev, "%s - out of memory\n", - __FUNCTION__); + __func__); return -ENOMEM; } @@ -259,7 +259,7 @@ servo_probe(struct usb_interface *interface, const struct usb_device_id *id) dev = kzalloc(sizeof (struct phidget_servo), GFP_KERNEL); if (dev == NULL) { - dev_err(&interface->dev, "%s - out of memory\n", __FUNCTION__); + dev_err(&interface->dev, "%s - out of memory\n", __func__); rc = -ENOMEM; goto out; } diff --git a/drivers/usb/misc/usblcd.c b/drivers/usb/misc/usblcd.c index 20777d01db62..7f7021ee4189 100644 --- a/drivers/usb/misc/usblcd.c +++ b/drivers/usb/misc/usblcd.c @@ -78,7 +78,7 @@ static int lcd_open(struct inode *inode, struct file *file) interface = usb_find_interface(&lcd_driver, subminor); if (!interface) { err ("USBLCD: %s - error, can't find device for minor %d", - __FUNCTION__, subminor); + __func__, subminor); return -ENODEV; } @@ -185,7 +185,7 @@ static void lcd_write_bulk_callback(struct urb *urb) struct usb_lcd *dev; int status = urb->status; - dev = (struct usb_lcd *)urb->context; + dev = urb->context; /* sync/async unlink faults aren't errors */ if (status && @@ -193,7 +193,7 @@ static void lcd_write_bulk_callback(struct urb *urb) status == -ECONNRESET || status == -ESHUTDOWN)) { dbg("USBLCD: %s - nonzero write bulk status received: %d", - __FUNCTION__, status); + __func__, status); } /* free up our allocated buffer */ @@ -248,7 +248,7 @@ static ssize_t lcd_write(struct file *file, const char __user * user_buffer, siz /* send the data out the bulk port */ retval = usb_submit_urb(urb, GFP_KERNEL); if (retval) { - err("USBLCD: %s - failed submitting write urb, error %d", __FUNCTION__, retval); + err("USBLCD: %s - failed submitting write urb, error %d", __func__, retval); goto error_unanchor; } diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c index b6b5b2affad1..a51983854ca0 100644 --- a/drivers/usb/misc/usbtest.c +++ b/drivers/usb/misc/usbtest.c @@ -201,7 +201,7 @@ found: static void simple_callback (struct urb *urb) { - complete ((struct completion *) urb->context); + complete(urb->context); } static struct urb *simple_alloc_urb ( @@ -1046,7 +1046,7 @@ static void unlink1_callback (struct urb *urb) status = usb_submit_urb (urb, GFP_ATOMIC); if (status) { urb->status = status; - complete ((struct completion *) urb->context); + complete(urb->context); } } @@ -1136,7 +1136,7 @@ static int verify_not_halted (int ep, struct urb *urb) dbg ("ep %02x bogus status: %04x != 0", ep, status); return -EINVAL; } - retval = simple_io (urb, 1, 0, 0, __FUNCTION__); + retval = simple_io (urb, 1, 0, 0, __func__); if (retval != 0) return -EINVAL; return 0; @@ -1158,7 +1158,7 @@ static int verify_halted (int ep, struct urb *urb) dbg ("ep %02x bogus status: %04x != 1", ep, status); return -EINVAL; } - retval = simple_io (urb, 1, 0, -EPIPE, __FUNCTION__); + retval = simple_io (urb, 1, 0, -EPIPE, __func__); if (retval != -EPIPE) return -EINVAL; retval = simple_io (urb, 1, 0, -EPIPE, "verify_still_halted"); @@ -1404,7 +1404,7 @@ static struct urb *iso_alloc_urb ( return NULL; maxp = 0x7ff & le16_to_cpu(desc->wMaxPacketSize); maxp *= 1 + (0x3 & (le16_to_cpu(desc->wMaxPacketSize) >> 11)); - packets = (bytes + maxp - 1) / maxp; + packets = DIV_ROUND_UP(bytes, maxp); urb = usb_alloc_urb (packets, GFP_KERNEL); if (!urb) @@ -1564,7 +1564,8 @@ usbtest_ioctl (struct usb_interface *intf, unsigned int code, void *buf) if (mutex_lock_interruptible(&dev->lock)) return -ERESTARTSYS; - if (intf->dev.power.power_state.event != PM_EVENT_ON) { + /* FIXME: What if a system sleep starts while a test is running? */ + if (!intf->is_active) { mutex_unlock(&dev->lock); return -EHOSTUNREACH; } |