Re: [PATCH] iio: adc: adi-axi-adc: Use kobj_to_dev() instead of container_of()

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

 



On Thu, Aug 20, 2020 at 12:10 PM Alexandru Ardelean
<ardeleanalex@xxxxxxxxx> wrote:
> On Thu, Aug 20, 2020 at 6:04 AM Tian Tao <tiantao6@xxxxxxxxxxxxx> wrote:
> >
> > Use kobj_to_dev() instead of container_of()

> Good point.
>
> Acked-by: Alexandru Ardelean <alexandru.ardelean@xxxxxxxxxx>

...

> > -       struct device *dev = container_of(kobj, struct device, kobj);
> > +       struct device *dev = kobj_to_dev(kobj);
> >         struct iio_dev *indio_dev = dev_to_iio_dev(dev);

And now this can be one line since dev is not used separately.

> >         struct adi_axi_adc_state *st = iio_priv(indio_dev);
> >         struct adi_axi_adc_conv *conv = &st->client->conv;

-- 
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