summaryrefslogtreecommitdiffstats
path: root/drivers/mmc
diff options
context:
space:
mode:
authorUlf Hansson <ulf.hansson@linaro.org>2018-05-31 11:40:39 +0200
committerUlf Hansson <ulf.hansson@linaro.org>2018-12-17 08:26:24 +0100
commit4bfdd76dcb672dd55121b04ed7f1c1ff4343f1ef (patch)
tree88c058370737106b9b4a2fa19547e8c49d7f68a6 /drivers/mmc
parent7d5ef512575663695cf85f3aeb985a0aeb03e364 (diff)
downloadlinux-4bfdd76dcb672dd55121b04ed7f1c1ff4343f1ef.tar.bz2
mmc: rtsx_usb_sdmmc: Don't runtime resume the device while changing led
In case the card has been powered off, it seems silly to continue to allow the led to be updated. Instead let's forbid that, as it enables us to prevent runtime resuming the device and thus avoids wasting energy. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Tested-by: Kai-Heng Feng <kai.heng.feng@canonical.com> Tested-by: Oleksandr Natalenko <oleksandr@natalenko.name>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/host/rtsx_usb_sdmmc.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/mmc/host/rtsx_usb_sdmmc.c b/drivers/mmc/host/rtsx_usb_sdmmc.c
index 9a3ff22dd0fe..14b4a4e13fe6 100644
--- a/drivers/mmc/host/rtsx_usb_sdmmc.c
+++ b/drivers/mmc/host/rtsx_usb_sdmmc.c
@@ -1297,14 +1297,18 @@ static void rtsx_usb_update_led(struct work_struct *work)
container_of(work, struct rtsx_usb_sdmmc, led_work);
struct rtsx_ucr *ucr = host->ucr;
- pm_runtime_get_sync(sdmmc_dev(host));
+ pm_runtime_get_noresume(sdmmc_dev(host));
mutex_lock(&ucr->dev_mutex);
+ if (host->power_mode == MMC_POWER_OFF)
+ goto out;
+
if (host->led.brightness == LED_OFF)
rtsx_usb_turn_off_led(ucr);
else
rtsx_usb_turn_on_led(ucr);
+out:
mutex_unlock(&ucr->dev_mutex);
pm_runtime_put(sdmmc_dev(host));
}