mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peng Fan <peng.fan@oss.nxp.com>
To: Linus Walleij <linusw@kernel.org>,
	Bartosz Golaszewski <brgl@kernel.org>,
	Frank Li <Frank.Li@nxp.com>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Pengutronix Kernel Team <kernel@pengutronix.de>,
	Fabio Estevam <festevam@gmail.com>,
	Shenwei Wang <shenwei.wang@nxp.com>,
	Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: linux-gpio@vger.kernel.org, imx@lists.linux.dev,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, Peng Fan <peng.fan@nxp.com>
Subject: Re: [PATCH v3 0/9] gpio: mxc: bug fixes and probe cleanup
Date: Tue, 6 Oct 2026 20:43:34 +0800	[thread overview]
Message-ID: <asTs9scYht+xg7v5@shlinux89> (raw)
In-Reply-To: <20261006-gpio-mxc-cleanup-v3-0-129f93302a90@nxp.com>

Ignore this V3 patchset. This is not a complete version.

Thanks
Peng

On Tue, Oct 06, 2026 at 08:31:05PM +0800, Peng Fan (OSS) wrote:
>This series cleans up the gpio-mxc driver in several incremental steps:
>bug fixes, converting runtime state to static per-compatible data,
>modernizing resource management with devres, and cleaning up
>register access patterns.
>
>Patches 1-2 are bug fixes:
>  - Fix a race where the chained IRQ handler is installed before probe
>    completes, allowing interrupts to fire on a half-initialized port.
>  - Fix wakeup_pads bit operations that used wrong set_bit/clear_bit
>    logic, folding in the assign_bit() simplification from V1.
>
>Patches 3-4 replace runtime of_device_is_compatible() calls with static
>per-compatible hwdata flags, eliminating repeated string comparisons in
>the suspend/resume path.
>
>Patches 5-6 convert probe error handling to devres and dev_err_probe().
>
>Patches 7-9 are cosmetic cleanups: local dev variable, MXC_ICR macros
>with field_prep/field_get, and BIT() macro for single-bit shifts.
>
>Signed-off-by: Peng Fan <peng.fan@nxp.com>
>---
>Changes in v3:
>- Patch 5/8 ("gpio: mxc: convert probe error handling to devres"):
>  Replaced pm_runtime_get_noresume() with
>  devm_pm_runtime_get_noresume() to fix a PM usage counter leak on
>  probe error paths. The non-devm pm_runtime_get_noresume() was not
>  balanced by any devres action, so any probe failure after the PM
>  block (e.g. -EPROBE_DEFER from devm_gpiochip_add_data()) would
>  leave usage_count permanently elevated, preventing runtime suspend
>  on re-probe.
>  Dropped the explicit pm_runtime_put_noidle() on
>  devm_pm_runtime_set_active_enabled() failure - the devres
>  registered by devm_pm_runtime_get_noresume() handles the balance
>  automatically during probe unwind.
>- Patch 6/8 ("gpio: mxc: use local dev variable"):
>  Keep of_device_is_compatible(), only focus on switching &pdev->dev to
>  dev.
>- Link to v2: https://patch.msgid.link/20261005-gpio-mxc-cleanup-v2-0-bdc3afbb35e2@nxp.com
>
>Changes in V2:
>- Reworked compatible-string caching (V1 patch 3) from probe-time bools
>  in mxc_gpio_port to static hwdata flags with per-compatible data
>  instances.  Split into two patches: one introducing the flags scheme
>  with MXC_GPIO_HW_DATA_COMMON macro for power_off (patch 3), one
>  extending it to pad_wakeup and imx8qm (patch 4).  (Frank, bot review)
>- Replaced devm_pm_runtime_get_noresume() + pm_runtime_set_active() +
>  devm_pm_runtime_enable() with devm_pm_runtime_set_active_enabled().
>  Keep plain pm_runtime_get_noresume() (non-devm) for the probe-scoped
>  reference to avoid usage_count underflow on unbind.  (Frank, bot review)
>- Replaced irq_domain_create_legacy() + devm_add_action_or_reset() with
>  devm_irq_domain_instantiate().  Squashed with the PM runtime devres
>  conversion (V1 patches 4+5) into a single patch (patch 5), since the
>  goto labels cannot be removed until both resources are devres-managed.
>- Split dev_err_probe() conversion into its own patch (patch 6) for
>  bisectability — patch 5 uses bare returns with correct error values.
>- Folded gpio_set_wake_irq() assign_bit simplification (V1 patch 9) into
>  the wakeup_pads fix (patch 2) where it belongs.
>- Used 0x3U (unsigned) in MXC_ICR_MASK() to avoid implementation-defined
>  behavior when shifting by 30 bits.
>- Replaced linux/of.h with linux/property.h to match the
>  of_device_is_compatible() → device_is_compatible() API change (patch 7).
>- Added return-value checks for devm_pm_runtime_set_active_enabled().
>- Fixed stale error code returns after devm_irq_alloc_descs() and
>  devm_irq_domain_instantiate() in the devres conversion patch.
>- Link to v1: https://patch.msgid.link/20261003-gpio-mxc-cleanup-v1-0-dad728ce27f2@nxp.com
>
>---
>Peng Fan (9):
>      gpio: mxc: fix race between chained IRQ handler install and probe completion
>      gpio: mxc: fix wakeup_pads bit operations
>      gpio: mxc: replace of_device_is_compatible() with hwdata flags
>      gpio: mxc: convert pad wakeup compatible checks to hwdata flags
>      gpio: mxc: convert probe error handling to devres
>      gpio: mxc: switch probe error paths to dev_err_probe()
>      gpio: mxc: use local dev variable
>      gpio: mxc: introduce MXC_ICR macros and use field_prep/field_get
>      gpio: mxc: use BIT() macro for single-bit operations
>
> drivers/gpio/gpio-mxc.c | 257 +++++++++++++++++++++++++++---------------------
> 1 file changed, 145 insertions(+), 112 deletions(-)
>---
>base-commit: f0406245cb9855e6318335a8a223551354291a46
>change-id: 20261003-gpio-mxc-cleanup-e49cc626c51e
>
>Best regards,
>--  
>Peng Fan <peng.fan@nxp.com>
>
>

      parent reply	other threads:[~2026-10-06 12:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-06 12:31 Peng Fan (OSS)
2026-10-06 12:31 ` [PATCH v3 1/9] gpio: mxc: fix race between chained IRQ handler install and probe completion Peng Fan (OSS)
2026-10-06 12:31 ` [PATCH v3 2/9] gpio: mxc: fix wakeup_pads bit operations Peng Fan (OSS)
2026-10-06 12:31 ` [PATCH v3 3/9] gpio: mxc: replace of_device_is_compatible() with hwdata flags Peng Fan (OSS)
2026-10-06 12:31 ` [PATCH v3 4/9] gpio: mxc: convert pad wakeup compatible checks to " Peng Fan (OSS)
2026-10-06 12:43 ` Peng Fan [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=asTs9scYht+xg7v5@shlinux89 \
    --to=peng.fan@oss.nxp.com \
    --cc=Frank.Li@nxp.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=brgl@kernel.org \
    --cc=festevam@gmail.com \
    --cc=imx@lists.linux.dev \
    --cc=kernel@pengutronix.de \
    --cc=linusw@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peng.fan@nxp.com \
    --cc=s.hauer@pengutronix.de \
    --cc=shenwei.wang@nxp.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

all inboxes | Powered by JetHome®