diff options
author | Arve Hjønnevåg <arve@android.com> | 2010-01-06 17:17:33 -0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-11-30 20:40:05 +0900 |
commit | 0445f1548fc66a72f3b91cdbe8f26b120245efd1 (patch) | |
tree | fed5740ec2d40874b923432fe4de2d9dbe99e4b1 | |
parent | 81057ec1ded5ddf15149c3b266f414c0fbde5530 (diff) | |
download | op-kernel-dev-0445f1548fc66a72f3b91cdbe8f26b120245efd1.zip op-kernel-dev-0445f1548fc66a72f3b91cdbe8f26b120245efd1.tar.gz |
Staging: android: timed_gpio: Request gpios.
Signed-off-by: Arve Hjønnevåg <arve@android.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/staging/android/timed_gpio.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/staging/android/timed_gpio.c b/drivers/staging/android/timed_gpio.c index 3bfe6e0..a64481c 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); |