mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Victor Chernyakin <chernyakin.victor.j@outlook.com>
Cc: neil.armstrong@linaro.org, Michael.Hennerich@analog.com,
	andy@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org,
	dlechner@baylibre.com, jic23@kernel.org, krzk+dt@kernel.org,
	linux-hwmon@vger.kernel.org, linux-iio@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux@analog.com,
	nuno.sa@analog.com, robh@kernel.org
Subject: Re: [PATCH v4 3/3] iio: adc: add driver for the MAX34417 Four-Channel High Dynamic Range Power Accumulator
Date: Thu, 29 Oct 2026 15:04:19 +0200	[thread overview]
Message-ID: <auNEU_eozTEhRwGN@ashevche-desk.local> (raw)
In-Reply-To: <SN1PR12MB25286BDD49B0947AC40257D1A56F2@SN1PR12MB2528.namprd12.prod.outlook.com>

On Wed, Oct 28, 2026 at 01:12:40PM -0500, Victor Chernyakin wrote:

...

> > +/**
> > + * struct max34417_data - MAX34417 specific data.
> > + * @indio_dev:  IIO Device.
> > + * @regmap:	Device register map.
> > + * @lock:	Lock for protecting access to device hardware registers, mostly
> > + *		for reading common accumulator count and control register.
> > + * @input_correction:	Correction based on the Rsense value from channel nodes.
> > + * @input_label:	Channel label from channel nodes.
> > + * @cam_mode:		State of the Continuous Accumulate Mode feature
> > + * @acc_power:		Saved power accumulator for each channel when in CAM mode
> > + * @acc_count:		Saved counter for each channel when in CAM mode
> > + */
> 
> All the sentences should have periods at the end

Not really. The only requirement is to keep a consistent style (either all with
periods as you pointed out, or all without).

...

> > +static int max34417_check_ovf(struct max34417_data *max34417)
> > +{
> > +	u32 control;
> > +	int rc;
> > +
> > +	rc = regmap_read(max34417->regmap, MAX34417_CONTROL_REG, &control);
> > +	if (rc)
> > +		return rc;
> > +
> > +	if (control & MAX34417_CONTROL_OVF) {
> > +		rc = regmap_clear_bits(max34417->regmap, MAX34417_CONTROL_REG,
> > +				       MAX34417_CONTROL_OVF);
> > +		if (rc)
> > +			return rc;
> > +
> > +		rc = regmap_write(max34417->regmap, MAX34417_UPDATE_REG, 1);
> > +		if (rc)
> > +			return rc;
> > +	}
> > +
> > +	return 0;
> > +}
> 
> Up to you, but could reduce indentation here:

This makes sense as the function is dedicated for overflow check.

> 	if (!(control & MAX34417_CONTROL_OVF))
> 		return 0;
> 
> 	rc = regmap_clear_bits(max34417->regmap, MAX34417_CONTROL_REG,
> 			       MAX34417_CONTROL_OVF);
> 	if (rc)
> 		return rc;
> 
> 	return regmap_write(max34417->regmap, MAX34417_UPDATE_REG, 1);

...

> > +	*val = lower_32_bits(power);
> > +	*val2 = upper_32_bits(power);
> 
> iio_val_s64_decompose(power, val, val2)?

Good catch!

...

> > +		rc = regmap_set_bits(max34417->regmap, MAX34417_CONTROL_REG,
> > +				     MAX34417_CONTROL_CAM);
> > +		if (rc)
> > +			return rc;
> > +
> 
> Can the regmap_clear_bits() and regmap_set_bits() calls be
> merged into one regmap_update_bits()?

If they are separated, it should be carefully checked with datasheet.

...

> > +static unsigned int max34417_calc_input_correction(u32 rsense_microOhm)
> 
> Spell the return type as u32, to match the parameter

If it's going to be used as an input for regmap APIs unsigned it makes perfect
sense.

-- 
With Best Regards,
Andy Shevchenko



      reply	other threads:[~2026-10-29 13:04 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-28 13:19 [PATCH v4 0/3] iio: adc: add support " Neil Armstrong
2026-10-28 13:19 ` [PATCH v4 1/3] dt-bindings: iio: add: document " Neil Armstrong
2026-10-28 17:50   ` Conor Dooley
2026-10-28 13:19 ` [PATCH v4 2/3] unaligned: introduce be56 unaligned accessors Neil Armstrong
2026-10-28 13:54   ` Andy Shevchenko
2026-10-28 13:19 ` [PATCH v4 3/3] iio: adc: add driver for the MAX34417 Four-Channel High Dynamic Range Power Accumulator Neil Armstrong
2026-10-28 15:06   ` Andy Shevchenko
2026-10-28 15:26     ` Neil Armstrong
2026-10-29 12:58       ` Andy Shevchenko
2026-10-28 18:12   ` Victor Chernyakin
2026-10-29 13:04     ` Andy Shevchenko [this message]

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=auNEU_eozTEhRwGN@ashevche-desk.local \
    --to=andriy.shevchenko@intel.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=andy@kernel.org \
    --cc=chernyakin.victor.j@outlook.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@analog.com \
    --cc=neil.armstrong@linaro.org \
    --cc=nuno.sa@analog.com \
    --cc=robh@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®