mmc: renesas_sdhi: add checks for pinctrl_lookup_state
Subsystems (2)
PATCH 1/1 mmc: renesas_sdhi: add checks for pinctrl_lookup_state
renesas_sdhi_probe misses checks for pinctrl_lookup_state and may miss failures.
Add checks for them to fix the problem.
--- drivers/mmc/host/renesas_sdhi_core.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/mmc/host/renesas_sdhi_core.c +5 -0
@@ -694,8 +694,13 @@ int renesas_sdhi_probe(struct platform_device *pdev,if (!IS_ERR (priv->pinctrl)) { priv->pins_default =pinctrl_lookup_state (priv->pinctrl,PINCTRL_STATE_DEFAULT ); +if (IS_ERR (priv->pins_default)) +return PTR_ERR (priv->pins_default); + priv->pins_uhs =pinctrl_lookup_state (priv->pinctrl,"state_uhs" ); +if (IS_ERR (priv->pins_uhs)) +return PTR_ERR (priv->pins_uhs); } host =tmio_mmc_host_alloc (pdev, mmc_data);
Signature · 1 line
2.20.1
Quoted 16 lines · Chuhong Yuan
renesas_sdhi_probemisses checks forpinctrl_lookup_stateand may miss failures.
Add checks for them to fix the problem.Signed-off-by Chuhong Yuan <[email protected]>--- drivers/mmc/host/renesas_sdhi_core.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/mmc/host/renesas_sdhi_core.c +0
-0@@ -694,8 +694,13 @@ int renesas_sdhi_probe(struct platform_device *pdev,if (!IS_ERR (priv->pinctrl)) {
drivers/mmc/host/renesas_sdhi_core.c int renesas_sdhi_probe(struct platform_device *pdev, · line 704
Quoted 10 lines
drivers/mmc/host/renesas_sdhi_core.c +5
-0priv->pins_default =pinctrl_lookup_state (priv->pinctrl,PINCTRL_STATE_DEFAULT ); +if (IS_ERR (priv->pins_default)) +return PTR_ERR (priv->pins_default); + priv->pins_uhs =pinctrl_lookup_state (priv->pinctrl,"state_uhs" ); +if (IS_ERR (priv->pins_uhs)) +return PTR_ERR (priv->pins_uhs); }
This looks correct to me, as I guess if there is a pinctrl specified for device node of the controller, it means that it should be used!?
I understand that this is only used for those variants that supports UHS-I via the renesas_sdhi_start_signal_voltage_switch(). Wolfram, is this fine you think?
Quoted 5 lines
drivers/mmc/host/renesas_sdhi_core.c +0
-1host =tmio_mmc_host_alloc (pdev, mmc_data); --2.20.1
Kind regards
Uffe
Quoted 4 lines
I understand that this is only used for those variants that supports UHS-I via the
renesas_sdhi_start_signal_voltage_switch(). Wolfram, is this fine you think?
I'll double check tomorrow.
Quoted 31 lines · Ulf Hansson
Quoted 16 lines · Chuhong Yuan
renesas_sdhi_probemisses checks forpinctrl_lookup_stateand may miss failures.
Add checks for them to fix the problem.Signed-off-by Chuhong Yuan <[email protected]>--- drivers/mmc/host/renesas_sdhi_core.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/mmc/host/renesas_sdhi_core.c +0
-0@@ -694,8 +694,13 @@ int renesas_sdhi_probe(struct platform_device *pdev,if (!IS_ERR (priv->pinctrl)) {drivers/mmc/host/renesas_sdhi_core.c int renesas_sdhi_probe(struct platform_device *pdev, · line 704
Quoted 10 lines
drivers/mmc/host/renesas_sdhi_core.c +5
-0priv->pins_default =pinctrl_lookup_state (priv->pinctrl,PINCTRL_STATE_DEFAULT ); +if (IS_ERR (priv->pins_default)) +return PTR_ERR (priv->pins_default); + priv->pins_uhs =pinctrl_lookup_state (priv->pinctrl,"state_uhs" ); +if (IS_ERR (priv->pins_uhs)) +return PTR_ERR (priv->pins_uhs); }This looks correct to me, as I guess if there is a pinctrl specified for device node of the controller, it means that it should be used!?
Quoted 3 lines
I understand that this is only used for those variants that supports UHS-I via the
renesas_sdhi_start_signal_voltage_switch(). Wolfram, is this fine you think?
Well, I don't like to bail out because this error is not fatal for basic operations. How about releasing priv->pinctrl again with an additional warning that pinctrl settings are broken and will prevent 1.8v modes?
Opinions?
Quoted 37 lines · Wolfram Sang
Quoted 31 lines · Ulf Hansson
Quoted 16 lines · Chuhong Yuan
renesas_sdhi_probemisses checks forpinctrl_lookup_stateand may miss failures.
Add checks for them to fix the problem.Signed-off-by Chuhong Yuan <[email protected]>--- drivers/mmc/host/renesas_sdhi_core.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/mmc/host/renesas_sdhi_core.c +0
-0@@ -694,8 +694,13 @@ int renesas_sdhi_probe(struct platform_device *pdev,if (!IS_ERR (priv->pinctrl)) {drivers/mmc/host/renesas_sdhi_core.c int renesas_sdhi_probe(struct platform_device *pdev, · line 704
Quoted 10 lines
drivers/mmc/host/renesas_sdhi_core.c +5
-0priv->pins_default =pinctrl_lookup_state (priv->pinctrl,PINCTRL_STATE_DEFAULT ); +if (IS_ERR (priv->pins_default)) +return PTR_ERR (priv->pins_default); + priv->pins_uhs =pinctrl_lookup_state (priv->pinctrl,"state_uhs" ); +if (IS_ERR (priv->pins_uhs)) +return PTR_ERR (priv->pins_uhs); }This looks correct to me, as I guess if there is a pinctrl specified for device node of the controller, it means that it should be used!?
Quoted 3 lines
I understand that this is only used for those variants that supports UHS-I via the
renesas_sdhi_start_signal_voltage_switch(). Wolfram, is this fine you think?
Quoted 5 lines
Well, I don't like to bail out because this error is not fatal for basic operations. How about releasing
priv->pinctrlagain with an additional warning that pinctrl settings are broken and will prevent 1.8v modes?Opinions?
Hmm, from a mmc driver probe point of view, I don't quite share this approach.
I would rather fail as it forces the DTB to be corrected immediately, rather than trusting some developer to look at a warning in a log. The point is, in such a case it may never get fixed, if the product is shipped with the wrong DTB.
My concern at this point is rather to break existing DTBs, but it seems that should not be an issue, right?
Kind regards
Uffe
HI Ulf,
Quoted 4 lines
Quoted 4 lines
Well, I don't like to bail out because this error is not fatal for basic operations. How about releasing
priv->pinctrlagain with an additional warning that pinctrl settings are broken and will prevent 1.8v modes?
Quoted 8 lines
Quoted 1 line
Opinions?
Hmm, from a mmc driver probe point of view, I don't quite share this approach.
I would rather fail as it forces the DTB to be corrected immediately, rather than trusting some developer to look at a warning in a log. The point is, in such a case it may never get fixed, if the product is shipped with the wrong DTB.
I could agree to this arguement, iff the only way pinctrl_select fails is a DT misconfiguration. I am not sure if this is true right now, and we can't be sure about the future. Or?
Quoted 2 lines
My concern at this point is rather to break existing DTBs, but it seems that should not be an issue, right?
AFAIK not for the upstream ones, I don't know the customer ones.
I still prefer to not bail out.
Kind regards,
Wolfram
Hi Wolfram,
Quoted 8 lines · Wolfram Sang
Quoted 8 lines
Quoted 5 lines
Well, I don't like to bail out because this error is not fatal for basic operations. How about releasing
priv->pinctrlagain with an additional warning that pinctrl settings are broken and will prevent 1.8v modes?Opinions?
Hmm, from a mmc driver probe point of view, I don't quite share this approach.
Quoted 8 lines
Quoted 4 lines
I would rather fail as it forces the DTB to be corrected immediately, rather than trusting some developer to look at a warning in a log. The point is, in such a case it may never get fixed, if the product is shipped with the wrong DTB.
I could agree to this arguement, iff the only way
pinctrl_selectfails is a DT misconfiguration. I am not sure if this is true right now, and we can't be sure about the future. Or?
Isn't "state_uhs" optional? So bailing out if it doesn't exist is wrong. "default" should be there, if the device node has pinctrl properties.
renesas_sdhi_start_signal_voltage_switch() already handles fallback to 3v3 operation.
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 24 lines · Geert Uytterhoeven
Hi Wolfram,
Quoted 8 lines · Wolfram Sang
Quoted 8 lines
Quoted 5 lines
Well, I don't like to bail out because this error is not fatal for basic operations. How about releasing
priv->pinctrlagain with an additional warning that pinctrl settings are broken and will prevent 1.8v modes?Opinions?
Hmm, from a mmc driver probe point of view, I don't quite share this approach.
Quoted 8 lines
Quoted 4 lines
I would rather fail as it forces the DTB to be corrected immediately, rather than trusting some developer to look at a warning in a log. The point is, in such a case it may never get fixed, if the product is shipped with the wrong DTB.
I could agree to this arguement, iff the only way
pinctrl_selectfails is a DT misconfiguration. I am not sure if this is true right now, and we can't be sure about the future. Or?Isn't "
state_uhs" optional? So bailing out if it doesn't exist is wrong. "default" should be there, if the device node has pinctrl properties.
Quoted 7 lines
renesas_sdhi_start_signal_voltage_switch()already handles fallback to 3v3 operation.Gr{oetje,eeting}s,
Geert
Just ping this thread.
I am not clear about what is the conclusion of how to deal with the error? Should I resend a new version of the patch?
Regards,
Chuhong
Quoted 6 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