devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Cosmin Tanislav <demonsingur@gmail.com>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>,
	Rob Herring <robh+dt@kernel.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	linux-iio <linux-iio@vger.kernel.org>,
	"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	devicetree <devicetree@vger.kernel.org>,
	Cosmin Tanislav <cosmin.tanislav@analog.com>
Subject: Re: [PATCH v4 2/2] iio: adc: ad4130: add AD4130 driver
Date: Tue, 14 Jun 2022 12:47:35 +0100	[thread overview]
Message-ID: <20220614124735.1d712a4a@jic23-huawei> (raw)
In-Reply-To: <37ac71be-78d6-a266-045b-18164d715e57@gmail.com>

On Wed, 8 Jun 2022 23:11:51 +0300
Cosmin Tanislav <demonsingur@gmail.com> wrote:

> On 6/8/22 18:59, Andy Shevchenko wrote:
> > On Wed, Jun 8, 2022 at 12:19 PM Cosmin Tanislav <demonsingur@gmail.com> wrote:  
> >>
> >> AD4130-8 is an ultra-low power, high precision, measurement solution for
> >> low bandwidth battery operated applications.
> >>
> >> The fully integrated AFE (Analog Front-End) includes a multiplexer for up
> >> to 16 single-ended or 8 differential inputs, PGA (Programmable Gain
> >> Amplifier), 24-bit Sigma-Delta ADC, on-chip reference and oscillator,
> >> selectable filter options, smart sequencer, sensor biasing and excitation
> >> options, diagnostics, and a FIFO buffer.  
> > 
> > I believe we may gain a few LoCs by slightly bending the rule of 80.
> > Also see below.
> >   
> 
> I'll only go over the 80 columns limit if Jonathan agrees to it.


Where it helps readability I fine with us going past 80.
I'm not convinced by every case Andy highlights, but many do
make things easier to read.


> 
> >> +       *size = ad4130_reg_size[reg];
> >> +       if (!*size)
> >> +               return -EINVAL;  
> > 
> > Is this check necessary?
> >   
> 
> Yes. I haven't described all registers in the table, and the registers
> can be accessed by the user via the debugfs_reg_access() method.

For that one, probably worth a comment as not immediately obvious.

> 

...

> 
> >> +       switch (ref_sel) {
> >> +       case AD4130_REF_REFIN1:
> >> +               ret = regulator_get_voltage(st->regulators[2].consumer);
> >> +               break;
> >> +       case AD4130_REF_REFIN2:
> >> +               ret = regulator_get_voltage(st->regulators[3].consumer);
> >> +               break;
> >> +       case AD4130_REF_AVDD_AVSS:
> >> +               ret = regulator_get_voltage(st->regulators[0].consumer);
> >> +               break;
> >> +       case AD4130_REF_REFOUT_AVSS:
> >> +               ret = st->int_ref_uv;
> >> +               break;
> >> +       default:
> >> +               ret = -EINVAL;
> >> +               break;
> >> +       }  
> >   
> >> +       if (ret < 0)
> >> +               return dev_err_probe(dev, ret, "Cannot use reference %u\n",
> >> +                                    ref_sel);  
> > 
> > Can it be moved to the caller where it would cleaner to use, I think?
> > As a good side effect the all above will be shortened to just return directly.
> >   
> 
> I'm pretty sure I remember Jonathan suggested moving it inside the
> function.

It's possible, though I don't know what my reasoning would have been...


  reply	other threads:[~2022-06-14 11:38 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-08  9:12 [PATCH v4 0/2] AD4130 Cosmin Tanislav
2022-06-08  9:12 ` [PATCH v4 1/2] dt-bindings: iio: adc: add AD4130 Cosmin Tanislav
2022-06-09 21:03   ` Rob Herring
2022-06-15 12:43     ` Cosmin Tanislav
2022-06-08  9:12 ` [PATCH v4 2/2] iio: adc: ad4130: add AD4130 driver Cosmin Tanislav
2022-06-08 15:59   ` Andy Shevchenko
2022-06-08 20:11     ` Cosmin Tanislav
2022-06-14 11:47       ` Jonathan Cameron [this message]
2022-06-18 13:48   ` 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=20220614124735.1d712a4a@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=andy.shevchenko@gmail.com \
    --cc=cosmin.tanislav@analog.com \
    --cc=demonsingur@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh+dt@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).