Commit ab8c77a9 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

[PATCH] USB: fix up sparse warnings in drivers/usb/class/*

parent c993621b
......@@ -541,7 +541,7 @@ static void dmabuf_copyin(struct dmabuf *db, const void *buffer, unsigned int si
pgrem = rem;
memcpy((db->sgbuf[db->wrptr >> PAGE_SHIFT]) + (db->wrptr & (PAGE_SIZE-1)), buffer, pgrem);
size -= pgrem;
(char *)buffer += pgrem;
buffer += pgrem;
db->wrptr += pgrem;
if (db->wrptr >= db->dmasize)
db->wrptr = 0;
......@@ -564,14 +564,14 @@ static void dmabuf_copyout(struct dmabuf *db, void *buffer, unsigned int size)
pgrem = rem;
memcpy(buffer, (db->sgbuf[db->rdptr >> PAGE_SHIFT]) + (db->rdptr & (PAGE_SIZE-1)), pgrem);
size -= pgrem;
(char *)buffer += pgrem;
buffer += pgrem;
db->rdptr += pgrem;
if (db->rdptr >= db->dmasize)
db->rdptr = 0;
}
}
static int dmabuf_copyin_user(struct dmabuf *db, unsigned int ptr, const void *buffer, unsigned int size)
static int dmabuf_copyin_user(struct dmabuf *db, unsigned int ptr, const void __user *buffer, unsigned int size)
{
unsigned int pgrem, rem;
......@@ -589,14 +589,14 @@ static int dmabuf_copyin_user(struct dmabuf *db, unsigned int ptr, const void *b
if (copy_from_user((db->sgbuf[ptr >> PAGE_SHIFT]) + (ptr & (PAGE_SIZE-1)), buffer, pgrem))
return -EFAULT;
size -= pgrem;
(char *)buffer += pgrem;
buffer += pgrem;
ptr += pgrem;
if (ptr >= db->dmasize)
ptr = 0;
}
}
static int dmabuf_copyout_user(struct dmabuf *db, unsigned int ptr, void *buffer, unsigned int size)
static int dmabuf_copyout_user(struct dmabuf *db, unsigned int ptr, void __user *buffer, unsigned int size)
{
unsigned int pgrem, rem;
......@@ -614,7 +614,7 @@ static int dmabuf_copyout_user(struct dmabuf *db, unsigned int ptr, void *buffer
if (copy_to_user(buffer, (db->sgbuf[ptr >> PAGE_SHIFT]) + (ptr & (PAGE_SIZE-1)), pgrem))
return -EFAULT;
size -= pgrem;
(char *)buffer += pgrem;
buffer += pgrem;
ptr += pgrem;
if (ptr >= db->dmasize)
ptr = 0;
......@@ -2010,7 +2010,7 @@ static int usb_audio_ioctl_mixdev(struct inode *inode, struct file *file, unsign
strncpy(info.id, "USB_AUDIO", sizeof(info.id));
strncpy(info.name, "USB Audio Class Driver", sizeof(info.name));
info.modify_counter = ms->modcnt;
if (copy_to_user((void *)arg, &info, sizeof(info)))
if (copy_to_user((void __user *)arg, &info, sizeof(info)))
return -EFAULT;
return 0;
}
......@@ -2018,7 +2018,7 @@ static int usb_audio_ioctl_mixdev(struct inode *inode, struct file *file, unsign
_old_mixer_info info;
strncpy(info.id, "USB_AUDIO", sizeof(info.id));
strncpy(info.name, "USB Audio Class Driver", sizeof(info.name));
if (copy_to_user((void *)arg, &info, sizeof(info)))
if (copy_to_user((void __user *)arg, &info, sizeof(info)))
return -EFAULT;
return 0;
}
......@@ -2140,7 +2140,7 @@ static int drain_out(struct usb_audiodev *as, int nonblock)
/* --------------------------------------------------------------------- */
static ssize_t usb_audio_read(struct file *file, char *buffer, size_t count, loff_t *ppos)
static ssize_t usb_audio_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
{
struct usb_audiodev *as = (struct usb_audiodev *)file->private_data;
DECLARE_WAITQUEUE(wait, current);
......@@ -2208,7 +2208,7 @@ static ssize_t usb_audio_read(struct file *file, char *buffer, size_t count, lof
return ret;
}
static ssize_t usb_audio_write(struct file *file, const char *buffer, size_t count, loff_t *ppos)
static ssize_t usb_audio_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos)
{
struct usb_audiodev *as = (struct usb_audiodev *)file->private_data;
DECLARE_WAITQUEUE(wait, current);
......@@ -2507,7 +2507,7 @@ static int usb_audio_ioctl(struct inode *inode, struct file *file, unsigned int
abinfo.fragstotal = as->usbout.dma.numfrag;
abinfo.fragments = abinfo.bytes >> as->usbout.dma.fragshift;
spin_unlock_irqrestore(&as->lock, flags);
return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
return copy_to_user((void __user *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
case SNDCTL_DSP_GETISPACE:
if (!(file->f_mode & FMODE_READ))
......@@ -2520,7 +2520,7 @@ static int usb_audio_ioctl(struct inode *inode, struct file *file, unsigned int
abinfo.fragstotal = as->usbin.dma.numfrag;
abinfo.fragments = abinfo.bytes >> as->usbin.dma.fragshift;
spin_unlock_irqrestore(&as->lock, flags);
return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
return copy_to_user((void __user *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
case SNDCTL_DSP_NONBLOCK:
file->f_flags |= O_NONBLOCK;
......@@ -2544,7 +2544,7 @@ static int usb_audio_ioctl(struct inode *inode, struct file *file, unsigned int
if (as->usbin.dma.mapped)
as->usbin.dma.count &= as->usbin.dma.fragsize-1;
spin_unlock_irqrestore(&as->lock, flags);
if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo)))
if (copy_to_user((void __user *)arg, &cinfo, sizeof(cinfo)))
return -EFAULT;
return 0;
......@@ -2558,7 +2558,7 @@ static int usb_audio_ioctl(struct inode *inode, struct file *file, unsigned int
if (as->usbout.dma.mapped)
as->usbout.dma.count &= as->usbout.dma.fragsize-1;
spin_unlock_irqrestore(&as->lock, flags);
if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo)))
if (copy_to_user((void __user *)arg, &cinfo, sizeof(cinfo)))
return -EFAULT;
return 0;
......
......@@ -484,7 +484,7 @@ static int bluetooth_write (struct tty_struct * tty, int from_user, const unsign
retval = -ENOMEM;
goto exit;
}
if (copy_from_user (temp_buffer, buf, count)) {
if (copy_from_user (temp_buffer, (void __user *)buf, count)) {
retval = -EFAULT;
goto exit;
}
......
......@@ -388,7 +388,7 @@ static int acm_tty_write(struct tty_struct *tty, int from_user, const unsigned c
count = (count > acm->writesize) ? acm->writesize : count;
if (from_user) {
if (copy_from_user(acm->writeurb->transfer_buffer, buf, count))
if (copy_from_user(acm->writeurb->transfer_buffer, (void __user *)buf, count))
return -EFAULT;
} else
memcpy(acm->writeurb->transfer_buffer, buf, count);
......
......@@ -642,7 +642,7 @@ static loff_t usb_midi_llseek(struct file *file, loff_t offset, int origin)
*
**/
static ssize_t usb_midi_read(struct file *file, char *buffer, size_t count, loff_t *ppos)
static ssize_t usb_midi_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
{
struct usb_mididev *m = (struct usb_mididev *)file->private_data;
struct midi_in_endpoint *ep = m->min.ep;
......@@ -725,7 +725,7 @@ static ssize_t usb_midi_read(struct file *file, char *buffer, size_t count, loff
*
**/
static ssize_t usb_midi_write(struct file *file, const char *buffer, size_t count, loff_t *ppos)
static ssize_t usb_midi_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos)
{
struct usb_mididev *m = (struct usb_mididev *)file->private_data;
ssize_t ret;
......
......@@ -455,7 +455,7 @@ static int usblp_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
if (length > _IOC_SIZE(cmd))
length = _IOC_SIZE(cmd); /* truncate */
if (copy_to_user((unsigned char *) arg,
if (copy_to_user((void __user *) arg,
usblp->device_id_string,
(unsigned long) length)) {
retval = -EFAULT;
......@@ -479,7 +479,7 @@ static int usblp_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
twoints[1] |= (1<<i);
}
if (copy_to_user((unsigned char *)arg,
if (copy_to_user((void __user *)arg,
(unsigned char *)twoints,
sizeof(twoints))) {
retval = -EFAULT;
......@@ -540,7 +540,7 @@ static int usblp_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
twoints[0] = usblp->dev->bus->busnum;
twoints[1] = usblp->dev->devnum;
if (copy_to_user((unsigned char *)arg,
if (copy_to_user((void __user *)arg,
(unsigned char *)twoints,
sizeof(twoints))) {
retval = -EFAULT;
......@@ -560,7 +560,7 @@ static int usblp_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
twoints[0] = usblp->dev->descriptor.idVendor;
twoints[1] = usblp->dev->descriptor.idProduct;
if (copy_to_user((unsigned char *)arg,
if (copy_to_user((void __user *)arg,
(unsigned char *)twoints,
sizeof(twoints))) {
retval = -EFAULT;
......@@ -584,7 +584,7 @@ static int usblp_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
goto done;
}
status = *usblp->statusbuf;
if (copy_to_user ((int *)arg, &status, sizeof(int)))
if (copy_to_user ((void __user *)arg, &status, sizeof(int)))
retval = -EFAULT;
break;
......@@ -597,7 +597,7 @@ static int usblp_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
return retval;
}
static ssize_t usblp_write(struct file *file, const char *buffer, size_t count, loff_t *ppos)
static ssize_t usblp_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos)
{
DECLARE_WAITQUEUE(wait, current);
struct usblp *usblp = file->private_data;
......@@ -682,7 +682,7 @@ static ssize_t usblp_write(struct file *file, const char *buffer, size_t count,
return count;
}
static ssize_t usblp_read(struct file *file, char *buffer, size_t count, loff_t *ppos)
static ssize_t usblp_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
{
struct usblp *usblp = file->private_data;
DECLARE_WAITQUEUE(wait, current);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment