[PATCH] drivers/input/joystick: convert to dynamic input_dev allocation
[powerpc.git] / drivers / input / joystick / iforce / iforce-usb.c
index 6369a24..64b4a30 100644 (file)
@@ -95,6 +95,7 @@ static void iforce_usb_irq(struct urb *urb, struct pt_regs *regs)
                goto exit;
        }
 
+       wake_up(&iforce->wait);
        iforce_process_packet(iforce,
                (iforce->data[0] << 8) | (urb->actual_length - 1), iforce->data + 1, regs);
 
@@ -134,28 +135,24 @@ static int iforce_usb_probe(struct usb_interface *intf,
        struct usb_host_interface *interface;
        struct usb_endpoint_descriptor *epirq, *epout;
        struct iforce *iforce;
+       int err = -ENOMEM;
 
        interface = intf->cur_altsetting;
 
        epirq = &interface->endpoint[0].desc;
        epout = &interface->endpoint[1].desc;
 
-       if (!(iforce = kmalloc(sizeof(struct iforce) + 32, GFP_KERNEL)))
+       if (!(iforce = kzalloc(sizeof(struct iforce) + 32, GFP_KERNEL)))
                goto fail;
 
-       memset(iforce, 0, sizeof(struct iforce));
-
-       if (!(iforce->irq = usb_alloc_urb(0, GFP_KERNEL))) {
+       if (!(iforce->irq = usb_alloc_urb(0, GFP_KERNEL)))
                goto fail;
-       }
 
-       if (!(iforce->out = usb_alloc_urb(0, GFP_KERNEL))) {
+       if (!(iforce->out = usb_alloc_urb(0, GFP_KERNEL)))
                goto fail;
-       }
 
-       if (!(iforce->ctrl = usb_alloc_urb(0, GFP_KERNEL))) {
+       if (!(iforce->ctrl = usb_alloc_urb(0, GFP_KERNEL)))
                goto fail;
-       }
 
        iforce->bus = IFORCE_USB;
        iforce->usbdev = dev;
@@ -173,7 +170,9 @@ static int iforce_usb_probe(struct usb_interface *intf,
        usb_fill_control_urb(iforce->ctrl, dev, usb_rcvctrlpipe(dev, 0),
                        (void*) &iforce->cr, iforce->edata, 16, iforce_usb_ctrl, iforce);
 
-       if (iforce_init_device(iforce)) goto fail;
+       err = iforce_init_device(iforce);
+       if (err)
+               goto fail;
 
        usb_set_intfdata(intf, iforce);
        return 0;
@@ -186,7 +185,7 @@ fail:
                kfree(iforce);
        }
 
-       return -ENODEV;
+       return err;
 }
 
 /* Called by iforce_delete() */
@@ -210,7 +209,7 @@ static void iforce_usb_disconnect(struct usb_interface *intf)
        usb_set_intfdata(intf, NULL);
        if (iforce) {
                iforce->usbdev = NULL;
-               input_unregister_device(&iforce->dev);
+               input_unregister_device(iforce->dev);
 
                if (!open) {
                        iforce_delete_device(iforce);