From 0bec8b7e5ca1a629f26173691526432f9d7cf8c1 Mon Sep 17 00:00:00 2001 From: Stephen Boyd Date: Wed, 14 Aug 2019 10:46:38 -0700 Subject: Input: remove dev_err() usage after platform_get_irq() We don't need dev_err() messages when platform_get_irq() fails now that platform_get_irq() prints an error message itself when something goes wrong. Let's remove these prints with a simple semantic patch. // @@ expression ret; struct platform_device *E; @@ ret = ( platform_get_irq(E, ...) | platform_get_irq_byname(E, ...) ); if ( \( ret < 0 \| ret <= 0 \) ) { ( -if (ret != -EPROBE_DEFER) -{ ... -dev_err(...); -... } | ... -dev_err(...); ) ... } // While we're here, remove braces on if statements that only have one statement (manually). Signed-off-by: Stephen Boyd Signed-off-by: Dmitry Torokhov --- drivers/input/serio/arc_ps2.c | 4 +--- drivers/input/serio/ps2-gpio.c | 2 -- 2 files changed, 1 insertion(+), 5 deletions(-) (limited to 'drivers/input/serio') diff --git a/drivers/input/serio/arc_ps2.c b/drivers/input/serio/arc_ps2.c index 443194a2b9e3..0af9fba5d16d 100644 --- a/drivers/input/serio/arc_ps2.c +++ b/drivers/input/serio/arc_ps2.c @@ -187,10 +187,8 @@ static int arc_ps2_probe(struct platform_device *pdev) int error, id, i; irq = platform_get_irq_byname(pdev, "arc_ps2_irq"); - if (irq < 0) { - dev_err(&pdev->dev, "no IRQ defined\n"); + if (irq < 0) return -EINVAL; - } arc_ps2 = devm_kzalloc(&pdev->dev, sizeof(struct arc_ps2_data), GFP_KERNEL); diff --git a/drivers/input/serio/ps2-gpio.c b/drivers/input/serio/ps2-gpio.c index e0f18469d01b..8970b49ea09a 100644 --- a/drivers/input/serio/ps2-gpio.c +++ b/drivers/input/serio/ps2-gpio.c @@ -369,8 +369,6 @@ static int ps2_gpio_probe(struct platform_device *pdev) drvdata->irq = platform_get_irq(pdev, 0); if (drvdata->irq < 0) { - dev_err(dev, "failed to get irq from platform resource: %d\n", - drvdata->irq); error = drvdata->irq; goto err_free_serio; } -- cgit v1.2.3 From c8a144b250dcd5fe6df95b8d101e9e2fe4c16201 Mon Sep 17 00:00:00 2001 From: Stephen Boyd Date: Thu, 29 Aug 2019 14:31:05 -0700 Subject: Input: i8042 - enable wakeup on a stable struct device We don't know when the device will be added with device_add() in serio_add_port() because serio_add_port() is called from a workqueue that this driver schedules by calling serio_register_port(). The best we can know is that the device will definitely not have been added yet when the start callback is called on the serio device. While it hasn't been shown to be a problem, proactively move the wakeup enabling calls to the start hook so that we don't race with the workqueue calling device_add(). This will avoid racy situations where code tries to add wakeup sysfs attributes for this device from dpm_sysfs_add() but the path in device_set_wakeup_capable() has already done so. Signed-off-by: Stephen Boyd Signed-off-by: Dmitry Torokhov --- drivers/input/serio/i8042.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'drivers/input/serio') diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c index b695094290ab..20ff2bed3917 100644 --- a/drivers/input/serio/i8042.c +++ b/drivers/input/serio/i8042.c @@ -432,6 +432,20 @@ static int i8042_start(struct serio *serio) { struct i8042_port *port = serio->port_data; + device_set_wakeup_capable(&serio->dev, true); + + /* + * On platforms using suspend-to-idle, allow the keyboard to + * wake up the system from sleep by enabling keyboard wakeups + * by default. This is consistent with keyboard wakeup + * behavior on many platforms using suspend-to-RAM (ACPI S3) + * by default. + */ + if (pm_suspend_default_s2idle() && + serio == i8042_ports[I8042_KBD_PORT_NO].serio) { + device_set_wakeup_enable(&serio->dev, true); + } + spin_lock_irq(&i8042_lock); port->exists = true; spin_unlock_irq(&i8042_lock); @@ -1397,17 +1411,6 @@ static void __init i8042_register_ports(void) (unsigned long) I8042_COMMAND_REG, i8042_ports[i].irq); serio_register_port(serio); - device_set_wakeup_capable(&serio->dev, true); - - /* - * On platforms using suspend-to-idle, allow the keyboard to - * wake up the system from sleep by enabling keyboard wakeups - * by default. This is consistent with keyboard wakeup - * behavior on many platforms using suspend-to-RAM (ACPI S3) - * by default. - */ - if (pm_suspend_default_s2idle() && i == I8042_KBD_PORT_NO) - device_set_wakeup_enable(&serio->dev, true); } } -- cgit v1.2.3