diff options
author | Axel Lin <axel.lin@gmail.com> | 2012-01-10 18:09:37 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-10 19:30:49 -0500 |
commit | b96a573f4c27529d379922670e8cf5530120d5ca (patch) | |
tree | 3bcc570221a4a47c83e50d8d538730c4ea4bedd3 /drivers/leds/leds-netxbig.c | |
parent | 95dafd475382740a841697a2ead6566175d26390 (diff) |
drivers/leds/leds-netxbig.c: use gpio_request_one()
Use gpio_request_one() instead of multiple gpiolib calls. This also
simplifies error handling a bit.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Cc: Simon Guinot <sguinot@lacie.com>
Cc: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/leds/leds-netxbig.c')
-rw-r--r-- | drivers/leds/leds-netxbig.c | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/drivers/leds/leds-netxbig.c b/drivers/leds/leds-netxbig.c index 8c7a4ea10dc3..d8433f2d53bc 100644 --- a/drivers/leds/leds-netxbig.c +++ b/drivers/leds/leds-netxbig.c | |||
@@ -81,35 +81,23 @@ static int __devinit gpio_ext_init(struct netxbig_gpio_ext *gpio_ext) | |||
81 | 81 | ||
82 | /* Configure address GPIOs. */ | 82 | /* Configure address GPIOs. */ |
83 | for (i = 0; i < gpio_ext->num_addr; i++) { | 83 | for (i = 0; i < gpio_ext->num_addr; i++) { |
84 | err = gpio_request(gpio_ext->addr[i], "GPIO extension addr"); | 84 | err = gpio_request_one(gpio_ext->addr[i], GPIOF_OUT_INIT_LOW, |
85 | "GPIO extension addr"); | ||
85 | if (err) | 86 | if (err) |
86 | goto err_free_addr; | 87 | goto err_free_addr; |
87 | err = gpio_direction_output(gpio_ext->addr[i], 0); | ||
88 | if (err) { | ||
89 | gpio_free(gpio_ext->addr[i]); | ||
90 | goto err_free_addr; | ||
91 | } | ||
92 | } | 88 | } |
93 | /* Configure data GPIOs. */ | 89 | /* Configure data GPIOs. */ |
94 | for (i = 0; i < gpio_ext->num_data; i++) { | 90 | for (i = 0; i < gpio_ext->num_data; i++) { |
95 | err = gpio_request(gpio_ext->data[i], "GPIO extension data"); | 91 | err = gpio_request_one(gpio_ext->data[i], GPIOF_OUT_INIT_LOW, |
92 | "GPIO extension data"); | ||
96 | if (err) | 93 | if (err) |
97 | goto err_free_data; | 94 | goto err_free_data; |
98 | err = gpio_direction_output(gpio_ext->data[i], 0); | ||
99 | if (err) { | ||
100 | gpio_free(gpio_ext->data[i]); | ||
101 | goto err_free_data; | ||
102 | } | ||
103 | } | 95 | } |
104 | /* Configure "enable select" GPIO. */ | 96 | /* Configure "enable select" GPIO. */ |
105 | err = gpio_request(gpio_ext->enable, "GPIO extension enable"); | 97 | err = gpio_request_one(gpio_ext->enable, GPIOF_OUT_INIT_LOW, |
98 | "GPIO extension enable"); | ||
106 | if (err) | 99 | if (err) |
107 | goto err_free_data; | 100 | goto err_free_data; |
108 | err = gpio_direction_output(gpio_ext->enable, 0); | ||
109 | if (err) { | ||
110 | gpio_free(gpio_ext->enable); | ||
111 | goto err_free_data; | ||
112 | } | ||
113 | 101 | ||
114 | return 0; | 102 | return 0; |
115 | 103 | ||