Commit ec17cf1c authored by Tobias Klauser's avatar Tobias Klauser Committed by Greg Kroah-Hartman

USB: Remove unneeded void * casts in core files

The patch removes unneeded casts for the following (void *) pointers:
 - struct file: private
 - struct urb: context
 - struct usb_bus: hcpriv
 - return value of kmalloc()

The patch also contains some whitespace cleanup in the relevant areas.
Signed-off-by: default avatarTobias Klauser <tklauser@distanz.ch>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent d774efea
...@@ -593,7 +593,7 @@ static ssize_t usb_device_read(struct file *file, char __user *buf, size_t nbyte ...@@ -593,7 +593,7 @@ static ssize_t usb_device_read(struct file *file, char __user *buf, size_t nbyte
/* Kernel lock for "lastev" protection */ /* Kernel lock for "lastev" protection */
static unsigned int usb_device_poll(struct file *file, struct poll_table_struct *wait) static unsigned int usb_device_poll(struct file *file, struct poll_table_struct *wait)
{ {
struct usb_device_status *st = (struct usb_device_status *)file->private_data; struct usb_device_status *st = file->private_data;
unsigned int mask = 0; unsigned int mask = 0;
lock_kernel(); lock_kernel();
......
...@@ -122,7 +122,7 @@ static loff_t usbdev_lseek(struct file *file, loff_t offset, int orig) ...@@ -122,7 +122,7 @@ static loff_t usbdev_lseek(struct file *file, loff_t offset, int orig)
static ssize_t usbdev_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos) static ssize_t usbdev_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos)
{ {
struct dev_state *ps = (struct dev_state *)file->private_data; struct dev_state *ps = file->private_data;
struct usb_device *dev = ps->dev; struct usb_device *dev = ps->dev;
ssize_t ret = 0; ssize_t ret = 0;
unsigned len; unsigned len;
...@@ -305,7 +305,7 @@ static void snoop_urb(struct urb *urb, void __user *userurb) ...@@ -305,7 +305,7 @@ static void snoop_urb(struct urb *urb, void __user *userurb)
static void async_completed(struct urb *urb, struct pt_regs *regs) static void async_completed(struct urb *urb, struct pt_regs *regs)
{ {
struct async *as = (struct async *)urb->context; struct async *as = urb->context;
struct dev_state *ps = as->ps; struct dev_state *ps = as->ps;
struct siginfo sinfo; struct siginfo sinfo;
...@@ -591,7 +591,7 @@ static int usbdev_open(struct inode *inode, struct file *file) ...@@ -591,7 +591,7 @@ static int usbdev_open(struct inode *inode, struct file *file)
static int usbdev_release(struct inode *inode, struct file *file) static int usbdev_release(struct inode *inode, struct file *file)
{ {
struct dev_state *ps = (struct dev_state *)file->private_data; struct dev_state *ps = file->private_data;
struct usb_device *dev = ps->dev; struct usb_device *dev = ps->dev;
unsigned int ifnum; unsigned int ifnum;
...@@ -1423,7 +1423,7 @@ static int proc_ioctl_compat(struct dev_state *ps, compat_uptr_t arg) ...@@ -1423,7 +1423,7 @@ static int proc_ioctl_compat(struct dev_state *ps, compat_uptr_t arg)
*/ */
static int usbdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) static int usbdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
{ {
struct dev_state *ps = (struct dev_state *)file->private_data; struct dev_state *ps = file->private_data;
struct usb_device *dev = ps->dev; struct usb_device *dev = ps->dev;
void __user *p = (void __user *)arg; void __user *p = (void __user *)arg;
int ret = -ENOTTY; int ret = -ENOTTY;
...@@ -1566,7 +1566,7 @@ static int usbdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd ...@@ -1566,7 +1566,7 @@ static int usbdev_ioctl(struct inode *inode, struct file *file, unsigned int cmd
/* No kernel lock - fine */ /* No kernel lock - fine */
static unsigned int usbdev_poll(struct file *file, struct poll_table_struct *wait) static unsigned int usbdev_poll(struct file *file, struct poll_table_struct *wait)
{ {
struct dev_state *ps = (struct dev_state *)file->private_data; struct dev_state *ps = file->private_data;
unsigned int mask = 0; unsigned int mask = 0;
poll_wait(file, &ps->wait, wait); poll_wait(file, &ps->wait, wait);
......
...@@ -293,7 +293,7 @@ void usb_kick_khubd(struct usb_device *hdev) ...@@ -293,7 +293,7 @@ void usb_kick_khubd(struct usb_device *hdev)
/* completion function, fires on port status changes and various faults */ /* completion function, fires on port status changes and various faults */
static void hub_irq(struct urb *urb, struct pt_regs *regs) static void hub_irq(struct urb *urb, struct pt_regs *regs)
{ {
struct usb_hub *hub = (struct usb_hub *)urb->context; struct usb_hub *hub = urb->context;
int status; int status;
int i; int i;
unsigned long bits; unsigned long bits;
......
...@@ -248,7 +248,7 @@ static void sg_clean (struct usb_sg_request *io) ...@@ -248,7 +248,7 @@ static void sg_clean (struct usb_sg_request *io)
static void sg_complete (struct urb *urb, struct pt_regs *regs) static void sg_complete (struct urb *urb, struct pt_regs *regs)
{ {
struct usb_sg_request *io = (struct usb_sg_request *) urb->context; struct usb_sg_request *io = urb->context;
spin_lock (&io->lock); spin_lock (&io->lock);
......
...@@ -57,7 +57,7 @@ struct urb *usb_alloc_urb(int iso_packets, gfp_t mem_flags) ...@@ -57,7 +57,7 @@ struct urb *usb_alloc_urb(int iso_packets, gfp_t mem_flags)
{ {
struct urb *urb; struct urb *urb;
urb = (struct urb *)kmalloc(sizeof(struct urb) + urb = kmalloc(sizeof(struct urb) +
iso_packets * sizeof(struct usb_iso_packet_descriptor), iso_packets * sizeof(struct usb_iso_packet_descriptor),
mem_flags); mem_flags);
if (!urb) { if (!urb) {
......
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