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: <aC2bLrxMP2DhY4go@smile.fi.intel.com>
Date: Wed, 21 May 2025 12:21:50 +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 v2 09/12] iio: accel: adxl313: add activity sensing

On Tue, May 20, 2025 at 10:50:04PM +0000, Lothar Rubusch wrote:
> Add possibilities to set a threshold for activity sensing. Extend the
> interrupt handler to process activity interrupts. Provide functions to set
> the activity threshold and to enable/disable activity sensing. Further add
> a fake channel for having x, y and z axis anded on the iio channel.
> 
> This is a preparatory patch. Some of the definitions and functions are
> supposed to be extended for inactivity later on.

...

> +	int axis_en, int_en, ret;
> +
> +	ret = regmap_read(data->regmap, ADXL313_REG_ACT_INACT_CTL, &axis_ctrl);
> +	if (ret)
> +		return ret;

> +	/* Check if axis for activity are enabled */
> +	if (type == ADXL313_ACTIVITY)
> +		axis_en = FIELD_GET(ADXL313_ACT_XYZ_EN, axis_ctrl);
> +	else

Probably redundant 'else'. Wouldn't

	if (!=)
		return 0;

work?

> +		return 0;

> +	/* The axis are enabled, now check if specific interrupt is enabled */
> +	ret = regmap_read(data->regmap, ADXL313_REG_INT_ENABLE, &regval);
> +	if (ret)
> +		return ret;

> +	int_en = adxl313_act_int_reg[type] & regval;
> +
> +	return axis_en && int_en;

With the above these lines become:

	if (FIELD_GET(ADXL313_ACT_XYZ_EN, axis_ctrl) == 0)
		return 0;

	return !!(adxl313_act_int_reg[type] & regval);

...

> +	ret = regmap_update_bits(data->regmap,
> +				 ADXL313_REG_ACT_INACT_CTL,
> +				 axis_ctrl,
> +				 cmd_en ? 0xff : 0x00);

Please, utilize given space. You have a lot of it in each line above.

> +	if (ret)
> +		return ret;

-- 
With Best Regards,
Andy Shevchenko



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ