linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Akshay Jindal <akshayaj.lkd@gmail.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: anshulusr@gmail.com, jic23@kernel.org, dlechner@baylibre.com,
	 nuno.sa@analog.com, andy@kernel.org, shuah@kernel.org,
	 linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] iio: light: ltr390: Implement runtime PM support
Date: Fri, 29 Aug 2025 00:16:47 +0530	[thread overview]
Message-ID: <CAE3SzaTJTi3bHnqNbAfQ3W2jHcmhQHqa2ZtKE7=2BnP+onJv-w@mail.gmail.com> (raw)
In-Reply-To: <CAHp75VdQB673=qXBp0mPUHxQGxM=Z1CNSmEpP82OprVn++Y5uw@mail.gmail.com>

On Thu, Aug 28, 2025 at 7:17 AM Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
>
> On Wed, Aug 27, 2025 at 10:19 PM Akshay Jindal <akshayaj.lkd@gmail.com> wrote:
> >
>
> > +static int ltr390_read_raw(struct iio_dev *iio_device,
> > +                          struct iio_chan_spec const *chan, int *val,
> > +                          int *val2, long mask)
> > +{
> > +       int ret, retval;
> > +       struct ltr390_data *data = iio_priv(iio_device);
> > +       struct device *dev = &data->client->dev;
> > +
> > +       ret = pm_runtime_resume_and_get(dev);
> > +       if (ret < 0)
> > +               dev_err(dev, "runtime PM failed to resume: %d\n", ret);
>
> If it fails, there is no point to read the value, it will be garbage
> or even can make the bus stuck.
>
My rationale behind this approach is that earlier ltr390_read_raw()
had all the functionality
of the .read_raw callback so the return value whether success or
failure was of the core functionality.
But now, since the core functionality has been relocated into
__ltr390_read_raw(), I felt the return value
ltr390_read_raw should be the return value of __ltr390_read_raw().
Hence I thought, it will be better to
just print dev_err for runtime PM failures and return the retval of
__ltr390_read_raw only.
Let me know your thoughts on this. Will make the change accordingly in
the next version.

Thanks,
Akshay

  reply	other threads:[~2025-08-28 18:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-27 19:19 [PATCH v2] iio: light: ltr390: Implement runtime PM support Akshay Jindal
2025-08-28  1:46 ` Andy Shevchenko
2025-08-28 18:46   ` Akshay Jindal [this message]
2025-08-29 15:45     ` Andy Shevchenko
2025-08-29 18:02       ` Akshay Jindal
2025-08-29 18:49         ` Andy Shevchenko
2025-08-30  3:13           ` Akshay Jindal

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='CAE3SzaTJTi3bHnqNbAfQ3W2jHcmhQHqa2ZtKE7=2BnP+onJv-w@mail.gmail.com' \
    --to=akshayaj.lkd@gmail.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=andy@kernel.org \
    --cc=anshulusr@gmail.com \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=shuah@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).