Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Revert "Input: serio - make write method mandatory"

This reverts commit 81c7c0a350bfe9306ad9fb10356534ede8f4ab31. The idea
to make write method mandatory was flawed as several client drivers
(such as atkbd) check for presence of write() method to adjust behavior
of the driver.

Reported-by: Nathan Chancellor <nathan@kernel.org>
Reported-by: Michael Kelley <mikelley@microsoft.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

+4 -12
-6
drivers/input/serio/ams_delta_serio.c
··· 89 89 return IRQ_HANDLED; 90 90 } 91 91 92 - static int ams_delta_serio_write(struct serio *serio, u8 data) 93 - { 94 - return -EINVAL; 95 - } 96 - 97 92 static int ams_delta_serio_open(struct serio *serio) 98 93 { 99 94 struct ams_delta_serio *priv = serio->port_data; ··· 157 162 priv->serio = serio; 158 163 159 164 serio->id.type = SERIO_8042; 160 - serio->write = ams_delta_serio_write; 161 165 serio->open = ams_delta_serio_open; 162 166 serio->close = ams_delta_serio_close; 163 167 strlcpy(serio->name, "AMS DELTA keyboard adapter", sizeof(serio->name));
-5
drivers/input/serio/serio.c
··· 694 694 */ 695 695 void __serio_register_port(struct serio *serio, struct module *owner) 696 696 { 697 - if (!serio->write) { 698 - pr_err("%s: refusing to register %s without write method\n", 699 - __func__, serio->name); 700 - return; 701 - } 702 697 serio_init_port(serio); 703 698 serio_queue_event(serio, owner, SERIO_REGISTER_PORT); 704 699 }
+4 -1
include/linux/serio.h
··· 121 121 122 122 static inline int serio_write(struct serio *serio, unsigned char data) 123 123 { 124 - return serio->write(serio, data); 124 + if (serio->write) 125 + return serio->write(serio, data); 126 + else 127 + return -1; 125 128 } 126 129 127 130 static inline void serio_drv_write_wakeup(struct serio *serio)