]> git.karo-electronics.de Git - karo-tx-linux.git/commit
gpiolib: Refactor gpio_export
authorRyan Mallon <rmallon@gmail.com>
Mon, 22 Oct 2012 00:39:12 +0000 (11:39 +1100)
committerLinus Walleij <linus.walleij@linaro.org>
Mon, 22 Oct 2012 22:13:36 +0000 (00:13 +0200)
commitfc4e2514995d9cd7f3e1a67098ce65d72acf8ec7
tree05cb8ff2fbf178fd5282e970173cac05f6e6c132
parent67a0d4993d85ee2f42c9909127794553df69dd59
gpiolib: Refactor gpio_export

The gpio_export function uses nested if statements and the status
variable to handle the failure cases. This makes the function logic
difficult to follow. Refactor the code to abort immediately on failure
using goto. This makes the code slightly longer, but significantly
reduces the nesting and number of split lines and makes the code easier
to read.

Signed-off-by: Ryan Mallon <rmallon@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpiolib.c