[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220831100506.3368103-4-vincent.whitchurch@axis.com>
Date: Wed, 31 Aug 2022 12:05:04 +0200
From: Vincent Whitchurch <vincent.whitchurch@...s.com>
To: <jic23@...nel.org>
CC: <kernel@...s.com>,
Vincent Whitchurch <vincent.whitchurch@...s.com>,
<andy.shevchenko@...il.com>, <lars@...afoo.de>,
<linux-iio@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: [PATCH v2 3/5] iio: adc: mcp320x: use conv_time instead of device_index switch
In mcp320x_adc_conversion(), the presence of the chip_info's conv_time
is used as a condition for using the conversion message. Use that same
condition when initializing the conversion message and the other
handling for variants which need it, instead of the different condition
(checking of the device_index) which is used currently.
Signed-off-by: Vincent Whitchurch <vincent.whitchurch@...s.com>
---
drivers/iio/adc/mcp320x.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/drivers/iio/adc/mcp320x.c b/drivers/iio/adc/mcp320x.c
index 77fb4522a378..8ed27df9a0bb 100644
--- a/drivers/iio/adc/mcp320x.c
+++ b/drivers/iio/adc/mcp320x.c
@@ -429,11 +429,7 @@ static int mcp320x_probe(struct spi_device *spi)
spi_message_init_with_transfers(&adc->msg, adc->transfer,
ARRAY_SIZE(adc->transfer));
- switch (device_index) {
- case mcp3550_50:
- case mcp3550_60:
- case mcp3551:
- case mcp3553:
+ if (chip_info->conv_time) {
/* rx len increases from 24 to 25 bit in SPI mode 0,0 */
if (!(spi->mode & SPI_CPOL))
adc->transfer[1].len++;
--
2.34.1
Powered by blists - more mailing lists