From: "Mathieu Dubois-Briand" <mathieu.dubois-briand@bootlin.com>
To: "Dmitry Torokhov" <dmitry.torokhov@gmail.com>
Cc: "Lee Jones" <lee@kernel.org>, "Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Kamel Bouhara" <kamel.bouhara@bootlin.com>,
"Linus Walleij" <linus.walleij@linaro.org>,
"Bartosz Golaszewski" <brgl@bgdev.pl>,
"Uwe Kleine-König" <ukleinek@kernel.org>,
"Michael Walle" <mwalle@kernel.org>,
"Mark Brown" <broonie@kernel.org>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
"Danilo Krummrich" <dakr@kernel.org>,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-gpio@vger.kernel.org, linux-input@vger.kernel.org,
linux-pwm@vger.kernel.org, andriy.shevchenko@intel.com,
"Grégory Clement" <gregory.clement@bootlin.com>,
"Thomas Petazzoni" <thomas.petazzoni@bootlin.com>
Subject: Re: [PATCH v10 10/11] input: misc: Add support for MAX7360 rotary
Date: Tue, 08 Jul 2025 11:26:47 +0200 [thread overview]
Message-ID: <DB6KEG68GC91.VC8LHYCZCLT7@bootlin.com> (raw)
In-Reply-To: <rfxdncj7o6ow53jthveea6byresoz3vwts3h4cqjezn3egrny3@sd63xrnhwm6s>
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@gmail.com>
>
> Thanks.
Thanks for the review!
--
Mathieu Dubois-Briand, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
next prev parent reply other threads:[~2025-07-08 9:26 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-30 10:00 [PATCH v10 00/11] Add support for MAX7360 Mathieu Dubois-Briand
2025-05-30 10:00 ` [PATCH v10 01/11] dt-bindings: mfd: gpio: Add MAX7360 Mathieu Dubois-Briand
2025-06-02 11:21 ` Krzysztof Kozlowski
2025-06-03 8:14 ` Mathieu Dubois-Briand
2025-06-03 9:27 ` Krzysztof Kozlowski
2025-05-30 10:00 ` [PATCH v10 02/11] mfd: Add max7360 support mathieu.dubois-briand
2025-05-30 17:55 ` Andy Shevchenko
2025-06-13 14:15 ` Lee Jones
2025-05-30 10:00 ` [PATCH v10 03/11] pinctrl: Add MAX7360 pinctrl driver Mathieu Dubois-Briand
2025-05-30 10:00 ` [PATCH v10 04/11] pwm: max7360: Add MAX7360 PWM support mathieu.dubois-briand
2025-05-30 17:57 ` Andy Shevchenko
2025-06-18 18:45 ` Uwe Kleine-König
2025-07-08 11:31 ` Mathieu Dubois-Briand
2025-05-30 10:00 ` [PATCH v10 05/11] regmap: irq: Add support for chips without separate IRQ status Mathieu Dubois-Briand
2025-05-30 10:37 ` Mark Brown
2025-06-03 8:01 ` Mathieu Dubois-Briand
2025-06-03 12:45 ` Mark Brown
2025-05-30 10:00 ` [PATCH v10 06/11] gpio: regmap: Allow to allocate regmap-irq device Mathieu Dubois-Briand
2025-05-30 17:59 ` Andy Shevchenko
2025-06-02 10:19 ` Bartosz Golaszewski
2025-05-30 10:00 ` [PATCH v10 07/11] gpio: regmap: Allow to provide init_valid_mask callback Mathieu Dubois-Briand
2025-05-30 10:00 ` [PATCH v10 08/11] gpio: max7360: Add MAX7360 gpio support Mathieu Dubois-Briand
2025-05-30 18:03 ` Andy Shevchenko
2025-07-08 9:13 ` Mathieu Dubois-Briand
2025-05-30 10:00 ` [PATCH v10 09/11] input: keyboard: Add support for MAX7360 keypad Mathieu Dubois-Briand
2025-07-02 21:00 ` Dmitry Torokhov
2025-07-08 9:32 ` Mathieu Dubois-Briand
2025-05-30 10:00 ` [PATCH v10 10/11] input: misc: Add support for MAX7360 rotary Mathieu Dubois-Briand
2025-07-02 21:05 ` Dmitry Torokhov
2025-07-08 9:26 ` Mathieu Dubois-Briand [this message]
2025-05-30 10:00 ` [PATCH v10 11/11] MAINTAINERS: Add entry on MAX7360 driver Mathieu Dubois-Briand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DB6KEG68GC91.VC8LHYCZCLT7@bootlin.com \
--to=mathieu.dubois-briand@bootlin.com \
--cc=andriy.shevchenko@intel.com \
--cc=brgl@bgdev.pl \
--cc=broonie@kernel.org \
--cc=conor+dt@kernel.org \
--cc=dakr@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=gregory.clement@bootlin.com \
--cc=kamel.bouhara@bootlin.com \
--cc=krzk+dt@kernel.org \
--cc=lee@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=mwalle@kernel.org \
--cc=rafael@kernel.org \
--cc=robh@kernel.org \
--cc=thomas.petazzoni@bootlin.com \
--cc=ukleinek@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.