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: <20250706171051.678c2519@jic23-huawei>
Date: Sun, 6 Jul 2025 17:10:51 +0100
From: Jonathan Cameron <jic23@...nel.org>
To: Lothar Rubusch <l.rubusch@...il.com>
Cc: lars@...afoo.de, Michael.Hennerich@...log.com, dlechner@...libre.com,
 nuno.sa@...log.com, andy@...nel.org, corbet@....net,
 linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org,
 linux-doc@...r.kernel.org, eraretuya@...il.com, Andy Shevchenko
 <andriy.shevchenko@...ux.intel.com>
Subject: Re: [PATCH v11 1/8] iio: accel: adxl345: simplify interrupt mapping

On Wed,  2 Jul 2025 23:03:08 +0000
Lothar Rubusch <l.rubusch@...il.com> wrote:

> Refactor the sensor interrupt mapping by utilizing regmap_assign_bits(),
> which accepts a boolean value directly. Introduce a helper function to
> streamline the identification of the configured interrupt line pin. Also,
> use identifiers from units.h to represent the full 8-bit register when
> setting bits.
> 
> This is a purely refactoring change and does not affect functionality.
> 
> Signed-off-by: Lothar Rubusch <l.rubusch@...il.com>
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
I'd really like to reduce the number of patches outstanding so I'll
apply a few of these now.

Applied this one.

Jonathan

> ---
>  drivers/iio/accel/adxl345_core.c | 34 +++++++++++++++++++-------------
>  1 file changed, 20 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/iio/accel/adxl345_core.c b/drivers/iio/accel/adxl345_core.c
> index e21ec6c15d15..6c437d7a59ed 100644
> --- a/drivers/iio/accel/adxl345_core.c
> +++ b/drivers/iio/accel/adxl345_core.c
> @@ -1088,6 +1088,19 @@ static const struct iio_info adxl345_info = {
>  	.hwfifo_set_watermark = adxl345_set_watermark,
>  };
>  
> +static int adxl345_get_int_line(struct device *dev, int *irq)
> +{
> +	*irq = fwnode_irq_get_byname(dev_fwnode(dev), "INT1");
> +	if (*irq > 0)
> +		return ADXL345_INT1;
> +
> +	*irq = fwnode_irq_get_byname(dev_fwnode(dev), "INT2");
> +	if (*irq > 0)
> +		return ADXL345_INT2;
> +
> +	return ADXL345_INT_NONE;
> +}
> +
>  /**
>   * adxl345_core_probe() - Probe and setup for the accelerometer.
>   * @dev:	Driver model representation of the device
> @@ -1203,23 +1216,16 @@ int adxl345_core_probe(struct device *dev, struct regmap *regmap,
>  	if (ret)
>  		return ret;
>  
> -	irq = fwnode_irq_get_byname(dev_fwnode(dev), "INT1");
> -	if (irq < 0) {
> -		intio = ADXL345_INT2;
> -		irq = fwnode_irq_get_byname(dev_fwnode(dev), "INT2");
> -		if (irq < 0)
> -			intio = ADXL345_INT_NONE;
> -	}
> -
> +	intio = adxl345_get_int_line(dev, &irq);
>  	if (intio != ADXL345_INT_NONE) {
>  		/*
> -		 * Any bits set to 0 in the INT map register send their respective
> -		 * interrupts to the INT1 pin, whereas bits set to 1 send their respective
> -		 * interrupts to the INT2 pin. The intio shall convert this accordingly.
> +		 * In the INT map register, bits set to 0 route their
> +		 * corresponding interrupts to the INT1 pin, while bits set to 1
> +		 * route them to the INT2 pin. The intio should handle this
> +		 * mapping accordingly.
>  		 */
> -		regval = intio ? 0xff : 0;
> -
> -		ret = regmap_write(st->regmap, ADXL345_REG_INT_MAP, regval);
> +		ret = regmap_assign_bits(st->regmap, ADXL345_REG_INT_MAP,
> +					 U8_MAX, intio);
>  		if (ret)
>  			return ret;
>  


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ