summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLoic Poulain <loic.poulain@intel.com>2014-05-07 11:38:11 +0200
committerJohannes Berg <johannes.berg@intel.com>2014-05-07 13:20:59 +0200
commit771bb3ddc225d6dbbef8f22838c1287c4e3cd02b (patch)
treea2b7a5154245dca80db205967650b2e82eff350e
parente5593f56ebbc1b427055da8bc49d7e12a108de36 (diff)
downloadlinux-stable-771bb3ddc225d6dbbef8f22838c1287c4e3cd02b.tar.gz
linux-stable-771bb3ddc225d6dbbef8f22838c1287c4e3cd02b.tar.bz2
linux-stable-771bb3ddc225d6dbbef8f22838c1287c4e3cd02b.zip
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>
-rw-r--r--net/rfkill/rfkill-gpio.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/net/rfkill/rfkill-gpio.c b/net/rfkill/rfkill-gpio.c
index bd2a5b90400c..1cb42d040669 100644
--- a/net/rfkill/rfkill-gpio.c
+++ b/net/rfkill/rfkill-gpio.c
@@ -47,17 +47,14 @@ static int rfkill_gpio_set_power(void *data, bool blocked)
{
struct rfkill_gpio_data *rfkill = data;
- if (blocked) {
- gpiod_set_value(rfkill->shutdown_gpio, 0);
- gpiod_set_value(rfkill->reset_gpio, 0);
- if (!IS_ERR(rfkill->clk) && rfkill->clk_enabled)
- clk_disable(rfkill->clk);
- } else {
- if (!IS_ERR(rfkill->clk) && !rfkill->clk_enabled)
- clk_enable(rfkill->clk);
- gpiod_set_value(rfkill->reset_gpio, 1);
- gpiod_set_value(rfkill->shutdown_gpio, 1);
- }
+ if (!blocked && !IS_ERR(rfkill->clk) && !rfkill->clk_enabled)
+ clk_enable(rfkill->clk);
+
+ gpiod_set_value_cansleep(rfkill->shutdown_gpio, !blocked);
+ gpiod_set_value_cansleep(rfkill->reset_gpio, !blocked);
+
+ if (blocked && !IS_ERR(rfkill->clk) && rfkill->clk_enabled)
+ clk_disable(rfkill->clk);
rfkill->clk_enabled = blocked;