summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author=?UTF-8?q?Arve=20Hj=C3=B8nnev=C3=A5g?= <arve@android.com>2011-12-13 01:25:06 +0800
committerAndy Green <andy.green@linaro.org>2011-12-22 10:34:22 +0800
commitcea66b04903a77cb9c016edb3a0cc09e32d444b1 (patch)
tree7022ad5661ea42f0e80153ab96d348efc3049e48
parente8c416420b67c341ba46fac9f30355632ecfddfb (diff)
Staging: android: timed_gpio: Request gpios.
MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I9e98250a04e5505ce2db2edd355e8fdf8391cabd Signed-off-by: Arve Hjønnevåg <arve@android.com>
-rw-r--r--drivers/staging/android/timed_gpio.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/staging/android/timed_gpio.c b/drivers/staging/android/timed_gpio.c
index 3bfe6e0e5a7..a64481c3e86 100644
--- a/drivers/staging/android/timed_gpio.c
+++ b/drivers/staging/android/timed_gpio.c
@@ -107,10 +107,17 @@ static int timed_gpio_probe(struct platform_device *pdev)
gpio_dat->dev.name = cur_gpio->name;
gpio_dat->dev.get_time = gpio_get_time;
gpio_dat->dev.enable = gpio_enable;
- ret = timed_output_dev_register(&gpio_dat->dev);
+ ret = gpio_request(cur_gpio->gpio, cur_gpio->name);
+ if (ret >= 0) {
+ ret = timed_output_dev_register(&gpio_dat->dev);
+ if (ret < 0)
+ gpio_free(cur_gpio->gpio);
+ }
if (ret < 0) {
- for (j = 0; j < i; j++)
+ for (j = 0; j < i; j++) {
timed_output_dev_unregister(&gpio_data[i].dev);
+ gpio_free(gpio_data[i].gpio);
+ }
kfree(gpio_data);
return ret;
}
@@ -132,8 +139,10 @@ static int timed_gpio_remove(struct platform_device *pdev)
struct timed_gpio_data *gpio_data = platform_get_drvdata(pdev);
int i;
- for (i = 0; i < pdata->num_gpios; i++)
+ for (i = 0; i < pdata->num_gpios; i++) {
timed_output_dev_unregister(&gpio_data[i].dev);
+ gpio_free(gpio_data[i].gpio);
+ }
kfree(gpio_data);