diff options
Diffstat (limited to 'drivers/usb/input/appletouch.c')
-rw-r--r-- | drivers/usb/input/appletouch.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/drivers/usb/input/appletouch.c b/drivers/usb/input/appletouch.c index c77291d3d063..e3215267db11 100644 --- a/drivers/usb/input/appletouch.c +++ b/drivers/usb/input/appletouch.c | |||
@@ -466,7 +466,7 @@ exit: | |||
466 | 466 | ||
467 | static int atp_open(struct input_dev *input) | 467 | static int atp_open(struct input_dev *input) |
468 | { | 468 | { |
469 | struct atp *dev = input->private; | 469 | struct atp *dev = input_get_drvdata(input); |
470 | 470 | ||
471 | if (usb_submit_urb(dev->urb, GFP_ATOMIC)) | 471 | if (usb_submit_urb(dev->urb, GFP_ATOMIC)) |
472 | return -EIO; | 472 | return -EIO; |
@@ -477,7 +477,7 @@ static int atp_open(struct input_dev *input) | |||
477 | 477 | ||
478 | static void atp_close(struct input_dev *input) | 478 | static void atp_close(struct input_dev *input) |
479 | { | 479 | { |
480 | struct atp *dev = input->private; | 480 | struct atp *dev = input_get_drvdata(input); |
481 | 481 | ||
482 | usb_kill_urb(dev->urb); | 482 | usb_kill_urb(dev->urb); |
483 | dev->open = 0; | 483 | dev->open = 0; |
@@ -491,8 +491,7 @@ static int atp_probe(struct usb_interface *iface, const struct usb_device_id *id | |||
491 | struct usb_host_interface *iface_desc; | 491 | struct usb_host_interface *iface_desc; |
492 | struct usb_endpoint_descriptor *endpoint; | 492 | struct usb_endpoint_descriptor *endpoint; |
493 | int int_in_endpointAddr = 0; | 493 | int int_in_endpointAddr = 0; |
494 | int i, retval = -ENOMEM; | 494 | int i, error = -ENOMEM; |
495 | |||
496 | 495 | ||
497 | /* set up the endpoint information */ | 496 | /* set up the endpoint information */ |
498 | /* use only the first interrupt-in endpoint */ | 497 | /* use only the first interrupt-in endpoint */ |
@@ -567,17 +566,13 @@ static int atp_probe(struct usb_interface *iface, const struct usb_device_id *id | |||
567 | } | 566 | } |
568 | 567 | ||
569 | dev->urb = usb_alloc_urb(0, GFP_KERNEL); | 568 | dev->urb = usb_alloc_urb(0, GFP_KERNEL); |
570 | if (!dev->urb) { | 569 | if (!dev->urb) |
571 | retval = -ENOMEM; | ||
572 | goto err_free_devs; | 570 | goto err_free_devs; |
573 | } | ||
574 | 571 | ||
575 | dev->data = usb_buffer_alloc(dev->udev, dev->datalen, GFP_KERNEL, | 572 | dev->data = usb_buffer_alloc(dev->udev, dev->datalen, GFP_KERNEL, |
576 | &dev->urb->transfer_dma); | 573 | &dev->urb->transfer_dma); |
577 | if (!dev->data) { | 574 | if (!dev->data) |
578 | retval = -ENOMEM; | ||
579 | goto err_free_urb; | 575 | goto err_free_urb; |
580 | } | ||
581 | 576 | ||
582 | usb_fill_int_urb(dev->urb, udev, | 577 | usb_fill_int_urb(dev->urb, udev, |
583 | usb_rcvintpipe(udev, int_in_endpointAddr), | 578 | usb_rcvintpipe(udev, int_in_endpointAddr), |
@@ -589,9 +584,10 @@ static int atp_probe(struct usb_interface *iface, const struct usb_device_id *id | |||
589 | input_dev->name = "appletouch"; | 584 | input_dev->name = "appletouch"; |
590 | input_dev->phys = dev->phys; | 585 | input_dev->phys = dev->phys; |
591 | usb_to_input_id(dev->udev, &input_dev->id); | 586 | usb_to_input_id(dev->udev, &input_dev->id); |
592 | input_dev->cdev.dev = &iface->dev; | 587 | input_dev->dev.parent = &iface->dev; |
588 | |||
589 | input_set_drvdata(input_dev, dev); | ||
593 | 590 | ||
594 | input_dev->private = dev; | ||
595 | input_dev->open = atp_open; | 591 | input_dev->open = atp_open; |
596 | input_dev->close = atp_close; | 592 | input_dev->close = atp_close; |
597 | 593 | ||
@@ -633,20 +629,25 @@ static int atp_probe(struct usb_interface *iface, const struct usb_device_id *id | |||
633 | set_bit(BTN_TOOL_TRIPLETAP, input_dev->keybit); | 629 | set_bit(BTN_TOOL_TRIPLETAP, input_dev->keybit); |
634 | set_bit(BTN_LEFT, input_dev->keybit); | 630 | set_bit(BTN_LEFT, input_dev->keybit); |
635 | 631 | ||
636 | input_register_device(dev->input); | 632 | error = input_register_device(dev->input); |
633 | if (error) | ||
634 | goto err_free_buffer; | ||
637 | 635 | ||
638 | /* save our data pointer in this interface device */ | 636 | /* save our data pointer in this interface device */ |
639 | usb_set_intfdata(iface, dev); | 637 | usb_set_intfdata(iface, dev); |
640 | 638 | ||
641 | return 0; | 639 | return 0; |
642 | 640 | ||
641 | err_free_buffer: | ||
642 | usb_buffer_free(dev->udev, dev->datalen, | ||
643 | dev->data, dev->urb->transfer_dma); | ||
643 | err_free_urb: | 644 | err_free_urb: |
644 | usb_free_urb(dev->urb); | 645 | usb_free_urb(dev->urb); |
645 | err_free_devs: | 646 | err_free_devs: |
646 | usb_set_intfdata(iface, NULL); | 647 | usb_set_intfdata(iface, NULL); |
647 | kfree(dev); | 648 | kfree(dev); |
648 | input_free_device(input_dev); | 649 | input_free_device(input_dev); |
649 | return retval; | 650 | return error; |
650 | } | 651 | } |
651 | 652 | ||
652 | static void atp_disconnect(struct usb_interface *iface) | 653 | static void atp_disconnect(struct usb_interface *iface) |