public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Kyle Hsieh <kylehsieh1995@gmail.com>
Cc: "Lars-Peter Clausen" <lars@metafoo.de>,
	"Michael Hennerich" <Michael.Hennerich@analog.com>,
	"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>,
	"Liam Beguin" <liambeguin@gmail.com>,
	linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/2] iio: adc: ltc2309: add support for ltc2305
Date: Sat, 27 Dec 2025 16:55:12 +0200	[thread overview]
Message-ID: <aU_zUI8xOt7Cl5vP@smile.fi.intel.com> (raw)
In-Reply-To: <20251224-add_ltc2305_driver-v2-2-061f78cf45a3@gmail.com>

On Wed, Dec 24, 2025 at 01:37:15PM +0800, Kyle Hsieh wrote:
> Add support for the 2-channel LTC2305 ADC in the existing LTC2309 driver.
> The LTC2305 and LTC2309 share similar features: both are 12-bit,
> low-noise, low-power SAR ADCs with an I2C interface.
> The main difference is the number of channels: LTC2305 has 2 channels,
> while LTC2309 has 8 channels.

>  /* Order matches expected channel address, See datasheet Table 1. */
> +enum ltc2305_channels {
> +	LTC2305_CH0_CH1 = 0,
> +	LTC2305_CH1_CH0,
> +	LTC2305_CH0,
> +	LTC2305_CH1,

When it's hardware defined, assign all of them explicitly. Otherwise drop the
unneeded 0 which is guaranteed by the C standard.

> +};

...

> +	chip_info = i2c_get_match_data(client);

> +	if (!chip_info)
> +		return -EINVAL;

I consider this check redundant. There is shouldn't be a production code that
works nicely when there is a clear mistake in it (absence of the mandatory
static initialiser). The author of the change should have been testing this
and hence it will Oops the kernel, which means that the initial code is b0rken.
So, drop the dead check.

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2025-12-27 14:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-24  5:37 [PATCH v2 0/2] iio: adc: ltc2309: add support driver for ltc2305 Kyle Hsieh
2025-12-24  5:37 ` [PATCH v2 1/2] dt-bindings: adc: ltc2497: add support " Kyle Hsieh
2025-12-27 12:39   ` Krzysztof Kozlowski
2025-12-30  1:08     ` Kyle Hsieh
2025-12-24  5:37 ` [PATCH v2 2/2] iio: adc: ltc2309: " Kyle Hsieh
2025-12-27 14:55   ` Andy Shevchenko [this message]
2025-12-27 18:18   ` Jonathan Cameron
2025-12-30  1:13     ` Kyle Hsieh
2025-12-27 18:07 ` [PATCH v2 0/2] iio: adc: ltc2309: add support driver " 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=aU_zUI8xOt7Cl5vP@smile.fi.intel.com \
    --to=andriy.shevchenko@intel.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=andy@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=kylehsieh1995@gmail.com \
    --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 \
    /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