[PATCH 2/4] iio: light: stk3310: Implement vdd supply and power it off during suspend

Andy Shevchenko andy.shevchenko at gmail.com
Thu Apr 18 08:56:09 PDT 2024


On Thu, Apr 18, 2024 at 6:06 PM Aren <aren at peacevolution.org> wrote:
> On Mon, Apr 15, 2024 at 05:04:53PM +0300, Andy Shevchenko wrote:
> > On Sun, Apr 14, 2024 at 8:57 PM Aren Moynihan <aren at peacevolution.org> wrote:

...

> > >         stk3310_set_state(iio_priv(indio_dev), STK3310_STATE_STANDBY);
> > > +       if (data->vdd_reg)
> > > +               regulator_disable(data->vdd_reg);
> >
> > I forgot to check the order of freeing resources, be sure you have no
> > devm_*() releases happening before this call.
>
> If I understand what you're saying, this should be fine. The driver just
> uses devm to clean up acquired resources after remove is called. Or am I
> missing something and resources could be freed before calling
> stk3310_remove?

I'm not objecting to that. The point here is that the resources should
be freed in the reversed order. devm-allocated resources are deferred
to be freed after the explicit driver ->remove() callback. At the end
it should not interleave with each other, i.o.w. it should be
probe: devm followed by non-devm
remove: non-devm only.

-- 
With Best Regards,
Andy Shevchenko



More information about the linux-arm-kernel mailing list