From: sashiko-bot@kernel.org
To: "Yu-Chun Lin" <eleanor.lin@realtek.com>
Cc: conor+dt@kernel.org, krzk+dt@kernel.org,
devicetree@vger.kernel.org, robh@kernel.org
Subject: Re: [PATCH v3 4/7] gpio: regmap: Add set_config callback
Date: Wed, 13 May 2026 04:23:24 +0000 [thread overview]
Message-ID: <20260513042325.68C09C2BCB7@smtp.kernel.org> (raw)
In-Reply-To: <20260512033317.1602537-5-eleanor.lin@realtek.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The `set_config` callback leaks the underlying `struct gpio_chip` to the driver, breaking the abstraction boundary provided by `gpio_regmap`.
--
commit ac512057e733370619e59d76ffbee25d7ea97d9f
Author: Yu-Chun Lin <eleanor.lin@realtek.com>
gpio: regmap: Add set_config callback
This commit adds a new set_config callback to struct gpio_regmap_config
to allow drivers to implement hardware-specific configurations like
debounce settings or other platform-specific GPIO properties.
> diff --git a/include/linux/gpio/regmap.h b/include/linux/gpio/regmap.h
> --- a/include/linux/gpio/regmap.h
> +++ b/include/linux/gpio/regmap.h
[ ... ]
> @@ -142,6 +145,10 @@ struct gpio_regmap_config {
> unsigned long *valid_mask,
> unsigned int ngpios);
>
> + int (*set_config)(struct gpio_chip *gc,
> + unsigned int offset,
> + unsigned long config);
> +
> void *drvdata;
> };
Does exposing struct gpio_chip directly to the driver break the
abstraction boundary provided by gpio_regmap?
The gpio_regmap library appears designed to abstract away struct gpio_chip
from generic regmap-based drivers. For instance, the reg_mask_xlate
callback takes a struct gpio_regmap pointer rather than the raw chip.
Because gpio_regmap sets its own internal structure as the private data
of the gpio_chip during registration via gpiochip_add_data(), drivers cannot
simply access their private data using gpiochip_get_data(). They would
instead be forced to use a lookup chain like
gpio_regmap_get_drvdata(gpiochip_get_data(gc)).
Would it be better to have the callback in struct gpio_regmap_config take
a struct gpio_regmap pointer instead?
> diff --git a/drivers/gpio/gpio-regmap.c b/drivers/gpio/gpio-regmap.c
> --- a/drivers/gpio/gpio-regmap.c
> +++ b/drivers/gpio/gpio-regmap.c
[ ... ]
> @@ -371,6 +371,8 @@ struct gpio_regmap *gpio_regmap_register(const struct gpio_regmap_config *config
> if (!gpio->reg_mask_xlate)
> gpio->reg_mask_xlate = gpio_regmap_simple_xlate;
>
> + chip->set_config = config->set_config;
> +
> ret = gpiochip_add_data(chip, gpio);
> if (ret < 0)
If the struct gpio_regmap_config callback is updated to use struct
gpio_regmap, could an internal wrapper function be added here in
gpio-regmap.c?
The wrapper could implement the struct gpio_chip set_config signature,
handle the translation from struct gpio_chip to struct gpio_regmap, and then
invoke the driver's config->set_config callback.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260512033317.1602537-1-eleanor.lin@realtek.com?part=4
next prev parent reply other threads:[~2026-05-13 4:23 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-12 3:33 [PATCH v3 0/7] gpio: realtek: Add support for Realtek DHC RTD1625 Yu-Chun Lin
2026-05-12 3:33 ` [PATCH v3 1/7] gpio: Replace "default y" with "default ARCH_REALTEK" in Kconfig Yu-Chun Lin
2026-05-12 3:33 ` [PATCH v3 2/7] gpio: regmap: add gpio_regmap_get_gpiochip() accessor Yu-Chun Lin
2026-05-12 11:20 ` Andy Shevchenko
2026-05-25 12:04 ` Yu-Chun Lin [林祐君]
2026-06-03 0:34 ` Andy Shevchenko
2026-06-08 14:10 ` Bartosz Golaszewski
2026-06-08 14:41 ` Michael Walle
2026-05-12 3:33 ` [PATCH v3 3/7] gpio: regmap: Add gpio_regmap_operation and write-enable support Yu-Chun Lin
2026-05-12 11:26 ` Andy Shevchenko
2026-05-12 14:37 ` Jonathan Cameron
2026-05-13 4:01 ` sashiko-bot
2026-05-13 7:40 ` Linus Walleij
2026-05-12 3:33 ` [PATCH v3 4/7] gpio: regmap: Add set_config callback Yu-Chun Lin
2026-05-12 18:12 ` Andy Shevchenko
2026-05-13 4:23 ` sashiko-bot [this message]
2026-05-12 3:33 ` [PATCH v3 5/7] dt-bindings: gpio: realtek: Add realtek,rtd1625-gpio Yu-Chun Lin
2026-05-13 4:26 ` sashiko-bot
2026-05-12 3:33 ` [PATCH v3 6/7] gpio: realtek: Add driver for Realtek DHC RTD1625 SoC Yu-Chun Lin
2026-05-12 18:50 ` Andy Shevchenko
2026-05-13 4:56 ` sashiko-bot
2026-05-12 3:33 ` [PATCH v3 7/7] arm64: dts: realtek: Add GPIO support for RTD1625 Yu-Chun Lin
2026-05-13 5:40 ` sashiko-bot
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=20260513042325.68C09C2BCB7@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=eleanor.lin@realtek.com \
--cc=krzk+dt@kernel.org \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.