Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1573728

Re: [PATCH 4/5] regulator: core: simplify _regulator_get()

From Dmitry Torokhov <dmitry.torokhov@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH 4/5] regulator: core: simplify _regulator_get()
Date 2017-02-04 19:30 +0100
Message-ID <t7dfX-4o7-3@gated-at.bofh.it> (permalink)
References <t6U3D-7uQ-13@gated-at.bofh.it> <t6U3D-7uQ-11@gated-at.bofh.it> <t75V8-7Br-41@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 4/5] regulator: core: simplify _regulator_get() Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-02-03 23:00 +0100
  Re: [PATCH 4/5] regulator: core: simplify _regulator_get() Mark Brown <broonie@kernel.org> - 2017-02-04 11:40 +0100
    Re: [PATCH 4/5] regulator: core: simplify _regulator_get() Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-02-04 19:30 +0100
      Re: [PATCH 4/5] regulator: core: simplify _regulator_get() Mark Brown <broonie@kernel.org> - 2017-02-05 17:10 +0100
  Applied "regulator: core: simplify _regulator_get()" to the regulator tree Mark Brown <broonie@kernel.org> - 2017-02-08 19:40 +0100

csiph-web