summaryrefslogtreecommitdiffstats
path: root/drivers/media/rc/mceusb.c
diff options
context:
space:
mode:
authorSean Young <sean@mess.org>2016-07-10 18:34:32 +0200
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2016-07-15 16:46:55 +0200
commit20f5a827cf4b8fa11d5897e4d92d1a480f2cf58b (patch)
treeb9a9b3f66a82b5009692dd2a1cb26b1da1af6d91 /drivers/media/rc/mceusb.c
parent[media] af9035: fix dual tuner detection with PCTV 79e (diff)
downloadlinux-20f5a827cf4b8fa11d5897e4d92d1a480f2cf58b.tar.xz
linux-20f5a827cf4b8fa11d5897e4d92d1a480f2cf58b.zip
[media] rc: make s_tx_mask consistent
When s_tx_mask is given an invalid bitmask, the number of transmitters should be returned. See the LIRC_SET_TRANSMITTER_MASK lirc ioctl documentation. Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/rc/mceusb.c')
-rw-r--r--drivers/media/rc/mceusb.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c
index 5cf2e749b9eb..2d1585d9bd9e 100644
--- a/drivers/media/rc/mceusb.c
+++ b/drivers/media/rc/mceusb.c
@@ -887,6 +887,12 @@ static int mceusb_set_tx_mask(struct rc_dev *dev, u32 mask)
{
struct mceusb_dev *ir = dev->priv;
+ /* return number of transmitters */
+ int emitters = ir->num_txports ? ir->num_txports : 2;
+
+ if (mask >= (1 << emitters))
+ return emitters;
+
if (ir->flags.tx_mask_normal)
ir->tx_mask = mask;
else