All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Aren <aren@peacevolution.org>
Cc: "Jonathan Cameron" <jic23@kernel.org>,
	"Lars-Peter Clausen" <lars@metafoo.de>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzysztof.kozlowski+dt@linaro.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Chen-Yu Tsai" <wens@csie.org>,
	"Jernej Skrabec" <jernej.skrabec@gmail.com>,
	"Samuel Holland" <samuel@sholland.org>,
	"Liam Girdwood" <lgirdwood@gmail.com>,
	"Mark Brown" <broonie@kernel.org>, "Ondrej Jirman" <megi@xff.cz>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	linux-iio@vger.kernel.org, phone-devel@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-sunxi@lists.linux.dev,
	"Willow Barraco" <contact@willowbarraco.fr>
Subject: Re: [PATCH 2/4] iio: light: stk3310: Implement vdd supply and power it off during suspend
Date: Thu, 18 Apr 2024 18:56:09 +0300	[thread overview]
Message-ID: <CAHp75Veoibnk2pYuAY-T+u=8t7ackQ8zBjxSHcWb1AeHnq84yQ@mail.gmail.com> (raw)
In-Reply-To: <xxeg3as5m5vmmu6fbjujcnvchrerxs2rr42nloirwsktbv4r57@vpxtxblxmspl>

On Thu, Apr 18, 2024 at 6:06 PM Aren <aren@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@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

WARNING: multiple messages have this Message-ID (diff)
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Aren <aren@peacevolution.org>
Cc: "Jonathan Cameron" <jic23@kernel.org>,
	"Lars-Peter Clausen" <lars@metafoo.de>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzysztof.kozlowski+dt@linaro.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Chen-Yu Tsai" <wens@csie.org>,
	"Jernej Skrabec" <jernej.skrabec@gmail.com>,
	"Samuel Holland" <samuel@sholland.org>,
	"Liam Girdwood" <lgirdwood@gmail.com>,
	"Mark Brown" <broonie@kernel.org>, "Ondrej Jirman" <megi@xff.cz>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	linux-iio@vger.kernel.org, phone-devel@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-sunxi@lists.linux.dev,
	"Willow Barraco" <contact@willowbarraco.fr>
Subject: Re: [PATCH 2/4] iio: light: stk3310: Implement vdd supply and power it off during suspend
Date: Thu, 18 Apr 2024 18:56:09 +0300	[thread overview]
Message-ID: <CAHp75Veoibnk2pYuAY-T+u=8t7ackQ8zBjxSHcWb1AeHnq84yQ@mail.gmail.com> (raw)
In-Reply-To: <xxeg3as5m5vmmu6fbjujcnvchrerxs2rr42nloirwsktbv4r57@vpxtxblxmspl>

On Thu, Apr 18, 2024 at 6:06 PM Aren <aren@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@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

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2024-04-18 15:56 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-14 17:53 [PATCH 0/4] iio: light: stk3310: support powering off during suspend Aren Moynihan
2024-04-14 17:53 ` Aren Moynihan
2024-04-14 17:57 ` [PATCH 1/4] dt-bindings: iio: light: stk33xx: add regulator for vdd supply Aren Moynihan
2024-04-14 17:57   ` Aren Moynihan
2024-04-14 17:57   ` [PATCH 2/4] iio: light: stk3310: Implement vdd supply and power it off during suspend Aren Moynihan
2024-04-14 17:57     ` Aren Moynihan
2024-04-15 14:04     ` Andy Shevchenko
2024-04-15 14:04       ` Andy Shevchenko
2024-04-18 15:06       ` Aren
2024-04-18 15:06         ` Aren
2024-04-18 15:56         ` Andy Shevchenko [this message]
2024-04-18 15:56           ` Andy Shevchenko
2024-04-18 17:50           ` Aren
2024-04-18 17:50             ` Aren
2024-04-18 18:19             ` Andy Shevchenko
2024-04-18 18:19               ` Andy Shevchenko
2024-04-20 13:04     ` Jonathan Cameron
2024-04-20 13:04       ` Jonathan Cameron
2024-04-14 17:57   ` [PATCH 3/4] iio: light: stk3310: log error if reading the chip id fails Aren Moynihan
2024-04-14 17:57     ` Aren Moynihan
2024-04-15 15:05     ` Andy Shevchenko
2024-04-15 15:05       ` Andy Shevchenko
2024-04-20 13:06       ` Jonathan Cameron
2024-04-20 13:06         ` Jonathan Cameron
2024-04-14 17:57   ` [PATCH 4/4] arm64: dts: allwinner: pinephone: Add power supply to stk3311 Aren Moynihan
2024-04-14 17:57     ` Aren Moynihan
2024-04-14 18:39   ` [PATCH 1/4] dt-bindings: iio: light: stk33xx: add regulator for vdd supply Krzysztof Kozlowski
2024-04-14 18:39     ` Krzysztof Kozlowski
2024-04-15 20:46   ` Jernej Škrabec
2024-04-15 20:46     ` Jernej Škrabec
2024-04-20 13:05   ` Jonathan Cameron
2024-04-20 13:05     ` Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAHp75Veoibnk2pYuAY-T+u=8t7ackQ8zBjxSHcWb1AeHnq84yQ@mail.gmail.com' \
    --to=andy.shevchenko@gmail.com \
    --cc=aren@peacevolution.org \
    --cc=broonie@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=contact@willowbarraco.fr \
    --cc=devicetree@vger.kernel.org \
    --cc=jernej.skrabec@gmail.com \
    --cc=jic23@kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=lars@metafoo.de \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=megi@xff.cz \
    --cc=phone-devel@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=samuel@sholland.org \
    --cc=u.kleine-koenig@pengutronix.de \
    --cc=wens@csie.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.