spi: ti-qspi: improve ->remove() callback
PATCH 1/1 spi: ti-qspi: improve ->remove() callback
there's no need to call pm_runtime_get_sync() followed by pm_runtime_put(). We should, instead, just call pm_runtime_put_sync() and pm_runtime_disable().
--- drivers/spi/spi-ti-qspi.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-)
drivers/spi/spi-ti-qspi.c +1 -10
@@ -554,16 +554,7 @@ free_master:static int ti_qspi_remove (struct platform_device *pdev) { -struct ti_qspi *qspi =platform_get_drvdata (pdev); -int ret; - - ret =pm_runtime_get_sync (qspi->dev); -if (ret <0 ) { -dev_err (qspi->dev,"pm_runtime_get_sync() failed\n" ); -return ret; - } - -pm_runtime_put (qspi->dev); +pm_runtime_put_sync (&pdev->dev);pm_runtime_disable (&pdev->dev);return 0 ;
Signature · 6 lines
2.6.2 -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1446127050-5957-1-git-send-email-balbi-l0cyMroinI0@public.gmane.org
Quoted 3 lines · Felipe Balbi
there's no need to call
pm_runtime_get_sync()followed bypm_runtime_put(). We should, instead, just callpm_runtime_put_sync()andpm_runtime_disable().
Sry, but why do we need to call pm_runtime_put[_sync]() here?
My be just pm_runtime_disable() will be ok?
Quoted 29 lines
Signed-off-by Felipe Balbi <[email protected]>--- drivers/spi/spi-ti-qspi.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-)drivers/spi/spi-ti-qspi.c +1
-10@@ -554,16 +554,7 @@ free_master:static int ti_qspi_remove (struct platform_device *pdev) { -struct ti_qspi *qspi =platform_get_drvdata (pdev); -int ret; - - ret =pm_runtime_get_sync (qspi->dev); -if (ret <0 ) { -dev_err (qspi->dev,"pm_runtime_get_sync() failed\n" ); -return ret; - } - -pm_runtime_put (qspi->dev); +pm_runtime_put_sync (&pdev->dev);pm_runtime_disable (&pdev->dev);return 0 ;
Signature · 6 lines
regards, -grygorii -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 8 lines · Grygorii Strashko
Quoted 3 lines · Felipe Balbi
there's no need to call
pm_runtime_get_sync()followed bypm_runtime_put(). We should, instead, just callpm_runtime_put_sync()andpm_runtime_disable().Sry, but why do we need to call pm_runtime_put[_sync]() here?
My be just
pm_runtime_disable()will be ok?
and disable with unbalanced pm_runtime_get() ?
Signature · 1 line
balbi
A message that is not in the archive (sent off-list or not yet received): 87bnbcctsk.fsf-HgARHv6XitJaoMGHk7MhZQC/[email protected]
Quoted 7 lines · Felipe Balbi
Quoted 5 lines · Grygorii Strashko
Quoted 3 lines · Felipe Balbi
there's no need to call
pm_runtime_get_sync()followed bypm_runtime_put(). We should, instead, just callpm_runtime_put_sync()andpm_runtime_disable().
Quoted 6 lines
Quoted 3 lines
Sry, but why do we need to call pm_runtime_put[_sync]() here?
My be just
pm_runtime_disable()will be ok?and disable with unbalanced
pm_runtime_get()?
Which one is unbalanced pm_runtime_get()?
There are no pm_runtime_get() in probe, so there you are going to introduce unbalanced pm_runtime_put_sync() actually :(
Signature · 6 lines
regards, -grygorii -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): [email protected]
hi,
Quoted 10 lines · Grygorii Strashko
Quoted 9 lines · Felipe Balbi
Quoted 7 lines · Grygorii Strashko
Quoted 3 lines · Felipe Balbi
there's no need to call
pm_runtime_get_sync()followed bypm_runtime_put(). We should, instead, just callpm_runtime_put_sync()andpm_runtime_disable().Sry, but why do we need to call pm_runtime_put[_sync]() here?
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
My be just
pm_runtime_disable()will be ok?and disable with unbalanced
pm_runtime_get()?Which one is unbalanced
pm_runtime_get()?
There are nopm_runtime_get()in probe, so there you are going to introduce unbalancedpm_runtime_put_sync()actually :(
look at ti_qspi_setup(). I _do_ see, however, that it calls pm_runtime_put_autosuspend() in the same function; what happens if driver is removed after ti_qspi_setup() runs but before put_autosuspend() has time to actually run ?
Signature · 1 line
balbi
A message that is not in the archive (sent off-list or not yet received): 87si4oo07n.fsf-HgARHv6XitJaoMGHk7MhZQC/[email protected]
Quoted 19 lines · Felipe Balbi
hi,
Quoted 15 lines · Grygorii Strashko
Quoted 13 lines · Felipe Balbi
Quoted 8 lines · Grygorii Strashko
Quoted 3 lines · Felipe Balbi
there's no need to call
pm_runtime_get_sync()followed bypm_runtime_put(). We should, instead, just callpm_runtime_put_sync()andpm_runtime_disable().Sry, but why do we need to call pm_runtime_put[_sync]() here?
My be just
pm_runtime_disable()will be ok?and disable with unbalanced
pm_runtime_get()?
Quoted 9 lines
Quoted 3 lines
Which one is unbalanced
pm_runtime_get()?
There are nopm_runtime_get()in probe, so there you are going to introduce unbalancedpm_runtime_put_sync()actually :(look at
ti_qspi_setup(). I _do_ see, however, that it callspm_runtime_put_autosuspend()in the same function; what happens if driver is removed afterti_qspi_setup()runs but beforeput_autosuspend()has time to actually run ?
Seems nothing :) If I understand code in __device_release_driver() right:
the .remove() callback will be called after pm_runtime_put_sync() and device should be disabled at this moment.
Also, note that ti_qspi_setup() will be called for each SPI device attached to SPI master and further PM management of SPI master is performed by SPI core from __spi_pump_messages().
Signature · 6 lines
regards, -grygorii -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hi,
Quoted 30 lines · Grygorii Strashko
Quoted 19 lines · Felipe Balbi
hi,
Quoted 15 lines · Grygorii Strashko
Quoted 13 lines · Felipe Balbi
Quoted 8 lines · Grygorii Strashko
Quoted 3 lines · Felipe Balbi
there's no need to call
pm_runtime_get_sync()followed bypm_runtime_put(). We should, instead, just callpm_runtime_put_sync()andpm_runtime_disable().Sry, but why do we need to call pm_runtime_put[_sync]() here?
My be just
pm_runtime_disable()will be ok?and disable with unbalanced
pm_runtime_get()?Quoted 9 lines
Quoted 3 lines
Which one is unbalanced
pm_runtime_get()?
There are nopm_runtime_get()in probe, so there you are going to introduce unbalancedpm_runtime_put_sync()actually :(look at
ti_qspi_setup(). I _do_ see, however, that it callspm_runtime_put_autosuspend()in the same function; what happens if driver is removed afterti_qspi_setup()runs but beforeput_autosuspend()has time to actually run ?
Quoted 7 lines
Seems nothing :) If I understand code in
__device_release_driver()
right: the .remove() callback will be called afterpm_runtime_put_sync()and device should be disabled at this moment.Also, note that
ti_qspi_setup()will be called for each SPI device attached to SPI master and further PM management of SPI master is performed by SPI core from__spi_pump_messages().
all right, do you want to send a patch fixing it ?
Signature · 1 line
balbi