diff options
author | Wolfram Sang <w.sang@pengutronix.de> | 2011-12-13 12:34:01 -0500 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2012-04-06 00:24:06 -0400 |
commit | fc3a1f04f5040255cbc086c419e4237f29f89f88 (patch) | |
tree | 3ece85d636a3ceeffb157b77ee51b4745cbdf2d9 /drivers/gpio/gpiolib.c | |
parent | dd775ae2549217d3ae09363e3edb305d0fa19928 (diff) |
gpio: add flags to export GPIOs when requesting
Introduce new flags to automatically export GPIOs when using the convenience
functions gpio_request_one() or gpio_request_array(). This eases support for
custom boards where lots of GPIOs need to be exported for customer
applications.
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'drivers/gpio/gpiolib.c')
-rw-r--r-- | drivers/gpio/gpiolib.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 5a75510d66bb..566d0122d832 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c | |||
@@ -1302,8 +1302,18 @@ int gpio_request_one(unsigned gpio, unsigned long flags, const char *label) | |||
1302 | (flags & GPIOF_INIT_HIGH) ? 1 : 0); | 1302 | (flags & GPIOF_INIT_HIGH) ? 1 : 0); |
1303 | 1303 | ||
1304 | if (err) | 1304 | if (err) |
1305 | gpio_free(gpio); | 1305 | goto free_gpio; |
1306 | |||
1307 | if (flags & GPIOF_EXPORT) { | ||
1308 | err = gpio_export(gpio, flags & GPIOF_EXPORT_CHANGEABLE); | ||
1309 | if (err) | ||
1310 | goto free_gpio; | ||
1311 | } | ||
1312 | |||
1313 | return 0; | ||
1306 | 1314 | ||
1315 | free_gpio: | ||
1316 | gpio_free(gpio); | ||
1307 | return err; | 1317 | return err; |
1308 | } | 1318 | } |
1309 | EXPORT_SYMBOL_GPL(gpio_request_one); | 1319 | EXPORT_SYMBOL_GPL(gpio_request_one); |