reset: don't overwrite fwnode_reset_n_cells
PATCH 1/1 reset: don't overwrite fwnode_reset_n_cells
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.
--- drivers/reset/core.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/reset/core.c +7 -6
@@ -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);
Signature · 1 line
2.47.3
Hi Bartosz,
Hi Bartosz,
Thanks for your patch!
Quoted 1 line · Bartosz Golaszewski
Fix a logic bug in
reser_register()where we setfwnode_reset_n_cellsto
One more non-existing function ;-)
reset_controller_register()
Quoted 8 lines
1 if fwnode is set and
fwnode_xlateis not but we do it after assigningof_fwnode_handle(of_node)to fwnode.Modify the logic to: assign fwnode from
of_nodeif applicable, if fwnode is still not set, try to get it from the device and only then checkof_xlateandfwnode_xlateand either assignfwnode_reset_n_cellsfrom OF or default tofwnode_reset_simple_xlateandfwnode_reset_n_cells= 1.
Quoted 4 lines
Fixes ba8dbbb14b7e ("reset: convert the core API to using firmware nodes")Reported-by Mark Brown <[email protected]>Signed-off-by Bartosz Golaszewski <[email protected]>
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] 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
Quoted 7 lines · Geert Uytterhoeven
Hi Bartosz,
Hi Bartosz,
Thanks for your patch!
Quoted 8 lines
Quoted 1 line · Bartosz Golaszewski
Fix a logic bug in
reser_register()where we setfwnode_reset_n_cellstoOne 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
Quoted 12 lines · Bartosz Golaszewski
Quoted 11 lines · Geert Uytterhoeven
Hi Bartosz,
Hi Bartosz,
Thanks for your patch!
Quoted 1 line · Bartosz Golaszewski
Fix a logic bug in
reser_register()where we setfwnode_reset_n_cellsto
Quoted 7 lines
Quoted 4 lines
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.
regards
Philipp
Quoted 3 lines · Bartosz Golaszewski
Fix a logic bug in
reser_register()where we setfwnode_reset_n_cellsto 1 if fwnode is set andfwnode_xlateis not but we do it after assigningof_fwnode_handle(of_node)to fwnode.
Hi Bartosz, Mark,
Quoted 9 lines · Bartosz Golaszewski
Fix a logic bug in
reser_register()where we setfwnode_reset_n_cellsto 1 if fwnode is set andfwnode_xlateis not but we do it after assigningof_fwnode_handle(of_node)to fwnode.Modify the logic to: assign fwnode from
of_nodeif applicable, if fwnode is still not set, try to get it from the device and only then checkof_xlateandfwnode_xlateand either assignfwnode_reset_n_cellsfrom OF or default tofwnode_reset_simple_xlateandfwnode_reset_n_cells= 1.
Quoted 4 lines
Fixes ba8dbbb14b7e ("reset: convert the core API to using firmware nodes")Reported-by Mark Brown <[email protected]>Signed-off-by Bartosz Golaszewski <[email protected]>
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
Hi Bartosz,
Thanks for your patch.
Quoted 10 lines · Bartosz Golaszewski
Fix a logic bug in
reser_register()where we setfwnode_reset_n_cellsto 1 if fwnode is set andfwnode_xlateis not but we do it after assigningof_fwnode_handle(of_node)to fwnode.Modify the logic to: assign fwnode from
of_nodeif applicable, if fwnode is still not set, try to get it from the device and only then checkof_xlateandfwnode_xlateand either assignfwnode_reset_n_cellsfrom OF or default tofwnode_reset_simple_xlateandfwnode_reset_n_cells= 1.Fixes ba8dbbb14b7e ("reset: convert the core API to using firmware nodes")
Tested on RZ/G3E.
Kind Regards,
Tommaso
Quoted 42 lines
Reported-by Mark Brown <[email protected]>Signed-off-by Bartosz Golaszewski <[email protected]>--- drivers/reset/core.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)drivers/reset/core.c +7
-6@@ -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);Signature · 1 line
2.47.3