Linux IIO development
 help / color / mirror / Atom feed
From: Vincent Whitchurch <vincent.whitchurch@axis.com>
To: <jic23@kernel.org>
Cc: <kernel@axis.com>,
	Vincent Whitchurch <vincent.whitchurch@axis.com>,
	<andy.shevchenko@gmail.com>, <lars@metafoo.de>,
	<linux-iio@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: [PATCH v2 3/5] iio: adc: mcp320x: use conv_time instead of device_index switch
Date: Wed, 31 Aug 2022 12:05:04 +0200	[thread overview]
Message-ID: <20220831100506.3368103-4-vincent.whitchurch@axis.com> (raw)
In-Reply-To: <20220831100506.3368103-1-vincent.whitchurch@axis.com>

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@axis.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


  parent reply	other threads:[~2022-08-31 10:05 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-31 10:05 [PATCH v2 0/5] iio: adc: mcp320x: Add triggered buffer support Vincent Whitchurch
2022-08-31 10:05 ` [PATCH v2 1/5] iio: adc: mcp320x: use callbacks for RX conversion Vincent Whitchurch
2022-08-31 12:40   ` Andy Shevchenko
2022-08-31 14:19     ` Vincent Whitchurch
2022-08-31 20:21       ` Andy Shevchenko
2022-09-04 16:15     ` Jonathan Cameron
2022-09-05  8:27       ` Vincent Whitchurch
2022-09-05  8:38         ` Andy Shevchenko
2022-08-31 10:05 ` [PATCH v2 2/5] iio: adc: mcp320x: remove device_index check for TX Vincent Whitchurch
2022-08-31 12:42   ` Andy Shevchenko
2022-08-31 10:05 ` Vincent Whitchurch [this message]
2022-08-31 12:43   ` [PATCH v2 3/5] iio: adc: mcp320x: use conv_time instead of device_index switch Andy Shevchenko
2022-08-31 10:05 ` [PATCH v2 4/5] iio: adc: mcp320x: use device managed functions Vincent Whitchurch
2022-08-31 12:50   ` Andy Shevchenko
2022-09-04 16:08     ` Jonathan Cameron
2022-08-31 10:05 ` [PATCH v2 5/5] iio: adc: mcp320x: add triggered buffer support Vincent Whitchurch
2022-09-04 16:26   ` 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=20220831100506.3368103-4-vincent.whitchurch@axis.com \
    --to=vincent.whitchurch@axis.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=jic23@kernel.org \
    --cc=kernel@axis.com \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.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