Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp441077lqp; Sat, 13 Apr 2024 04:05:30 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXcbWunFLg6Em/LLn6+Df1ep4DFogqZOm3pwvCR7pngvLhFmGgTbk5i9RPVz8jmpTTPMgQ/GsXYb+ND2L+og2oSiP4xlQpJIK9NRzB0cA== X-Google-Smtp-Source: AGHT+IEL+kMAqYrcH1gu2o5MKnMS9hSewEeiVSPnmBkZeidwYwRNSwYq+nLMSRTem+x8tXSj4Eba X-Received: by 2002:a17:906:eec3:b0:a51:c84b:f17b with SMTP id wu3-20020a170906eec300b00a51c84bf17bmr3994267ejb.69.1713006330232; Sat, 13 Apr 2024 04:05:30 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713006330; cv=pass; d=google.com; s=arc-20160816; b=X/vJFWcFOdwgAoEIlVW/izHgSki5xC2EAJosT/Hv++bUn0FuR6k/iqFp4DX0ZT8mFi X3T/l/vY2/tfSh6USOcxtYcquzi4xPOfEt3X+BXIl7/g8hzABHEnlfSDeBEjPWvjC/4l K9YQXNWd9/gMmmdEKLRQjFHZrG1XZiFWROG/T0BgX+66ADiMUg2jXF7gAWvAeEVleglG ZQ/sfdXf8LKFGLRfUdgxaOOxhM4t5aTnDQs+o+vCSXhCC1gCV089Ea+JAZdxoZGUxTfH A8ZeC0HY2pzkGNoK5gIUePs3vAjay056rvD+QnQfxRNZDFqZuRqolabNi9eOjju4/X00 jfCg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=pUTkQdM/Gb7p9MDnKQ6Zf2CPus+OE+b6+3GOyqvqsUQ=; fh=yUY539+YALmVSY+JeBYLOSADzFq1fLVaYV47lw7WKb4=; b=WHOQIUYFc6AOd6cZk+VQeeVIOOwTTc33Momh0kWNE8MLz5XxJ1xBIuVoYaivLpaATM khUmFAtPpBFX8hCSkqBQIy7aM77OYQsD/i8riMgwXX3JjU9uAi+xHnxDHqczZhMaASkK mzJ1JPb+ROkfsY+qB98yp0G8sI9Mu6/ZmlL/ddkC6ZUjnibKi523yxZJEfyHOCfeCsf/ Z53a00I+Y1ybURpSMORYr7TH29REUqau1hN8Pn9CAwjLaBOSyH/MU+7nwdMOhtxqV2Sn dse1Oc3QPYxiPeHZscHyH75G6hP5CGi/tSyS+XjEH/HUKOyfSBvJDQRj7ATF6J8XILyo 7qrQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SAOnqAN4; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-143702-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-143702-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id ds17-20020a170907725100b00a517997352bsi367678ejc.581.2024.04.13.04.05.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Apr 2024 04:05:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-143702-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SAOnqAN4; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-143702-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-143702-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id EFE221F21C6C for ; Sat, 13 Apr 2024 11:05:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 693003E462; Sat, 13 Apr 2024 11:05:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="SAOnqAN4" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 904A51DFD0; Sat, 13 Apr 2024 11:05:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713006321; cv=none; b=ShgOGf6gbl2K3LWCo0IKFRGpIag1k3gbR4WJ0SiVclMlinfQs+w3zQNOsazuoVMnzuce3RQ4HwksBdNb9TE/EDXzxrd8REtCihznNzdlJi+b5hEtC9RjedPvi1M9/nw1lZ4jY3FB7hW+ngWVZQ1HbT7kQNFjHAT7oTnibGqP+Dk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713006321; c=relaxed/simple; bh=V3Zu5G77tqEQ8hNClJQcGwH8VEW5Nfg9tKuIPYVYU/E=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=tMTijhrXscnLDv1ToVSCJFfFWumoQ8cGuetXsdMf4NXDuLpg1F2oElzOjPtcbv0DxKn09NDtdndW3aJ7HBTHAYENAFhasz2HWj6kAiOrX90w0dCfb1Lqb0VjvyDMJjhuQZhhpRArUAFsjZIm7ytIA6KyARTY51TpbKF7ZCz8fRc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=SAOnqAN4; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id B5DFFC2BBFC; Sat, 13 Apr 2024 11:05:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713006320; bh=V3Zu5G77tqEQ8hNClJQcGwH8VEW5Nfg9tKuIPYVYU/E=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=SAOnqAN4DVepX+AHbcnLGgFGqdPWgawkgnuUO7Uw/WbTUBZBGvY7w3fh3mspPVuxm SbNPi3gz5vVfI8tguUWt3DRZGiZrAsGsRwkjgkmzNDmTab8mm/SJaMvne7ybzuxY98 lRLFePdmClDha7jI8+XaWRvdwBbGtzP1gDn180aJHcVte76yDI5hvXlV/f+QkFWcjw gXf4XiEqrNpW2XsJVjzfb+z91f0VT545FMkj+2DOaBI5MSwFM9JDKnW7vlNmPhc0UR j8j+U3XviYRSH1Lq+F+nyjJii/88J5PI86HuPl4oMYQH4XnYGXW5Z9pZWjP5Z2b1Hx ym0cUnmAheL2A== Date: Sat, 13 Apr 2024 12:05:07 +0100 From: Jonathan Cameron To: David Lechner Cc: Michael Hennerich , Nuno =?UTF-8?B?U8Oh?= , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] iio: adc: ad7944: Consolidate spi_sync() wrapper Message-ID: <20240413120507.05bbd229@jic23-huawei> In-Reply-To: <20240412-ad7944-consolidate-msg-v1-1-7fdeff89172f@baylibre.com> References: <20240412-ad7944-consolidate-msg-v1-1-7fdeff89172f@baylibre.com> X-Mailer: Claws Mail 4.2.0 (GTK 3.24.41; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Fri, 12 Apr 2024 18:25:02 -0500 David Lechner wrote: > Since commit 6020ca4de8e5 ("iio: adc: ad7944: use spi_optimize_message()"), > The helper functions wrapping spi_sync() for 3-wire and 4-wire modes are > virtually identical. Since gpiod_set_value_cansleep() does a NULL check > internally, we can consolidate the two functions into one and avoid > switch statements at the call sites. > > The default cases of the removed switch statement were just to make the > compiler happy and are not reachable since the mode is validated in the > probe function. So removing those should be safe. > > Signed-off-by: David Lechner I was initially dubious about implying the need to change a GPIO when we don't, but given that the resulting function is really simple and the comment on that is immediately above the code (not obvious from this diff) this seems fine to me. Applied.