Re: [RFC PATCH 2/6] [media] lirc: LIRC_[SG]ET_SEND_MODE should return -ENOSYS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Em Thu, 19 Mar 2015 21:50:13 +0000
Sean Young <sean@xxxxxxxx> 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@xxxxxxxx>
> ---
>  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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux