lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240304190838.GA4431@vamoiridPC>
Date: Mon, 4 Mar 2024 20:08:38 +0100
From: Vasileios Amoiridis <vassilisamir@...il.com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: Vasileios Amoiridis <vassilisamir@...il.com>, jic23@...nel.org,
	lars@...afoo.de, ang.iglesiasg@...il.com, mazziesaccount@...il.com,
	ak@...klinger.de, petre.rodan@...dimension.ro, phil@...pberrypi.com,
	579lpy@...il.com, linux-iio@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 4/4] iio: pressure: Add triggered buffer support for
 BMP280 driver

On Mon, Mar 04, 2024 at 01:52:05PM +0200, Andy Shevchenko wrote:
> On Sun, Mar 03, 2024 at 05:53:00PM +0100, Vasileios Amoiridis wrote:
> > Add a buffer struct that will hold the values of the measurements
> > and will be pushed to userspace. Modify all read_* functions in order
> > to just read and compensate the data without though converting to the
> > required IIO measurement units which are used for the oneshot captures.
> 
> > +#include <linux/iio/buffer.h>
> >  #include <linux/iio/iio.h>
> >  #include <linux/iio/sysfs.h>
> > +#include <linux/iio/trigger.h>
> > +#include <linux/iio/trigger_consumer.h>
> > +#include <linux/iio/triggered_buffer.h>
> 
> Yes, taking into account the comment against patch 1, this will become the part
> of iio/* group.
> 
> ...
> 
> > +	/* val might be NULL if we're called by the buffer handler */
> > +	if (val) {
> > +		*val = comp_press;
> > +		/* Compensated pressure is in cPa (centipascals) */
> > +		*val2 = 100000;
> 
> Here and everywhere else where it makes sense
> 
> 		*val2 = CENTI * 1000; // (What is 1000 here?)
> 
> from units.h?
> 

I didn't change these values, the addition here is that I put them under an
if statement that checks if we were called by the buffer handler or by the
oneshot capture read_raw function. The point is that every sensor provides
values that need different scaling in order to have the IIO standard
measurement units. In the above code I guess since 1kPa=100000cPa that's
why *val2=100000.

The *val and *val2 values could be moved to the read_raw function as it will
already happen for the IIO_CHAN_INFO_SCALE values from chip_info arrays as
you proposed in Patch No.2. This would require though that all the functions
like this one you commented would need to change. Is that something that you
think as better?

> > +		return IIO_VAL_FRACTIONAL;
> > +	}
> 
> ...
> 
> > +	struct {
> > +		s32 temperature;
> > +		u32 pressure;
> > +		u32 humidity;
> 
> > +		s64 timestamp;
> 
> Shouldn't this be aligned properly?
> 

I saw that in some drivers it was added and in some it was not. What is the
difference of aligning just the timestamp of the kernel?
> > +	} iio_buffer;
> 
> -- 
> With Best Regards,
> Andy Shevchenko
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ