* [PATCH v5 07/11] mmc: sdio: Convert to dev_pm_domain_attach|detach() [not found] ` <1411151264-16245-1-git-send-email-ulf.hansson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> @ 2014-09-19 18:27 ` Ulf Hansson 2014-10-02 0:27 ` Dmitry Torokhov 0 siblings, 1 reply; 4+ messages in thread From: Ulf Hansson @ 2014-09-19 18:27 UTC (permalink / raw) To: Rafael J. Wysocki, Len Brown, Pavel Machek, Greg Kroah-Hartman, linux-pm-u79uwXL29TY76Z2rM5mHXA Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linux-acpi-u79uwXL29TY76Z2rM5mHXA, Geert Uytterhoeven, Kevin Hilman, Alan Stern, Daniel Lezcano, Tomasz Figa, devicetree-u79uwXL29TY76Z2rM5mHXA, Linus Walleij, Simon Horman, Magnus Damm, Ben Dooks, Kukjin Kim, Stephen Boyd, Philipp Zabel, Mark Brown, Wolfram Sang, Chris Ball, Russell King, Dmitry Torokhov, Ulf Hansson, linux-mmc-u79uwXL29TY76Z2rM5mHXA Previously only the ACPI PM domain was supported by the sdio bus. Let's convert to the common attach/detach functions for PM domains, which currently means we are extending the support to include the generic PM domain as well. Cc: linux-mmc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Signed-off-by: Ulf Hansson <ulf.hansson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> Reviewed-by: Kevin Hilman <khilman-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> --- drivers/mmc/core/sdio_bus.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/core/sdio_bus.c b/drivers/mmc/core/sdio_bus.c index 4fa8fef9..1df0fc6 100644 --- a/drivers/mmc/core/sdio_bus.c +++ b/drivers/mmc/core/sdio_bus.c @@ -315,7 +315,7 @@ int sdio_add_func(struct sdio_func *func) ret = device_add(&func->dev); if (ret == 0) { sdio_func_set_present(func); - acpi_dev_pm_attach(&func->dev, false); + dev_pm_domain_attach(&func->dev, false); } return ret; @@ -332,7 +332,7 @@ void sdio_remove_func(struct sdio_func *func) if (!sdio_func_present(func)) return; - acpi_dev_pm_detach(&func->dev, false); + dev_pm_domain_detach(&func->dev, false); device_del(&func->dev); put_device(&func->dev); } -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v5 07/11] mmc: sdio: Convert to dev_pm_domain_attach|detach() 2014-09-19 18:27 ` [PATCH v5 07/11] mmc: sdio: Convert to dev_pm_domain_attach|detach() Ulf Hansson @ 2014-10-02 0:27 ` Dmitry Torokhov 2014-10-13 2:48 ` Aaron Lu 0 siblings, 1 reply; 4+ messages in thread From: Dmitry Torokhov @ 2014-10-02 0:27 UTC (permalink / raw) To: Ulf Hansson Cc: Rafael J. Wysocki, Len Brown, Pavel Machek, Greg Kroah-Hartman, linux-pm, linux-arm-kernel, linux-acpi, Geert Uytterhoeven, Kevin Hilman, Alan Stern, Daniel Lezcano, Tomasz Figa, devicetree, Linus Walleij, Simon Horman, Magnus Damm, Ben Dooks, Kukjin Kim, Stephen Boyd, Philipp Zabel, Mark Brown, Wolfram Sang, Chris Ball, Russell King Hi Ulf, On Fri, Sep 19, 2014 at 08:27:40PM +0200, Ulf Hansson wrote: > Previously only the ACPI PM domain was supported by the sdio bus. > > Let's convert to the common attach/detach functions for PM domains, > which currently means we are extending the support to include the > generic PM domain as well. > > Cc: linux-mmc@vger.kernel.org > Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> > Reviewed-by: Kevin Hilman <khilman@linaro.org> > --- > drivers/mmc/core/sdio_bus.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/mmc/core/sdio_bus.c b/drivers/mmc/core/sdio_bus.c > index 4fa8fef9..1df0fc6 100644 > --- a/drivers/mmc/core/sdio_bus.c > +++ b/drivers/mmc/core/sdio_bus.c > @@ -315,7 +315,7 @@ int sdio_add_func(struct sdio_func *func) > ret = device_add(&func->dev); > if (ret == 0) { > sdio_func_set_present(func); > - acpi_dev_pm_attach(&func->dev, false); > + dev_pm_domain_attach(&func->dev, false); Admittedly it is not brought in by your change, but I am a bit worried about this code. In all other busses we attach power domain to a device before probing it (and detach if probe fails). Why here we only attach it to power domain after adding the device to the bus? If driver for the function has already been loaded the probe() would run without device being attached to a power domain... Adding Aaron as he's the author of the original change. Thanks. -- Dmitry ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v5 07/11] mmc: sdio: Convert to dev_pm_domain_attach|detach() 2014-10-02 0:27 ` Dmitry Torokhov @ 2014-10-13 2:48 ` Aaron Lu 2014-10-13 11:44 ` Ulf Hansson 0 siblings, 1 reply; 4+ messages in thread From: Aaron Lu @ 2014-10-13 2:48 UTC (permalink / raw) To: Dmitry Torokhov, Ulf Hansson Cc: Rafael J. Wysocki, Len Brown, Pavel Machek, Greg Kroah-Hartman, linux-pm, linux-arm-kernel, linux-acpi, Geert Uytterhoeven, Kevin Hilman, Alan Stern, Daniel Lezcano, Tomasz Figa, devicetree, Linus Walleij, Simon Horman, Magnus Damm, Ben Dooks, Kukjin Kim, Stephen Boyd, Philipp Zabel, Mark Brown, Wolfram Sang, Chris Ball, Russell King On 10/02/2014 08:27 AM, Dmitry Torokhov wrote: > Hi Ulf, > > On Fri, Sep 19, 2014 at 08:27:40PM +0200, Ulf Hansson wrote: >> Previously only the ACPI PM domain was supported by the sdio bus. >> >> Let's convert to the common attach/detach functions for PM domains, >> which currently means we are extending the support to include the >> generic PM domain as well. >> >> Cc: linux-mmc@vger.kernel.org >> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> >> Reviewed-by: Kevin Hilman <khilman@linaro.org> >> --- >> drivers/mmc/core/sdio_bus.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/mmc/core/sdio_bus.c b/drivers/mmc/core/sdio_bus.c >> index 4fa8fef9..1df0fc6 100644 >> --- a/drivers/mmc/core/sdio_bus.c >> +++ b/drivers/mmc/core/sdio_bus.c >> @@ -315,7 +315,7 @@ int sdio_add_func(struct sdio_func *func) >> ret = device_add(&func->dev); >> if (ret == 0) { >> sdio_func_set_present(func); >> - acpi_dev_pm_attach(&func->dev, false); >> + dev_pm_domain_attach(&func->dev, false); > > Admittedly it is not brought in by your change, but I am a bit worried > about this code. In all other busses we attach power domain to a device > before probing it (and detach if probe fails). Why here we only attach > it to power domain after adding the device to the bus? If driver for the > function has already been loaded the probe() would run without device > being attached to a power domain... Sorry for replying late... I see your concern, but it should be safe here. The dev_pm_domain_attach does primarily two things(for ACPI based system): assign the pm_domian field so that later system and runtime PM transitions we have proper callbacks for this device; power on the device if needed. I was using Broadcom BCM43241 SDIO wifi card when developing the code, it doesn't need the pm_domain set in its probe function and since the SDIO wifi card is powered on after system boot, no power on is needed either. That's why I added the attach function after device_add to save a little code(detach if probe fails). Feel free to change the sequence if the current one is a bad one, I'm OK with either case. > > Adding Aaron as he's the author of the original change. Thanks, Aaron ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v5 07/11] mmc: sdio: Convert to dev_pm_domain_attach|detach() 2014-10-13 2:48 ` Aaron Lu @ 2014-10-13 11:44 ` Ulf Hansson 0 siblings, 0 replies; 4+ messages in thread From: Ulf Hansson @ 2014-10-13 11:44 UTC (permalink / raw) To: Aaron Lu, Dmitry Torokhov Cc: Rafael J. Wysocki, Len Brown, Pavel Machek, Greg Kroah-Hartman, linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, ACPI Devel Maling List, Geert Uytterhoeven, Kevin Hilman, Alan Stern, Daniel Lezcano, Tomasz Figa, devicetree@vger.kernel.org, Linus Walleij, Simon Horman, Magnus Damm, Ben Dooks, Kukjin Kim, Stephen Boyd, Philipp Zabel On 13 October 2014 04:48, Aaron Lu <aaron.lu@intel.com> wrote: > On 10/02/2014 08:27 AM, Dmitry Torokhov wrote: >> Hi Ulf, >> >> On Fri, Sep 19, 2014 at 08:27:40PM +0200, Ulf Hansson wrote: >>> Previously only the ACPI PM domain was supported by the sdio bus. >>> >>> Let's convert to the common attach/detach functions for PM domains, >>> which currently means we are extending the support to include the >>> generic PM domain as well. >>> >>> Cc: linux-mmc@vger.kernel.org >>> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> >>> Reviewed-by: Kevin Hilman <khilman@linaro.org> >>> --- >>> drivers/mmc/core/sdio_bus.c | 4 ++-- >>> 1 file changed, 2 insertions(+), 2 deletions(-) >>> >>> diff --git a/drivers/mmc/core/sdio_bus.c b/drivers/mmc/core/sdio_bus.c >>> index 4fa8fef9..1df0fc6 100644 >>> --- a/drivers/mmc/core/sdio_bus.c >>> +++ b/drivers/mmc/core/sdio_bus.c >>> @@ -315,7 +315,7 @@ int sdio_add_func(struct sdio_func *func) >>> ret = device_add(&func->dev); >>> if (ret == 0) { >>> sdio_func_set_present(func); >>> - acpi_dev_pm_attach(&func->dev, false); >>> + dev_pm_domain_attach(&func->dev, false); >> >> Admittedly it is not brought in by your change, but I am a bit worried >> about this code. In all other busses we attach power domain to a device >> before probing it (and detach if probe fails). Why here we only attach >> it to power domain after adding the device to the bus? If driver for the >> function has already been loaded the probe() would run without device >> being attached to a power domain... > > Sorry for replying late... > > I see your concern, but it should be safe here. The dev_pm_domain_attach > does primarily two things(for ACPI based system): assign the pm_domian > field so that later system and runtime PM transitions we have proper > callbacks for this device; power on the device if needed. > > I was using Broadcom BCM43241 SDIO wifi card when developing the code, > it doesn't need the pm_domain set in its probe function and since the > SDIO wifi card is powered on after system boot, no power on is needed > either. That's why I added the attach function after device_add to save > a little code(detach if probe fails). > > Feel free to change the sequence if the current one is a bad one, I'm OK > with either case. Thanks for clarifying this. I plan to change the behaviour according to how other buses handles it. Though, the patch will be a part another patchset that handles a related initialization problem for the generic PM domain. I will keep you guys on cc when I post it. Kind regards Uffe ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-10-13 11:44 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1411151264-16245-1-git-send-email-ulf.hansson@linaro.org>
[not found] ` <1411151264-16245-1-git-send-email-ulf.hansson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2014-09-19 18:27 ` [PATCH v5 07/11] mmc: sdio: Convert to dev_pm_domain_attach|detach() Ulf Hansson
2014-10-02 0:27 ` Dmitry Torokhov
2014-10-13 2:48 ` Aaron Lu
2014-10-13 11:44 ` Ulf Hansson
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox