Re: [PATCH v2 6/6] pinctrl: intel: Enumerate PWM device when community has a capabilitty

From: Andy Shevchenko
Date: Thu Nov 10 2022 - 05:04:17 EST


On Thu, Nov 10, 2022 at 9:45 AM Uwe Kleine-König
<u.kleine-koenig@xxxxxxxxxxxxxx> wrote:
> On Tue, Nov 08, 2022 at 04:22:26PM +0200, Andy Shevchenko wrote:
> > Some of the Communities may have PWM capability. In such cases,
> > enumerate PWM device via respective driver. User is still responsible
> > for setting correct pin muxing for the line that needs to output the
> > signal.

...

> > + pwm = pwm_lpss_probe(pctrl->dev, community->regs + PWMC, &info);
> > + if (IS_ERR(pwm) && PTR_ERR(pwm) != -ENODEV)
> > + return PTR_ERR(pwm);
>
> Linus and Andy already agreed that this patch is ugly. I wonder if this
> here would be a bit less ugly if you do:
>
> if (IS_REACHABLE(...)) {
> pwm = pwm_lpss_probe(...);
> ...
>
>
> }
>
> and drop the check PTR_ERR(pwm) != -ENODEV (which might have a different
> semantic than "the pwm driver isn't available").

I will think about it (in such case the comment against the previous
patch makes more sense to me).

Thank you for the review!

--
With Best Regards,
Andy Shevchenko