[PATCH v2 3/5] iio: adc: mcp320x: use conv_time instead of device_index switch

From: Vincent Whitchurch
Date: Wed Aug 31 2022 - 06:05:40 EST


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@xxxxxxxx>
---
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