Commit ac1c86c8 authored by Antti Palosaari's avatar Antti Palosaari Committed by Mauro Carvalho Chehab

[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: default avatarAntti Palosaari <crope@iki.fi>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent ef382402
...@@ -347,6 +347,7 @@ struct dvb_usb_adapter { ...@@ -347,6 +347,7 @@ struct dvb_usb_adapter {
* @props: device properties * @props: device properties
* @name: device name * @name: device name
* @rc_map: name of rc codes table * @rc_map: name of rc codes table
* @rc_polling_active: set when RC polling is active
* @udev: pointer to the device's struct usb_device * @udev: pointer to the device's struct usb_device
* @intf: pointer to the device's usb interface * @intf: pointer to the device's usb interface
* @rc: remote controller configuration * @rc: remote controller configuration
...@@ -364,7 +365,7 @@ struct dvb_usb_device { ...@@ -364,7 +365,7 @@ struct dvb_usb_device {
const struct dvb_usb_device_properties *props; const struct dvb_usb_device_properties *props;
const char *name; const char *name;
const char *rc_map; const char *rc_map;
bool rc_polling_active;
struct usb_device *udev; struct usb_device *udev;
struct usb_interface *intf; struct usb_interface *intf;
struct dvb_usb_rc rc; struct dvb_usb_rc rc;
......
...@@ -113,13 +113,16 @@ static void dvb_usb_read_remote_control(struct work_struct *work) ...@@ -113,13 +113,16 @@ static void dvb_usb_read_remote_control(struct work_struct *work)
* When the parameter has been set to 1 via sysfs while the * When the parameter has been set to 1 via sysfs while the
* driver was running, or when bulk mode is enabled after IR init. * driver was running, or when bulk mode is enabled after IR init.
*/ */
if (dvb_usbv2_disable_rc_polling || d->rc.bulk_mode) if (dvb_usbv2_disable_rc_polling || d->rc.bulk_mode) {
d->rc_polling_active = false;
return; return;
}
ret = d->rc.query(d); ret = d->rc.query(d);
if (ret < 0) { if (ret < 0) {
dev_err(&d->udev->dev, "%s: rc.query() failed=%d\n", dev_err(&d->udev->dev, "%s: rc.query() failed=%d\n",
KBUILD_MODNAME, ret); KBUILD_MODNAME, ret);
d->rc_polling_active = false;
return; /* stop polling */ return; /* stop polling */
} }
...@@ -183,6 +186,7 @@ static int dvb_usbv2_remote_init(struct dvb_usb_device *d) ...@@ -183,6 +186,7 @@ static int dvb_usbv2_remote_init(struct dvb_usb_device *d)
d->rc.interval); d->rc.interval);
schedule_delayed_work(&d->rc_query_work, schedule_delayed_work(&d->rc_query_work,
msecs_to_jiffies(d->rc.interval)); msecs_to_jiffies(d->rc.interval));
d->rc_polling_active = true;
} }
return 0; return 0;
...@@ -964,7 +968,7 @@ int dvb_usbv2_suspend(struct usb_interface *intf, pm_message_t msg) ...@@ -964,7 +968,7 @@ int dvb_usbv2_suspend(struct usb_interface *intf, pm_message_t msg)
dev_dbg(&d->udev->dev, "%s:\n", __func__); dev_dbg(&d->udev->dev, "%s:\n", __func__);
/* stop remote controller poll */ /* stop remote controller poll */
if (d->rc.query && !d->rc.bulk_mode) if (d->rc_polling_active)
cancel_delayed_work_sync(&d->rc_query_work); cancel_delayed_work_sync(&d->rc_query_work);
for (i = MAX_NO_OF_ADAPTER_PER_DEVICE - 1; i >= 0; i--) { 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,7 +1015,7 @@ static int dvb_usbv2_resume_common(struct dvb_usb_device *d)
} }
/* start remote controller poll */ /* start remote controller poll */
if (d->rc.query && !d->rc.bulk_mode) if (d->rc_polling_active)
schedule_delayed_work(&d->rc_query_work, schedule_delayed_work(&d->rc_query_work,
msecs_to_jiffies(d->rc.interval)); msecs_to_jiffies(d->rc.interval));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment