Re[2]: [PATCH 1/2] GPIO: Check for "gpio_is_valid" first

2013-05-10 Thread Alexander Shiyan
> HI, > > do as in linux > > introduce > > static struct gpio_desc *gpio_to_desc(unsigned gpio) > > and we need to check the gpio is valid before calling _free/ser/get > etc.. Indeed. > > Signed-off-by: Alexander Shiyan > > --- > > drivers/gpio/gpiolib.c | 181

Re: [PATCH 1/2] GPIO: Check for "gpio_is_valid" first

2013-05-10 Thread Jean-Christophe PLAGNIOL-VILLARD
HI, do as in linux introduce static struct gpio_desc *gpio_to_desc(unsigned gpio) and we need to check the gpio is valid before calling _free/ser/get etc.. On 11:27 Fri 10 May , Alexander Shiyan wrote: > > Signed-off-by: Alexander Shiyan > --- > d

Re: [PATCH 1/2] GPIO: Check for "gpio_is_valid" first

2013-05-10 Thread Jean-Christophe PLAGNIOL-VILLARD
no the current code is more clean just move gi = &gpio_desc[gpio]; chip = gi->chip after the current check; On 11:27 Fri 10 May , Alexander Shiyan wrote: > > Signed-off-by: Alexander Shiyan > --- > drivers/gpio/gpiolib.c | 181 > ++--- > 1 fil

[PATCH 1/2] GPIO: Check for "gpio_is_valid" first

2013-05-10 Thread Alexander Shiyan
Signed-off-by: Alexander Shiyan --- drivers/gpio/gpiolib.c | 181 ++--- 1 file changed, 95 insertions(+), 86 deletions(-) diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 6398268..1662dcd 100644 --- a/drivers/gpio/gpiolib.c +++ b/dri