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: <DB6KEG68GC91.VC8LHYCZCLT7@bootlin.com>
Date: Tue, 08 Jul 2025 11:26:47 +0200
From: "Mathieu Dubois-Briand" <mathieu.dubois-briand@...tlin.com>
To: "Dmitry Torokhov" <dmitry.torokhov@...il.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

On Wed Jul 2, 2025 at 11:05 PM CEST, Dmitry Torokhov wrote:
> 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?
>

Comparing with the behaviour of rotary_encoder.c, yes, maxval should
probably be excluded.

Good catch, thanks!

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

Thanks for the review!

-- 
Mathieu Dubois-Briand, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ