Re: [PATCH 4/5] Input: tsc2007 - do not register input device without IRQ

From: Andy Shevchenko

Date: Fri Nov 13 2026 - 07:29:42 EST


On Thu, Nov 12, 2026 at 8:56 AM Dmitry Torokhov
<dmitry.torokhov@xxxxxxxxx> wrote:
>
> The driver has no polled input mode and only reports touchscreen input
> events from its threaded interrupt handler. When no interrupt is wired,
> the device is used solely as an IIO ADC, so registering an input device
> serves no purpose and creates a non-functional input node.
>
> Only allocate, configure, and register the input device when an
> interrupt is present. This also allows removing the unnecessary
> ts->irq checks in the open and stop callbacks.

...

> ts->stopped = false;
> -
> - if (ts->irq)
> - enable_irq(ts->irq);
> + enable_irq(ts->irq);


Looking at this makes me think that if "stopped" is tightened to IRQ
enablement, the IRQ framework already has an API which may be used
instead of having a local flag. This can be achieved with
irqd_irq_disabled(irq_get_irq_data(ts->irq)), but this is most likely
for the other day.

...

> - snprintf(ts->phys, sizeof(ts->phys),
> - "%s/input0", dev_name(&client->dev));
> + snprintf(ts->phys, sizeof(ts->phys), "%s/input0", dev_name(dev));

Perhaps scnprintf() to avoid compiler warnings?

...

> + err = devm_request_threaded_irq(dev, ts->irq,
> + NULL, tsc2007_soft_irq,
> + IRQF_ONESHOT,
> + dev->driver->name, ts);
> + if (err) {

> + dev_err(dev, "Failed to request irq %d: %d\n", ts->irq, err);

This has to be dropped in a separate patch as dup. The above API
prints the very similar message on error.

> + return err;
> + }

--
With Best Regards,
Andy Shevchenko