Re: [PATCH v1 1/2] pinctrl: intel: Use temporary variable for struct device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Nov 3, 2022 at 9:26 AM Mika Westerberg
<mika.westerberg@xxxxxxxxxxxxxxx> wrote:
> On Wed, Nov 02, 2022 at 05:29:14PM +0200, Andy Shevchenko wrote:
> > Use temporary variable for struct device to make code neater.
> >
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
> > ---
> >  drivers/pinctrl/intel/pinctrl-intel.c | 23 ++++++++++++-----------
> >  1 file changed, 12 insertions(+), 11 deletions(-)
> >
> > diff --git a/drivers/pinctrl/intel/pinctrl-intel.c b/drivers/pinctrl/intel/pinctrl-intel.c
> > index fe5bf2184cbf..e15629348cb5 100644
> > --- a/drivers/pinctrl/intel/pinctrl-intel.c
> > +++ b/drivers/pinctrl/intel/pinctrl-intel.c
> > @@ -1522,14 +1522,15 @@ static int intel_pinctrl_probe_pwm(struct intel_pinctrl *pctrl,
> >  int intel_pinctrl_probe(struct platform_device *pdev,
> >                       const struct intel_pinctrl_soc_data *soc_data)
> >  {
> > +     struct device *dev = &pdev->dev;
> >       struct intel_pinctrl *pctrl;
> >       int i, ret, irq;
> >
> > -     pctrl = devm_kzalloc(&pdev->dev, sizeof(*pctrl), GFP_KERNEL);
> > +     pctrl = devm_kzalloc(dev, sizeof(*pctrl), GFP_KERNEL);
>
> IMHO &pdev->dev is neater and saves an extra line. I would agree if this
> would be something like &foo->bar->baz->dev but it is not.

I have no strong opinion, but one thing which may play in favour of
the patches is that all other drivers, that have their custom
->probe() implemented, are using temporary variable. That said, let's
consider this as unification among Intel pin control drivers.

> Anyway, no feelings about this so feel free to add,
>
> Reviewed-by: Mika Westerberg <mika.westerberg@xxxxxxxxxxxxxxx>
>
> for both patches.

Thank you!

-- 
With Best Regards,
Andy Shevchenko



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux