Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp311687rwe; Wed, 31 Aug 2022 03:20:03 -0700 (PDT) X-Google-Smtp-Source: AA6agR40Kry20UdkVlIEguBWam91ykO3zM5DHcgU7Fl7CaTBupwK27x1fHxWUZpDS3BvAub8GDri X-Received: by 2002:a17:906:cc12:b0:741:64ed:125a with SMTP id ml18-20020a170906cc1200b0074164ed125amr11787348ejb.713.1661941203006; Wed, 31 Aug 2022 03:20:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661941202; cv=none; d=google.com; s=arc-20160816; b=aTjnwyLogtRtG7nMwZYbxjKo0JlSMrVg11r5IuutBuQgKrEr/yMrTlXfY0j1X+aDzG bKOVh8sKlgEv8rTNOBHYXoTM7oUjmPwnlz+s4X8b78LthkhnbT+AT5qWPJqt/Xvq8WqH tJlqwkQbGey/See9760si1eoUQlMU7E1e4mP/D8bZf5KKXMTWdY/9zqgKWe0ONMBpQjQ B3Jqs4BFL8zTRtSdGwowJYl91ny+lpQhfwKzK8K9P8ogJn5A4/zHX8VAiiSw3FIpqfrf mxmxfpkrS1qZyTneaBt56GN7CWsb1CwoyyNiFHqaUsXFAPlUxA8c9K9g1FXVB6VoXdHq n0lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=XUwffz74uZ7Ute+FLoHNJJSSnt2Skf2zaVZglgR4zyk=; b=JexMJJw+coy+IOH9kKVrpUN2srVQZu6BMYHNNzZm3T7Ef0Kes32N8vlbomtKmUdpT2 ad6lNuYfjv3FP7l5+7Tfd6A63yTlffP5g/CUfn1buPHLVkrt+QWLJ/MH6oSBXYfymLkO SJXGih5K82ZBR897rEAfTQRE17bEhukYNRLNLy3McZts18dWwJNSQPHvf/VY9HqTH0Hz PAH0eC1McefZiqatywDUXwbJC1ARyZP73rj54SmYHtcgqUf83ArVG9jVhhG4r58dKrfc npqmU9NBw/4NQ9PVR2AJKd1Yw+8vKkaZWFz/A12Uupp8ZYFiVF1YW3d+HazX8+d8e/xZ 4OMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@axis.com header.s=axis-central1 header.b="RH/X2wRV"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=axis.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id xg8-20020a170907320800b0073d5ed5bdfdsi1967469ejb.377.2022.08.31.03.19.37; Wed, 31 Aug 2022 03:20:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@axis.com header.s=axis-central1 header.b="RH/X2wRV"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=axis.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231216AbiHaKFh (ORCPT + 99 others); Wed, 31 Aug 2022 06:05:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230497AbiHaKFY (ORCPT ); Wed, 31 Aug 2022 06:05:24 -0400 Received: from smtp2.axis.com (smtp2.axis.com [195.60.68.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84D9C99247; Wed, 31 Aug 2022 03:05:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; q=dns/txt; s=axis-central1; t=1661940319; x=1693476319; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=XUwffz74uZ7Ute+FLoHNJJSSnt2Skf2zaVZglgR4zyk=; b=RH/X2wRVDfLx6fmgYCYmq5djOa1uOrvTwBGOzUsbtS7ASb9MzPhImSpK JQlaHUlplR1rdYDVn2y9rxiC5cw1v/jlnQNb1IXr6+f3oY2uhILME0S8U 9PgZHTLui7FUh/f5MbAa3Vu9jdc/+126ldXh0Wl/p6f8LzzCxJtYQIQNH 4/Tfhov/KVzml0xQLMxpNxC2Io1/QkZ3ixt7NLBIa8HKfTzooIOLoY7Vh s6w/8/XtB8+k+Ors1x7BRV3q3/+brOYp+CYyUp8apBpymwNtpzTFEAtIb xWJbc5L9Jk8q3b/usXzN/+9o/tE2i6WuvccTypJA9ny0U3oaoF1UZglwj w==; From: Vincent Whitchurch To: CC: , Vincent Whitchurch , , , , 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 Message-ID: <20220831100506.3368103-4-vincent.whitchurch@axis.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220831100506.3368103-1-vincent.whitchurch@axis.com> References: <20220831100506.3368103-1-vincent.whitchurch@axis.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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