[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <D9LQ7NV1LJM9.F2GF0YEEDFEY@bootlin.com>
Date: Fri, 02 May 2025 15:58:04 +0200
From: "Mathieu Dubois-Briand" <mathieu.dubois-briand@...tlin.com>
To: "Andy Shevchenko" <andriy.shevchenko@...el.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>,
"Dmitry Torokhov" <dmitry.torokhov@...il.com>,
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>, Grégory Clement
<gregory.clement@...tlin.com>, "Thomas Petazzoni"
<thomas.petazzoni@...tlin.com>
Subject: Re: [PATCH v7 10/11] input: misc: Add support for MAX7360 rotary
On Fri May 2, 2025 at 12:52 PM CEST, Andy Shevchenko wrote:
> On Mon, Apr 28, 2025 at 01:57:28PM +0200, Mathieu Dubois-Briand wrote:
>> Add driver for Maxim Integrated MAX7360 rotary encoder controller,
>> supporting a single rotary switch.
>
> ...
>
>> +struct max7360_rotary {
>> + struct input_dev *input;
>> + unsigned int debounce_ms;
>> + struct regmap *regmap;
>> +
>> + u32 steps;
>> + u32 axis;
>> + bool relative_axis;
>> + bool rollover;
>> +
>> + unsigned int pos;
>> +};
>
> I believe `pahole` can recommend better layout (look for the better position
> of debounce_ms).
>
> ...
>
Oh yes it does on arm64. Moving it after the regmap pointer, it should
be better.
>> +static void max7360_rotaty_report_event(struct max7360_rotary *max7360_rotary, int steps)
>> +{
>> + if (max7360_rotary->relative_axis) {
>> + input_report_rel(max7360_rotary->input, max7360_rotary->axis, steps);
>> + } else {
>> + unsigned int pos = max7360_rotary->pos;
>> +
>> + if (steps < 0) {
>> + /* turning counter-clockwise */
>> + if (max7360_rotary->rollover)
>> + pos += max7360_rotary->steps + steps;
>> + else
>
>> + pos = max(0, (int)pos + steps);
>
> Please, no castings for min()/max()/clamp(). It diminishes the use of those
> macros.
>
Sorry, I'm not sure to get the point. Should I use MIN_T() instead?
>
> ...
>
>> +static int max7360_rotary_probe(struct platform_device *pdev)
>> +{
>> + struct max7360_rotary *max7360_rotary;
>> + struct device *dev = &pdev->dev;
>> + struct input_dev *input;
>> + struct regmap *regmap;
>> + int irq;
>> + int error;
>> +
>> + regmap = dev_get_regmap(dev->parent, NULL);
>> + if (!regmap)
>> + dev_err_probe(dev, -ENODEV, "Could not get parent regmap\n");
>
> Missing return. Copy'n'paste error over all drivers?
>
Probably more an error while replacing all dev_err()+return by
dev_err_probe(), but yes. I will look for similar issues.
> ...
OK with all other comments.
Thanks for your review.
Mathieu
--
Mathieu Dubois-Briand, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
Powered by blists - more mailing lists