Re: [PATCH v1 14/22] iio: imu: st_lsm6dsx: Get platform data via dev_get_platdata()

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

 



On Tue, Sep 3, 2024 at 10:11 AM Lorenzo Bianconi <lorenzo@xxxxxxxxxx> wrote:

...

> >       struct device *dev = hw->dev;
> > +     const struct st_sensors_platform_data *pdata = dev_get_platdata(dev);
>
> nit: I guess you can move pdata pointer in the 'if' block, since it is just
> used there.

Yes, but it will increase the LoCs number by 3 for no benefit for each
of such cases.

> >       int err = 0, drdy_pin;
> >
> > -     if (device_property_read_u32(dev, "st,drdy-int-pin", &drdy_pin) < 0) {
> > -             struct st_sensors_platform_data *pdata;
> > -
> > -             pdata = (struct st_sensors_platform_data *)dev->platform_data;
> > +     if (device_property_read_u32(dev, "st,drdy-int-pin", &drdy_pin) < 0)
> >               drdy_pin = pdata ? pdata->drdy_int_pin : 1;
> > -     }


-- 
With Best Regards,
Andy Shevchenko





[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux