All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mmc: sdhci-acpi: Only powered up enabled acpi child devices
@ 2016-12-20 23:19 Hans de Goede
  2017-01-12 10:03 ` Ulf Hansson
  2017-01-12 12:00 ` Ulf Hansson
  0 siblings, 2 replies; 4+ messages in thread
From: Hans de Goede @ 2016-12-20 23:19 UTC (permalink / raw)
  To: Adrian Hunter, Ulf Hansson
  Cc: russianneuromancer @ ya . ru, linux-mmc, Hans de Goede

Commit e5bbf30733f9 ("mmc: sdhci-acpi: Ensure connected devices are
powered when probing") introduced code to powerup any acpi child
nodes listed in the dstd. But some dstd-s list all possible devices
used on some board variants, while reporting if the device is actually
present and enabled in the status field of the device.

So we end up calling the acpi _PS0 (power-on) method for devices which
are not actually present. This does not always end well, e.g. on my
cube iwork8 air tablet, this results in freezing the entire tablet as
soon as the r8723bs module is loaded.

This commit fixes this by checking the child device's status.present
and status.enabled bits and only call acpi_device_fix_up_power()
if both are set.

Fixes: e5bbf30733f9 ("mmc: sdhci-acpi: Ensure connected devices are powered when probing")
BugLink: https://github.com/hadess/rtl8723bs/issues/80
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/mmc/host/sdhci-acpi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c
index 92096db..34ee237 100644
--- a/drivers/mmc/host/sdhci-acpi.c
+++ b/drivers/mmc/host/sdhci-acpi.c
@@ -396,7 +396,8 @@ static int sdhci_acpi_probe(struct platform_device *pdev)
 	/* Power on the SDHCI controller and its children */
 	acpi_device_fix_up_power(device);
 	list_for_each_entry(child, &device->children, node)
-		acpi_device_fix_up_power(child);
+		if (child->status.present && child->status.enabled)
+			acpi_device_fix_up_power(child);
 
 	if (acpi_bus_get_status(device) || !device->status.present)
 		return -ENODEV;
-- 
2.9.3


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

* Re: [PATCH] mmc: sdhci-acpi: Only powered up enabled acpi child devices
  2016-12-20 23:19 [PATCH] mmc: sdhci-acpi: Only powered up enabled acpi child devices Hans de Goede
@ 2017-01-12 10:03 ` Ulf Hansson
  2017-01-12 10:50   ` Adrian Hunter
  2017-01-12 12:00 ` Ulf Hansson
  1 sibling, 1 reply; 4+ messages in thread
From: Ulf Hansson @ 2017-01-12 10:03 UTC (permalink / raw)
  To: Hans de Goede, Adrian Hunter; +Cc: russianneuromancer @ ya . ru, linux-mmc

On 21 December 2016 at 00:19, Hans de Goede <hdegoede@redhat.com> wrote:
> Commit e5bbf30733f9 ("mmc: sdhci-acpi: Ensure connected devices are
> powered when probing") introduced code to powerup any acpi child
> nodes listed in the dstd. But some dstd-s list all possible devices
> used on some board variants, while reporting if the device is actually
> present and enabled in the status field of the device.
>
> So we end up calling the acpi _PS0 (power-on) method for devices which
> are not actually present. This does not always end well, e.g. on my
> cube iwork8 air tablet, this results in freezing the entire tablet as
> soon as the r8723bs module is loaded.
>
> This commit fixes this by checking the child device's status.present
> and status.enabled bits and only call acpi_device_fix_up_power()
> if both are set.
>
> Fixes: e5bbf30733f9 ("mmc: sdhci-acpi: Ensure connected devices are powered when probing")
> BugLink: https://github.com/hadess/rtl8723bs/issues/80
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Seems like I should add stable tag to this as well!?

> ---
>  drivers/mmc/host/sdhci-acpi.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c
> index 92096db..34ee237 100644
> --- a/drivers/mmc/host/sdhci-acpi.c
> +++ b/drivers/mmc/host/sdhci-acpi.c
> @@ -396,7 +396,8 @@ static int sdhci_acpi_probe(struct platform_device *pdev)
>         /* Power on the SDHCI controller and its children */
>         acpi_device_fix_up_power(device);
>         list_for_each_entry(child, &device->children, node)
> -               acpi_device_fix_up_power(child);
> +               if (child->status.present && child->status.enabled)
> +                       acpi_device_fix_up_power(child);
>
>         if (acpi_bus_get_status(device) || !device->status.present)
>                 return -ENODEV;
> --
> 2.9.3
>

Adrian, are you happy with this fix?

Kind regards
Uffe

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

* Re: [PATCH] mmc: sdhci-acpi: Only powered up enabled acpi child devices
  2017-01-12 10:03 ` Ulf Hansson
@ 2017-01-12 10:50   ` Adrian Hunter
  0 siblings, 0 replies; 4+ messages in thread
From: Adrian Hunter @ 2017-01-12 10:50 UTC (permalink / raw)
  To: Ulf Hansson, Hans de Goede; +Cc: russianneuromancer @ ya . ru, linux-mmc

On 12/01/17 12:03, Ulf Hansson wrote:
> On 21 December 2016 at 00:19, Hans de Goede <hdegoede@redhat.com> wrote:
>> Commit e5bbf30733f9 ("mmc: sdhci-acpi: Ensure connected devices are
>> powered when probing") introduced code to powerup any acpi child
>> nodes listed in the dstd. But some dstd-s list all possible devices
>> used on some board variants, while reporting if the device is actually
>> present and enabled in the status field of the device.
>>
>> So we end up calling the acpi _PS0 (power-on) method for devices which
>> are not actually present. This does not always end well, e.g. on my
>> cube iwork8 air tablet, this results in freezing the entire tablet as
>> soon as the r8723bs module is loaded.
>>
>> This commit fixes this by checking the child device's status.present
>> and status.enabled bits and only call acpi_device_fix_up_power()
>> if both are set.
>>
>> Fixes: e5bbf30733f9 ("mmc: sdhci-acpi: Ensure connected devices are powered when probing")
>> BugLink: https://github.com/hadess/rtl8723bs/issues/80
>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> 
> Seems like I should add stable tag to this as well!?

Yes I think so.

> 
>> ---
>>  drivers/mmc/host/sdhci-acpi.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c
>> index 92096db..34ee237 100644
>> --- a/drivers/mmc/host/sdhci-acpi.c
>> +++ b/drivers/mmc/host/sdhci-acpi.c
>> @@ -396,7 +396,8 @@ static int sdhci_acpi_probe(struct platform_device *pdev)
>>         /* Power on the SDHCI controller and its children */
>>         acpi_device_fix_up_power(device);
>>         list_for_each_entry(child, &device->children, node)
>> -               acpi_device_fix_up_power(child);
>> +               if (child->status.present && child->status.enabled)
>> +                       acpi_device_fix_up_power(child);
>>
>>         if (acpi_bus_get_status(device) || !device->status.present)
>>                 return -ENODEV;
>> --
>> 2.9.3
>>
> 
> Adrian, are you happy with this fix?

Yes.

Acked-by: Adrian Hunter <adrian.hunter@intel.com>


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

* Re: [PATCH] mmc: sdhci-acpi: Only powered up enabled acpi child devices
  2016-12-20 23:19 [PATCH] mmc: sdhci-acpi: Only powered up enabled acpi child devices Hans de Goede
  2017-01-12 10:03 ` Ulf Hansson
@ 2017-01-12 12:00 ` Ulf Hansson
  1 sibling, 0 replies; 4+ messages in thread
From: Ulf Hansson @ 2017-01-12 12:00 UTC (permalink / raw)
  To: Hans de Goede
  Cc: Adrian Hunter, russianneuromancer @ ya . ru, linux-mmc, # 4.0+

+stable

On 21 December 2016 at 00:19, Hans de Goede <hdegoede@redhat.com> wrote:
> Commit e5bbf30733f9 ("mmc: sdhci-acpi: Ensure connected devices are
> powered when probing") introduced code to powerup any acpi child
> nodes listed in the dstd. But some dstd-s list all possible devices
> used on some board variants, while reporting if the device is actually
> present and enabled in the status field of the device.
>
> So we end up calling the acpi _PS0 (power-on) method for devices which
> are not actually present. This does not always end well, e.g. on my
> cube iwork8 air tablet, this results in freezing the entire tablet as
> soon as the r8723bs module is loaded.
>
> This commit fixes this by checking the child device's status.present
> and status.enabled bits and only call acpi_device_fix_up_power()
> if both are set.
>
> Fixes: e5bbf30733f9 ("mmc: sdhci-acpi: Ensure connected devices are powered when probing")
> BugLink: https://github.com/hadess/rtl8723bs/issues/80
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Thanks, applied for fixes and added a stable tag.

Kind regards
Uffe

> ---
>  drivers/mmc/host/sdhci-acpi.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c
> index 92096db..34ee237 100644
> --- a/drivers/mmc/host/sdhci-acpi.c
> +++ b/drivers/mmc/host/sdhci-acpi.c
> @@ -396,7 +396,8 @@ static int sdhci_acpi_probe(struct platform_device *pdev)
>         /* Power on the SDHCI controller and its children */
>         acpi_device_fix_up_power(device);
>         list_for_each_entry(child, &device->children, node)
> -               acpi_device_fix_up_power(child);
> +               if (child->status.present && child->status.enabled)
> +                       acpi_device_fix_up_power(child);
>
>         if (acpi_bus_get_status(device) || !device->status.present)
>                 return -ENODEV;
> --
> 2.9.3
>

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

end of thread, other threads:[~2017-01-12 12:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-20 23:19 [PATCH] mmc: sdhci-acpi: Only powered up enabled acpi child devices Hans de Goede
2017-01-12 10:03 ` Ulf Hansson
2017-01-12 10:50   ` Adrian Hunter
2017-01-12 12:00 ` Ulf Hansson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.