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: <rfxdncj7o6ow53jthveea6byresoz3vwts3h4cqjezn3egrny3@sd63xrnhwm6s>
Date: Wed, 2 Jul 2025 14:05:07 -0700
From: Dmitry Torokhov <dmitry.torokhov@...il.com>
To: Mathieu Dubois-Briand <mathieu.dubois-briand@...tlin.com>
Cc: Lee Jones <lee@...nel.org>, Rob Herring <robh@...nel.org>, 
	Krzysztof Kozlowski <krzk+dt@...nel.org>, Conor Dooley <conor+dt@...nel.org>, 
	Kamel Bouhara <kamel.bouhara@...tlin.com>, Linus Walleij <linus.walleij@...aro.org>, 
	Bartosz Golaszewski <brgl@...ev.pl>, Uwe Kleine-König <ukleinek@...nel.org>, 
	Michael Walle <mwalle@...nel.org>, Mark Brown <broonie@...nel.org>, 
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>, "Rafael J. Wysocki" <rafael@...nel.org>, 
	Danilo Krummrich <dakr@...nel.org>, devicetree@...r.kernel.org, linux-kernel@...r.kernel.org, 
	linux-gpio@...r.kernel.org, linux-input@...r.kernel.org, linux-pwm@...r.kernel.org, 
	andriy.shevchenko@...el.com, Grégory Clement <gregory.clement@...tlin.com>, 
	Thomas Petazzoni <thomas.petazzoni@...tlin.com>
Subject: Re: [PATCH v10 10/11] input: misc: Add support for MAX7360 rotary

Hi Mathieu,

On Fri, May 30, 2025 at 12:00:18PM +0200, Mathieu Dubois-Briand wrote:
> +
> +static void max7360_rotaty_report_event(struct max7360_rotary *max7360_rotary, int steps)

s/rotaty/rotary

> +	if (max7360_rotary->relative_axis) {
> +		input_report_rel(max7360_rotary->input, max7360_rotary->axis, steps);
> +	} else {
> +		int pos = max7360_rotary->pos;
> +		int maxval = max7360_rotary->steps;
> +
> +		/*
> +		 * Add steps to the position.
> +		 * Make sure added steps are always in ]-maxval; maxval[
> +		 * interval, so (pos + maxval) is always >= 0.
> +		 * Then set back pos to the [0; maxval[ interval.
> +		 */
> +		pos += steps % maxval;
> +		if (max7360_rotary->rollover)
> +			pos = (pos + maxval) % maxval;
> +		else
> +			pos = clamp(pos, 0, maxval);

Should it be clamp(pos, 0, maxval - 1) by chance?

Otherwise:

Acked-by: Dmitry Torokhov <dmitry.torokhov@...il.com>

Thanks.

-- 
Dmitry

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ