public inbox for linux-gpio@vger.kernel.org
 help / color / mirror / Atom feed
From: Alan Borzeszkowski <alan.borzeszkowski@linux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: linux-gpio@vger.kernel.org, linusw@kernel.org, brgl@kernel.org,
	 mika.westerberg@linux.intel.com
Subject: Re: [PATCH] gpio: Add Intel Nova Lake ACPI GPIO events driver
Date: Tue, 31 Mar 2026 19:53:00 +0200	[thread overview]
Message-ID: <9bfcb2462dec32be58573ad956e7a90c2093973c.camel@linux.intel.com> (raw)
In-Reply-To: <abq4i4Kt0azQcYtq@ashevche-desk.local>

Hi Andy,

On Wed, 2026-03-18 at 16:36 +0200, Andy Shevchenko wrote:
> On Wed, Mar 18, 2026 at 03:24:18PM +0100, Alan Borzeszkowski wrote:
> > This driver provides support for new way of handling platform
> > events,
> > through the use of GPIO-signaled ACPI events. This mechanism is
> > used on
> > Intel client platforms released in 2026 and later, starting with
> > Intel
> > Nova Lake.
> 
> ...
> 
> > +static void nvl_gpio_irq_mask_unmask(struct gpio_chip *gc,
> > unsigned long hwirq,
> > +				     bool mask)
> 
> > +	addr = nvl_gpio_get_byte_addr(priv,
> > GPE_EN_REG_OFFSET(priv->blk_size),
> > +				      byte_idx);
> 
> These are only two cases where we go a bit further than 80, so I
> would just
> make them a single line each.
> 
> 
> ...
> 
> > +	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
> > +	if (!priv)
> > +		return -ENOMEM;
> > +	raw_spin_lock_init(&priv->lock);
> > +
> > +	res = platform_get_resource(pdev, IORESOURCE_IO, 0);
> > +	if (!res)
> > +		return -ENXIO;
> > +	/*
> > +	 * GPE block length should be non-negative multiple of two
> > and allow up
> > +	 * to 128 pins. ACPI v6.6 section 5.2.9 and 5.6.4.
> > +	 */
> > +	ioresource_size = resource_size(res);
> > +	if (!ioresource_size || ioresource_size % 2 ||
> > ioresource_size > 0x20)
> > +		return dev_err_probe(dev, -EINVAL,
> > +				     "invalid GPE block length,
> > resource: %pR\n",
> > +				     res);
> 
> There is no point to even allocate memory if the resource is not
> available or
> invalid.
> 
> 	..._get_resource()
> 	...validate...
> 	...map, as we still have local variable for that...
> 
> 	priv = devm_kzalloc(...);
> 	...
> 	_init_lock(...);
> 
> 
> > +	regs = devm_ioport_map(dev, res->start, ioresource_size);
> > +	if (!regs)
> > +		return -ENOMEM;
> > +	priv->reg_base = regs;
> > +	priv->blk_size = ioresource_size;
> > +
> > +	irq = platform_get_irq(pdev, 0);
> > +	if (irq < 0)
> > +		return irq;
> > +
> > +	ret = devm_request_irq(dev, irq, nvl_gpio_irq,
> > IRQF_SHARED,
> > +			       dev_name(dev), priv);
> 
> I would also go with a single line here:
> 
> 	ret = devm_request_irq(dev, irq, nvl_gpio_irq, IRQF_SHARED,
> dev_name(dev), priv);
> 
> One Q though, is it indeed shared? Or can it be shared?

It can be shared.

> 
> > +	if (ret)
> > +		return ret;
> 


      reply	other threads:[~2026-03-31 17:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-18 14:24 [PATCH] gpio: Add Intel Nova Lake ACPI GPIO events driver Alan Borzeszkowski
2026-03-18 14:36 ` Andy Shevchenko
2026-03-31 17:53   ` Alan Borzeszkowski [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9bfcb2462dec32be58573ad956e7a90c2093973c.camel@linux.intel.com \
    --to=alan.borzeszkowski@linux.intel.com \
    --cc=andriy.shevchenko@intel.com \
    --cc=brgl@kernel.org \
    --cc=linusw@kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox