Devicetree
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Carlos Jones Jr <carlosjr.jones@analog.com>
Cc: "Jonathan Cameron" <jic23@kernel.org>,
	"Lars-Peter Clausen" <lars@metafoo.de>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"David Lechner" <dlechner@baylibre.com>,
	"Michael Hennerich" <Michael.Hennerich@analog.com>,
	"Liam Beguin" <liambeguin@gmail.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Tobias Sperling" <tobias.sperling@softing.com>,
	"Jorge Marques" <jorge.marques@analog.com>,
	linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/4] iio: adc: ltc2309: Introduce chip_info structure
Date: Tue, 24 Mar 2026 14:24:38 +0200	[thread overview]
Message-ID: <acKChrd_0cRXu7-k@ashevche-desk.local> (raw)
In-Reply-To: <20260324071331.842-2-carlosjr.jones@analog.com>

On Tue, Mar 24, 2026 at 03:13:28PM +0800, Carlos Jones Jr wrote:
> Introduce a chip_info structure to facilitate adding support for
> chip variants with different channel configurations and timing
> requirements.
> 
> The chip_info structure contains:
> - Device name for proper sysfs identification
> - Channel specifications and count
> - Read delay timing for variants requiring settling time
> 
> The ltc2309 struct is modified to store only the read_delay_us value
> rather than a pointer to the full chip_info, as this is the only
> runtime-accessed field after probe.
> 
> This preparatory refactoring does not modify existing LTC2309
> functionality.

...

>  #include <linux/bitfield.h>
> +#include <linux/delay.h>
>  #include <linux/i2c.h>
>  #include <linux/iio/iio.h>
>  #include <linux/kernel.h>
>  #include <linux/module.h>
>  #include <linux/mutex.h>
>  #include <linux/regulator/consumer.h>

> +#include <linux/array_size.h>

It starts with 'a'...

...

> +struct ltc2309_chip_info {
> +	const char *name;
> +	unsigned int num_channels;
> +	const struct iio_chan_spec *channels __counted_by_ptr(num_channels);
> +	unsigned int read_delay_us;

Now on some architectures this might have gaps. Have you run `pahole`?
Even if it's fine, I would rather see

	const char *name;
	const struct iio_chan_spec *channels __counted_by_ptr(num_channels);
	unsigned int num_channels;
	unsigned int read_delay_us;

OR (if there are limitations of __counted_by_ptr() attribute)

	const char *name;
	unsigned int read_delay_us;
	unsigned int num_channels;
	const struct iio_chan_spec *channels __counted_by_ptr(num_channels);

> +};

...

> +static const struct ltc2309_chip_info ltc2309_chip_info = {
> +	.name = "ltc2309",
> +	.num_channels = ARRAY_SIZE(ltc2309_channels),
> +	.channels = ltc2309_channels,
> +};
> +
> +

One blank line too many.

...

>  static int ltc2309_probe(struct i2c_client *client)
>  {
>  	struct iio_dev *indio_dev;
>  	struct ltc2309 *ltc2309;
> +	const struct ltc2309_chip_info *chip_info;

Try to preserve reversed xmas tree order.

>  	int ret;

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2026-03-24 12:24 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-24  7:13 [PATCH v2 0/4] Add support for LTC2305 Carlos Jones Jr
2026-03-24  7:13 ` [PATCH v2 1/4] iio: adc: ltc2309: Introduce chip_info structure Carlos Jones Jr
2026-03-24 12:24   ` Andy Shevchenko [this message]
2026-03-25  0:01     ` Jones, Carlos jr
2026-03-24  7:13 ` [PATCH v2 2/4] iio: adc: ltc2309: Use i2c_get_match_data() helper Carlos Jones Jr
2026-03-24 12:35   ` Andy Shevchenko
2026-03-24  7:13 ` [PATCH v2 3/4] dt-bindings: iio: adc: ltc2497: Add LTC2305 compatible Carlos Jones Jr
2026-03-24 12:36   ` Krzysztof Kozlowski
2026-03-24  7:13 ` [PATCH v2 4/4] iio: adc: ltc2309: Add LTC2305 support Carlos Jones Jr
2026-03-24 12:39   ` Andy Shevchenko
2026-03-25 20:19 ` [PATCH v2 0/4] Add support for LTC2305 Jonathan Cameron
2026-03-26  2:21   ` Jones, Carlos jr
2026-03-26  8:17     ` 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=acKChrd_0cRXu7-k@ashevche-desk.local \
    --to=andriy.shevchenko@intel.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=andy@kernel.org \
    --cc=carlosjr.jones@analog.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=jorge.marques@analog.com \
    --cc=krzk+dt@kernel.org \
    --cc=lars@metafoo.de \
    --cc=liambeguin@gmail.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=robh@kernel.org \
    --cc=tobias.sperling@softing.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