From: Loic Poulain <loic.poulain@intel.com>
To: johannes@sipsolutions.net
Cc: linux-wireless@vger.kernel.org, Loic Poulain <loic.poulain@intel.com>
Subject: [PATCH] rfkill-gpio: Use gpio cansleep version
Date: Tue, 6 May 2014 18:14:09 +0200 [thread overview]
Message-ID: <1399392849-6021-1-git-send-email-loic.poulain@intel.com> (raw)
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>
---
net/rfkill/rfkill-gpio.c | 22 +++++++++++++++-------
1 file changed, 15 insertions(+), 7 deletions(-)
diff --git a/net/rfkill/rfkill-gpio.c b/net/rfkill/rfkill-gpio.c
index bd2a5b9..db6579d 100644
--- a/net/rfkill/rfkill-gpio.c
+++ b/net/rfkill/rfkill-gpio.c
@@ -47,16 +47,24 @@ static int rfkill_gpio_set_power(void *data, bool blocked)
{
struct rfkill_gpio_data *rfkill = data;
+ if (!blocked) {
+ if (!IS_ERR(rfkill->clk) && !rfkill->clk_enabled)
+ clk_enable(rfkill->clk);
+ }
+
+ if (gpiod_cansleep(rfkill->shutdown_gpio))
+ gpiod_set_value_cansleep(rfkill->shutdown_gpio, !blocked);
+ else
+ gpiod_set_value(rfkill->shutdown_gpio, !blocked);
+
+ if (gpiod_cansleep(rfkill->reset_gpio))
+ gpiod_set_value_cansleep(rfkill->reset_gpio, !blocked);
+ else
+ gpiod_set_value(rfkill->reset_gpio, !blocked);
+
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);
}
rfkill->clk_enabled = blocked;
--
1.8.3.2
next reply other threads:[~2014-05-06 16:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-06 16:14 Loic Poulain [this message]
2014-05-07 9:02 ` [PATCH] rfkill-gpio: Use gpio cansleep version Johannes Berg
2014-05-07 9:04 ` Johannes Berg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1399392849-6021-1-git-send-email-loic.poulain@intel.com \
--to=loic.poulain@intel.com \
--cc=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox