summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorHeikki Krogerus <heikki.krogerus@linux.intel.com>2013-10-16 13:53:40 +0300
committerChanho Park <chanho61.park@samsung.com>2014-11-18 12:00:31 +0900
commit1a3f50fce28e3048f1d61b3a32f5fdc04ee9c6b6 (patch)
tree82596c0b11a93f7044073c5db28a8ce8302b8be9 /net
parent561c5d468eafece1ffeefc834e96d4d12db4e182 (diff)
downloadlinux-3.10-1a3f50fce28e3048f1d61b3a32f5fdc04ee9c6b6.tar.gz
linux-3.10-1a3f50fce28e3048f1d61b3a32f5fdc04ee9c6b6.tar.bz2
linux-3.10-1a3f50fce28e3048f1d61b3a32f5fdc04ee9c6b6.zip
net: rfkill: gpio: clean up clock handling
Use a simple flag to see the state of the clock, and make the clock available even without a name. Also, get rid of HAVE_CLK dependency. Change-Id: Ie113c861a296a57ff32f5a3ee95ef0b9d9fff7e4 Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Acked-by: Rhyland Klein <rklein@nvidia.com> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net')
-rw-r--r--net/rfkill/Kconfig2
-rw-r--r--net/rfkill/rfkill-gpio.c35
2 files changed, 9 insertions, 28 deletions
diff --git a/net/rfkill/Kconfig b/net/rfkill/Kconfig
index 78efe895b66..4c10e7e6c9f 100644
--- a/net/rfkill/Kconfig
+++ b/net/rfkill/Kconfig
@@ -36,7 +36,7 @@ config RFKILL_REGULATOR
config RFKILL_GPIO
tristate "GPIO RFKILL driver"
- depends on RFKILL && GPIOLIB && HAVE_CLK
+ depends on RFKILL && GPIOLIB
default n
help
If you say yes here you get support of a generic gpio RFKILL
diff --git a/net/rfkill/rfkill-gpio.c b/net/rfkill/rfkill-gpio.c
index 070580619e3..1d104e728ef 100644
--- a/net/rfkill/rfkill-gpio.c
+++ b/net/rfkill/rfkill-gpio.c
@@ -27,24 +27,13 @@
#include <linux/rfkill-gpio.h>
-enum rfkill_gpio_clk_state {
- UNSPECIFIED = 0,
- PWR_ENABLED,
- PWR_DISABLED
-};
-
-#define PWR_CLK_SET(_RF, _EN) \
- ((_RF)->pwr_clk_enabled = (!(_EN) ? PWR_ENABLED : PWR_DISABLED))
-#define PWR_CLK_ENABLED(_RF) ((_RF)->pwr_clk_enabled == PWR_ENABLED)
-#define PWR_CLK_DISABLED(_RF) ((_RF)->pwr_clk_enabled != PWR_ENABLED)
-
struct rfkill_gpio_data {
struct rfkill_gpio_platform_data *pdata;
struct rfkill *rfkill_dev;
char *reset_name;
char *shutdown_name;
- enum rfkill_gpio_clk_state pwr_clk_enabled;
- struct clk *pwr_clk;
+ struct clk *clk;
+ bool clk_enabled;
};
static int rfkill_gpio_set_power(void *data, bool blocked)
@@ -56,19 +45,18 @@ static int rfkill_gpio_set_power(void *data, bool blocked)
gpio_direction_output(rfkill->pdata->shutdown_gpio, 0);
if (gpio_is_valid(rfkill->pdata->reset_gpio))
gpio_direction_output(rfkill->pdata->reset_gpio, 0);
- if (rfkill->pwr_clk && PWR_CLK_ENABLED(rfkill))
- clk_disable(rfkill->pwr_clk);
+ if (!IS_ERR(rfkill->clk) && rfkill->clk_enabled)
+ clk_disable(rfkill->clk);
} else {
- if (rfkill->pwr_clk && PWR_CLK_DISABLED(rfkill))
- clk_enable(rfkill->pwr_clk);
+ if (!IS_ERR(rfkill->clk) && !rfkill->clk_enabled)
+ clk_enable(rfkill->clk);
if (gpio_is_valid(rfkill->pdata->reset_gpio))
gpio_direction_output(rfkill->pdata->reset_gpio, 1);
if (gpio_is_valid(rfkill->pdata->shutdown_gpio))
gpio_direction_output(rfkill->pdata->shutdown_gpio, 1);
}
- if (rfkill->pwr_clk)
- PWR_CLK_SET(rfkill, blocked);
+ rfkill->clk_enabled = blocked;
return 0;
}
@@ -123,14 +111,7 @@ static int rfkill_gpio_probe(struct platform_device *pdev)
snprintf(rfkill->reset_name, len + 6 , "%s_reset", pdata->name);
snprintf(rfkill->shutdown_name, len + 9, "%s_shutdown", pdata->name);
- if (pdata->power_clk_name) {
- rfkill->pwr_clk = devm_clk_get(&pdev->dev,
- pdata->power_clk_name);
- if (IS_ERR(rfkill->pwr_clk)) {
- pr_warn("%s: can't find pwr_clk.\n", __func__);
- return PTR_ERR(rfkill->pwr_clk);
- }
- }
+ rfkill->clk = devm_clk_get(&pdev->dev, pdata->power_clk_name);
if (gpio_is_valid(pdata->reset_gpio)) {
ret = devm_gpio_request(&pdev->dev, pdata->reset_gpio,