From: Sean Young <sean@mess.org>
To: linux-media@vger.kernel.org
Subject: [PATCH v3 02/19] [media] lirc: return ENOTTY when ioctl is not supported
Date: Sat, 25 Feb 2017 11:51:17 +0000 [thread overview]
Message-ID: <73f3a22bda686bb8fa550c04928502c998220cd7.1488023302.git.sean@mess.org> (raw)
In-Reply-To: <cover.1488023302.git.sean@mess.org>
In-Reply-To: <cover.1488023302.git.sean@mess.org>
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: Sean Young <sean@mess.org>
---
drivers/media/rc/ir-lirc-codec.c | 20 ++++++++++----------
drivers/media/rc/lirc_dev.c | 2 +-
2 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/drivers/media/rc/ir-lirc-codec.c b/drivers/media/rc/ir-lirc-codec.c
index 8517d51..637b583 100644
--- a/drivers/media/rc/ir-lirc-codec.c
+++ b/drivers/media/rc/ir-lirc-codec.c
@@ -139,7 +139,7 @@ static ssize_t ir_lirc_transmit_ir(struct file *file, const char __user *buf,
}
if (!dev->tx_ir) {
- ret = -ENOSYS;
+ ret = -EINVAL;
goto out;
}
@@ -221,19 +221,19 @@ static long ir_lirc_ioctl(struct file *filep, unsigned int cmd,
/* TX settings */
case LIRC_SET_TRANSMITTER_MASK:
if (!dev->s_tx_mask)
- return -ENOSYS;
+ return -ENOTTY;
return dev->s_tx_mask(dev, val);
case LIRC_SET_SEND_CARRIER:
if (!dev->s_tx_carrier)
- return -ENOSYS;
+ return -ENOTTY;
return dev->s_tx_carrier(dev, val);
case LIRC_SET_SEND_DUTY_CYCLE:
if (!dev->s_tx_duty_cycle)
- return -ENOSYS;
+ return -ENOTTY;
if (val <= 0 || val >= 100)
return -EINVAL;
@@ -243,7 +243,7 @@ static long ir_lirc_ioctl(struct file *filep, unsigned int cmd,
/* RX settings */
case LIRC_SET_REC_CARRIER:
if (!dev->s_rx_carrier_range)
- return -ENOSYS;
+ return -ENOTTY;
if (val <= 0)
return -EINVAL;
@@ -265,32 +265,32 @@ static long ir_lirc_ioctl(struct file *filep, unsigned int cmd,
case LIRC_SET_WIDEBAND_RECEIVER:
if (!dev->s_learning_mode)
- return -ENOSYS;
+ return -ENOTTY;
return dev->s_learning_mode(dev, !!val);
case LIRC_SET_MEASURE_CARRIER_MODE:
if (!dev->s_carrier_report)
- return -ENOSYS;
+ return -ENOTTY;
return dev->s_carrier_report(dev, !!val);
/* Generic timeout support */
case LIRC_GET_MIN_TIMEOUT:
if (!dev->max_timeout)
- return -ENOSYS;
+ return -ENOTTY;
val = DIV_ROUND_UP(dev->min_timeout, 1000);
break;
case LIRC_GET_MAX_TIMEOUT:
if (!dev->max_timeout)
- return -ENOSYS;
+ return -ENOTTY;
val = dev->max_timeout / 1000;
break;
case LIRC_SET_REC_TIMEOUT:
if (!dev->max_timeout)
- return -ENOSYS;
+ return -ENOTTY;
tmp = val * 1000;
diff --git a/drivers/media/rc/lirc_dev.c b/drivers/media/rc/lirc_dev.c
index a54ca53..ccbdce0 100644
--- a/drivers/media/rc/lirc_dev.c
+++ b/drivers/media/rc/lirc_dev.c
@@ -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);
break;
default:
- result = -EINVAL;
+ result = -ENOTTY;
}
mutex_unlock(&ir->irctl_lock);
--
2.9.3
next prev parent reply other threads:[~2017-02-25 11:51 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-25 11:51 [PATCH v3 00/19] Teach lirc how to send and receive scancodes Sean Young
2017-02-25 11:51 ` [PATCH v3 01/19] [media] lirc: document lirc modes better Sean Young
2017-02-25 11:51 ` Sean Young [this message]
2017-02-25 11:51 ` [PATCH v3 03/19] [media] lirc: return ENOTTY when device does support ioctl Sean Young
2017-02-25 11:51 ` [PATCH v3 04/19] [media] winbond: allow timeout to be set Sean Young
2017-02-25 11:51 ` [PATCH v3 05/19] [media] gpio-ir: do not allow a timeout of 0 Sean Young
2017-02-25 11:51 ` [PATCH v3 06/19] [media] rc: lirc keymap no longer makes any sense Sean Young
2017-02-25 11:51 ` [PATCH v3 07/19] [media] lirc: advertise LIRC_CAN_GET_REC_RESOLUTION and improve Sean Young
2017-02-25 11:51 ` [PATCH v3 08/19] [media] mce_kbd: add encoder Sean Young
2017-02-25 11:51 ` [PATCH v3 09/19] [media] serial_ir: iommap is a memory address, not bool Sean Young
2017-02-25 11:51 ` [PATCH v3 10/19] [media] lirc: use refcounting for lirc devices Sean Young
2017-02-25 11:51 ` [PATCH v3 11/19] [media] lirc: lirc interface should not be a raw decoder Sean Young
2017-02-25 11:51 ` [PATCH v3 12/19] [media] lirc: exorcise struct irctl Sean Young
2017-02-25 11:51 ` [PATCH v3 13/19] [media] lirc: use plain kfifo rather than lirc_buffer Sean Young
2017-02-25 11:51 ` [PATCH v3 14/19] [media] lirc: implement scancode sending Sean Young
2017-02-25 11:51 ` [PATCH v3 15/19] [media] rc: use the correct carrier for scancode transmit Sean Young
2017-02-25 11:51 ` [PATCH v3 16/19] [media] rc: auto load encoder if necessary Sean Young
2017-02-25 11:51 ` [PATCH v3 17/19] [media] lirc: implement reading scancode Sean Young
2017-03-02 13:31 ` Sean Young
2017-03-06 16:16 ` [PATCH] [media] lirc: introduce LIRC_SET_POLL_MODE Sean Young
2017-02-25 11:51 ` [PATCH v3 18/19] [media] lirc: scancode rc devices should have a lirc device too Sean Young
2017-02-25 11:51 ` [PATCH v3 19/19] [media] lirc: document LIRC_MODE_SCANCODE Sean Young
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=73f3a22bda686bb8fa550c04928502c998220cd7.1488023302.git.sean@mess.org \
--to=sean@mess.org \
--cc=linux-media@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).