From: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
To: Krzysztof Kozlowski <krzk@kernel.org>,
Philipp Zabel <p.zabel@pengutronix.de>
Cc: linux-kernel@vger.kernel.org,
Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Subject: [PATCH 03/15] reset: gpio: simplify fallback device matching
Date: Mon, 05 Jan 2026 15:15:22 +0100 [thread overview]
Message-ID: <20260105-reset-core-refactor-v1-3-ac443103498d@oss.qualcomm.com> (raw)
In-Reply-To: <20260105-reset-core-refactor-v1-0-ac443103498d@oss.qualcomm.com>
The of_args field of struct reset_controller_dev was introduced to allow
the reset-gpio driver to pass the phandle arguments back to reset core.
The thing is: it doesn't even have to do it. The core sets the platform
data of the auxiliary device *AND* has access to it later on during the
lookup. This means the field is unneeded and all can happen entirely in
reset core.
Remove the field from the public header and don't set it in
reset-gpio.c. Retrieve the platform data in reset core when needed
instead.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
---
drivers/reset/core.c | 14 +++++---------
drivers/reset/reset-gpio.c | 5 -----
include/linux/reset-controller.h | 4 ----
3 files changed, 5 insertions(+), 18 deletions(-)
diff --git a/drivers/reset/core.c b/drivers/reset/core.c
index 813b85cb2758e129c72c09267a387108d7ad683b..ec9e4c39e8debd93d59851cfe72fcf44a79ed7e1 100644
--- a/drivers/reset/core.c
+++ b/drivers/reset/core.c
@@ -95,9 +95,6 @@ static const char *rcdev_name(struct reset_controller_dev *rcdev)
if (rcdev->of_node)
return rcdev->of_node->full_name;
- if (rcdev->of_args)
- return rcdev->of_args->np->full_name;
-
return NULL;
}
@@ -126,9 +123,6 @@ static int of_reset_simple_xlate(struct reset_controller_dev *rcdev,
*/
int reset_controller_register(struct reset_controller_dev *rcdev)
{
- if (rcdev->of_node && rcdev->of_args)
- return -EINVAL;
-
if (!rcdev->of_xlate) {
rcdev->of_reset_n_cells = 1;
rcdev->of_xlate = of_reset_simple_xlate;
@@ -1007,13 +1001,15 @@ static struct reset_controller_dev *__reset_find_rcdev(const struct of_phandle_a
bool gpio_fallback)
{
struct reset_controller_dev *rcdev;
+ struct of_phandle_args *rc_args;
lockdep_assert_held(&reset_list_mutex);
list_for_each_entry(rcdev, &reset_controller_list, list) {
- if (gpio_fallback) {
- if (rcdev->of_args && of_phandle_args_equal(args,
- rcdev->of_args))
+ if (gpio_fallback && device_is_compatible(rcdev->dev, "reset-gpio")) {
+ rc_args = dev_get_platdata(rcdev->dev);
+
+ if (of_phandle_args_equal(args, rc_args))
return rcdev;
} else {
if (args->np == rcdev->of_node)
diff --git a/drivers/reset/reset-gpio.c b/drivers/reset/reset-gpio.c
index 003bad361b3d32560f931f6b92234de523f97cf7..100fa23b56eaa01d042101b11a823196ae5ff113 100644
--- a/drivers/reset/reset-gpio.c
+++ b/drivers/reset/reset-gpio.c
@@ -60,12 +60,8 @@ static int reset_gpio_probe(struct auxiliary_device *adev,
const struct auxiliary_device_id *id)
{
struct device *dev = &adev->dev;
- struct of_phandle_args *platdata = dev_get_platdata(dev);
struct reset_gpio_priv *priv;
- if (!platdata)
- return -EINVAL;
-
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
return -ENOMEM;
@@ -80,7 +76,6 @@ static int reset_gpio_probe(struct auxiliary_device *adev,
priv->rc.ops = &reset_gpio_ops;
priv->rc.owner = THIS_MODULE;
priv->rc.dev = dev;
- priv->rc.of_args = platdata;
/* Cells to match GPIO specifier, but it's not really used */
priv->rc.of_reset_n_cells = 2;
diff --git a/include/linux/reset-controller.h b/include/linux/reset-controller.h
index 46514cb1b9e0626872fe71357b24d54ff0e81a8b..aa95b460fdf86f10002a465e285cd0119da6eeaf 100644
--- a/include/linux/reset-controller.h
+++ b/include/linux/reset-controller.h
@@ -35,9 +35,6 @@ struct of_phandle_args;
* @reset_control_head: head of internal list of requested reset controls
* @dev: corresponding driver model device struct
* @of_node: corresponding device tree node as phandle target
- * @of_args: for reset-gpios controllers: corresponding phandle args with
- * of_node and GPIO number complementing of_node; either this or
- * of_node should be present
* @of_reset_n_cells: number of cells in reset line specifiers
* @of_xlate: translation function to translate from specifier as found in the
* device tree to id as given to the reset control ops, defaults
@@ -51,7 +48,6 @@ struct reset_controller_dev {
struct list_head reset_control_head;
struct device *dev;
struct device_node *of_node;
- const struct of_phandle_args *of_args;
int of_reset_n_cells;
int (*of_xlate)(struct reset_controller_dev *rcdev,
const struct of_phandle_args *reset_spec);
--
2.47.3
next prev parent reply other threads:[~2026-01-05 14:16 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-05 14:15 [PATCH 00/15] reset: major reset core refactoring Bartosz Golaszewski
2026-01-05 14:15 ` [PATCH 01/15] reset: gpio: remove unneeded OF-node put Bartosz Golaszewski
2026-01-08 9:02 ` Philipp Zabel
2026-01-05 14:15 ` [PATCH 02/15] reset: gpio: add a devlink between reset-gpio and its consumer Bartosz Golaszewski
2026-01-08 9:02 ` Philipp Zabel
2026-01-05 14:15 ` Bartosz Golaszewski [this message]
2026-01-08 9:26 ` [PATCH 03/15] reset: gpio: simplify fallback device matching Philipp Zabel
2026-01-05 14:15 ` [PATCH 04/15] reset: gpio: remove unneeded auxiliary_set_drvdata() Bartosz Golaszewski
2026-01-08 9:27 ` Philipp Zabel
2026-01-05 14:15 ` [PATCH 05/15] reset: warn on reset-gpio release Bartosz Golaszewski
2026-01-05 14:15 ` [PATCH 06/15] reset: fold ida_alloc() into reset_create_gpio_aux_device() Bartosz Golaszewski
2026-01-05 14:15 ` [PATCH 07/15] reset: use lock guards in reset core Bartosz Golaszewski
2026-01-08 9:39 ` Philipp Zabel
2026-01-05 14:15 ` [PATCH 08/15] reset: remove unneeded include Bartosz Golaszewski
2026-01-08 9:44 ` Philipp Zabel
2026-01-08 14:13 ` Bartosz Golaszewski
2026-01-05 14:15 ` [PATCH 09/15] reset: handle removing supplier before consumers Bartosz Golaszewski
2026-01-05 14:15 ` [PATCH 10/15] reset: protect struct reset_controller_dev with its own mutex Bartosz Golaszewski
2026-01-05 14:15 ` [PATCH 11/15] reset: protect struct reset_control " Bartosz Golaszewski
2026-01-05 14:15 ` [PATCH 12/15] reset: convert of_reset_control_get_count() to using firmware nodes Bartosz Golaszewski
2026-01-05 14:15 ` [PATCH 13/15] reset: convert the core API " Bartosz Golaszewski
2026-01-05 14:15 ` [PATCH 14/15] reset: convert reset core " Bartosz Golaszewski
2026-01-05 14:15 ` [PATCH 15/15] reset: gpio: make the driver fwnode-agnostic Bartosz Golaszewski
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=20260105-reset-core-refactor-v1-3-ac443103498d@oss.qualcomm.com \
--to=bartosz.golaszewski@oss.qualcomm.com \
--cc=krzk@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=p.zabel@pengutronix.de \
/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®