mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Crt Mori <cmo@melexis.com>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>,
	linux-iio <linux-iio@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/3] iio: temperature: mlx90632 Add runtime powermanagement modes
Date: Sun, 4 Sep 2022 15:03:46 +0100	[thread overview]
Message-ID: <20220904150346.0c56de9d@jic23-huawei> (raw)
In-Reply-To: <CAKv63us6OLg8ahdbKvd8c4x9-Ri4aDwNvgc_oov7wZnSBmJGVA@mail.gmail.com>

On Sat, 3 Sep 2022 14:05:38 +0200
Crt Mori <cmo@melexis.com> wrote:

> On Fri, 2 Sept 2022 at 20:39, Andy Shevchenko <andy.shevchenko@gmail.com> wrote:
> >
> > On Fri, Sep 2, 2022 at 8:59 PM Crt Mori <cmo@melexis.com> wrote:  
> > > On Fri, 2 Sept 2022 at 17:28, Andy Shevchenko <andy.shevchenko@gmail.com> wrote:  
> > > > On Fri, Sep 2, 2022 at 4:13 PM <cmo@melexis.com> wrote:  
> > > > > +       if (current_powerstatus == MLX90632_PWR_STATUS_SLEEP_STEP)
> > > > > +               return mlx90632_pwr_set_sleep_step(data->regmap);  
> > > >  
> > > > > +       else  
> > > >
> > > > Redundant.
> > > >  
> > > No, the powermode changes among the type.  
> >
> > Yes. 'else' keyword is always redundant in the
> >
> >   if (...)
> >     return / break / continue / goto
> >   else
> >
> > cases.
> >  
> In this case current power mode of the sensor is halt, so the else is
> needed to set it to continuous mode, which means I can't just remove
> the else here because this statement restores the power mode before
> this function was entered (and changed powermode for the setup).
> 
> > > > > +               return mlx90632_pwr_continuous(data->regmap);  
> >
> > ...
> >  
> > > > > +static int __maybe_unused mlx90632_pm_runtime_suspend(struct device *dev)  
> > > >
> > > > No __maybe_unused, use pm_ptr() / pm_sleep_ptr() below.
> > > >  
> > > Care to explain a bit more about this? I just followed what other
> > > drivers have...  
> >
> > And other drivers have what I said, but it's a new feature.
> > If you run `git log --no-merges --grep 'pm_ptr' -- drivers/iio
> > include/linux/` and read the history it will explain the case.
> >  
> Thanks for the hint.

The relevant EXPORT_ for this particular case isn't upstream yet
We had a proposal on IIO list, but there was a better one as part of
cleaning this up for MFD.  I haven't checked if there is a suitable
immutable branch for that patch yet...

Jonathan



  parent reply	other threads:[~2022-09-04 14:38 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-02 13:12 cmo
2022-09-02 15:27 ` Andy Shevchenko
2022-09-02 17:59   ` Crt Mori
2022-09-02 18:38     ` Andy Shevchenko
2022-09-03 12:05       ` Crt Mori
2022-09-03 13:58         ` Andy Shevchenko
2022-09-04 14:03         ` Jonathan Cameron [this message]
2022-09-04 19:08           ` Andy Shevchenko

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=20220904150346.0c56de9d@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=andy.shevchenko@gmail.com \
    --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

all inboxes | Powered by JetHome®