VServer 1.9.2 (patch-2.6.8.1-vs1.9.2.diff)
[linux-2.6.git] / drivers / usb / core / devio.c
index 2979912..6f969a4 100644 (file)
@@ -269,7 +269,7 @@ static void async_completed(struct urb *urb, struct pt_regs *regs)
                sinfo.si_signo = as->signr;
                sinfo.si_errno = as->urb->status;
                sinfo.si_code = SI_ASYNCIO;
-               sinfo.si_addr = (void *)as->userurb;
+               sinfo.si_addr = as->userurb;
                send_sig_info(as->signr, &sinfo, as->task);
        }
         wake_up(&ps->wait);
@@ -290,8 +290,11 @@ static void destroy_async (struct dev_state *ps, struct list_head *list)
                spin_lock_irqsave(&ps->lock, flags);
        }
        spin_unlock_irqrestore(&ps->lock, flags);
-       while ((as = async_getcompleted(ps)))
+       as = async_getcompleted(ps);
+       while (as) {
                free_async(as);
+               as = async_getcompleted(ps);
+       }
 }
 
 static void destroy_async_on_interface (struct dev_state *ps, unsigned int ifnum)
@@ -558,7 +561,7 @@ static int proc_control(struct dev_state *ps, void __user *arg)
                        if (usbfs_snoop) {
                                dev_info(&dev->dev, "control read: data ");
                                for (j = 0; j < ctrl.wLength; ++j)
-                                       printk ("%02x ", (unsigned char)((char *)ctrl.data)[j]);
+                                       printk ("%02x ", (unsigned char)(tbuf)[j]);
                                printk("\n");
                        }
                        if (copy_to_user(ctrl.data, tbuf, ctrl.wLength)) {
@@ -578,7 +581,7 @@ static int proc_control(struct dev_state *ps, void __user *arg)
                if (usbfs_snoop) {
                        dev_info(&dev->dev, "control write: data: ");
                        for (j = 0; j < ctrl.wLength; ++j)
-                               printk ("%02x ", (unsigned char)((char *)ctrl.data)[j]);
+                               printk ("%02x ", (unsigned char)(tbuf)[j]);
                        printk("\n");
                }
                i = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), ctrl.bRequest, ctrl.bRequestType,
@@ -968,29 +971,27 @@ static int proc_unlinkurb(struct dev_state *ps, void __user *arg)
 static int processcompl(struct async *as)
 {
        struct urb *urb = as->urb;
+       struct usbdevfs_urb __user *userurb = as->userurb;
        unsigned int i;
 
        if (as->userbuffer)
                if (copy_to_user(as->userbuffer, urb->transfer_buffer, urb->transfer_buffer_length))
                        return -EFAULT;
-       if (put_user(urb->status,
-                    &((struct usbdevfs_urb *)as->userurb)->status))
+       if (put_user(urb->status, &userurb->status))
                return -EFAULT;
-       if (put_user(urb->actual_length,
-                    &((struct usbdevfs_urb *)as->userurb)->actual_length))
+       if (put_user(urb->actual_length, &userurb->actual_length))
                return -EFAULT;
-       if (put_user(urb->error_count,
-                    &((struct usbdevfs_urb *)as->userurb)->error_count))
+       if (put_user(urb->error_count, &userurb->error_count))
                return -EFAULT;
 
        if (!(usb_pipeisoc(urb->pipe)))
                return 0;
        for (i = 0; i < urb->number_of_packets; i++) {
                if (put_user(urb->iso_frame_desc[i].actual_length,
-                            &((struct usbdevfs_urb *)as->userurb)->iso_frame_desc[i].actual_length))
+                            &userurb->iso_frame_desc[i].actual_length))
                        return -EFAULT;
                if (put_user(urb->iso_frame_desc[i].status,
-                            &((struct usbdevfs_urb *)as->userurb)->iso_frame_desc[i].status))
+                            &userurb->iso_frame_desc[i].status))
                        return -EFAULT;
        }
        return 0;
@@ -1089,10 +1090,10 @@ static int proc_ioctl (struct dev_state *ps, void __user *arg)
 {
        struct usbdevfs_ioctl   ctrl;
        int                     size;
-       void                    *buf = 0;
+       void                    *buf = NULL;
        int                     retval = 0;
-       struct usb_interface    *intf = 0;
-       struct usb_driver       *driver = 0;
+       struct usb_interface    *intf = NULL;
+       struct usb_driver       *driver = NULL;
 
        /* get input parameters and alloc buffer */
        if (copy_from_user(&ctrl, arg, sizeof (ctrl)))