From: Jonathan Cameron <jic23@kernel.org>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Shreeya Patel <shreeya.patel@collabora.com>,
Lars-Peter Clausen <lars@metafoo.de>,
Rob Herring <robh+dt@kernel.org>,
Zhigang.Shi@liteon.com, krisman@collabora.com,
linux-iio <linux-iio@vger.kernel.org>,
devicetree <devicetree@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Collabora Kernel ML <kernel@collabora.com>,
alvaro.soliverez@collabora.com,
Dmitry Osipenko <digetx@gmail.com>,
kernel test robot <lkp@intel.com>
Subject: Re: [PATCH v6 2/2] iio: light: Add support for ltrf216a sensor
Date: Sun, 19 Jun 2022 13:44:43 +0100 [thread overview]
Message-ID: <20220619134443.23874255@jic23-huawei> (raw)
In-Reply-To: <CAHp75VeU9oSJmMdyT_0BZDuG5WMiuJiCPv5So4DWG05EEDKrhw@mail.gmail.com>
>
> > + /* reset sensor, chip fails to respond to this, so ignore any errors */
> > + ltrf216a_reset(indio_dev);
> > +
> > + ret = pm_runtime_set_active(&client->dev);
> > + if (ret)
> > + goto error_power_down;
>
> Why do you need to power down here?
>
> > + pm_runtime_enable(&client->dev);
We now have devm_pm_runtime_enable() which will also deal
with disabling use_autosuspend for you and should help you
sort out some of the ordering.
> > + pm_runtime_set_autosuspend_delay(&client->dev, 5000);
> > + pm_runtime_use_autosuspend(&client->dev);
> > +
> > + ltrf216a_set_power_state(data, true);
>
> The below code suggests that you are mixing badly devm_ with non-devm_
> APIs, don't do this. You have to group devm_ first followed by
> non-devm_ calls.
>
> ...
>
> > +static int ltrf216a_remove(struct i2c_client *client)
> > +{
> > + struct iio_dev *indio_dev = i2c_get_clientdata(client);
> > +
> > + iio_device_unregister(indio_dev);
> > + pm_runtime_disable(&client->dev);
> > + pm_runtime_set_suspended(&client->dev);
> > + ltrf216a_disable(indio_dev);
> > +
> > + return 0;
>
> I believe the ordering of freeing resources and reverting state is not
> in reverse. See above why.
In particular you are calling disable there which is already handled
by devm_ unwinding.
>
> > +}
>
next prev parent reply other threads:[~2022-06-19 12:35 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-15 13:51 [PATCH v6 0/2] Add LTRF216A Driver Shreeya Patel
2022-06-15 13:51 ` [PATCH v6 1/2] dt-bindings: Document ltrf216a light sensor bindings Shreeya Patel
2022-06-15 17:20 ` Rob Herring
2022-06-19 12:34 ` Jonathan Cameron
2022-06-19 12:57 ` Shreeya Patel
2022-06-15 13:51 ` [PATCH v6 2/2] iio: light: Add support for ltrf216a sensor Shreeya Patel
2022-06-15 16:32 ` Andy Shevchenko
2022-06-19 12:44 ` Jonathan Cameron [this message]
2022-07-06 20:52 ` Dmitry Osipenko
2022-07-06 20:52 ` Dmitry Osipenko
2022-07-06 20:59 ` Dmitry Osipenko
2022-07-06 21:00 ` Dmitry Osipenko
2022-07-06 21:09 ` Dmitry Osipenko
2022-07-06 22:48 ` Shreeya Patel
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=20220619134443.23874255@jic23-huawei \
--to=jic23@kernel.org \
--cc=Zhigang.Shi@liteon.com \
--cc=alvaro.soliverez@collabora.com \
--cc=andy.shevchenko@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=digetx@gmail.com \
--cc=kernel@collabora.com \
--cc=krisman@collabora.com \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=robh+dt@kernel.org \
--cc=shreeya.patel@collabora.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox