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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aCsdEzm0ph_LfkWP@smile.fi.intel.com>
Date: Mon, 19 May 2025 14:59:15 +0300
From: Andy Shevchenko <andy@...nel.org>
To: Lothar Rubusch <l.rubusch@...il.com>
Cc: jic23@...nel.org, dlechner@...libre.com, nuno.sa@...log.com,
	corbet@....net, lucas.p.stankus@...il.com, lars@...afoo.de,
	Michael.Hennerich@...log.com, linux-iio@...r.kernel.org,
	linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1 07/12] iio: accel: adxl313: add basic interrupt
 handling

On Sun, May 18, 2025 at 11:13:16AM +0000, Lothar Rubusch wrote:
> Prepare the interrupt handler. Add register entries to evaluate the
> incoming interrupt. Add functions to clear status registers and reset the
> FIFO.

...

> +static int adxl313_set_fifo(struct adxl313_data *data)
> +{
> +	unsigned int int_line;
> +	int ret;
> +
> +	ret = adxl313_set_measure_en(data, false);
> +	if (ret)
> +		return ret;
> +
> +	ret = regmap_read(data->regmap, ADXL313_REG_INT_MAP, &int_line);
> +	if (ret)
> +		return ret;
> +
> +	ret = regmap_write(data->regmap, ADXL313_REG_FIFO_CTL,

> +			   FIELD_PREP(ADXL313_REG_FIFO_CTL_MODE_MSK,
> +				      data->fifo_mode));

Better to have these two on one line. It makes it easier to read.

> +	return adxl313_set_measure_en(data, true);
> +}

...

> +static int adxl313_fifo_transfer(struct adxl313_data *data, int samples)
> +{
> +	size_t count;
> +	int i;
> +	int ret;

> +	ret = 0;

Useless. See below.

> +	count = sizeof(data->fifo_buf[0]) * ADXL313_NUM_AXIS;

Perhaps use array_size() from overflow.h?

> +	for (i = 0; i < samples; i++) {
> +		ret = regmap_bulk_read(data->regmap, ADXL313_REG_XYZ_BASE,
> +				       data->fifo_buf + (i * count / 2), count);
> +		if (ret)
> +			return ret;
> +	}

> +	return ret;

Just return 0 here.

> +}

...

> +static irqreturn_t adxl313_irq_handler(int irq, void *p)
> +{
> +	struct iio_dev *indio_dev = p;
> +	struct adxl313_data *data = iio_priv(indio_dev);
> +	int int_stat;
> +
> +	if (regmap_read(data->regmap, ADXL313_REG_INT_SOURCE, &int_stat))
> +		return IRQ_NONE;
> +
> +	if (FIELD_GET(ADXL313_INT_OVERRUN, int_stat))
> +		goto err;
> +
> +	return IRQ_HANDLED;
> +err:
> +	adxl313_fifo_reset(data);
> +
> +	return IRQ_HANDLED;

Why do we need the label? Same can be achieved without it by moving the call
under the conditional.

> +}

-- 
With Best Regards,
Andy Shevchenko



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ