Skip to content

Commit cc9432c

Browse files
tq-steinastorulf
authored andcommitted
mmc: slot-gpio: Allow non-sleeping GPIO ro
This change uses the appropriate _cansleep or non-sleeping API for reading GPIO read-only state. This allows users with GPIOs that never sleepbeing called in atomic context. Implement the same mechanism as in commit 52af318 ("mmc: Allow non-sleeping GPIO cd"). Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com> Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20240206083912.2543142-1-alexander.stein@ew.tq-group.com Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
1 parent 58aeb56 commit cc9432c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/mmc/core/slot-gpio.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,15 @@ EXPORT_SYMBOL(mmc_gpio_set_cd_irq);
7575
int mmc_gpio_get_ro(struct mmc_host *host)
7676
{
7777
struct mmc_gpio *ctx = host->slot.handler_priv;
78+
int cansleep;
7879

7980
if (!ctx || !ctx->ro_gpio)
8081
return -ENOSYS;
8182

82-
return gpiod_get_value_cansleep(ctx->ro_gpio);
83+
cansleep = gpiod_cansleep(ctx->ro_gpio);
84+
return cansleep ?
85+
gpiod_get_value_cansleep(ctx->ro_gpio) :
86+
gpiod_get_value(ctx->ro_gpio);
8387
}
8488
EXPORT_SYMBOL(mmc_gpio_get_ro);
8589

0 commit comments

Comments
 (0)