diff options
author | Sean Young <sean@mess.org> | 2012-08-13 07:59:43 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-08-13 15:06:22 -0400 |
commit | 7c0bd96b767da250e5aa5ee135c530d87454d9fe (patch) | |
tree | 774e0e5a049f2736100b62658e48b37b0baafe13 /drivers | |
parent | 0797b4802b57ce88e9361c8d64b0980508370649 (diff) |
[media] iguanair: support suspend and resume
Now unbind also stops the receiver.
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/rc/iguanair.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/drivers/media/rc/iguanair.c b/drivers/media/rc/iguanair.c index 58854004db88..f1c5846b35f4 100644 --- a/drivers/media/rc/iguanair.c +++ b/drivers/media/rc/iguanair.c | |||
@@ -155,6 +155,7 @@ static void process_ir_data(struct iguanair *ir, unsigned len) | |||
155 | static void iguanair_rx(struct urb *urb) | 155 | static void iguanair_rx(struct urb *urb) |
156 | { | 156 | { |
157 | struct iguanair *ir; | 157 | struct iguanair *ir; |
158 | int rc; | ||
158 | 159 | ||
159 | if (!urb) | 160 | if (!urb) |
160 | return; | 161 | return; |
@@ -180,7 +181,9 @@ static void iguanair_rx(struct urb *urb) | |||
180 | break; | 181 | break; |
181 | } | 182 | } |
182 | 183 | ||
183 | usb_submit_urb(urb, GFP_ATOMIC); | 184 | rc = usb_submit_urb(urb, GFP_ATOMIC); |
185 | if (rc && rc != -ENODEV) | ||
186 | dev_warn(ir->dev, "failed to resubmit urb: %d\n", rc); | ||
184 | } | 187 | } |
185 | 188 | ||
186 | static int iguanair_send(struct iguanair *ir, void *data, unsigned size) | 189 | static int iguanair_send(struct iguanair *ir, void *data, unsigned size) |
@@ -423,7 +426,7 @@ static void iguanair_close(struct rc_dev *rdev) | |||
423 | 426 | ||
424 | rc = iguanair_receiver(ir, false); | 427 | rc = iguanair_receiver(ir, false); |
425 | ir->receiver_on = false; | 428 | ir->receiver_on = false; |
426 | if (rc) | 429 | if (rc && rc != -ENODEV) |
427 | dev_warn(ir->dev, "failed to disable receiver: %d\n", rc); | 430 | dev_warn(ir->dev, "failed to disable receiver: %d\n", rc); |
428 | 431 | ||
429 | mutex_unlock(&ir->lock); | 432 | mutex_unlock(&ir->lock); |
@@ -516,8 +519,6 @@ static int __devinit iguanair_probe(struct usb_interface *intf, | |||
516 | 519 | ||
517 | usb_set_intfdata(intf, ir); | 520 | usb_set_intfdata(intf, ir); |
518 | 521 | ||
519 | dev_info(&intf->dev, "Registered %s", ir->name); | ||
520 | |||
521 | return 0; | 522 | return 0; |
522 | out2: | 523 | out2: |
523 | usb_kill_urb(ir->urb_in); | 524 | usb_kill_urb(ir->urb_in); |
@@ -536,12 +537,11 @@ static void __devexit iguanair_disconnect(struct usb_interface *intf) | |||
536 | { | 537 | { |
537 | struct iguanair *ir = usb_get_intfdata(intf); | 538 | struct iguanair *ir = usb_get_intfdata(intf); |
538 | 539 | ||
540 | rc_unregister_device(ir->rc); | ||
539 | usb_set_intfdata(intf, NULL); | 541 | usb_set_intfdata(intf, NULL); |
540 | |||
541 | usb_kill_urb(ir->urb_in); | 542 | usb_kill_urb(ir->urb_in); |
542 | usb_free_urb(ir->urb_in); | 543 | usb_free_urb(ir->urb_in); |
543 | usb_free_coherent(ir->udev, MAX_PACKET_SIZE, ir->buf_in, ir->dma_in); | 544 | usb_free_coherent(ir->udev, MAX_PACKET_SIZE, ir->buf_in, ir->dma_in); |
544 | rc_unregister_device(ir->rc); | ||
545 | kfree(ir); | 545 | kfree(ir); |
546 | } | 546 | } |
547 | 547 | ||
@@ -558,6 +558,8 @@ static int iguanair_suspend(struct usb_interface *intf, pm_message_t message) | |||
558 | dev_warn(ir->dev, "failed to disable receiver for suspend\n"); | 558 | dev_warn(ir->dev, "failed to disable receiver for suspend\n"); |
559 | } | 559 | } |
560 | 560 | ||
561 | usb_kill_urb(ir->urb_in); | ||
562 | |||
561 | mutex_unlock(&ir->lock); | 563 | mutex_unlock(&ir->lock); |
562 | 564 | ||
563 | return rc; | 565 | return rc; |
@@ -570,6 +572,10 @@ static int iguanair_resume(struct usb_interface *intf) | |||
570 | 572 | ||
571 | mutex_lock(&ir->lock); | 573 | mutex_lock(&ir->lock); |
572 | 574 | ||
575 | rc = usb_submit_urb(ir->urb_in, GFP_KERNEL); | ||
576 | if (rc) | ||
577 | dev_warn(&intf->dev, "failed to submit urb: %d\n", rc); | ||
578 | |||
573 | if (ir->receiver_on) { | 579 | if (ir->receiver_on) { |
574 | rc = iguanair_receiver(ir, true); | 580 | rc = iguanair_receiver(ir, true); |
575 | if (rc) | 581 | if (rc) |
@@ -593,7 +599,8 @@ static struct usb_driver iguanair_driver = { | |||
593 | .suspend = iguanair_suspend, | 599 | .suspend = iguanair_suspend, |
594 | .resume = iguanair_resume, | 600 | .resume = iguanair_resume, |
595 | .reset_resume = iguanair_resume, | 601 | .reset_resume = iguanair_resume, |
596 | .id_table = iguanair_table | 602 | .id_table = iguanair_table, |
603 | .soft_unbind = 1 /* we want to disable receiver on unbind */ | ||
597 | }; | 604 | }; |
598 | 605 | ||
599 | module_usb_driver(iguanair_driver); | 606 | module_usb_driver(iguanair_driver); |