lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <nk5qn7ye44lbtppp2opa273ut7lxkcz7jsw6giagwngiwhg7rr@puexvdzd2ymq>
Date: Tue, 20 Jan 2026 21:23:32 -0800
From: Dmitry Torokhov <dmitry.torokhov@...il.com>
To: Marek Vasut <marek.vasut@...lbox.org>
Cc: linux-input@...r.kernel.org, Conor Dooley <conor+dt@...nel.org>, 
	Frank Li <Frank.Li@....com>, Job Noorman <job@...rman.info>, 
	Krzysztof Kozlowski <krzk+dt@...nel.org>, Rob Herring <robh@...nel.org>, devicetree@...r.kernel.org, 
	linux-kernel@...r.kernel.org, linux-renesas-soc@...r.kernel.org
Subject: Re: [PATCH v4 3/3] Input: ili210x - add support for polling mode

On Tue, Jan 20, 2026 at 11:50:53PM +0100, Marek Vasut wrote:
> On 1/20/26 7:31 PM, Dmitry Torokhov wrote:
> > Hi Marek,
> > 
> > On Sat, Jan 17, 2026 at 01:12:04AM +0100, Marek Vasut wrote:
> > > @@ -860,16 +893,12 @@ static ssize_t ili210x_firmware_update_store(struct device *dev,
> > >   	 * the touch controller to disable the IRQs during update, so we have
> > >   	 * to do it this way here.
> > >   	 */
> > > -	scoped_guard(disable_irq, &client->irq) {
> > > -		dev_dbg(dev, "Firmware update started, firmware=%s\n", fwname);
> > > -
> > > -		ili210x_hardware_reset(priv->reset_gpio);
> > > -
> > > -		error = ili210x_do_firmware_update(priv, fwbuf, ac_end, df_end);
> > > -
> > > -		ili210x_hardware_reset(priv->reset_gpio);
> > > -
> > > -		dev_dbg(dev, "Firmware update ended, error=%i\n", error);
> > > +	if (client->irq > 0) {
> > > +		scoped_guard(disable_irq, &client->irq) {
> > > +			error = ili210x_firmware_update_noirq(dev, fwbuf, ac_end, df_end);
> > > +		}
> > 
> > You already have a scope here, no need to establish a new one:
> > 
> > 		guard(disable_irq)(&client->irq);
> > 		error = ili210x_firmware_update_noirq(dev, fwbuf, ac_end, df_end);
> 
> This part ^ I do not understand. If there is no IRQ defined in DT, I need to
> call ili210x_firmware_update_noirq() without the guard because I cannot
> disable_irq() with client->irq < 0, else I need to call
> ili210x_firmware_update_noirq() within the scoped_guard() to disable IRQs to
> avoid spurious IRQs that would interfere with the firmware update ?

You do not need to use scoped_guard() because you already define a scope
in your if statement:

if (client->irq > 0) {
	guard(disable_irq)(&client->irq);
	error = ili210x_firmware_update_noirq(dev, fwbuf, ac_end, df_end);
} else {
	error = ili210x_firmware_update_noirq(dev, fwbuf, ac_end, df_end);
}

This is sill a bit awkward. Maybe we could add to interrupt.h

void __disable_valid_irq(unsigned int irq)
{
	if (irq > 0)
		disable_irq(irq);
}

void __enable_valid_irq(unsigned int irq)
{
	if (irq > 0)
		enable_irq(irq);
}

DEFINE_LOCK_GUARD_1(disable_valid_irq, int,
		    disable_valid_irq(*_T->lock), enable_valid_irq(*_T->lock))

and then we'd be able to keep the driver as is (just adjust the type of
the original scoped_guard).

> 
> > BTW, not a fan of the "_noirq" suffix... Maybe drop it and add
> > lockdep_is_held() there?
> 
> This part I understand even less, how does lockdep play into this ? The
> scoped_guard() disables and enables IRQs if they are available.

Ah, sorry, brainfart on my part. I got confused by _noirq suffix.

Thanks.

-- 
Dmitry

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ