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: <20250112131845.539ecc7c@jic23-huawei>
Date: Sun, 12 Jan 2025 13:18:45 +0000
From: Jonathan Cameron <jic23@...nel.org>
To: Javier Carrasco <javier.carrasco.cruz@...il.com>
Cc: Lars-Peter Clausen <lars@...afoo.de>, Rishi Gupta <gupt21@...il.com>,
 linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org, Jonathan Cameron
 <Jonathan.Cameron@...wei.com>
Subject: Re: [PATCH 1/2] iio: light: veml6030: extend regmap to support
 regfields and caching

On Tue, 07 Jan 2025 21:50:21 +0100
Javier Carrasco <javier.carrasco.cruz@...il.com> wrote:

> The configuration registers are not volatile and are not affected
> by read operations (i.e. not precious), making them suitable to be
> cached in order to reduce the number of accesses to the device.
> 
> Add support for regfields as well to simplify register operations,
> taking into account the different fields for the veml6030/veml7700 and
> veml6035.
> 
> Signed-off-by: Javier Carrasco <javier.carrasco.cruz@...il.com>
> ---
>  drivers/iio/light/veml6030.c | 141 +++++++++++++++++++++++++++++++++++--------
>  1 file changed, 116 insertions(+), 25 deletions(-)
> 
> diff --git a/drivers/iio/light/veml6030.c b/drivers/iio/light/veml6030.c
> index 9b71825eea9bee2146be17ed2f30f5a8f7ad37e3..a6385c6d3fba59a6b22845a3c5e252b619faed65 100644
> --- a/drivers/iio/light/veml6030.c
> +++ b/drivers/iio/light/veml6030.c
> @@ -65,6 +65,11 @@ enum veml6030_scan {
>  	VEML6030_SCAN_TIMESTAMP,
>  };
>  
> +struct veml6030_rf {
> +	struct regmap_field *it;
> +	struct regmap_field *gain;
> +};
> +
>  struct veml603x_chip {
>  	const char *name;
>  	const int(*scale_vals)[][2];
> @@ -75,6 +80,7 @@ struct veml603x_chip {
>  	int (*set_info)(struct iio_dev *indio_dev);
>  	int (*set_als_gain)(struct iio_dev *indio_dev, int val, int val2);
>  	int (*get_als_gain)(struct iio_dev *indio_dev, int *val, int *val2);
> +	int (*regfield_init)(struct iio_dev *indio_dev);

With only two fields, why use a callback rather than just adding the two
const struct reg_field into this structure directly?

I'd also be tempted to do the caching and regfield changes as separate patches.

Jonathan




Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ