Message ID | f0607fde6ec1ad120f62a80c53b1d44c4d5f4d81.1426801061.git.sean@mess.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Em Thu, 19 Mar 2015 21:50:13 +0000 Sean Young <sean@mess.org> escreveu: > If the device cannot transmit then -ENOSYS should be returned. Also clarify > that the ioctl should return modes, not features. The values happen to be > identical. Makes sense to me. Yet, applying it (without patch 1) causes compilation to break. I would put this at the top of the series, as this actually seems to be a bug fix that it could eventually make sense to backport. So, better to keep this patch independent. > > Signed-off-by: Sean Young <sean@mess.org> > --- > drivers/media/rc/ir-lirc-codec.c | 11 +++++++++-- > 1 file changed, 9 insertions(+), 2 deletions(-) > > diff --git a/drivers/media/rc/ir-lirc-codec.c b/drivers/media/rc/ir-lirc-codec.c > index 98893a8..17fd956 100644 > --- a/drivers/media/rc/ir-lirc-codec.c > +++ b/drivers/media/rc/ir-lirc-codec.c > @@ -207,12 +207,19 @@ static long ir_lirc_ioctl(struct file *filep, unsigned int cmd, > > /* legacy support */ > case LIRC_GET_SEND_MODE: > - val = LIRC_CAN_SEND_PULSE & LIRC_CAN_SEND_MASK; > + if (!(dev->lirc->features & LIRC_CAN_SEND_MASK)) > + return -ENOSYS; > + > + val = LIRC_MODE_PULSE; > break; > > case LIRC_SET_SEND_MODE: > - if (val != (LIRC_MODE_PULSE & LIRC_CAN_SEND_MASK)) > + if (!(dev->lirc->features & LIRC_CAN_SEND_MASK)) > + return -ENOSYS; > + > + if (val != LIRC_MODE_PULSE) > return -EINVAL; > + > return 0; > > /* TX settings */ -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/media/rc/ir-lirc-codec.c b/drivers/media/rc/ir-lirc-codec.c index 98893a8..17fd956 100644 --- a/drivers/media/rc/ir-lirc-codec.c +++ b/drivers/media/rc/ir-lirc-codec.c @@ -207,12 +207,19 @@ static long ir_lirc_ioctl(struct file *filep, unsigned int cmd, /* legacy support */ case LIRC_GET_SEND_MODE: - val = LIRC_CAN_SEND_PULSE & LIRC_CAN_SEND_MASK; + if (!(dev->lirc->features & LIRC_CAN_SEND_MASK)) + return -ENOSYS; + + val = LIRC_MODE_PULSE; break; case LIRC_SET_SEND_MODE: - if (val != (LIRC_MODE_PULSE & LIRC_CAN_SEND_MASK)) + if (!(dev->lirc->features & LIRC_CAN_SEND_MASK)) + return -ENOSYS; + + if (val != LIRC_MODE_PULSE) return -EINVAL; + return 0; /* TX settings */
If the device cannot transmit then -ENOSYS should be returned. Also clarify that the ioctl should return modes, not features. The values happen to be identical. Signed-off-by: Sean Young <sean@mess.org> --- drivers/media/rc/ir-lirc-codec.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)