aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAntti Palosaari <crope@iki.fi>2012-12-09 19:23:30 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-01-06 07:20:03 -0500
commitac1c86c857368eb727b7ca2c7a48bd6e373fa628 (patch)
tree7265e12747a5db0a77206716684b7efb484c00cc /drivers
parentef3824029d0f5887c065ea461157bdf8b2287bf8 (diff)
[media] dvb_usb_v2: change rc polling active/deactive logic
Use own flag to mark when rc polling is active/deactive and make decisions, like start/stop polling on suspend/resume, against that. Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/usb/dvb-usb-v2/dvb_usb.h3
-rw-r--r--drivers/media/usb/dvb-usb-v2/dvb_usb_core.c10
2 files changed, 9 insertions, 4 deletions
diff --git a/drivers/media/usb/dvb-usb-v2/dvb_usb.h b/drivers/media/usb/dvb-usb-v2/dvb_usb.h
index 059291b892b8..3cac8bd0b116 100644
--- a/drivers/media/usb/dvb-usb-v2/dvb_usb.h
+++ b/drivers/media/usb/dvb-usb-v2/dvb_usb.h
@@ -347,6 +347,7 @@ struct dvb_usb_adapter {
347 * @props: device properties 347 * @props: device properties
348 * @name: device name 348 * @name: device name
349 * @rc_map: name of rc codes table 349 * @rc_map: name of rc codes table
350 * @rc_polling_active: set when RC polling is active
350 * @udev: pointer to the device's struct usb_device 351 * @udev: pointer to the device's struct usb_device
351 * @intf: pointer to the device's usb interface 352 * @intf: pointer to the device's usb interface
352 * @rc: remote controller configuration 353 * @rc: remote controller configuration
@@ -364,7 +365,7 @@ struct dvb_usb_device {
364 const struct dvb_usb_device_properties *props; 365 const struct dvb_usb_device_properties *props;
365 const char *name; 366 const char *name;
366 const char *rc_map; 367 const char *rc_map;
367 368 bool rc_polling_active;
368 struct usb_device *udev; 369 struct usb_device *udev;
369 struct usb_interface *intf; 370 struct usb_interface *intf;
370 struct dvb_usb_rc rc; 371 struct dvb_usb_rc rc;
diff --git a/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c b/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c
index 1330c644dd8d..95968d39c1ca 100644
--- a/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c
+++ b/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c
@@ -113,13 +113,16 @@ static void dvb_usb_read_remote_control(struct work_struct *work)
113 * When the parameter has been set to 1 via sysfs while the 113 * When the parameter has been set to 1 via sysfs while the
114 * driver was running, or when bulk mode is enabled after IR init. 114 * driver was running, or when bulk mode is enabled after IR init.
115 */ 115 */
116 if (dvb_usbv2_disable_rc_polling || d->rc.bulk_mode) 116 if (dvb_usbv2_disable_rc_polling || d->rc.bulk_mode) {
117 d->rc_polling_active = false;
117 return; 118 return;
119 }
118 120
119 ret = d->rc.query(d); 121 ret = d->rc.query(d);
120 if (ret < 0) { 122 if (ret < 0) {
121 dev_err(&d->udev->dev, "%s: rc.query() failed=%d\n", 123 dev_err(&d->udev->dev, "%s: rc.query() failed=%d\n",
122 KBUILD_MODNAME, ret); 124 KBUILD_MODNAME, ret);
125 d->rc_polling_active = false;
123 return; /* stop polling */ 126 return; /* stop polling */
124 } 127 }
125 128
@@ -183,6 +186,7 @@ static int dvb_usbv2_remote_init(struct dvb_usb_device *d)
183 d->rc.interval); 186 d->rc.interval);
184 schedule_delayed_work(&d->rc_query_work, 187 schedule_delayed_work(&d->rc_query_work,
185 msecs_to_jiffies(d->rc.interval)); 188 msecs_to_jiffies(d->rc.interval));
189 d->rc_polling_active = true;
186 } 190 }
187 191
188 return 0; 192 return 0;
@@ -964,7 +968,7 @@ int dvb_usbv2_suspend(struct usb_interface *intf, pm_message_t msg)
964 dev_dbg(&d->udev->dev, "%s:\n", __func__); 968 dev_dbg(&d->udev->dev, "%s:\n", __func__);
965 969
966 /* stop remote controller poll */ 970 /* stop remote controller poll */
967 if (d->rc.query && !d->rc.bulk_mode) 971 if (d->rc_polling_active)
968 cancel_delayed_work_sync(&d->rc_query_work); 972 cancel_delayed_work_sync(&d->rc_query_work);
969 973
970 for (i = MAX_NO_OF_ADAPTER_PER_DEVICE - 1; i >= 0; i--) { 974 for (i = MAX_NO_OF_ADAPTER_PER_DEVICE - 1; i >= 0; i--) {
@@ -1011,7 +1015,7 @@ static int dvb_usbv2_resume_common(struct dvb_usb_device *d)
1011 } 1015 }
1012 1016
1013 /* start remote controller poll */ 1017 /* start remote controller poll */
1014 if (d->rc.query && !d->rc.bulk_mode) 1018 if (d->rc_polling_active)
1015 schedule_delayed_work(&d->rc_query_work, 1019 schedule_delayed_work(&d->rc_query_work,
1016 msecs_to_jiffies(d->rc.interval)); 1020 msecs_to_jiffies(d->rc.interval));
1017 1021