Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Axel Lin and committed by
Linus Torvalds
b96a573f 95dafd47

+6 -18
+6 -18
drivers/leds/leds-netxbig.c
··· 81 81 82 82 /* Configure address GPIOs. */ 83 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 86 if (err) 86 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 89 /* Configure data GPIOs. */ 94 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 93 if (err) 97 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 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 99 if (err) 107 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 102 return 0; 115 103