Linux IIO development
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: David Lechner <dlechner@baylibre.com>
Cc: "Uwe Kleine-König" <u.kleine-koenig@baylibre.com>,
	"Lars-Peter Clausen" <lars@metafoo.de>,
	"Michael Hennerich" <Michael.Hennerich@analog.com>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] iio: adc: ad7124: Don't create more channels than the hardware is capable of
Date: Sat, 23 Nov 2024 15:01:01 +0000	[thread overview]
Message-ID: <20241123150101.1c5ce5c8@jic23-huawei> (raw)
In-Reply-To: <8636a00f-81e6-4439-9778-abce6e0c931b@baylibre.com>

On Mon, 11 Nov 2024 08:21:45 -0600
David Lechner <dlechner@baylibre.com> wrote:

> On 11/11/24 6:08 AM, Uwe Kleine-König wrote:
> > [dropped Mircea Caprioru from Cc: as their address bounces.]
> > 
> > Hello David,
> > 
> > On Fri, Nov 08, 2024 at 12:52:35PM -0600, David Lechner wrote:  
> >> On 11/8/24 12:18 PM, Uwe Kleine-König wrote:  
> >>> The ad7124-4 and ad7124-8 both support 16 channel registers. Don't
> >>> accept more (logical) channels from dt than that.  
> >>
> >> Why should the devicetree be limited by the number of channel
> >> registers? Channel registers are a resource than can be
> >> dynamically assigned, so it doesn't seem like the devicetree
> >> should be specifying that assignment.  
> > 
> > Note the device tree isn't limited as I didn't adapt the binding. It's
> > just that the driver doesn't bind if too many channels are specified.
> > And while your statement about the channels being a dynamic resource is
> > right, currently the driver doesn't cope and allocates resources
> > statically, and happily assumes there is a CHANNEL_16 register if the
> > device tree specifies 17 (or more) logical channels and writes to
> > CONFIG_0 then which very likely results in strange effects.
> > 
> > So as long as the driver doesn't implement this (possible) dynamic
> > mapping to the CHANNEL registers, it's IMHO right to refuse to bind (or
> > alternatively only use the 16 first logical channels).
> > 
> > Best regards
> > Uwe  
> 
> Understood. It would be nice to implement such dynamic allocation
> in the future but as a fix to backport to stable kernels, this makes
> sense.

Agreed.  We do have other drivers that have internal allocators
for constrained sequencer resources, but they are complex so not
fix material!

Jonathan



  reply	other threads:[~2024-11-23 15:01 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-08 18:18 [PATCH 0/2] iio: adc: ad7124: Implement input validation Uwe Kleine-König
2024-11-08 18:18 ` [PATCH 1/2] iio: adc: ad7124: Don't create more channels than the hardware is capable of Uwe Kleine-König
2024-11-08 18:52   ` David Lechner
2024-11-11 12:08     ` Uwe Kleine-König
2024-11-11 14:21       ` David Lechner
2024-11-23 15:01         ` Jonathan Cameron [this message]
2024-11-11 10:37   ` Nuno Sá
2024-11-11 11:53     ` Uwe Kleine-König
2024-11-11 14:32       ` Nuno Sá
2024-11-08 18:18 ` [PATCH 2/2] iio: adc: ad7124: Refuse invalid input specifiers Uwe Kleine-König
2024-11-11  9:15   ` Dan Carpenter
2024-11-11 12:12     ` Uwe Kleine-König

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=20241123150101.1c5ce5c8@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=Michael.Hennerich@analog.com \
    --cc=dlechner@baylibre.com \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --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