[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <556f87c8931d7d7cdf56ebc79f974f8bef045b0d.1733431628.git.christophe.jaillet@wanadoo.fr>
Date: Thu, 5 Dec 2024 21:47:29 +0100
From: Christophe JAILLET <christophe.jaillet@...adoo.fr>
To: Michael Hennerich <Michael.Hennerich@...log.com>,
Nuno Sa <nuno.sa@...log.com>,
Lars-Peter Clausen <lars@...afoo.de>,
Jonathan Cameron <jic23@...nel.org>
Cc: linux-kernel@...r.kernel.org,
kernel-janitors@...r.kernel.org,
Christophe JAILLET <christophe.jaillet@...adoo.fr>,
Jonathan Cameron <Jonathan.Cameron@...wei.com>,
linux-iio@...r.kernel.org
Subject: [PATCH] iio: adc: ad9467: Fix the "don't allow reading vref if not available" case
The commit in Fixes add a special case when only one possible scale is
available.
If several scales are available, it sets the .read_avail field of the
struct iio_info to ad9467_read_avail().
However, this field already holds this function pointer, so the code is a
no-op.
Update ad9467_info to actually reflect the intent described in the commit
message. Keep .read_avail to NULL, unless it is changed to
ad9467_read_avail() in the probe at runtime.
Fixes: b92f94f74826 ("iio: adc: ad9467: don't allow reading vref if not available")
Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
---
This patch is compile tested only and is completely speculative.
Another solution would be to keep ad9467_info as a const struct as it was
before and add a new ad9467_info_no_read structure.
This way, instead of writing in the structure itself, we would choose at
runtime which version to use. The main benefit would be keep this structure
with function pointer const.
---
drivers/iio/adc/ad9467.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/iio/adc/ad9467.c b/drivers/iio/adc/ad9467.c
index d358958ab310..356637677524 100644
--- a/drivers/iio/adc/ad9467.c
+++ b/drivers/iio/adc/ad9467.c
@@ -900,7 +900,6 @@ static struct iio_info ad9467_info = {
.write_raw = ad9467_write_raw,
.update_scan_mode = ad9467_update_scan_mode,
.debugfs_reg_access = ad9467_reg_access,
- .read_avail = ad9467_read_avail,
};
static int ad9467_scale_fill(struct ad9467_state *st)
--
2.47.1
Powered by blists - more mailing lists