public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: David Lechner <dlechner@baylibre.com>
To: Antoniu Miclaus <antoniu.miclaus@analog.com>,
	jic23@kernel.org, robh@kernel.org, conor+dt@kernel.org,
	linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-pwm@vger.kernel.org
Subject: Re: [PATCH v12 9/9] iio: adc: ad4851: add ad485x driver
Date: Fri, 7 Feb 2025 14:51:40 -0600	[thread overview]
Message-ID: <dd263ac6-1843-493c-90ea-d303eae561e5@baylibre.com> (raw)
In-Reply-To: <20250207140918.7814-10-antoniu.miclaus@analog.com>

On 2/7/25 8:09 AM, Antoniu Miclaus wrote:
> Add support for the AD485X a fully buffered, 8-channel simultaneous
> sampling, 16/20-bit, 1 MSPS data acquisition system (DAS) with
> differential, wide common-mode range inputs.
> 
> Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
> ---

...

> +static int ad4851_parse_channels_common(struct iio_dev *indio_dev,
> +					struct iio_chan_spec **chans,
> +					const struct iio_chan_spec ad4851_chan)
> +{
> +	struct ad4851_state *st = iio_priv(indio_dev);
> +	struct device *dev = &st->spi->dev;
> +	struct iio_chan_spec *channels, *chan_start;
> +	unsigned int num_channels, reg;
> +	unsigned int index = 0;
> +	int ret;
> +
> +	num_channels = device_get_child_node_count(dev);
> +	if (num_channels > AD4851_MAX_CH_NR)
> +		return dev_err_probe(dev, -EINVAL, "Too many channels: %u\n",
> +				     num_channels);
> +
> +	channels = devm_kcalloc(dev, num_channels, sizeof(*channels), GFP_KERNEL);
> +	if (!channels)
> +		return -ENOMEM;
> +
> +	chan_start = channels;
> +
> +	device_for_each_child_node_scoped(dev, child) {
> +		ret = fwnode_property_read_u32(child, "reg", &reg);
> +		if (ret)
> +			return dev_err_probe(dev, ret,
> +					     "Missing channel number\n");
> +		if (reg >= AD4851_MAX_CH_NR)
> +			return dev_err_probe(dev, ret,

ret will be == 0 here, so need to replace with -EINVAL.

> +					     "Invalid channel number\n");

  reply	other threads:[~2025-02-07 20:51 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-07 14:09 [PATCH v12 0/9] Add support for AD485x DAS Family Antoniu Miclaus
2025-02-07 14:09 ` [PATCH v12 1/9] iio: backend: add API for interface get Antoniu Miclaus
2025-02-07 14:09 ` [PATCH v12 2/9] iio: backend: add support for data size set Antoniu Miclaus
2025-02-07 14:09 ` [PATCH v12 3/9] iio: backend: add API for oversampling Antoniu Miclaus
2025-02-07 14:09 ` [PATCH v12 4/9] iio: adc: adi-axi-adc: add interface type Antoniu Miclaus
2025-02-07 14:09 ` [PATCH v12 5/9] dt-bindings: iio: adc: add ad485x axi variant Antoniu Miclaus
2025-02-08 16:20   ` Jonathan Cameron
2025-02-11  8:16     ` Krzysztof Kozlowski
2025-02-11 19:53       ` Jonathan Cameron
2025-02-07 14:09 ` [PATCH v12 6/9] iio: adc: adi-axi-adc: set data format Antoniu Miclaus
2025-02-07 20:51   ` David Lechner
2025-02-08 16:22   ` Jonathan Cameron
2025-02-11 19:55     ` Jonathan Cameron
2025-02-07 14:09 ` [PATCH v12 7/9] iio: adc: adi-axi-adc: add oversampling Antoniu Miclaus
2025-02-08 16:23   ` Jonathan Cameron
2025-02-07 14:09 ` [PATCH v12 8/9] dt-bindings: iio: adc: add ad4851 Antoniu Miclaus
2025-02-07 14:09 ` [PATCH v12 9/9] iio: adc: ad4851: add ad485x driver Antoniu Miclaus
2025-02-07 20:51   ` David Lechner [this message]
2025-02-08 16:28   ` 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=dd263ac6-1843-493c-90ea-d303eae561e5@baylibre.com \
    --to=dlechner@baylibre.com \
    --cc=antoniu.miclaus@analog.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --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