linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Mark Brown <broonie@kernel.org>
Cc: Liam Girdwood <lgirdwood@gmail.com>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/5] regulator: core: simplify _regulator_get()
Date: Sat, 4 Feb 2017 10:27:33 -0800	[thread overview]
Message-ID: <20170204182733.GD12980@dtor-ws> (raw)
In-Reply-To: <20170204103458.vqqhpqhwjwkiizxo@sirena.org.uk>

On Sat, Feb 04, 2017 at 11:34:58AM +0100, Mark Brown wrote:
> On Fri, Feb 03, 2017 at 01:56:03PM -0800, Dmitry Torokhov wrote:
> > The code in _regulator_get() got a bit confusing over time, with control
> > flow jumping to a label from couple of places. Let's untangle it a bit.
> 
> This is quite hard to review without a concrete description of what the
> changes actually are...
> 
> > Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> > ---
> >  drivers/regulator/core.c | 66 +++++++++++++++++++++++++-----------------------
> >  1 file changed, 34 insertions(+), 32 deletions(-)
> 
> ...it's a fairly large change in core code which is as you say a little
> complicated.

OK, so the change is twofold:

1. We make handling of missing supplies and substituting them with dummy
regulators more explicit:

- check if we not have full constraints and refuse considering dummy
  regulators with appropriate message

- use "switch (get_type)" to handle different types of request explicit
  as well. "Normal" requests will get dummies, exclusive will not and
  will notify user about that; optional will fail silently.

2. We will not be jumping to a label normal in the middle of the
function but instead have proper conditional flow. I believe jumps
should be reserved for error handling, breaking from inner loop, or
restarting a loop, but not for implementing normal conditional flow.

Do you need me to put this into commit description or this is
sufficient?

Thanks.

-- 
Dmitry

  reply	other threads:[~2017-02-04 18:27 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-03 21:56 [PATCH 1/5] regulator: core: remove dead code in _regulator_get() Dmitry Torokhov
2017-02-03 21:56 ` [PATCH 2/5] regulator: core: have regulator_dev_lookup() return ERR_PTR-encoded errors Dmitry Torokhov
2017-02-04 10:11   ` Mark Brown
2017-02-04 18:19     ` [PATCH v2 " Dmitry Torokhov
2017-02-05 14:49       ` Mark Brown
2017-02-05 23:49       ` Mark Brown
2017-02-06 13:37       ` Applied "regulator: core: have regulator_dev_lookup() return ERR_PTR-encoded errors" to the regulator tree Mark Brown
2017-02-03 21:56 ` [PATCH 3/5] regulator: core: have _regulator_get() accept get_type argument Dmitry Torokhov
2017-02-04 10:48   ` Applied "regulator: core: have _regulator_get() accept get_type argument" to the regulator tree Mark Brown
2017-02-03 21:56 ` [PATCH 4/5] regulator: core: simplify _regulator_get() Dmitry Torokhov
2017-02-04 10:34   ` Mark Brown
2017-02-04 18:27     ` Dmitry Torokhov [this message]
2017-02-05 16:08       ` Mark Brown
2017-02-08 18:34   ` Applied "regulator: core: simplify _regulator_get()" to the regulator tree Mark Brown
2017-02-03 21:56 ` [PATCH 5/5] regulator: core: lower severity level of message about using dummy supplies Dmitry Torokhov
2017-02-04 11:48   ` Mark Brown
2017-02-04 17:45     ` Dmitry Torokhov
2017-02-05 16:12       ` Mark Brown
2017-02-07  0:56         ` Dmitry Torokhov
2017-02-08 18:19           ` Mark Brown
2017-02-04 10:48 ` Applied "regulator: core: remove dead code in _regulator_get()" to the regulator tree Mark Brown

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=20170204182733.GD12980@dtor-ws \
    --to=dmitry.torokhov@gmail.com \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --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).