diff options
Diffstat (limited to 'drivers/usb/input/keyspan_remote.c')
-rw-r--r-- | drivers/usb/input/keyspan_remote.c | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/drivers/usb/input/keyspan_remote.c b/drivers/usb/input/keyspan_remote.c index 98bd323369c7..1bffc9fa98c2 100644 --- a/drivers/usb/input/keyspan_remote.c +++ b/drivers/usb/input/keyspan_remote.c | |||
@@ -394,7 +394,7 @@ resubmit: | |||
394 | 394 | ||
395 | static int keyspan_open(struct input_dev *dev) | 395 | static int keyspan_open(struct input_dev *dev) |
396 | { | 396 | { |
397 | struct usb_keyspan *remote = dev->private; | 397 | struct usb_keyspan *remote = input_get_drvdata(dev); |
398 | 398 | ||
399 | remote->irq_urb->dev = remote->udev; | 399 | remote->irq_urb->dev = remote->udev; |
400 | if (usb_submit_urb(remote->irq_urb, GFP_KERNEL)) | 400 | if (usb_submit_urb(remote->irq_urb, GFP_KERNEL)) |
@@ -405,7 +405,7 @@ static int keyspan_open(struct input_dev *dev) | |||
405 | 405 | ||
406 | static void keyspan_close(struct input_dev *dev) | 406 | static void keyspan_close(struct input_dev *dev) |
407 | { | 407 | { |
408 | struct usb_keyspan *remote = dev->private; | 408 | struct usb_keyspan *remote = input_get_drvdata(dev); |
409 | 409 | ||
410 | usb_kill_urb(remote->irq_urb); | 410 | usb_kill_urb(remote->irq_urb); |
411 | } | 411 | } |
@@ -437,7 +437,7 @@ static int keyspan_probe(struct usb_interface *interface, const struct usb_devic | |||
437 | struct usb_endpoint_descriptor *endpoint; | 437 | struct usb_endpoint_descriptor *endpoint; |
438 | struct usb_keyspan *remote; | 438 | struct usb_keyspan *remote; |
439 | struct input_dev *input_dev; | 439 | struct input_dev *input_dev; |
440 | int i, retval; | 440 | int i, error; |
441 | 441 | ||
442 | endpoint = keyspan_get_in_endpoint(interface->cur_altsetting); | 442 | endpoint = keyspan_get_in_endpoint(interface->cur_altsetting); |
443 | if (!endpoint) | 443 | if (!endpoint) |
@@ -446,7 +446,7 @@ static int keyspan_probe(struct usb_interface *interface, const struct usb_devic | |||
446 | remote = kzalloc(sizeof(*remote), GFP_KERNEL); | 446 | remote = kzalloc(sizeof(*remote), GFP_KERNEL); |
447 | input_dev = input_allocate_device(); | 447 | input_dev = input_allocate_device(); |
448 | if (!remote || !input_dev) { | 448 | if (!remote || !input_dev) { |
449 | retval = -ENOMEM; | 449 | error = -ENOMEM; |
450 | goto fail1; | 450 | goto fail1; |
451 | } | 451 | } |
452 | 452 | ||
@@ -458,19 +458,19 @@ static int keyspan_probe(struct usb_interface *interface, const struct usb_devic | |||
458 | 458 | ||
459 | remote->in_buffer = usb_buffer_alloc(udev, RECV_SIZE, GFP_ATOMIC, &remote->in_dma); | 459 | remote->in_buffer = usb_buffer_alloc(udev, RECV_SIZE, GFP_ATOMIC, &remote->in_dma); |
460 | if (!remote->in_buffer) { | 460 | if (!remote->in_buffer) { |
461 | retval = -ENOMEM; | 461 | error = -ENOMEM; |
462 | goto fail1; | 462 | goto fail1; |
463 | } | 463 | } |
464 | 464 | ||
465 | remote->irq_urb = usb_alloc_urb(0, GFP_KERNEL); | 465 | remote->irq_urb = usb_alloc_urb(0, GFP_KERNEL); |
466 | if (!remote->irq_urb) { | 466 | if (!remote->irq_urb) { |
467 | retval = -ENOMEM; | 467 | error = -ENOMEM; |
468 | goto fail2; | 468 | goto fail2; |
469 | } | 469 | } |
470 | 470 | ||
471 | retval = keyspan_setup(udev); | 471 | error = keyspan_setup(udev); |
472 | if (retval) { | 472 | if (error) { |
473 | retval = -ENODEV; | 473 | error = -ENODEV; |
474 | goto fail3; | 474 | goto fail3; |
475 | } | 475 | } |
476 | 476 | ||
@@ -495,14 +495,15 @@ static int keyspan_probe(struct usb_interface *interface, const struct usb_devic | |||
495 | input_dev->name = remote->name; | 495 | input_dev->name = remote->name; |
496 | input_dev->phys = remote->phys; | 496 | input_dev->phys = remote->phys; |
497 | usb_to_input_id(udev, &input_dev->id); | 497 | usb_to_input_id(udev, &input_dev->id); |
498 | input_dev->cdev.dev = &interface->dev; | 498 | input_dev->dev.parent = &interface->dev; |
499 | 499 | ||
500 | input_dev->evbit[0] = BIT(EV_KEY); /* We will only report KEY events. */ | 500 | input_dev->evbit[0] = BIT(EV_KEY); /* We will only report KEY events. */ |
501 | for (i = 0; i < ARRAY_SIZE(keyspan_key_table); i++) | 501 | for (i = 0; i < ARRAY_SIZE(keyspan_key_table); i++) |
502 | if (keyspan_key_table[i] != KEY_RESERVED) | 502 | if (keyspan_key_table[i] != KEY_RESERVED) |
503 | set_bit(keyspan_key_table[i], input_dev->keybit); | 503 | set_bit(keyspan_key_table[i], input_dev->keybit); |
504 | 504 | ||
505 | input_dev->private = remote; | 505 | input_set_drvdata(input_dev, remote); |
506 | |||
506 | input_dev->open = keyspan_open; | 507 | input_dev->open = keyspan_open; |
507 | input_dev->close = keyspan_close; | 508 | input_dev->close = keyspan_close; |
508 | 509 | ||
@@ -517,7 +518,9 @@ static int keyspan_probe(struct usb_interface *interface, const struct usb_devic | |||
517 | remote->irq_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; | 518 | remote->irq_urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; |
518 | 519 | ||
519 | /* we can register the device now, as it is ready */ | 520 | /* we can register the device now, as it is ready */ |
520 | input_register_device(remote->input); | 521 | error = input_register_device(remote->input); |
522 | if (error) | ||
523 | goto fail3; | ||
521 | 524 | ||
522 | /* save our data pointer in this interface device */ | 525 | /* save our data pointer in this interface device */ |
523 | usb_set_intfdata(interface, remote); | 526 | usb_set_intfdata(interface, remote); |
@@ -529,7 +532,7 @@ static int keyspan_probe(struct usb_interface *interface, const struct usb_devic | |||
529 | fail1: kfree(remote); | 532 | fail1: kfree(remote); |
530 | input_free_device(input_dev); | 533 | input_free_device(input_dev); |
531 | 534 | ||
532 | return retval; | 535 | return error; |
533 | } | 536 | } |
534 | 537 | ||
535 | /* | 538 | /* |