Skip to content

Commit 771bb3d

Browse files
Loic Poulainjmberg-intel
authored andcommitted
rfkill-gpio: Use gpio cansleep version
If gpio controller requires waiting for read and write GPIO values, then we have to use the gpio cansleep api. Fix the rfkill_gpio_set_power which calls only the nonsleep version (causing kernel warning). There is no problem to use the cansleep version here because we are not in IRQ handler or similar context (cf rfkill_set_block). Signed-off-by: Loic Poulain <loic.poulain@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent e5593f5 commit 771bb3d

1 file changed

Lines changed: 8 additions & 11 deletions

File tree

‎net/rfkill/rfkill-gpio.c‎

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,14 @@ static int rfkill_gpio_set_power(void *data, bool blocked)
4747
{
4848
struct rfkill_gpio_data *rfkill = data;
4949

50-
if (blocked) {
51-
gpiod_set_value(rfkill->shutdown_gpio, 0);
52-
gpiod_set_value(rfkill->reset_gpio, 0);
53-
if (!IS_ERR(rfkill->clk) && rfkill->clk_enabled)
54-
clk_disable(rfkill->clk);
55-
} else {
56-
if (!IS_ERR(rfkill->clk) && !rfkill->clk_enabled)
57-
clk_enable(rfkill->clk);
58-
gpiod_set_value(rfkill->reset_gpio, 1);
59-
gpiod_set_value(rfkill->shutdown_gpio, 1);
60-
}
50+
if (!blocked && !IS_ERR(rfkill->clk) && !rfkill->clk_enabled)
51+
clk_enable(rfkill->clk);
52+
53+
gpiod_set_value_cansleep(rfkill->shutdown_gpio, !blocked);
54+
gpiod_set_value_cansleep(rfkill->reset_gpio, !blocked);
55+
56+
if (blocked && !IS_ERR(rfkill->clk) && rfkill->clk_enabled)
57+
clk_disable(rfkill->clk);
6158

6259
rfkill->clk_enabled = blocked;
6360

0 commit comments

Comments
 (0)