All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] gpio: sx150x: fix error code value
@ 2010-09-12 18:57 ` Vasiliy Kulikov
  0 siblings, 0 replies; 4+ messages in thread
From: Vasiliy Kulikov @ 2010-09-12 18:57 UTC (permalink / raw)
  To: kernel-janitors; +Cc: Andrew Morton, Gregory Bean, linux-kernel

The return code of sx150x_get_io() is propagated as error code,
so it should look like standard code.

Signed-off-by: Vasiliy Kulikov <segooon@gmail.com>
---
 Compile tested.

 drivers/gpio/sx150x.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/gpio/sx150x.c b/drivers/gpio/sx150x.c
index b42f42c..b0eed89 100644
--- a/drivers/gpio/sx150x.c
+++ b/drivers/gpio/sx150x.c
@@ -179,7 +179,7 @@ static int sx150x_get_io(struct sx150x_chip *chip, unsigned offset)
 	sx150x_find_cfg(offset, 1, &reg, &mask, &shift);
 	err = sx150x_i2c_read(chip->client, reg, &data);
 	if (err >= 0)
-		err = (data & mask) != 0 ? 1 : 0;
+		err = (data & mask) != 0 ? -EIO : 0;
 
 	return err;
 }
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] gpio: sx150x: fix error code value
@ 2010-09-12 18:57 ` Vasiliy Kulikov
  0 siblings, 0 replies; 4+ messages in thread
From: Vasiliy Kulikov @ 2010-09-12 18:57 UTC (permalink / raw)
  To: kernel-janitors; +Cc: Andrew Morton, Gregory Bean, linux-kernel

The return code of sx150x_get_io() is propagated as error code,
so it should look like standard code.

Signed-off-by: Vasiliy Kulikov <segooon@gmail.com>
---
 Compile tested.

 drivers/gpio/sx150x.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/gpio/sx150x.c b/drivers/gpio/sx150x.c
index b42f42c..b0eed89 100644
--- a/drivers/gpio/sx150x.c
+++ b/drivers/gpio/sx150x.c
@@ -179,7 +179,7 @@ static int sx150x_get_io(struct sx150x_chip *chip, unsigned offset)
 	sx150x_find_cfg(offset, 1, &reg, &mask, &shift);
 	err = sx150x_i2c_read(chip->client, reg, &data);
 	if (err >= 0)
-		err = (data & mask) != 0 ? 1 : 0;
+		err = (data & mask) != 0 ? -EIO : 0;
 
 	return err;
 }
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] gpio: sx150x: fix error code value
  2010-09-12 18:57 ` Vasiliy Kulikov
@ 2010-09-13 16:23   ` Gregory Bean
  -1 siblings, 0 replies; 4+ messages in thread
From: Gregory Bean @ 2010-09-13 16:23 UTC (permalink / raw)
  To: Vasiliy Kulikov; +Cc: kernel-janitors, Andrew Morton, linux-kernel

>   	err = sx150x_i2c_read(chip->client, reg,&data);
>   	if (err>= 0)
> -		err = (data&  mask) != 0 ? 1 : 0;
> +		err = (data&  mask) != 0 ? -EIO : 0;
>

This doesn't work.  The IO pins are gpio data pins, which are used as 0 
or 1 data values (see sx150x_gpio_get).  Returning -EIO whenever an 
attempt is made to gpio_get_value on a non-zero gpio line will break things.

--
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] gpio: sx150x: fix error code value
@ 2010-09-13 16:23   ` Gregory Bean
  0 siblings, 0 replies; 4+ messages in thread
From: Gregory Bean @ 2010-09-13 16:23 UTC (permalink / raw)
  To: Vasiliy Kulikov; +Cc: kernel-janitors, Andrew Morton, linux-kernel

>   	err = sx150x_i2c_read(chip->client, reg,&data);
>   	if (err>= 0)
> -		err = (data&  mask) != 0 ? 1 : 0;
> +		err = (data&  mask) != 0 ? -EIO : 0;
>

This doesn't work.  The IO pins are gpio data pins, which are used as 0 
or 1 data values (see sx150x_gpio_get).  Returning -EIO whenever an 
attempt is made to gpio_get_value on a non-zero gpio line will break things.

--
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-09-13 16:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-12 18:57 [PATCH] gpio: sx150x: fix error code value Vasiliy Kulikov
2010-09-12 18:57 ` Vasiliy Kulikov
2010-09-13 16:23 ` Gregory Bean
2010-09-13 16:23   ` Gregory Bean

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.