Re: [RFC PATCH] gpiolib: Refactor gpio_export

2012-10-19 Thread Grant Likely
On Fri, Oct 19, 2012 at 11:14 PM, Ryan Mallon wrote: > On 19/10/12 21:07, Linus Walleij wrote: > >> On Wed, Oct 17, 2012 at 1:41 AM, Ryan Mallon wrote: >> >>> The gpio_export function uses nested if statements and the status >>> variable to handle the failure cases. This makes the function logic

Re: [RFC PATCH] gpiolib: Refactor gpio_export

2012-10-19 Thread Ryan Mallon
On 19/10/12 21:07, Linus Walleij wrote: > On Wed, Oct 17, 2012 at 1:41 AM, Ryan Mallon wrote: > >> 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

Re: [RFC PATCH] gpiolib: Refactor gpio_export

2012-10-19 Thread Linus Walleij
On Wed, Oct 17, 2012 at 1:41 AM, Ryan Mallon wrote: > 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

Re: [RFC PATCH] gpiolib: Refactor gpio_export

2012-10-19 Thread Linus Walleij
On Wed, Oct 17, 2012 at 1:41 AM, Ryan Mallon rmal...@gmail.com wrote: 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

Re: [RFC PATCH] gpiolib: Refactor gpio_export

2012-10-19 Thread Ryan Mallon
On 19/10/12 21:07, Linus Walleij wrote: On Wed, Oct 17, 2012 at 1:41 AM, Ryan Mallon rmal...@gmail.com wrote: 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

Re: [RFC PATCH] gpiolib: Refactor gpio_export

2012-10-19 Thread Grant Likely
On Fri, Oct 19, 2012 at 11:14 PM, Ryan Mallon rmal...@gmail.com wrote: On 19/10/12 21:07, Linus Walleij wrote: On Wed, Oct 17, 2012 at 1:41 AM, Ryan Mallon rmal...@gmail.com wrote: The gpio_export function uses nested if statements and the status variable to handle the failure cases. This

[RFC PATCH] gpiolib: Refactor gpio_export

2012-10-16 Thread Ryan Mallon
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

[RFC PATCH] gpiolib: Refactor gpio_export

2012-10-16 Thread Ryan Mallon
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