mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Maxime Chevallier <maxime.chevallier@bootlin.com>
Cc: "Jonathan Cameron" <jic23@kernel.org>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Matti Vaittinen" <mazziesaccount@gmail.com>,
	"Rodolfo Giometti" <giometti@enneenne.com>,
	"Marcelo Schmitt" <marcelo.schmitt@analog.com>,
	"Antoniu Miclaus" <antoniu.miclaus@analog.com>,
	"Angelo Dureghello" <adureghello@baylibre.com>,
	"Tobias Sperling" <tobias.sperling@softing.com>,
	"Eason Yang" <j2anfernee@gmail.com>,
	"Marilene Andrade Garcia" <marilene.agarcia@gmail.com>,
	"Cosmin Tanislav" <cosmin-gabriel.tanislav.xa@renesas.com>,
	duje@dujemihanovic.xyz, "Joshua Crofts" <crofts@kernel.org>,
	"Uwe Kleine-König" <u.kleine-koenig@baylibre.com>,
	"Victor Chernyakin" <chernyakin.victor.j@outlook.com>,
	herve.codina@bootlin.com, thomas.petazzoni@bootlin.com,
	linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 2/2] iio: adc: add driver for Texas Instruments TLA2528 adc
Date: Fri, 13 Nov 2026 17:40:45 +0200	[thread overview]
Message-ID: <avcvfUcFwdJWjvs8@ashevche-desk.local> (raw)
In-Reply-To: <20261113151543.2241604-3-maxime.chevallier@bootlin.com>

On Fri, Nov 13, 2026 at 04:15:42PM +0100, Maxime Chevallier wrote:
> Add a new driver for the TI TLA2528 ADC chip. It has 8 12-bit
> channels, that can also be configured as 16-bit averaging channels.

I forgot to check if there is a justification of the brand new driver,
I assume there is.

> This is a very simple driver, allowing reading raw values for each
> channel. GPIO mode isn't supported for now, as well as buffered mode and
> the 16-bit averaging mode.

Some nit-picks below, but they do not prevent from this patch being accepted,
so

Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>

...

> +static int tla2528_read(struct tla2528 *tla2528, u8 channel, int *val)
> +{
> +	__be16 data;
> +	int ret;
> +
> +	guard(mutex)(&tla2528->lock);
> +
> +	ret = regmap_update_bits(tla2528->regmap, TLA2528_CHANNEL_SEL_ADR,
> +				 TLA2528_CHANNEL_SEL_MANUAL_CHID, channel);
> +	if (ret)
> +		return ret;

Ideally this needs a comment explaining in short why regmap IO accessors may
not be used.

> +	ret = i2c_master_recv(tla2528->client, (char *)&data, sizeof(data));
> +	if (ret < 0)
> +		return ret;
> +	if (ret != sizeof(data))
> +		return -EIO;
> +
> +	*val = be16_to_cpu(data) >> 4;
> +
> +	return 0;
> +}

...

> +	ret = regmap_write(tla2528->regmap, TLA2528_GENERAL_CFG_ADR,
> +			   TLA2528_GENERAL_CFG_RST);

With locally defined

	struct regmap *map;
	...
	map = devm_regmap_*init*(...);
	...
	tla2528->regmap = map;
	...
	ret = regmap_write(map, TLA2528_GENERAL_CFG_ADR, TLA2528_GENERAL_CFG_RST);

this can kill two birds with one stone:
- make this one line (yes, 82 characters is okay)
- keeping data structure free from error pointers

> +	if (ret)
> +		return ret;

-- 
With Best Regards,
Andy Shevchenko



      parent reply	other threads:[~2026-11-13 15:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13 15:15 [PATCH v4 0/2] " Maxime Chevallier
2026-11-13 15:15 ` [PATCH v4 1/2] dt-bindings: iio: adc: add Texas Instruments TLA2528 Maxime Chevallier
2026-11-13 15:15 ` [PATCH v4 2/2] iio: adc: add driver for Texas Instruments TLA2528 adc Maxime Chevallier
2026-11-13 15:26   ` Joshua Crofts
2026-11-13 15:36   ` Matti Vaittinen
2026-11-13 15:40   ` 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=avcvfUcFwdJWjvs8@ashevche-desk.local \
    --to=andriy.shevchenko@intel.com \
    --cc=adureghello@baylibre.com \
    --cc=andy@kernel.org \
    --cc=antoniu.miclaus@analog.com \
    --cc=chernyakin.victor.j@outlook.com \
    --cc=conor+dt@kernel.org \
    --cc=cosmin-gabriel.tanislav.xa@renesas.com \
    --cc=crofts@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=duje@dujemihanovic.xyz \
    --cc=giometti@enneenne.com \
    --cc=herve.codina@bootlin.com \
    --cc=j2anfernee@gmail.com \
    --cc=jic23@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo.schmitt@analog.com \
    --cc=marilene.agarcia@gmail.com \
    --cc=maxime.chevallier@bootlin.com \
    --cc=mazziesaccount@gmail.com \
    --cc=nuno.sa@analog.com \
    --cc=robh@kernel.org \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=tobias.sperling@softing.com \
    --cc=u.kleine-koenig@baylibre.com \
    /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®