[PATCH] media: dvb-usb: do not clear the raw IR change_protocol

Ho Jie Feng posted 1 patch 1 day, 4 hours ago
drivers/media/usb/dvb-usb-v2/dvb_usb_core.c | 3 ++-
drivers/media/usb/dvb-usb/dvb-usb-remote.c  | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
[PATCH] media: dvb-usb: do not clear the raw IR change_protocol
Posted by Ho Jie Feng 1 day, 4 hours ago
Since commit ec7cb49871e5 ("media: rc: Fix race condition during
rc_register_device()"), rc_allocate_device() prepares raw IR handling,
which sets dev->change_protocol for RC_DRIVER_IR_RAW devices.

dvb-usb and dvb-usb-v2 then overwrite dev->change_protocol with the
callback from the device properties, which is NULL for raw IR devices
such as rtl28xxu. Without it, rc-core enables no protocol decoder
when the device is registered, so keys are no longer decoded.

Only set change_protocol when the device provides one.

Tested with a rtl28xxu device.

Fixes: ec7cb49871e5 ("media: rc: Fix race condition during rc_register_device()")
Cc: stable@vger.kernel.org
Signed-off-by: Ho Jie Feng <hj3108@gmail.com>
---
 drivers/media/usb/dvb-usb-v2/dvb_usb_core.c | 3 ++-
 drivers/media/usb/dvb-usb/dvb-usb-remote.c  | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

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 bd86d25043..218397cc68 100644
--- a/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c
+++ b/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c
@@ -149,7 +149,8 @@ static int dvb_usbv2_remote_init(struct dvb_usb_device *d)
 	dev->driver_name = d->props->driver_name;
 	dev->map_name = d->rc.map_name;
 	dev->allowed_protocols = d->rc.allowed_protos;
-	dev->change_protocol = d->rc.change_protocol;
+	if (d->rc.change_protocol)
+		dev->change_protocol = d->rc.change_protocol;
 	dev->timeout = d->rc.timeout;
 	dev->priv = d;
 
diff --git a/drivers/media/usb/dvb-usb/dvb-usb-remote.c b/drivers/media/usb/dvb-usb/dvb-usb-remote.c
index 6dc11718df..f5f30d714e 100644
--- a/drivers/media/usb/dvb-usb/dvb-usb-remote.c
+++ b/drivers/media/usb/dvb-usb/dvb-usb-remote.c
@@ -277,7 +277,8 @@ static int rc_core_dvb_usb_remote_init(struct dvb_usb_device *d)
 
 	dev->driver_name = d->props.rc.core.module_name;
 	dev->map_name = d->props.rc.core.rc_codes;
-	dev->change_protocol = d->props.rc.core.change_protocol;
+	if (d->props.rc.core.change_protocol)
+		dev->change_protocol = d->props.rc.core.change_protocol;
 	dev->allowed_protocols = d->props.rc.core.allowed_protos;
 	usb_to_input_id(d->udev, &dev->input_id);
 	dev->device_name = d->desc->name;

base-commit: b7ac871daee981f1963f632586ff9b9d898ce5dd
-- 
2.53.0