Skip to content

Commit

Permalink
Revert "Input: serio - make write method mandatory"
Browse files Browse the repository at this point in the history
This reverts commit 81c7c0a. 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 <[email protected]>
Reported-by: Michael Kelley <[email protected]>
Signed-off-by: Dmitry Torokhov <[email protected]>
  • Loading branch information
dtor committed Jul 21, 2021
1 parent 133b655 commit 7d3370e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 12 deletions.
6 changes: 0 additions & 6 deletions drivers/input/serio/ams_delta_serio.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,6 @@ 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;
Expand Down Expand Up @@ -162,7 +157,6 @@ 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));
Expand Down
5 changes: 0 additions & 5 deletions drivers/input/serio/serio.c
Original file line number Diff line number Diff line change
Expand Up @@ -694,11 +694,6 @@ 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);
}
Expand Down
5 changes: 4 additions & 1 deletion include/linux/serio.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,10 @@ void serio_unregister_driver(struct serio_driver *drv);

static inline int serio_write(struct serio *serio, unsigned char data)
{
return serio->write(serio, data);
if (serio->write)
return serio->write(serio, data);
else
return -1;
}

static inline void serio_drv_write_wakeup(struct serio *serio)
Expand Down

0 comments on commit 7d3370e

Please sign in to comment.