* [PATCH v2 0/2] Input: wdt87xx_i2c - a couple of cleanups
@ 2026-01-13 8:22 Andy Shevchenko
2026-01-13 8:22 ` [PATCH v2 1/2] Input: wdt87xx_i2c - tidy up ACPI ID table Andy Shevchenko
2026-01-13 8:22 ` [PATCH v2 2/2] Input: wdt87xx_i2c - switch to use dev_err_probe() Andy Shevchenko
0 siblings, 2 replies; 7+ messages in thread
From: Andy Shevchenko @ 2026-01-13 8:22 UTC (permalink / raw)
To: Andy Shevchenko, linux-input, linux-kernel; +Cc: Dmitry Torokhov
A couple of cleanups related to ACPI ID table and probe function.
Changelog v2:
- dropped no-op message for ENOMEM, dropped dup message for request IRQ failure
v1: 20260113073556.7380-1-andriy.shevchenko@linux.intel.com`
Andy Shevchenko (2):
Input: wdt87xx_i2c - tidy up ACPI ID table
Input: wdt87xx_i2c - switch to use dev_err_probe()
drivers/input/touchscreen/wdt87xx_i2c.c | 45 +++++++++++--------------
1 file changed, 20 insertions(+), 25 deletions(-)
--
2.50.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 1/2] Input: wdt87xx_i2c - tidy up ACPI ID table
2026-01-13 8:22 [PATCH v2 0/2] Input: wdt87xx_i2c - a couple of cleanups Andy Shevchenko
@ 2026-01-13 8:22 ` Andy Shevchenko
2026-01-20 20:42 ` Dmitry Torokhov
2026-01-13 8:22 ` [PATCH v2 2/2] Input: wdt87xx_i2c - switch to use dev_err_probe() Andy Shevchenko
1 sibling, 1 reply; 7+ messages in thread
From: Andy Shevchenko @ 2026-01-13 8:22 UTC (permalink / raw)
To: Andy Shevchenko, linux-input, linux-kernel; +Cc: Dmitry Torokhov
Tidy up ACPI ID table:
- drop ACPI_PTR() and hence replace acpi.h with mod_devicetable.h et al.
- remove explicit driver_data initializer
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/input/touchscreen/wdt87xx_i2c.c | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/drivers/input/touchscreen/wdt87xx_i2c.c b/drivers/input/touchscreen/wdt87xx_i2c.c
index 88d376090e6e..99636d6eb0f3 100644
--- a/drivers/input/touchscreen/wdt87xx_i2c.c
+++ b/drivers/input/touchscreen/wdt87xx_i2c.c
@@ -9,17 +9,24 @@
* may be copied, distributed, and modified under those terms.
*/
+#include <linux/array_size.h>
+#include <linux/delay.h>
+#include <linux/device.h>
+#include <linux/firmware.h>
#include <linux/i2c.h>
#include <linux/input.h>
+#include <linux/input/mt.h>
#include <linux/interrupt.h>
-#include <linux/delay.h>
#include <linux/irq.h>
#include <linux/io.h>
+#include <linux/math.h>
+#include <linux/mod_devicetable.h>
#include <linux/module.h>
+#include <linux/mutex.h>
+#include <linux/pm.h>
#include <linux/slab.h>
-#include <linux/firmware.h>
-#include <linux/input/mt.h>
-#include <linux/acpi.h>
+#include <linux/sysfs.h>
+#include <linux/types.h>
#include <linux/unaligned.h>
#define WDT87XX_NAME "wdt87xx_i2c"
@@ -1153,13 +1160,11 @@ static const struct i2c_device_id wdt87xx_dev_id[] = {
};
MODULE_DEVICE_TABLE(i2c, wdt87xx_dev_id);
-#ifdef CONFIG_ACPI
static const struct acpi_device_id wdt87xx_acpi_id[] = {
- { "WDHT0001", 0 },
+ { "WDHT0001" },
{ }
};
MODULE_DEVICE_TABLE(acpi, wdt87xx_acpi_id);
-#endif
static struct i2c_driver wdt87xx_driver = {
.probe = wdt87xx_ts_probe,
@@ -1168,7 +1173,7 @@ static struct i2c_driver wdt87xx_driver = {
.name = WDT87XX_NAME,
.dev_groups = wdt87xx_groups,
.pm = pm_sleep_ptr(&wdt87xx_pm_ops),
- .acpi_match_table = ACPI_PTR(wdt87xx_acpi_id),
+ .acpi_match_table = wdt87xx_acpi_id,
},
};
module_i2c_driver(wdt87xx_driver);
--
2.50.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 2/2] Input: wdt87xx_i2c - switch to use dev_err_probe()
2026-01-13 8:22 [PATCH v2 0/2] Input: wdt87xx_i2c - a couple of cleanups Andy Shevchenko
2026-01-13 8:22 ` [PATCH v2 1/2] Input: wdt87xx_i2c - tidy up ACPI ID table Andy Shevchenko
@ 2026-01-13 8:22 ` Andy Shevchenko
2026-01-20 20:40 ` Dmitry Torokhov
1 sibling, 1 reply; 7+ messages in thread
From: Andy Shevchenko @ 2026-01-13 8:22 UTC (permalink / raw)
To: Andy Shevchenko, linux-input, linux-kernel; +Cc: Dmitry Torokhov
Switch to use dev_err_probe() to simplify the error path and
unify a message template. With that being done, drop the now no-op
message for -ENOMEM as allocator will print a big warning anyway
and remove duplicate message for devm_request_threaded_irq().
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/input/touchscreen/wdt87xx_i2c.c | 24 +++++++-----------------
1 file changed, 7 insertions(+), 17 deletions(-)
diff --git a/drivers/input/touchscreen/wdt87xx_i2c.c b/drivers/input/touchscreen/wdt87xx_i2c.c
index 99636d6eb0f3..3bf899fe615c 100644
--- a/drivers/input/touchscreen/wdt87xx_i2c.c
+++ b/drivers/input/touchscreen/wdt87xx_i2c.c
@@ -1033,10 +1033,8 @@ static int wdt87xx_ts_create_input_device(struct wdt87xx_data *wdt)
int error;
input = devm_input_allocate_device(dev);
- if (!input) {
- dev_err(dev, "failed to allocate input device\n");
+ if (!input)
return -ENOMEM;
- }
wdt->input = input;
input->name = "WDT87xx Touchscreen";
@@ -1060,16 +1058,15 @@ static int wdt87xx_ts_create_input_device(struct wdt87xx_data *wdt)
INPUT_MT_DIRECT | INPUT_MT_DROP_UNUSED);
error = input_register_device(input);
- if (error) {
- dev_err(dev, "failed to register input device: %d\n", error);
- return error;
- }
+ if (error)
+ return dev_err_probe(dev, error, "failed to register input device\n");
return 0;
}
static int wdt87xx_ts_probe(struct i2c_client *client)
{
+ struct device *dev = &client->dev;
struct wdt87xx_data *wdt;
int error;
@@ -1099,16 +1096,9 @@ static int wdt87xx_ts_probe(struct i2c_client *client)
if (error)
return error;
- error = devm_request_threaded_irq(&client->dev, client->irq,
- NULL, wdt87xx_ts_interrupt,
- IRQF_ONESHOT,
- client->name, wdt);
- if (error) {
- dev_err(&client->dev, "request irq failed: %d\n", error);
- return error;
- }
-
- return 0;
+ return devm_request_threaded_irq(dev, client->irq,
+ NULL, wdt87xx_ts_interrupt,
+ IRQF_ONESHOT, client->name, wdt);
}
static int wdt87xx_suspend(struct device *dev)
--
2.50.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2 2/2] Input: wdt87xx_i2c - switch to use dev_err_probe()
2026-01-13 8:22 ` [PATCH v2 2/2] Input: wdt87xx_i2c - switch to use dev_err_probe() Andy Shevchenko
@ 2026-01-20 20:40 ` Dmitry Torokhov
2026-01-20 21:09 ` Andy Shevchenko
0 siblings, 1 reply; 7+ messages in thread
From: Dmitry Torokhov @ 2026-01-20 20:40 UTC (permalink / raw)
To: Andy Shevchenko; +Cc: linux-input, linux-kernel
Hi Andy,
On Tue, Jan 13, 2026 at 09:22:58AM +0100, Andy Shevchenko wrote:
> Switch to use dev_err_probe() to simplify the error path and
> unify a message template. With that being done, drop the now no-op
> message for -ENOMEM as allocator will print a big warning anyway
> and remove duplicate message for devm_request_threaded_irq().
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> drivers/input/touchscreen/wdt87xx_i2c.c | 24 +++++++-----------------
> 1 file changed, 7 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/input/touchscreen/wdt87xx_i2c.c b/drivers/input/touchscreen/wdt87xx_i2c.c
> index 99636d6eb0f3..3bf899fe615c 100644
> --- a/drivers/input/touchscreen/wdt87xx_i2c.c
> +++ b/drivers/input/touchscreen/wdt87xx_i2c.c
> @@ -1033,10 +1033,8 @@ static int wdt87xx_ts_create_input_device(struct wdt87xx_data *wdt)
> int error;
>
> input = devm_input_allocate_device(dev);
> - if (!input) {
> - dev_err(dev, "failed to allocate input device\n");
> + if (!input)
> return -ENOMEM;
> - }
> wdt->input = input;
>
> input->name = "WDT87xx Touchscreen";
> @@ -1060,16 +1058,15 @@ static int wdt87xx_ts_create_input_device(struct wdt87xx_data *wdt)
> INPUT_MT_DIRECT | INPUT_MT_DROP_UNUSED);
>
> error = input_register_device(input);
> - if (error) {
> - dev_err(dev, "failed to register input device: %d\n", error);
> - return error;
> - }
> + if (error)
> + return dev_err_probe(dev, error, "failed to register input device\n");
>
> return 0;
> }
>
> static int wdt87xx_ts_probe(struct i2c_client *client)
> {
> + struct device *dev = &client->dev;
You introduced a tempo but used it in only one place. I dropped it.
> struct wdt87xx_data *wdt;
> int error;
>
> @@ -1099,16 +1096,9 @@ static int wdt87xx_ts_probe(struct i2c_client *client)
> if (error)
> return error;
>
> - error = devm_request_threaded_irq(&client->dev, client->irq,
> - NULL, wdt87xx_ts_interrupt,
> - IRQF_ONESHOT,
> - client->name, wdt);
> - if (error) {
> - dev_err(&client->dev, "request irq failed: %d\n", error);
> - return error;
> - }
> -
> - return 0;
> + return devm_request_threaded_irq(dev, client->irq,
> + NULL, wdt87xx_ts_interrupt,
> + IRQF_ONESHOT, client->name, wdt);
My preference is to keep "if (error) return error;" even for the last
call when there are multiple potential points of failure in the
function, adjusted.
Applied the updated patch.
Thanks.
--
Dmitry
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 1/2] Input: wdt87xx_i2c - tidy up ACPI ID table
2026-01-13 8:22 ` [PATCH v2 1/2] Input: wdt87xx_i2c - tidy up ACPI ID table Andy Shevchenko
@ 2026-01-20 20:42 ` Dmitry Torokhov
2026-01-20 21:07 ` Andy Shevchenko
0 siblings, 1 reply; 7+ messages in thread
From: Dmitry Torokhov @ 2026-01-20 20:42 UTC (permalink / raw)
To: Andy Shevchenko; +Cc: linux-input, linux-kernel
Hi Andy,
On Tue, Jan 13, 2026 at 09:22:57AM +0100, Andy Shevchenko wrote:
> Tidy up ACPI ID table:
> - drop ACPI_PTR() and hence replace acpi.h with mod_devicetable.h et al.
> - remove explicit driver_data initializer
With the exception of cleaning the driver_data is it unclear to me what
the benefit is. The driver is potentially useful on non-ACPI systems (or
may be easily adopted) so making ACPI not optional does not sound like
improvement...
Thanks.
--
Dmitry
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 1/2] Input: wdt87xx_i2c - tidy up ACPI ID table
2026-01-20 20:42 ` Dmitry Torokhov
@ 2026-01-20 21:07 ` Andy Shevchenko
0 siblings, 0 replies; 7+ messages in thread
From: Andy Shevchenko @ 2026-01-20 21:07 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-input, linux-kernel
On Tue, Jan 20, 2026 at 12:42:16PM -0800, Dmitry Torokhov wrote:
> On Tue, Jan 13, 2026 at 09:22:57AM +0100, Andy Shevchenko wrote:
> > Tidy up ACPI ID table:
> > - drop ACPI_PTR() and hence replace acpi.h with mod_devicetable.h et al.
> > - remove explicit driver_data initializer
>
> With the exception of cleaning the driver_data is it unclear to me what
> the benefit is. The driver is potentially useful on non-ACPI systems (or
> may be easily adopted) so making ACPI not optional does not sound like
> improvement...
I'm not sure how you came to the conclusion "making ACPI not optional".
This is just matter of dozens of bytes in the binary, it doesn't affect
functionality neither on ACPI-based, nor on non-ACPI platforms.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 2/2] Input: wdt87xx_i2c - switch to use dev_err_probe()
2026-01-20 20:40 ` Dmitry Torokhov
@ 2026-01-20 21:09 ` Andy Shevchenko
0 siblings, 0 replies; 7+ messages in thread
From: Andy Shevchenko @ 2026-01-20 21:09 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-input, linux-kernel
On Tue, Jan 20, 2026 at 12:40:25PM -0800, Dmitry Torokhov wrote:
> On Tue, Jan 13, 2026 at 09:22:58AM +0100, Andy Shevchenko wrote:
...
> > + struct device *dev = &client->dev;
>
> You introduced a tempo but used it in only one place. I dropped it.
Yes, to avoid churn on converting unrelated places right now. But it may help
in the future.
...
> > - error = devm_request_threaded_irq(&client->dev, client->irq,
> > - NULL, wdt87xx_ts_interrupt,
> > - IRQF_ONESHOT,
> > - client->name, wdt);
> > - if (error) {
> > - dev_err(&client->dev, "request irq failed: %d\n", error);
> > - return error;
> > - }
> > -
> > - return 0;
> > + return devm_request_threaded_irq(dev, client->irq,
> > + NULL, wdt87xx_ts_interrupt,
> > + IRQF_ONESHOT, client->name, wdt);
>
> My preference is to keep "if (error) return error;" even for the last
> call when there are multiple potential points of failure in the
> function, adjusted.
Okay, no problem.
> Applied the updated patch.
Thanks!
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-01-20 21:09 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-13 8:22 [PATCH v2 0/2] Input: wdt87xx_i2c - a couple of cleanups Andy Shevchenko
2026-01-13 8:22 ` [PATCH v2 1/2] Input: wdt87xx_i2c - tidy up ACPI ID table Andy Shevchenko
2026-01-20 20:42 ` Dmitry Torokhov
2026-01-20 21:07 ` Andy Shevchenko
2026-01-13 8:22 ` [PATCH v2 2/2] Input: wdt87xx_i2c - switch to use dev_err_probe() Andy Shevchenko
2026-01-20 20:40 ` Dmitry Torokhov
2026-01-20 21:09 ` Andy Shevchenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox