[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z-LOokj8h13IRSSo@smile.fi.intel.com>
Date: Tue, 25 Mar 2025 17:41:22 +0200
From: Andy Shevchenko <andriy.shevchenko@...el.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>,
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 v5 04/11] pwm: max7360: Add MAX7360 PWM support
On Tue, Mar 25, 2025 at 03:29:18PM +0100, Mathieu Dubois-Briand wrote:
> On Wed Mar 19, 2025 at 12:18 PM CET, Andy Shevchenko wrote:
> > On Tue, Mar 18, 2025 at 05:26:20PM +0100, mathieu.dubois-briand@...tlin.com wrote:
...
> > > +static int max7360_pwm_round_waveform_tohw(struct pwm_chip *chip,
> > > + struct pwm_device *pwm,
> > > + const struct pwm_waveform *wf,
> > > + void *_wfhw)
> >
> > I would expect other way around, i.e. naming with leading underscore(s) to be
> > private / local. Ditto for all similar cases.
>
> I get the point, but the 2 existing drivers based on pwm_ops structure
> name it that way: drivers/pwm/pwm-axi-pwmgen.c and
> drivers/pwm/pwm-stm32.c.
>
> Also, the parameter is mostly unusable as-is, as it is a void*, so I
> believe it also makes sense to have no underscore for the correctly
> casted one, that we will be using in the function body (wfhw).
It's all up to PWM maintainers, but I find this style a bit weird, sorry.
I only saw this in the macros, where it's kinda okay. In functions it's
something that needs an additional thinking and understanding the semantics
of the underscore.
...
> > > +static int max7360_pwm_probe(struct platform_device *pdev)
> > > +{
> > > + struct device *dev = &pdev->dev;
> > > + struct pwm_chip *chip;
> > > + struct regmap *regmap;
> > > + int ret;
> > > +
> > > + if (!dev->parent)
> > > + return dev_err_probe(dev, -ENODEV, "no parent device\n");
> >
> > Why? Code most likely will fail on the regmap retrieval. Just do that first.
> >
> > > + chip = devm_pwmchip_alloc(dev->parent, MAX7360_NUM_PWMS, 0);
> >
> > This is quite worrying. The devm_ to parent makes a lot of assumptions that may
> > not be realised. If you really need this, it has to have a very good comment
> > explaining why and object lifetimes.
>
> Thanks, I'm fixing this in this driver and similar code in keypad,
> rotary and pinctrl. More details in the child mail.
Sure, thanks!
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists