Recent "Run the driver callback directly" patch breaks libertas suspend
Hi Rafael,
Your recent patch:
commit 35cd133c
PM: Run the driver callback directly if the subsystem one is not there
breaks suspend for my libertas wifi and probably other SDIO devices.
SDIO (and possible MMC in general) has a protocol where the suspend method can return -ENOSYS and this means "There is no point in suspending, just turn me off".
The device itself "mmc1:0001" (I think) doesn't have any bus etc 'suspend' function so the new code call the device's suspend function which returns ENOSYS and the suspend fails.
The previous code ignores the device as there is no bus suspend, and when it gets to suspend the ancestor - which for me is omap_hsmmc.1, it calls the device suspend function catches the ENOSYS, and turns it off.
I suspect just reverting it isn't the right long term solution, however I can confirm that it works for me for now.
I'm happy to try any alternate fixes you would like to suggest (but I cannot promise how quickly I will get the testing done).
(I'm testing with 3.3)
Thanks,
NeilBrown
Quoted 20 lines · NeilBrown
Hi Rafael,
Your recent patch:
commit35cd133c
PM: Run the driver callback directly if the subsystem one is not therebreaks suspend for my libertas wifi and probably other SDIO devices.
SDIO (and possible MMC in general) has a protocol where the suspend method can return
-ENOSYSand this means "There is no point in suspending, just turn me off".The device itself "mmc1:0001" (I think) doesn't have any bus etc 'suspend' function so the new code call the device's suspend function which returns ENOSYS and the suspend fails.
The previous code ignores the device as there is no bus suspend, and when it gets to suspend the ancestor - which for me is omap_hsmmc.1, it calls the device suspend function catches the ENOSYS, and turns it off.
Quoted 5 lines
I suspect just reverting it isn't the right long term solution, however I can confirm that it works for me for now.
I'm happy to try any alternate fixes you would like to suggest (but I cannot promise how quickly I will get the testing done).
With a little restructuring, this might be a good application for pm_runtime_no_callbacks().
Alan Stern
Hi,
Quoted 8 lines · NeilBrown
Hi Rafael,
Your recent patch:
commit35cd133c
PM: Run the driver callback directly if the subsystem one is not therebreaks suspend for my libertas wifi and probably other SDIO devices.
Well, the patch is not recent. The _commit_ is more than three months old and the patch has been around since the last November (at least).
Quoted 11 lines
SDIO (and possible MMC in general) has a protocol where the suspend method can return
-ENOSYSand this means "There is no point in suspending, just turn me off".The device itself "mmc1:0001" (I think) doesn't have any bus etc 'suspend' function so the new code call the device's suspend function which returns ENOSYS and the suspend fails.
The previous code ignores the device as there is no bus suspend, and when it gets to suspend the ancestor - which for me is omap_hsmmc.1, it calls the device suspend function catches the ENOSYS, and turns it off.
Well, I can only call that a blatant abuse of the PM infrastructure.
Quoted 2 lines
I suspect just reverting it isn't the right long term solution, however I can confirm that it works for me for now.
It's not a solution at all, because there's code that depends on it already in the tree and the fact that it works for you doesn't mean it won't break other systems. So no, it's not an option.
Quoted 4 lines
I'm happy to try any alternate fixes you would like to suggest (but I cannot promise how quickly I will get the testing done).
(I'm testing with 3.3)
The only fix I can think of is to rework SDIO to stop abusing the PM callbacks. I'll have a look at that next week, although I can't promise anything any time soon, because I'm heading to San Francisco on Saturday.
Thanks,
Rafael
Quoted 22 lines · Alan Stern
Quoted 20 lines · NeilBrown
Hi Rafael,
Your recent patch:
commit35cd133c
PM: Run the driver callback directly if the subsystem one is not therebreaks suspend for my libertas wifi and probably other SDIO devices.
SDIO (and possible MMC in general) has a protocol where the suspend method can return
-ENOSYSand this means "There is no point in suspending, just turn me off".The device itself "mmc1:0001" (I think) doesn't have any bus etc 'suspend' function so the new code call the device's suspend function which returns ENOSYS and the suspend fails.
The previous code ignores the device as there is no bus suspend, and when it gets to suspend the ancestor - which for me is omap_hsmmc.1, it calls the device suspend function catches the ENOSYS, and turns it off.
Quoted 8 lines
Quoted 5 lines
I suspect just reverting it isn't the right long term solution, however I can confirm that it works for me for now.
I'm happy to try any alternate fixes you would like to suggest (but I cannot promise how quickly I will get the testing done).
With a little restructuring, this might be a good application for
pm_runtime_no_callbacks().
That won't cover system suspend, though.
Thanks,
Rafael
Quoted 36 lines · Rafael J. Wysocki
Hi,
Quoted 8 lines · NeilBrown
Hi Rafael,
Your recent patch:
commit35cd133c
PM: Run the driver callback directly if the subsystem one is not therebreaks suspend for my libertas wifi and probably other SDIO devices.
Well, the patch is not recent. The _commit_ is more than three months old and the patch has been around since the last November (at least).
Quoted 11 lines
SDIO (and possible MMC in general) has a protocol where the suspend method can return
-ENOSYSand this means "There is no point in suspending, just turn me off".The device itself "mmc1:0001" (I think) doesn't have any bus etc 'suspend' function so the new code call the device's suspend function which returns ENOSYS and the suspend fails.
The previous code ignores the device as there is no bus suspend, and when it gets to suspend the ancestor - which for me is omap_hsmmc.1, it calls the device suspend function catches the ENOSYS, and turns it off.
Well, I can only call that a blatant abuse of the PM infrastructure.
Quoted 2 lines
I suspect just reverting it isn't the right long term solution, however I can confirm that it works for me for now.
It's not a solution at all, because there's code that depends on it already in the tree and the fact that it works for you doesn't mean it won't break other systems. So no, it's not an option.
Quoted 8 lines
Quoted 4 lines
I'm happy to try any alternate fixes you would like to suggest (but I cannot promise how quickly I will get the testing done).
(I'm testing with 3.3)
The only fix I can think of is to rework SDIO to stop abusing the PM callbacks. I'll have a look at that next week, although I can't promise anything any time soon, because I'm heading to San Francisco on Saturday.
Well, this is kind of a long shot, but I wonder if the patch below makes any difference?
Rafael
--- drivers/mmc/core/sdio_bus.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/mmc/core/sdio_bus.c +9 -3
@@ -192,9 +192,15 @@ static int sdio_bus_remove(struct devicereturn ret; } -#ifdef CONFIG_PM_RUNTIME +#ifdef CONFIG_PM + +static int pm_no_operation(struct device *dev) +{ + return 0; +} static const struct dev_pm_ops sdio_bus_pm_ops = { + SET_SYSTEM_SLEEP_PM_OPS(pm_no_operation, pm_no_operation) SET_RUNTIME_PM_OPS( pm_generic_runtime_suspend, pm_generic_runtime_resume,
@@ -204,11 +210,11 @@ static const struct dev_pm_ops sdio_bus_#define SDIO_PM_OPS_PTR (&sdio_bus_pm_ops) -#else /* !CONFIG_PM_RUNTIME */ +#else /* !CONFIG_PM */ #define SDIO_PM_OPS_PTR NULL -#endif /* !CONFIG_PM_RUNTIME */ +#endif /* !CONFIG_PM */ static struct bus_type sdio_bus_type = { .name ="sdio" ,
Quoted 40 lines · On Sun, 25 Mar 2012 23:25:37 +0200 "Rafael J. Wysocki" <[email protected]> wrote:
Quoted 39 lines · Rafael J. Wysocki
Hi,
Quoted 8 lines · NeilBrown
Hi Rafael,
Your recent patch:
commit35cd133c
PM: Run the driver callback directly if the subsystem one is not therebreaks suspend for my libertas wifi and probably other SDIO devices.
Well, the patch is not recent. The _commit_ is more than three months old and the patch has been around since the last November (at least).
Quoted 11 lines
SDIO (and possible MMC in general) has a protocol where the suspend method can return
-ENOSYSand this means "There is no point in suspending, just turn me off".The device itself "mmc1:0001" (I think) doesn't have any bus etc 'suspend' function so the new code call the device's suspend function which returns ENOSYS and the suspend fails.
The previous code ignores the device as there is no bus suspend, and when it gets to suspend the ancestor - which for me is omap_hsmmc.1, it calls the device suspend function catches the ENOSYS, and turns it off.
Well, I can only call that a blatant abuse of the PM infrastructure.
Quoted 2 lines
I suspect just reverting it isn't the right long term solution, however I can confirm that it works for me for now.
It's not a solution at all, because there's code that depends on it already in the tree and the fact that it works for you doesn't mean it won't break other systems. So no, it's not an option.
Quoted 3 lines
I'm happy to try any alternate fixes you would like to suggest (but I cannot promise how quickly I will get the testing done).
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
(I'm testing with 3.3)
The only fix I can think of is to rework SDIO to stop abusing the PM callbacks. I'll have a look at that next week, although I can't promise anything any time soon, because I'm heading to San Francisco on Saturday.
Well, this is kind of a long shot, but I wonder if the patch below makes any difference?
Hi Rafael,
thanks for looking into this so quickly.
I removed the revert and applied this patch instead and can confirm that suspend completes now (and resume works and the wifi works after resume).
Further, this patch fits with my (fairly shallow) understanding of the problem.
Thanks!
NeilBrown
Quoted 42 lines
Rafael
--- drivers/mmc/core/sdio_bus.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)Index:
linux/drivers/mmc/core/sdio_bus.c
===================================================================drivers/mmc/core/sdio_bus.c +9
-3@@ -192,9 +192,15 @@ static int sdio_bus_remove(struct devicereturn ret; } -#ifdef CONFIG_PM_RUNTIME +#ifdef CONFIG_PM + +static int pm_no_operation(struct device *dev) +{ + return 0; +} static const struct dev_pm_ops sdio_bus_pm_ops = { + SET_SYSTEM_SLEEP_PM_OPS(pm_no_operation, pm_no_operation) SET_RUNTIME_PM_OPS( pm_generic_runtime_suspend, pm_generic_runtime_resume,@@ -204,11 +210,11 @@ static const struct dev_pm_ops sdio_bus_#define SDIO_PM_OPS_PTR (&sdio_bus_pm_ops) -#else /* !CONFIG_PM_RUNTIME */ +#else /* !CONFIG_PM */ #define SDIO_PM_OPS_PTR NULL -#endif /* !CONFIG_PM_RUNTIME */ +#endif /* !CONFIG_PM */ static struct bus_type sdio_bus_type = { .name ="sdio" ,
PATCH 1/1 PM / SDIO: Use empty system suspend/resume callbacks at the bus level (was: Re: Recent ...)
Quoted 54 lines · NeilBrown
Quoted 40 lines · On Sun, 25 Mar 2012 23:25:37 +0200 "Rafael J. Wysocki" <[email protected]> wrote:
Quoted 39 lines · Rafael J. Wysocki
Hi,
Quoted 8 lines · NeilBrown
Hi Rafael,
Your recent patch:
commit35cd133c
PM: Run the driver callback directly if the subsystem one is not therebreaks suspend for my libertas wifi and probably other SDIO devices.
Well, the patch is not recent. The _commit_ is more than three months old and the patch has been around since the last November (at least).
Quoted 11 lines
SDIO (and possible MMC in general) has a protocol where the suspend method can return
-ENOSYSand this means "There is no point in suspending, just turn me off".The device itself "mmc1:0001" (I think) doesn't have any bus etc 'suspend' function so the new code call the device's suspend function which returns ENOSYS and the suspend fails.
The previous code ignores the device as there is no bus suspend, and when it gets to suspend the ancestor - which for me is omap_hsmmc.1, it calls the device suspend function catches the ENOSYS, and turns it off.
Well, I can only call that a blatant abuse of the PM infrastructure.
Quoted 2 lines
I suspect just reverting it isn't the right long term solution, however I can confirm that it works for me for now.
It's not a solution at all, because there's code that depends on it already in the tree and the fact that it works for you doesn't mean it won't break other systems. So no, it's not an option.
Quoted 3 lines
I'm happy to try any alternate fixes you would like to suggest (but I cannot promise how quickly I will get the testing done).
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
(I'm testing with 3.3)
The only fix I can think of is to rework SDIO to stop abusing the PM callbacks. I'll have a look at that next week, although I can't promise anything any time soon, because I'm heading to San Francisco on Saturday.
Well, this is kind of a long shot, but I wonder if the patch below makes any difference?
Hi Rafael,
thanks for looking into this so quickly.
Quoted 7 lines
I removed the revert and applied this patch instead and can confirm that suspend completes now (and resume works and the wifi works after resume).
Further, this patch fits with my (fairly shallow) understanding of the problem.
Thanks!
Thanks for the confirmation.
Below it goes again with a changelog and tags.
I don't really think that SDIO does the right thing here overall, but that's all I can do to address the problem timely.
Thanks,
Rafael
---
From: Rafael J. Wysocki <[email protected]>
Subject: PM / SDIO: Use empty system suspend/resume callbacks at the bus level
Neil Brown reports that commit 35cd133c
PM: Run the driver callback directly if the subsystem one is not there
breaks suspend for his libertas wifi, because SDIO has a protocol where the suspend method can return -ENOSYS and this means "There is no point in suspending, just turn me off". Moreover, the suspend methods provided by SDIO drivers are not supposed to be called by the PM core or bus-level suspend routines (which aren't presend for SDIO). Instead, when the SDIO core gets to suspend the device's ancestor, it calls the device driver's suspend function, catches the ENOSYS, and turns the device off.
The commit above breaks the SDIO core's assumption that the device drivers' callbacks won't be executed if it doesn't provide any bus-level callbacks. If fact, however, this assumption has never been really satisfied, because device class or device type suspend might very well use the driver's callback even without that commit.
The simplest way to address this problem is to make the SDIO core tell the PM core to ignore driver callbacks, for example by providing no-operation suspend/resume callbacks at the bus level for it, which is implemented by this change.
--- drivers/mmc/core/sdio_bus.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/mmc/core/sdio_bus.c +9 -3
@@ -192,9 +192,15 @@ static int sdio_bus_remove(struct devicereturn ret; } -#ifdef CONFIG_PM_RUNTIME +#ifdef CONFIG_PM + +static int pm_no_operation(struct device *dev) +{ + return 0; +} static const struct dev_pm_ops sdio_bus_pm_ops = { + SET_SYSTEM_SLEEP_PM_OPS(pm_no_operation, pm_no_operation) SET_RUNTIME_PM_OPS( pm_generic_runtime_suspend, pm_generic_runtime_resume,
@@ -204,11 +210,11 @@ static const struct dev_pm_ops sdio_bus_#define SDIO_PM_OPS_PTR (&sdio_bus_pm_ops) -#else /* !CONFIG_PM_RUNTIME */ +#else /* !CONFIG_PM */ #define SDIO_PM_OPS_PTR NULL -#endif /* !CONFIG_PM_RUNTIME */ +#endif /* !CONFIG_PM */ static struct bus_type sdio_bus_type = { .name ="sdio" ,
Re: [PATCH] PM / SDIO: Use empty system suspend/resume callbacks at the bus level (was: Re: Recent ...)
Quoted 96 lines · Rafael J. Wysocki
Quoted 54 lines · NeilBrown
Quoted 40 lines · On Sun, 25 Mar 2012 23:25:37 +0200 "Rafael J. Wysocki" <[email protected]> wrote:
Quoted 39 lines · Rafael J. Wysocki
Hi,
Quoted 8 lines · NeilBrown
Hi Rafael,
Your recent patch:
commit35cd133c
PM: Run the driver callback directly if the subsystem one is not therebreaks suspend for my libertas wifi and probably other SDIO devices.
Well, the patch is not recent. The _commit_ is more than three months old and the patch has been around since the last November (at least).
Quoted 11 lines
SDIO (and possible MMC in general) has a protocol where the suspend method can return
-ENOSYSand this means "There is no point in suspending, just turn me off".The device itself "mmc1:0001" (I think) doesn't have any bus etc 'suspend' function so the new code call the device's suspend function which returns ENOSYS and the suspend fails.
The previous code ignores the device as there is no bus suspend, and when it gets to suspend the ancestor - which for me is omap_hsmmc.1, it calls the device suspend function catches the ENOSYS, and turns it off.
Well, I can only call that a blatant abuse of the PM infrastructure.
Quoted 2 lines
I suspect just reverting it isn't the right long term solution, however I can confirm that it works for me for now.
It's not a solution at all, because there's code that depends on it already in the tree and the fact that it works for you doesn't mean it won't break other systems. So no, it's not an option.
Quoted 3 lines
I'm happy to try any alternate fixes you would like to suggest (but I cannot promise how quickly I will get the testing done).
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
(I'm testing with 3.3)
The only fix I can think of is to rework SDIO to stop abusing the PM callbacks. I'll have a look at that next week, although I can't promise anything any time soon, because I'm heading to San Francisco on Saturday.
Well, this is kind of a long shot, but I wonder if the patch below makes any difference?
Hi Rafael,
thanks for looking into this so quickly.Quoted 7 lines
I removed the revert and applied this patch instead and can confirm that suspend completes now (and resume works and the wifi works after resume).
Further, this patch fits with my (fairly shallow) understanding of the problem.
Thanks!
Thanks for the confirmation.
Below it goes again with a changelog and tags.
I don't really think that SDIO does the right thing here overall, but that's all I can do to address the problem timely.
Thanks,
Rafael---
From: Rafael J. Wysocki <[email protected]>
Subject: PM / SDIO: Use empty system suspend/resume callbacks at the bus levelNeil Brown reports that commit
35cd133cPM: Run the driver callback directly if the subsystem one is not there
breaks suspend for his libertas wifi, because SDIO has a protocol where the suspend method can return
-ENOSYSand this means "There is no point in suspending, just turn me off". Moreover, the suspend methods provided by SDIO drivers are not supposed to be called by the PM core or bus-level suspend routines (which aren't presend for SDIO). Instead, when the SDIO core gets to suspend the device's ancestor, it calls the device driver's suspend function, catches the ENOSYS, and turns the device off.The commit above breaks the SDIO core's assumption that the device drivers' callbacks won't be executed if it doesn't provide any bus-level callbacks. If fact, however, this assumption has never been really satisfied, because device class or device type suspend might very well use the driver's callback even without that commit.
Quoted 7 lines
The simplest way to address this problem is to make the SDIO core tell the PM core to ignore driver callbacks, for example by providing no-operation suspend/resume callbacks at the bus level for it, which is implemented by this change.
Reported-and-tested-by Neil Brown <[email protected]>Signed-off-by Rafael J. Wysocki <[email protected]>
OK, I don't see any objections. Does it mean I can push this patch as a fix for 3.4? Chris?
Rafael
Quoted 46 lines
--- drivers/mmc/core/sdio_bus.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)Index:
linux/drivers/mmc/core/sdio_bus.c
===================================================================drivers/mmc/core/sdio_bus.c +9
-4@@ -192,9 +192,15 @@ static int sdio_bus_remove(struct devicereturn ret; } -#ifdef CONFIG_PM_RUNTIME +#ifdef CONFIG_PM + +static int pm_no_operation(struct device *dev) +{ + return 0; +} static const struct dev_pm_ops sdio_bus_pm_ops = { + SET_SYSTEM_SLEEP_PM_OPS(pm_no_operation, pm_no_operation) SET_RUNTIME_PM_OPS( pm_generic_runtime_suspend, pm_generic_runtime_resume,@@ -204,11 +210,11 @@ static const struct dev_pm_ops sdio_bus_#define SDIO_PM_OPS_PTR (&sdio_bus_pm_ops) -#else /* !CONFIG_PM_RUNTIME */ +#else /* !CONFIG_PM */ #define SDIO_PM_OPS_PTR NULL -#endif /* !CONFIG_PM_RUNTIME */ +#endif /* !CONFIG_PM */ static struct bus_type sdio_bus_type = { .name ="sdio" , --To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] PM / SDIO: Use empty system suspend/resume callbacks at the bus level
Hi Rafael,
Quoted 2 lines · Rafael J. Wysocki
OK, I don't see any objections. Does it mean I can push this patch as a fix for 3.4? Chris?
Sounds good, I'll push it through the MMC tree. (With a stable@ tag for 3.3 to fix the regression there.)
Thanks,
- Chris.
Signature · 2 lines
Chris Ball <[email protected]> <http://printf.net/> One Laptop Per Child
Re: [PATCH] PM / SDIO: Use empty system suspend/resume callbacks at the bus level
Quoted 8 lines · Chris Ball
Hi Rafael,
Quoted 2 lines · Rafael J. Wysocki
OK, I don't see any objections. Does it mean I can push this patch as a fix for 3.4? Chris?
Sounds good, I'll push it through the MMC tree. (With a stable@ tag for 3.3 to fix the regression there.)
Cool, thanks!
Rafael
Re: [PATCH] PM / SDIO: Use empty system suspend/resume callbacks at the bus level (was: Re: Recent ...)
In reply to Rafael J. WysockiQuoted 9 lines · On Mon, 26 Mar 2012 00:29:24 +0200 "Rafael J. Wysocki" <[email protected]> wrote:
Thanks for the confirmation.
Below it goes again with a changelog and tags.
I don't really think that SDIO does the right thing here overall, but that's all I can do to address the problem timely.
Thanks,
Rafael
Hi Rafael,
I just discovered that this patch has since been reverted - with an 'ack' from you:
----------
commit d8e2ac330f65bcf47e8894fe5331a7e8ee019c06
Author: Thierry Reding <[email protected]> Date: Thu Aug 9 09:32:21 2012 +0000
mmc: sdio: Fix PM_SLEEP related build warnings
Power management callbacks defined by SIMPLE_DEV_PM_OPS are only used if the PM_SLEEP Kconfig symbol has been defined. If not, the compiler will complain about them being unused. However, since the callback for this driver doesn't do anything it can just as well be dropped.
-----------
Unsurprisingly the problem which your patch fixed has come back.
Do you think we could get the patch back in again. This time maybe we should put some comments in there pointing out that having a function which does nothing is very different from not having any function at all?
Thanks,
NeilBrown
Quoted 70 lines
---
From: Rafael J. Wysocki <[email protected]>
Subject: PM / SDIO: Use empty system suspend/resume callbacks at the bus levelNeil Brown reports that commit
35cd133cPM: Run the driver callback directly if the subsystem one is not there
breaks suspend for his libertas wifi, because SDIO has a protocol where the suspend method can return
-ENOSYSand this means "There is no point in suspending, just turn me off". Moreover, the suspend methods provided by SDIO drivers are not supposed to be called by the PM core or bus-level suspend routines (which aren't presend for SDIO). Instead, when the SDIO core gets to suspend the device's ancestor, it calls the device driver's suspend function, catches the ENOSYS, and turns the device off.The commit above breaks the SDIO core's assumption that the device drivers' callbacks won't be executed if it doesn't provide any bus-level callbacks. If fact, however, this assumption has never been really satisfied, because device class or device type suspend might very well use the driver's callback even without that commit.
The simplest way to address this problem is to make the SDIO core tell the PM core to ignore driver callbacks, for example by providing no-operation suspend/resume callbacks at the bus level for it, which is implemented by this change.
Reported-and-tested-by Neil Brown <[email protected]>Signed-off-by Rafael J. Wysocki <[email protected]>--- drivers/mmc/core/sdio_bus.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)Index:
linux/drivers/mmc/core/sdio_bus.c
===================================================================drivers/mmc/core/sdio_bus.c +9
-3@@ -192,9 +192,15 @@ static int sdio_bus_remove(struct devicereturn ret; } -#ifdef CONFIG_PM_RUNTIME +#ifdef CONFIG_PM + +static int pm_no_operation(struct device *dev) +{ + return 0; +} static const struct dev_pm_ops sdio_bus_pm_ops = { + SET_SYSTEM_SLEEP_PM_OPS(pm_no_operation, pm_no_operation) SET_RUNTIME_PM_OPS( pm_generic_runtime_suspend, pm_generic_runtime_resume,@@ -204,11 +210,11 @@ static const struct dev_pm_ops sdio_bus_#define SDIO_PM_OPS_PTR (&sdio_bus_pm_ops) -#else /* !CONFIG_PM_RUNTIME */ +#else /* !CONFIG_PM */ #define SDIO_PM_OPS_PTR NULL -#endif /* !CONFIG_PM_RUNTIME */ +#endif /* !CONFIG_PM */ static struct bus_type sdio_bus_type = { .name ="sdio" ,
PATCH 1/1 SDIO / PM: Add empty bus-level suspend/resume callbacks
Quoted 31 lines · NeilBrown
Quoted 9 lines · On Mon, 26 Mar 2012 00:29:24 +0200 "Rafael J. Wysocki" <[email protected]> wrote:
Thanks for the confirmation.
Below it goes again with a changelog and tags.
I don't really think that SDIO does the right thing here overall, but that's all I can do to address the problem timely.
Thanks,
RafaelHi Rafael,
I just discovered that this patch has since been reverted - with an 'ack' from you:
----------
commitd8e2ac330f65bcf47e8894fe5331a7e8ee019c06Author: Thierry Reding <[email protected]> Date: Thu Aug 9 09:32:21 2012 +0000mmc: sdio: Fix
PM_SLEEPrelated build warningsPower management callbacks defined by
SIMPLE_DEV_PM_OPSare only used if thePM_SLEEPKconfigsymbol has been defined. If not, the compiler will complain about them being unused. However, since the callback for this driver doesn't do anything it can just as well be dropped.Signed-off-by Thierry Reding <[email protected]>Signed-off-by Chris Ball <[email protected]>
Quoted 7 lines
-----------
Unsurprisingly the problem which your patch fixed has come back.
Do you think we could get the patch back in again. This time maybe we should put some comments in there pointing out that having a function which does nothing is very different from not having any function at all?
Well, I agree. I didn't remember that the callback had been added for a purpose and hence my "ack" for that patch.
What about applying the appended patch (hopefully, the build warnings should be fixed properly this time)?
Rafael
---
From: Rafael J. Wysocki <[email protected]>
Subject: SDIO / PM: Add empty bus-level suspend/resume callbacks
Suspend methods provided by SDIO drivers are not supposed to be called by the PM core. Instead, when the SDIO core gets to suspend a device's ancestor, it calls the device driver's suspend routine. However, the PM core executes suspend callback routines directly for device drivers whose bus types don't provide suspend callbacks. In consequece, because the SDIO bus type doesn't provide a suspend callback, the SDIO drivers' suspend routines will be executed by the PM core (which shouldn't happen).
To prevent this from happening, add empty system suspend/resume callbacks for the SDIO bus type.
An analogous change had been made already by commit (e841a7c mmc:
sdio: Use empty system suspend/resume callbacks at the bus level), but then it was reverted inadvertently by commit (d8e2ac3 mmc: sdio:
Fix PM_SLEEP related build warnings) that attempted to fix build warnings introduced by commit e841a7c.
--- drivers/mmc/core/sdio_bus.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/mmc/core/sdio_bus.c +14 -0
@@ -193,7 +193,21 @@ static int sdio_bus_remove(struct device } #ifdef CONFIG_PM + +#ifdef CONFIG_PM_SLEEP +static int pm_no_operation(struct device *dev) +{ + /* + * Prevent the PM core from calling SDIO device drivers' suspend + * callback routines, which it is not supposed to do, by using this + * empty function as the bus type suspend callaback for SDIO. + */ + return 0; +} +#endif + static const struct dev_pm_ops sdio_bus_pm_ops = { + SET_SYSTEM_SLEEP_PM_OPS(pm_no_operation, pm_no_operation) SET_RUNTIME_PM_OPS( pm_generic_runtime_suspend, pm_generic_runtime_resume,
Signature · 2 lines
I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center.
Re: [PATCH] SDIO / PM: Add empty bus-level suspend/resume callbacks
Quoted 40 lines · On Sun, 02 Dec 2012 14:48:50 +0100 "Rafael J. Wysocki" <[email protected]> wrote:
Quoted 31 lines · NeilBrown
Quoted 9 lines · On Mon, 26 Mar 2012 00:29:24 +0200 "Rafael J. Wysocki" <[email protected]> wrote:
Thanks for the confirmation.
Below it goes again with a changelog and tags.
I don't really think that SDIO does the right thing here overall, but that's all I can do to address the problem timely.
Thanks,
RafaelHi Rafael,
I just discovered that this patch has since been reverted - with an 'ack' from you:
----------
commitd8e2ac330f65bcf47e8894fe5331a7e8ee019c06Author: Thierry Reding <[email protected]> Date: Thu Aug 9 09:32:21 2012 +0000mmc: sdio: Fix
PM_SLEEPrelated build warningsPower management callbacks defined by
SIMPLE_DEV_PM_OPSare only used if thePM_SLEEPKconfigsymbol has been defined. If not, the compiler will complain about them being unused. However, since the callback for this driver doesn't do anything it can just as well be dropped.Signed-off-by Thierry Reding <[email protected]>Signed-off-by Chris Ball <[email protected]>Quoted 7 lines
-----------
Unsurprisingly the problem which your patch fixed has come back.
Do you think we could get the patch back in again. This time maybe we should put some comments in there pointing out that having a function which does nothing is very different from not having any function at all?
Quoted 5 lines
Well, I agree. I didn't remember that the callback had been added for a purpose and hence my "ack" for that patch.
What about applying the appended patch (hopefully, the build warnings should be fixed properly this time)?
Looks good to me - thanks!
NeilBrown
Quoted 60 lines
Rafael
---
From: Rafael J. Wysocki <[email protected]>
Subject: SDIO / PM: Add empty bus-level suspend/resume callbacksSuspend methods provided by SDIO drivers are not supposed to be called by the PM core. Instead, when the SDIO core gets to suspend a device's ancestor, it calls the device driver's suspend routine. However, the PM core executes suspend callback routines directly for device drivers whose bus types don't provide suspend callbacks. In consequece, because the SDIO bus type doesn't provide a suspend callback, the SDIO drivers' suspend routines will be executed by the PM core (which shouldn't happen).
To prevent this from happening, add empty system suspend/resume callbacks for the SDIO bus type.
An analogous change had been made already by commit (e841a7c mmc:
sdio: Use empty system suspend/resume callbacks at the bus level), but then it was reverted inadvertently by commit (d8e2ac3 mmc: sdio:
FixPM_SLEEPrelated build warnings) that attempted to fix build warnings introduced by commit e841a7c.Reported-by NeilBrown <[email protected]>Signed-off-by Rafael J. Wysocki <[email protected]>--- drivers/mmc/core/sdio_bus.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)Index:
linux/drivers/mmc/core/sdio_bus.c
===================================================================drivers/mmc/core/sdio_bus.c +14
-0@@ -193,7 +193,21 @@ static int sdio_bus_remove(struct device } #ifdef CONFIG_PM + +#ifdef CONFIG_PM_SLEEP +static int pm_no_operation(struct device *dev) +{ + /* + * Prevent the PM core from calling SDIO device drivers' suspend + * callback routines, which it is not supposed to do, by using this + * empty function as the bus type suspend callaback for SDIO. + */ + return 0; +} +#endif + static const struct dev_pm_ops sdio_bus_pm_ops = { + SET_SYSTEM_SLEEP_PM_OPS(pm_no_operation, pm_no_operation) SET_RUNTIME_PM_OPS( pm_generic_runtime_suspend, pm_generic_runtime_resume,
Re: [PATCH] SDIO / PM: Add empty bus-level suspend/resume callbacks
In reply to Rafael J. WysockiQuoted 94 lines · Rafael J. Wysocki
Quoted 31 lines · NeilBrown
Quoted 9 lines · On Mon, 26 Mar 2012 00:29:24 +0200 "Rafael J. Wysocki" <[email protected]> wrote:
Thanks for the confirmation.
Below it goes again with a changelog and tags.
I don't really think that SDIO does the right thing here overall, but that's all I can do to address the problem timely.
Thanks,
RafaelHi Rafael,
I just discovered that this patch has since been reverted - with an 'ack' from you:
----------
commitd8e2ac330f65bcf47e8894fe5331a7e8ee019c06Author: Thierry Reding <[email protected]> Date: Thu Aug 9 09:32:21 2012 +0000mmc: sdio: Fix
PM_SLEEPrelated build warningsPower management callbacks defined by
SIMPLE_DEV_PM_OPSare only used if thePM_SLEEPKconfigsymbol has been defined. If not, the compiler will complain about them being unused. However, since the callback for this driver doesn't do anything it can just as well be dropped.Signed-off-by Thierry Reding <[email protected]>Signed-off-by Chris Ball <[email protected]>Quoted 7 lines
-----------
Unsurprisingly the problem which your patch fixed has come back.
Do you think we could get the patch back in again. This time maybe we should put some comments in there pointing out that having a function which does nothing is very different from not having any function at all?
Well, I agree. I didn't remember that the callback had been added for a purpose and hence my "ack" for that patch.
What about applying the appended patch (hopefully, the build warnings should be fixed properly this time)?
Rafael
---
From: Rafael J. Wysocki <[email protected]>
Subject: SDIO / PM: Add empty bus-level suspend/resume callbacksSuspend methods provided by SDIO drivers are not supposed to be called by the PM core. Instead, when the SDIO core gets to suspend a device's ancestor, it calls the device driver's suspend routine. However, the PM core executes suspend callback routines directly for device drivers whose bus types don't provide suspend callbacks. In consequece, because the SDIO bus type doesn't provide a suspend callback, the SDIO drivers' suspend routines will be executed by the PM core (which shouldn't happen).
To prevent this from happening, add empty system suspend/resume callbacks for the SDIO bus type.
An analogous change had been made already by commit (e841a7c mmc:
sdio: Use empty system suspend/resume callbacks at the bus level), but then it was reverted inadvertently by commit (d8e2ac3 mmc: sdio:
FixPM_SLEEPrelated build warnings) that attempted to fix build warnings introduced by commit e841a7c.Reported-by NeilBrown <[email protected]>Signed-off-by Rafael J. Wysocki <[email protected]>--- drivers/mmc/core/sdio_bus.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)Index:
linux/drivers/mmc/core/sdio_bus.c
===================================================================drivers/mmc/core/sdio_bus.c +8
-0@@ -193,7 +193,21 @@ static int sdio_bus_remove(struct device } #ifdef CONFIG_PM + +#ifdef CONFIG_PM_SLEEP +static int pm_no_operation(struct device *dev) +{ + /* + * Prevent the PM core from calling SDIO device drivers' suspend + * callback routines, which it is not supposed to do, by using this + * empty function as the bus type suspend callaback for SDIO.
drivers/mmc/core/sdio_bus.c static int sdio_bus_remove(struct device · line 213
Quoted 10 lines
drivers/mmc/core/sdio_bus.c +6
-0+*/ +return 0 ; +} +#endif +static const struct dev_pm_ops sdio_bus_pm_ops = { + SET_SYSTEM_SLEEP_PM_OPS(pm_no_operation, pm_no_operation) SET_RUNTIME_PM_OPS( pm_generic_runtime_suspend, pm_generic_runtime_resume,
Hehe... if my memory serves me well, that's exactly (well, modulo the comment) what my initial patch did before somebody suggested that the empty callbacks should just be removed altogether. =)
Thierry
Re: [PATCH] SDIO / PM: Add empty bus-level suspend/resume callbacks
In reply to NeilBrownHi,
Quoted 4 lines · NeilBrown
Quoted 2 lines
What about applying the appended patch (hopefully, the build warnings should be fixed properly this time)?
Looks good to me - thanks!
Thanks, both of you, pushed to mmc-next for 3.8.
- Chris.
Signature · 2 lines
Chris Ball <[email protected]> <http://printf.net/> One Laptop Per Child