linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] spi: Gracefully handle power supplies with disabled PM
@ 2018-09-17 12:10 Lubomir Rintel
  2018-09-17 16:27 ` Mark Brown
  2018-11-03 19:12 ` Pavel Machek
  0 siblings, 2 replies; 3+ messages in thread
From: Lubomir Rintel @ 2018-09-17 12:10 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-spi, Lubomir Rintel, Mark Brown

This allows use of SPI when power management is disables, such as on
early boot;

See also: commit 31eb74318054 ("PM / runtime: Fix handling of suppliers
with disabled runtime PM")

Cc: Mark Brown <broonie@kernel.org>
Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
---
 drivers/spi/spi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index ec395a6baf9c..6546564e41d0 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -1212,7 +1212,7 @@ static void __spi_pump_messages(struct spi_controller *ctlr, bool in_kthread)
 
 	if (!was_busy && ctlr->auto_runtime_pm) {
 		ret = pm_runtime_get_sync(ctlr->dev.parent);
-		if (ret < 0) {
+		if (ret < 0 && ret != -EACCES) {
 			pm_runtime_put_noidle(ctlr->dev.parent);
 			dev_err(&ctlr->dev, "Failed to power device: %d\n",
 				ret);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] spi: Gracefully handle power supplies with disabled PM
  2018-09-17 12:10 [PATCH] spi: Gracefully handle power supplies with disabled PM Lubomir Rintel
@ 2018-09-17 16:27 ` Mark Brown
  2018-11-03 19:12 ` Pavel Machek
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2018-09-17 16:27 UTC (permalink / raw)
  To: Lubomir Rintel; +Cc: linux-kernel, linux-spi

[-- Attachment #1: Type: text/plain, Size: 688 bytes --]

On Mon, Sep 17, 2018 at 02:10:41PM +0200, Lubomir Rintel wrote:
> This allows use of SPI when power management is disables, such as on
> early boot;
> 
> See also: commit 31eb74318054 ("PM / runtime: Fix handling of suppliers
> with disabled runtime PM")

>  	if (!was_busy && ctlr->auto_runtime_pm) {
>  		ret = pm_runtime_get_sync(ctlr->dev.parent);
> -		if (ret < 0) {
> +		if (ret < 0 && ret != -EACCES) {

No, this is not at all clever.  If the device uses runtime PM and
doesn't get resumed then there is every likelyhood that the device won't
even be clocked.  If users want to disable power management it's going
to need rather more work than just setting a flag.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] spi: Gracefully handle power supplies with disabled PM
  2018-09-17 12:10 [PATCH] spi: Gracefully handle power supplies with disabled PM Lubomir Rintel
  2018-09-17 16:27 ` Mark Brown
@ 2018-11-03 19:12 ` Pavel Machek
  1 sibling, 0 replies; 3+ messages in thread
From: Pavel Machek @ 2018-11-03 19:12 UTC (permalink / raw)
  To: Lubomir Rintel; +Cc: linux-kernel, linux-spi, Mark Brown

[-- Attachment #1: Type: text/plain, Size: 1200 bytes --]

On Mon 2018-09-17 14:10:41, Lubomir Rintel wrote:
> This allows use of SPI when power management is disables, such as on
> early boot;

disabled
boot.

> See also: commit 31eb74318054 ("PM / runtime: Fix handling of suppliers
> with disabled runtime PM")
> 
> Cc: Mark Brown <broonie@kernel.org>
> Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>

Plus.. I'm not sure.

I thought you'd cause imbalance between _put and _get, but that one is
probably ok.

On early boot, you probably need to proceed, but is ret == -EACCESS
the right test?
									Pavel

> index ec395a6baf9c..6546564e41d0 100644
> --- a/drivers/spi/spi.c
> +++ b/drivers/spi/spi.c
> @@ -1212,7 +1212,7 @@ static void __spi_pump_messages(struct spi_controller *ctlr, bool in_kthread)
>  
>  	if (!was_busy && ctlr->auto_runtime_pm) {
>  		ret = pm_runtime_get_sync(ctlr->dev.parent);
> -		if (ret < 0) {
> +		if (ret < 0 && ret != -EACCES) {
>  			pm_runtime_put_noidle(ctlr->dev.parent);
>  			dev_err(&ctlr->dev, "Failed to power device: %d\n",
>  				ret);

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-11-03 19:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-17 12:10 [PATCH] spi: Gracefully handle power supplies with disabled PM Lubomir Rintel
2018-09-17 16:27 ` Mark Brown
2018-11-03 19:12 ` Pavel Machek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).