Commit 5c862758 authored by Sean Young's avatar Sean Young Committed by Mauro Carvalho Chehab

[media] lirc: return ENOTTY when ioctl is not supported

We shouldn't be using ENOSYS when a feature is not available. I've tested
lirc; nothing is broken as far as I can make out.
Signed-off-by: default avatarSean Young <sean@mess.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent a8b875a5
...@@ -139,7 +139,7 @@ static ssize_t ir_lirc_transmit_ir(struct file *file, const char __user *buf, ...@@ -139,7 +139,7 @@ static ssize_t ir_lirc_transmit_ir(struct file *file, const char __user *buf,
} }
if (!dev->tx_ir) { if (!dev->tx_ir) {
ret = -ENOSYS; ret = -EINVAL;
goto out; goto out;
} }
...@@ -221,19 +221,19 @@ static long ir_lirc_ioctl(struct file *filep, unsigned int cmd, ...@@ -221,19 +221,19 @@ static long ir_lirc_ioctl(struct file *filep, unsigned int cmd,
/* TX settings */ /* TX settings */
case LIRC_SET_TRANSMITTER_MASK: case LIRC_SET_TRANSMITTER_MASK:
if (!dev->s_tx_mask) if (!dev->s_tx_mask)
return -ENOSYS; return -ENOTTY;
return dev->s_tx_mask(dev, val); return dev->s_tx_mask(dev, val);
case LIRC_SET_SEND_CARRIER: case LIRC_SET_SEND_CARRIER:
if (!dev->s_tx_carrier) if (!dev->s_tx_carrier)
return -ENOSYS; return -ENOTTY;
return dev->s_tx_carrier(dev, val); return dev->s_tx_carrier(dev, val);
case LIRC_SET_SEND_DUTY_CYCLE: case LIRC_SET_SEND_DUTY_CYCLE:
if (!dev->s_tx_duty_cycle) if (!dev->s_tx_duty_cycle)
return -ENOSYS; return -ENOTTY;
if (val <= 0 || val >= 100) if (val <= 0 || val >= 100)
return -EINVAL; return -EINVAL;
...@@ -243,7 +243,7 @@ static long ir_lirc_ioctl(struct file *filep, unsigned int cmd, ...@@ -243,7 +243,7 @@ static long ir_lirc_ioctl(struct file *filep, unsigned int cmd,
/* RX settings */ /* RX settings */
case LIRC_SET_REC_CARRIER: case LIRC_SET_REC_CARRIER:
if (!dev->s_rx_carrier_range) if (!dev->s_rx_carrier_range)
return -ENOSYS; return -ENOTTY;
if (val <= 0) if (val <= 0)
return -EINVAL; return -EINVAL;
...@@ -265,32 +265,32 @@ static long ir_lirc_ioctl(struct file *filep, unsigned int cmd, ...@@ -265,32 +265,32 @@ static long ir_lirc_ioctl(struct file *filep, unsigned int cmd,
case LIRC_SET_WIDEBAND_RECEIVER: case LIRC_SET_WIDEBAND_RECEIVER:
if (!dev->s_learning_mode) if (!dev->s_learning_mode)
return -ENOSYS; return -ENOTTY;
return dev->s_learning_mode(dev, !!val); return dev->s_learning_mode(dev, !!val);
case LIRC_SET_MEASURE_CARRIER_MODE: case LIRC_SET_MEASURE_CARRIER_MODE:
if (!dev->s_carrier_report) if (!dev->s_carrier_report)
return -ENOSYS; return -ENOTTY;
return dev->s_carrier_report(dev, !!val); return dev->s_carrier_report(dev, !!val);
/* Generic timeout support */ /* Generic timeout support */
case LIRC_GET_MIN_TIMEOUT: case LIRC_GET_MIN_TIMEOUT:
if (!dev->max_timeout) if (!dev->max_timeout)
return -ENOSYS; return -ENOTTY;
val = DIV_ROUND_UP(dev->min_timeout, 1000); val = DIV_ROUND_UP(dev->min_timeout, 1000);
break; break;
case LIRC_GET_MAX_TIMEOUT: case LIRC_GET_MAX_TIMEOUT:
if (!dev->max_timeout) if (!dev->max_timeout)
return -ENOSYS; return -ENOTTY;
val = dev->max_timeout / 1000; val = dev->max_timeout / 1000;
break; break;
case LIRC_SET_REC_TIMEOUT: case LIRC_SET_REC_TIMEOUT:
if (!dev->max_timeout) if (!dev->max_timeout)
return -ENOSYS; return -ENOTTY;
tmp = val * 1000; tmp = val * 1000;
......
...@@ -623,7 +623,7 @@ long lirc_dev_fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -623,7 +623,7 @@ long lirc_dev_fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
result = put_user(ir->d.max_timeout, (__u32 __user *)arg); result = put_user(ir->d.max_timeout, (__u32 __user *)arg);
break; break;
default: default:
result = -EINVAL; result = -ENOTTY;
} }
mutex_unlock(&ir->irctl_lock); mutex_unlock(&ir->irctl_lock);
......
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