summaryrefslogtreecommitdiff
path: root/drivers/input
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2021-07-20 00:34:40 +0300
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2021-07-20 00:35:21 +0300
commit81c7c0a350bfe9306ad9fb10356534ede8f4ab31 (patch)
tree871f0848bcb473ea2a25c04f7e6ae5b90615f769 /drivers/input
parent9aa75914e5fcb39e79fc6de9e44cd12943732c38 (diff)
downloadlinux-81c7c0a350bfe9306ad9fb10356534ede8f4ab31.tar.xz
Input: serio - make write method mandatory
Given that all serio drivers except one implement write() method let's make it mandatory to avoid testing for its presence whenever we attempt to use it. Link: https://lore.kernel.org/r/YFgUxG/TljMuVeQ3@google.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/serio/ams_delta_serio.c6
-rw-r--r--drivers/input/serio/serio.c5
2 files changed, 11 insertions, 0 deletions
diff --git a/drivers/input/serio/ams_delta_serio.c b/drivers/input/serio/ams_delta_serio.c
index 1c0be299f179..a1c314897951 100644
--- a/drivers/input/serio/ams_delta_serio.c
+++ b/drivers/input/serio/ams_delta_serio.c
@@ -89,6 +89,11 @@ static irqreturn_t ams_delta_serio_interrupt(int irq, void *dev_id)
return IRQ_HANDLED;
}
+static int ams_delta_serio_write(struct serio *serio, u8 data)
+{
+ return -EINVAL;
+}
+
static int ams_delta_serio_open(struct serio *serio)
{
struct ams_delta_serio *priv = serio->port_data;
@@ -157,6 +162,7 @@ static int ams_delta_serio_init(struct platform_device *pdev)
priv->serio = serio;
serio->id.type = SERIO_8042;
+ serio->write = ams_delta_serio_write;
serio->open = ams_delta_serio_open;
serio->close = ams_delta_serio_close;
strlcpy(serio->name, "AMS DELTA keyboard adapter", sizeof(serio->name));
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c
index 29f491082926..8d229a11bb6b 100644
--- a/drivers/input/serio/serio.c
+++ b/drivers/input/serio/serio.c
@@ -694,6 +694,11 @@ EXPORT_SYMBOL(serio_reconnect);
*/
void __serio_register_port(struct serio *serio, struct module *owner)
{
+ if (!serio->write) {
+ pr_err("%s: refusing to register %s without write method\n",
+ __func__, serio->name);
+ return;
+ }
serio_init_port(serio);
serio_queue_event(serio, owner, SERIO_REGISTER_PORT);
}