From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Alan Borzeszkowski <alan.borzeszkowski@linux.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: Wed, 18 Mar 2026 16:36:59 +0200 [thread overview]
Message-ID: <abq4i4Kt0azQcYtq@ashevche-desk.local> (raw)
In-Reply-To: <20260318142418.48574-1-alan.borzeszkowski@linux.intel.com>
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?
> + if (ret)
> + return ret;
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2026-03-18 14:37 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 [this message]
2026-03-31 17:53 ` Alan Borzeszkowski
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=abq4i4Kt0azQcYtq@ashevche-desk.local \
--to=andriy.shevchenko@intel.com \
--cc=alan.borzeszkowski@linux.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).