All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iio: vncl4000: Fix early return in vcnl4200_set_power_state
@ 2020-02-07  9:12 Guido Günther
  2020-02-07 19:45 ` Matt Ranostay
  2020-02-08 14:17 ` Jonathan Cameron
  0 siblings, 2 replies; 4+ messages in thread
From: Guido Günther @ 2020-02-07  9:12 UTC (permalink / raw)
  To: Tomas Novotny, Jonathan Cameron, Hartmut Knaack,
	Lars-Peter Clausen, Peter Meerwald-Stadler,
	Angus Ainslie (Purism),
	Guido Günther, Marco Felsch, Thomas Gleixner, linux-iio,
	linux-kernel

Don't return early unconditionally.

Signed-off-by: Guido Günther <agx@sigxcpu.org>
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

---
I've not added a 'Fixes:' line since this is not part of Linus tree yet.
Tested proximity and ambient light on a vcnl4040 and checked the driver
suspends/resumes correctly and puts out valid data right after resume.  

 drivers/iio/light/vcnl4000.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/light/vcnl4000.c b/drivers/iio/light/vcnl4000.c
index 3b71c7d538af..38fcd9a26046 100644
--- a/drivers/iio/light/vcnl4000.c
+++ b/drivers/iio/light/vcnl4000.c
@@ -149,7 +149,7 @@ static int vcnl4200_set_power_state(struct vcnl4000_data *data, bool on)
 	if (ret < 0)
 		return ret;
 
-	return i2c_smbus_write_word_data(data->client, VCNL4200_PS_CONF1, val);
+	ret = i2c_smbus_write_word_data(data->client, VCNL4200_PS_CONF1, val);
 	if (ret < 0)
 		return ret;
 
-- 
2.23.0


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

* Re: [PATCH] iio: vncl4000: Fix early return in vcnl4200_set_power_state
  2020-02-07  9:12 [PATCH] iio: vncl4000: Fix early return in vcnl4200_set_power_state Guido Günther
@ 2020-02-07 19:45 ` Matt Ranostay
  2020-02-08 14:17 ` Jonathan Cameron
  1 sibling, 0 replies; 4+ messages in thread
From: Matt Ranostay @ 2020-02-07 19:45 UTC (permalink / raw)
  To: Guido Günther
  Cc: Tomas Novotny, Jonathan Cameron, Hartmut Knaack,
	Lars-Peter Clausen, Peter Meerwald-Stadler,
	Angus Ainslie (Purism),
	Marco Felsch, Thomas Gleixner,
	open list:IIO SUBSYSTEM AND DRIVERS, open list

On Fri, Feb 7, 2020 at 1:12 AM Guido Günther <agx@sigxcpu.org> wrote:
>
> Don't return early unconditionally.
>
> Signed-off-by: Guido Günther <agx@sigxcpu.org>
> Reported-by: kbuild test robot <lkp@intel.com>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

Reviewed-by: Matt Ranostay <matt.ranostay@konsulko.com>

>
> ---
> I've not added a 'Fixes:' line since this is not part of Linus tree yet.
> Tested proximity and ambient light on a vcnl4040 and checked the driver
> suspends/resumes correctly and puts out valid data right after resume.
>
>  drivers/iio/light/vcnl4000.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iio/light/vcnl4000.c b/drivers/iio/light/vcnl4000.c
> index 3b71c7d538af..38fcd9a26046 100644
> --- a/drivers/iio/light/vcnl4000.c
> +++ b/drivers/iio/light/vcnl4000.c
> @@ -149,7 +149,7 @@ static int vcnl4200_set_power_state(struct vcnl4000_data *data, bool on)
>         if (ret < 0)
>                 return ret;
>
> -       return i2c_smbus_write_word_data(data->client, VCNL4200_PS_CONF1, val);
> +       ret = i2c_smbus_write_word_data(data->client, VCNL4200_PS_CONF1, val);
>         if (ret < 0)
>                 return ret;
>
> --
> 2.23.0
>

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

* Re: [PATCH] iio: vncl4000: Fix early return in vcnl4200_set_power_state
  2020-02-07  9:12 [PATCH] iio: vncl4000: Fix early return in vcnl4200_set_power_state Guido Günther
  2020-02-07 19:45 ` Matt Ranostay
@ 2020-02-08 14:17 ` Jonathan Cameron
  2020-02-10 15:41   ` Exposing device properties for priximity sensors Guido Günther
  1 sibling, 1 reply; 4+ messages in thread
From: Jonathan Cameron @ 2020-02-08 14:17 UTC (permalink / raw)
  To: Guido Günther
  Cc: Tomas Novotny, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Angus Ainslie (Purism),
	Marco Felsch, Thomas Gleixner, linux-iio, linux-kernel

On Fri,  7 Feb 2020 10:12:09 +0100
Guido Günther <agx@sigxcpu.org> wrote:

> Don't return early unconditionally.
> 
> Signed-off-by: Guido Günther <agx@sigxcpu.org>
> Reported-by: kbuild test robot <lkp@intel.com>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
I've merged this down into the original patch.

Thanks,

Jonathan


> 
> ---
> I've not added a 'Fixes:' line since this is not part of Linus tree yet.
> Tested proximity and ambient light on a vcnl4040 and checked the driver
> suspends/resumes correctly and puts out valid data right after resume.  
> 
>  drivers/iio/light/vcnl4000.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/light/vcnl4000.c b/drivers/iio/light/vcnl4000.c
> index 3b71c7d538af..38fcd9a26046 100644
> --- a/drivers/iio/light/vcnl4000.c
> +++ b/drivers/iio/light/vcnl4000.c
> @@ -149,7 +149,7 @@ static int vcnl4200_set_power_state(struct vcnl4000_data *data, bool on)
>  	if (ret < 0)
>  		return ret;
>  
> -	return i2c_smbus_write_word_data(data->client, VCNL4200_PS_CONF1, val);
> +	ret = i2c_smbus_write_word_data(data->client, VCNL4200_PS_CONF1, val);
>  	if (ret < 0)
>  		return ret;
>  


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

* Exposing device properties for priximity sensors
  2020-02-08 14:17 ` Jonathan Cameron
@ 2020-02-10 15:41   ` Guido Günther
  0 siblings, 0 replies; 4+ messages in thread
From: Guido Günther @ 2020-02-10 15:41 UTC (permalink / raw)
  To: Jonathan Cameron; +Cc: linux-iio

Hi Jonathan,
I've been extending iio-sensor-proxy to handle iio based proximity
sensors:

    https://gitlab.freedesktop.org/hadess/iio-sensor-proxy/merge_requests/298

The API to applications shall not export the raw value but rather tell
if an object is near by:

   https://gitlab.freedesktop.org/hadess/iio-sensor-proxy/merge_requests/298/diffs#67dff3849420abc19453e1998b8904bbaee6f13c_67_79

So in the simplest case we'd have to set a level above which an object
is considered close:

My intitial intent was to expose that via DT but looking around in iio
drivers i couldn't see any driver doing that (i missed
iio_read_mount_matrix) and noticed that the mount matrix is given via
systemd/udev's hwdb:

    https://github.com/systemd/systemd/pull/14845

Since matching on hwdb is done via modalias we wouldn't be able to have
different values on different boards without DMI/smbios:

   https://github.com/systemd/systemd/pull/14845/files#diff-37fdc5406b715a9996bdcd3d8e439e16R539

The matching rule is explained here:

     https://github.com/systemd/systemd/blob/master/hwdb.d/60-sensor.hwdb#L12

So would specifying this via DT and then exporting via sysfs be an
acceptable solution? That is inventing something like
iio_read_close_level. The value would not be used by the driver itself
but only exposed to userspace.
Cheers,
 -- Guido


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

end of thread, other threads:[~2020-02-10 15:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-07  9:12 [PATCH] iio: vncl4000: Fix early return in vcnl4200_set_power_state Guido Günther
2020-02-07 19:45 ` Matt Ranostay
2020-02-08 14:17 ` Jonathan Cameron
2020-02-10 15:41   ` Exposing device properties for priximity sensors Guido Günther

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.