[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1131df96c22c28d5e3beca234dd3e81d0234b24d.camel@pengutronix.de>
Date: Thu, 08 Jan 2026 10:26:44 +0100
From: Philipp Zabel <p.zabel@...gutronix.de>
To: Bartosz Golaszewski <bartosz.golaszewski@....qualcomm.com>, Krzysztof
Kozlowski <krzk@...nel.org>
Cc: linux-kernel@...r.kernel.org
Subject: Re: [PATCH 03/15] reset: gpio: simplify fallback device matching
On Mo, 2026-01-05 at 15:15 +0100, Bartosz Golaszewski wrote:
> 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@....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")) {
This should check if rcdev->dev is set, otherwise
device_is_compatible() may try to dereference a NULL pointer in
dev_fwnode().
if (gpio_fallback && rcdev->dev &&
device_is_compatible(rcdev->dev, "reset-gpio")) {
regards
Philipp
Powered by blists - more mailing lists