* [PATCH] reset: don't overwrite fwnode_reset_n_cells
@ 2026-03-10 15:15 Bartosz Golaszewski
2026-03-10 15:17 ` Geert Uytterhoeven
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Bartosz Golaszewski @ 2026-03-10 15:15 UTC (permalink / raw)
To: Philipp Zabel, Mark Brown, Geert Uytterhoeven
Cc: linux-kernel, brgl, Bartosz Golaszewski
Fix a logic bug in reser_register() where we set fwnode_reset_n_cells to
1 if fwnode is set and fwnode_xlate is not but we do it after assigning
of_fwnode_handle(of_node) to fwnode.
Modify the logic to: assign fwnode from of_node if applicable, if fwnode
is still not set, try to get it from the device and only then check
of_xlate and fwnode_xlate and either assign fwnode_reset_n_cells from OF
or default to fwnode_reset_simple_xlate and fwnode_reset_n_cells = 1.
Fixes: ba8dbbb14b7e ("reset: convert the core API to using firmware nodes")
Reported-by: Mark Brown <broonie@kernel.org>
Closes: https://lore.kernel.org/all/0b72286b-33dd-4bc9-8c0e-161c2f4baed8@sirena.org.uk/
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
---
drivers/reset/core.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/reset/core.c b/drivers/reset/core.c
index e625cf59cfb0..4d27bbea1a69 100644
--- a/drivers/reset/core.c
+++ b/drivers/reset/core.c
@@ -132,20 +132,21 @@ int reset_controller_register(struct reset_controller_dev *rcdev)
if ((rcdev->of_node && rcdev->fwnode) || (rcdev->of_xlate && rcdev->fwnode_xlate))
return -EINVAL;
- if (!rcdev->of_node && !rcdev->fwnode) {
+ if (rcdev->of_node && !rcdev->fwnode)
+ rcdev->fwnode = of_fwnode_handle(rcdev->of_node);
+
+ if (!rcdev->fwnode) {
rcdev->fwnode = dev_fwnode(rcdev->dev);
if (!rcdev->fwnode)
return -EINVAL;
}
- if (rcdev->of_node) {
- rcdev->fwnode = of_fwnode_handle(rcdev->of_node);
+ if (rcdev->of_xlate)
rcdev->fwnode_reset_n_cells = rcdev->of_reset_n_cells;
- }
- if (rcdev->fwnode && !rcdev->fwnode_xlate) {
- rcdev->fwnode_reset_n_cells = 1;
+ if (!rcdev->fwnode_xlate && !rcdev->of_xlate) {
rcdev->fwnode_xlate = fwnode_reset_simple_xlate;
+ rcdev->fwnode_reset_n_cells = 1;
}
INIT_LIST_HEAD(&rcdev->reset_control_head);
--
2.47.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] reset: don't overwrite fwnode_reset_n_cells
2026-03-10 15:15 [PATCH] reset: don't overwrite fwnode_reset_n_cells Bartosz Golaszewski
@ 2026-03-10 15:17 ` Geert Uytterhoeven
2026-03-10 15:19 ` Bartosz Golaszewski
2026-03-10 16:38 ` Mark Brown
` (2 subsequent siblings)
3 siblings, 1 reply; 7+ messages in thread
From: Geert Uytterhoeven @ 2026-03-10 15:17 UTC (permalink / raw)
To: Bartosz Golaszewski; +Cc: Philipp Zabel, Mark Brown, linux-kernel, brgl
Hi Bartosz,
Hi Bartosz,
Thanks for your patch!
On Tue, 10 Mar 2026 at 16:15, Bartosz Golaszewski
<bartosz.golaszewski@oss.qualcomm.com> wrote:
> Fix a logic bug in reser_register() where we set fwnode_reset_n_cells to
One more non-existing function ;-)
reset_controller_register()
> 1 if fwnode is set and fwnode_xlate is not but we do it after assigning
> of_fwnode_handle(of_node) to fwnode.
>
> Modify the logic to: assign fwnode from of_node if applicable, if fwnode
> is still not set, try to get it from the device and only then check
> of_xlate and fwnode_xlate and either assign fwnode_reset_n_cells from OF
> or default to fwnode_reset_simple_xlate and fwnode_reset_n_cells = 1.
>
> Fixes: ba8dbbb14b7e ("reset: convert the core API to using firmware nodes")
> Reported-by: Mark Brown <broonie@kernel.org>
> Closes: https://lore.kernel.org/all/0b72286b-33dd-4bc9-8c0e-161c2f4baed8@sirena.org.uk/
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] reset: don't overwrite fwnode_reset_n_cells
2026-03-10 15:17 ` Geert Uytterhoeven
@ 2026-03-10 15:19 ` Bartosz Golaszewski
2026-03-11 7:25 ` Philipp Zabel
0 siblings, 1 reply; 7+ messages in thread
From: Bartosz Golaszewski @ 2026-03-10 15:19 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Bartosz Golaszewski, Philipp Zabel, Mark Brown, linux-kernel
On Tue, Mar 10, 2026 at 4:17 PM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>
> Hi Bartosz,
>
> Hi Bartosz,
>
> Thanks for your patch!
>
> On Tue, 10 Mar 2026 at 16:15, Bartosz Golaszewski
> <bartosz.golaszewski@oss.qualcomm.com> wrote:
> > Fix a logic bug in reser_register() where we set fwnode_reset_n_cells to
>
> One more non-existing function ;-)
>
> reset_controller_register()
>
Gah! If Mark says it fixes the issue, I'll either resend it with
commit message fixed or maybe Philipp can fix it when applying.
Bart
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] reset: don't overwrite fwnode_reset_n_cells
2026-03-10 15:15 [PATCH] reset: don't overwrite fwnode_reset_n_cells Bartosz Golaszewski
2026-03-10 15:17 ` Geert Uytterhoeven
@ 2026-03-10 16:38 ` Mark Brown
2026-03-11 7:51 ` Philipp Zabel
2026-03-11 16:11 ` Tommaso Merciai
3 siblings, 0 replies; 7+ messages in thread
From: Mark Brown @ 2026-03-10 16:38 UTC (permalink / raw)
To: Bartosz Golaszewski; +Cc: Philipp Zabel, Geert Uytterhoeven, linux-kernel, brgl
[-- Attachment #1: Type: text/plain, Size: 301 bytes --]
On Tue, Mar 10, 2026 at 04:15:15PM +0100, Bartosz Golaszewski wrote:
> Fix a logic bug in reser_register() where we set fwnode_reset_n_cells to
> 1 if fwnode is set and fwnode_xlate is not but we do it after assigning
> of_fwnode_handle(of_node) to fwnode.
Tested-by: Mark Brown <broonie@kernel.org>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] reset: don't overwrite fwnode_reset_n_cells
2026-03-10 15:19 ` Bartosz Golaszewski
@ 2026-03-11 7:25 ` Philipp Zabel
0 siblings, 0 replies; 7+ messages in thread
From: Philipp Zabel @ 2026-03-11 7:25 UTC (permalink / raw)
To: Bartosz Golaszewski, Geert Uytterhoeven
Cc: Bartosz Golaszewski, Mark Brown, linux-kernel
On Di, 2026-03-10 at 16:19 +0100, Bartosz Golaszewski wrote:
> On Tue, Mar 10, 2026 at 4:17 PM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> >
> > Hi Bartosz,
> >
> > Hi Bartosz,
> >
> > Thanks for your patch!
> >
> > On Tue, 10 Mar 2026 at 16:15, Bartosz Golaszewski
> > <bartosz.golaszewski@oss.qualcomm.com> wrote:
> > > Fix a logic bug in reser_register() where we set fwnode_reset_n_cells to
> >
> > One more non-existing function ;-)
> >
> > reset_controller_register()
> >
>
> Gah! If Mark says it fixes the issue, I'll either resend it with
> commit message fixed or maybe Philipp can fix it when applying.
I'll do that.
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
regards
Philipp
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] reset: don't overwrite fwnode_reset_n_cells
2026-03-10 15:15 [PATCH] reset: don't overwrite fwnode_reset_n_cells Bartosz Golaszewski
2026-03-10 15:17 ` Geert Uytterhoeven
2026-03-10 16:38 ` Mark Brown
@ 2026-03-11 7:51 ` Philipp Zabel
2026-03-11 16:11 ` Tommaso Merciai
3 siblings, 0 replies; 7+ messages in thread
From: Philipp Zabel @ 2026-03-11 7:51 UTC (permalink / raw)
To: Bartosz Golaszewski, Mark Brown, Geert Uytterhoeven; +Cc: linux-kernel, brgl
Hi Bartosz, Mark,
On Di, 2026-03-10 at 16:15 +0100, Bartosz Golaszewski wrote:
> Fix a logic bug in reser_register() where we set fwnode_reset_n_cells to
> 1 if fwnode is set and fwnode_xlate is not but we do it after assigning
> of_fwnode_handle(of_node) to fwnode.
>
> Modify the logic to: assign fwnode from of_node if applicable, if fwnode
> is still not set, try to get it from the device and only then check
> of_xlate and fwnode_xlate and either assign fwnode_reset_n_cells from OF
> or default to fwnode_reset_simple_xlate and fwnode_reset_n_cells = 1.
>
> Fixes: ba8dbbb14b7e ("reset: convert the core API to using firmware nodes")
> Reported-by: Mark Brown <broonie@kernel.org>
> Closes: https://lore.kernel.org/all/0b72286b-33dd-4bc9-8c0e-161c2f4baed8@sirena.org.uk/
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Applied to reset/next, thank you!
[1/1] reset: don't overwrite fwnode_reset_n_cells
https://git.pengutronix.de/cgit/pza/linux/commit/?id=62d11b80ea5d
regards
Philipp
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] reset: don't overwrite fwnode_reset_n_cells
2026-03-10 15:15 [PATCH] reset: don't overwrite fwnode_reset_n_cells Bartosz Golaszewski
` (2 preceding siblings ...)
2026-03-11 7:51 ` Philipp Zabel
@ 2026-03-11 16:11 ` Tommaso Merciai
3 siblings, 0 replies; 7+ messages in thread
From: Tommaso Merciai @ 2026-03-11 16:11 UTC (permalink / raw)
To: Bartosz Golaszewski
Cc: Philipp Zabel, Mark Brown, Geert Uytterhoeven, linux-kernel, brgl
Hi Bartosz,
Thanks for your patch.
On Tue, Mar 10, 2026 at 04:15:15PM +0100, Bartosz Golaszewski wrote:
> Fix a logic bug in reser_register() where we set fwnode_reset_n_cells to
> 1 if fwnode is set and fwnode_xlate is not but we do it after assigning
> of_fwnode_handle(of_node) to fwnode.
>
> Modify the logic to: assign fwnode from of_node if applicable, if fwnode
> is still not set, try to get it from the device and only then check
> of_xlate and fwnode_xlate and either assign fwnode_reset_n_cells from OF
> or default to fwnode_reset_simple_xlate and fwnode_reset_n_cells = 1.
>
> Fixes: ba8dbbb14b7e ("reset: convert the core API to using firmware nodes")
Tested on RZ/G3E.
Tested-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
Kind Regards,
Tommaso
> Reported-by: Mark Brown <broonie@kernel.org>
> Closes: https://lore.kernel.org/all/0b72286b-33dd-4bc9-8c0e-161c2f4baed8@sirena.org.uk/
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
> ---
> drivers/reset/core.c | 13 +++++++------
> 1 file changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/reset/core.c b/drivers/reset/core.c
> index e625cf59cfb0..4d27bbea1a69 100644
> --- a/drivers/reset/core.c
> +++ b/drivers/reset/core.c
> @@ -132,20 +132,21 @@ int reset_controller_register(struct reset_controller_dev *rcdev)
> if ((rcdev->of_node && rcdev->fwnode) || (rcdev->of_xlate && rcdev->fwnode_xlate))
> return -EINVAL;
>
> - if (!rcdev->of_node && !rcdev->fwnode) {
> + if (rcdev->of_node && !rcdev->fwnode)
> + rcdev->fwnode = of_fwnode_handle(rcdev->of_node);
> +
> + if (!rcdev->fwnode) {
> rcdev->fwnode = dev_fwnode(rcdev->dev);
> if (!rcdev->fwnode)
> return -EINVAL;
> }
>
> - if (rcdev->of_node) {
> - rcdev->fwnode = of_fwnode_handle(rcdev->of_node);
> + if (rcdev->of_xlate)
> rcdev->fwnode_reset_n_cells = rcdev->of_reset_n_cells;
> - }
>
> - if (rcdev->fwnode && !rcdev->fwnode_xlate) {
> - rcdev->fwnode_reset_n_cells = 1;
> + if (!rcdev->fwnode_xlate && !rcdev->of_xlate) {
> rcdev->fwnode_xlate = fwnode_reset_simple_xlate;
> + rcdev->fwnode_reset_n_cells = 1;
> }
>
> INIT_LIST_HEAD(&rcdev->reset_control_head);
> --
> 2.47.3
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-03-11 16:11 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-10 15:15 [PATCH] reset: don't overwrite fwnode_reset_n_cells Bartosz Golaszewski
2026-03-10 15:17 ` Geert Uytterhoeven
2026-03-10 15:19 ` Bartosz Golaszewski
2026-03-11 7:25 ` Philipp Zabel
2026-03-10 16:38 ` Mark Brown
2026-03-11 7:51 ` Philipp Zabel
2026-03-11 16:11 ` Tommaso Merciai
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.