From: Jonathan Cameron <jic23@kernel.org>
To: Crt Mori <cmo@melexis.com>
Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
andy.shevchenko@gmail.com, linux-iio@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v6 1/3] iio: temperature: mlx90632 Add runtime powermanagement modes
Date: Sun, 9 Oct 2022 17:36:06 +0100 [thread overview]
Message-ID: <20221009173606.5b8e5661@jic23-huawei> (raw)
In-Reply-To: <CAKv63ut4DJCLQP8ckOsC+K4DGy+v2Y5ghfoTjQoyg4CvditW6Q@mail.gmail.com>
On Mon, 3 Oct 2022 10:20:18 +0200
Crt Mori <cmo@melexis.com> wrote:
> On Sun, 2 Oct 2022 at 18:09, Christophe JAILLET
> <christophe.jaillet@wanadoo.fr> wrote:
> >
> > Le 22/09/2022 à 10:13, cmo-fc6wVz46lShBDgjK7y7TUQ@public.gmane.org a écrit :
> > > From: Crt Mori <cmo-fc6wVz46lShBDgjK7y7TUQ@public.gmane.org>
> > > measurements in lower power mode (SLEEP_STEP), with the lowest refresh
> > > rate (2 seconds).
> >
> > Hi,
> >
> > should there be a v7, a few nitpick below.
> >
> It was already applied, but I can spin a new patch for the suggested
> changes (the s32 is mostly there because before this patch it was
> returning value for further bit manipulation).
Follow on patch welcome!
Thanks,
Jonathan
>
> > >
> > > + ret = regmap_read_poll_timeout(data->regmap, MLX90632_REG_STATUS,
> > > + reg_status,
> > > + (reg_status & MLX90632_STAT_BUSY) == 0,
> > > + 10000, 100 * 10000);
> > > + if (ret < 0) {
> > > + dev_err(&data->client->dev, "data not ready");
> > > + return -ETIMEDOUT;
> >
> > Why not "return ret;"?
> >
> If you came to this point there were already several i2c reads, so I
> think it is more important to convert those to timeout.
>
> > > mutex_lock(&data->lock);
> > > - measurement = mlx90632_perform_measurement(data);
> > > - if (measurement < 0) {
> > > - ret = measurement;
> > > + ret = mlx90632_set_meas_type(data, MLX90632_MTYP_MEDICAL);
> > > + if (ret < 0)
> > > + goto read_unlock;
> > > +
> > > + switch (data->powerstatus) {
> > > + case MLX90632_PWR_STATUS_CONTINUOUS:
> > > + measurement = mlx90632_perform_measurement(data);
> >
> > ret = mlx90632_perform_measurement(data);
> > and
> > measurement = ret;
> > on success would be less verbose (no need for {}, and save 1 LoC) and
> > more in line with mlx90632_calculate_dataset_ready_time() above.
> >
> I wanted to change as few lines as possible to avoid clogging the
> patch with unrelated changes. Also in most cases, we will be
> in-success here, so limiting the number of variable copies in the
> success path should be the priority.
next prev parent reply other threads:[~2022-10-09 16:35 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-22 8:13 [PATCH v6 0/3] iio: temperature: mlx90632: Add powermanagement cmo
2022-09-22 8:13 ` [PATCH v6 1/3] iio: temperature: mlx90632 Add runtime powermanagement modes cmo
2022-10-02 16:09 ` Christophe JAILLET
2022-10-02 16:11 ` Christophe JAILLET
2022-10-02 16:11 ` Christophe JAILLET
2022-10-03 7:43 ` Andy Shevchenko
2022-10-03 8:20 ` Crt Mori
2022-10-09 16:36 ` Jonathan Cameron [this message]
2022-09-22 8:13 ` [PATCH v6 2/3] iio: temperature: mlx90632 Read sampling frequency cmo
2022-09-22 8:13 ` [PATCH v6 3/3] iio: temperature: mlx90632 Change return value of sensor measurement channel cmo
2022-09-24 16:32 ` [PATCH v6 0/3] iio: temperature: mlx90632: Add powermanagement Jonathan Cameron
2022-09-26 13:20 ` Crt Mori
2022-10-02 11:25 ` Jonathan Cameron
2022-10-02 14:36 ` Crt Mori
2022-10-02 14:43 ` 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=20221009173606.5b8e5661@jic23-huawei \
--to=jic23@kernel.org \
--cc=andy.shevchenko@gmail.com \
--cc=christophe.jaillet@wanadoo.fr \
--cc=cmo@melexis.com \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.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).