Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp1345134lqs; Sat, 15 Jun 2024 05:14:34 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXCzNj87VnWNy7yjS7EFkmEfZFU4ONfiElZwW8KVmI7SJ3NQ1qYsSyAbwoXOd7QM30MEL5kom6AYBxmRdH6boaBqwjakesikULyp+gR4w== X-Google-Smtp-Source: AGHT+IGSrhiCDHXCe+eA0BthjCzW0/Cp5+Ey38nBNR1ib5pg1rdPLZwXW8Eg7KwdwCtBUbVfhA2+ X-Received: by 2002:a05:6808:2026:b0:3d2:38a5:7875 with SMTP id 5614622812f47-3d24e8fb71amr5908952b6e.29.1718453674683; Sat, 15 Jun 2024 05:14:34 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718453674; cv=pass; d=google.com; s=arc-20160816; b=s1XmyrIruSdMlj7vBL7mjTfOXG5bwQEESJakQUp+1AGGNDiyjD3m7tf7mw9oHdvSw5 0oIhWfGtd1DY/9X0/5yyXiMspdYBr0Ey62iDxVEtfB4XHPy2pUlC9I04PgjmzROQdjob GannQs03NGTeor1x9/CV/y/tNnzikjtnRBXr2YqJxg3SooxJwJWBfkTSKtOR+OIHET5H VGO7O7jsXpjTpAOBSiFhKpEKCK0NGITV3b7kYKKu/7JrxTYgOHh1H7Azu2ZKvknuI9wV kvBPkVQ1kC8FqHqHENoYk5HcYNAw7/FE/XqisRKIcxDwv9W4IEQO6ODgmVctTAnzb9pF 7Ipg== 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=bW3GfrRz8Fbea0fvavZqLIcU+Ljkc87QdAKNtwAtcTg=; fh=ioarvT0aICOMJTSXjkqdp3rfMvQMFJk2WqX2NB7kZxI=; b=LSMyzv2brbQ8YIsQXDGmMXosqDA1v0ETPBxNBJzEAR0IwEXQtNcOEgqSRzKNmRuVrN n3v63ZhcU0v58wcYqX84+Nhj7ebl7bD7xMXjxbdVUEbBGmUnJ/HsupR9kMFgf86iCUvD +FTH026uihvf6cJ0sn0Ol44dXoB4BFSA0i2wzPzvkx8TsN+TdU8ZegQ/srn4NFT8Nu4X jtmMc1WRgFv0eHtRYkHNSueDxrQOWcAe7uXB8ZtkU3Xk/4GkHpRnagepdeUhxG+OtzAl h7/cf9eLaqjgPkEte9XS3/s8RipEmcCm0F160S2DRkP2R2aMnaztWfeOtvolz7P2t//R 3eQA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CaoQcW8r; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-215871-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-215871-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id af79cd13be357-798aadc3ba9si576982285a.221.2024.06.15.05.14.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jun 2024 05:14:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-215871-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CaoQcW8r; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-215871-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-215871-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 6466F1C21209 for ; Sat, 15 Jun 2024 12:14:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6EE7145034; Sat, 15 Jun 2024 12:14:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="CaoQcW8r" 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 92C29433C1; Sat, 15 Jun 2024 12:14:27 +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=1718453667; cv=none; b=Cikfhi712FBZ0C+wMSGcydjJg+oTcFaZzUE048H/nHRsig7JkiG1P/2cVuqT1f9tuhcJ/V+MXTF+q3/eeAj8v1GNjvaA095XaeaY9cvW9xNOVqnwPZz+Olu0K6Ud052Oo/etnarHsMMm4ZUyvwk82auNLFsZK9EBs2uN/K7nu0Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718453667; c=relaxed/simple; bh=OXaRvGK9YhpiNpQtteaABhrLSobVro6J5d7sXvHNJio=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=o0eoPi4EANsYnmLW1A4jKb9aXS6nR8iaF/hgUmSkVuo9zxDcA4wTMLg6WdoNFMh42zk/gJk+ANr6MPgpZtGwkfPkFDPib3fce4Nc/KpD52B+lcgJwEzI95Y3UJzkEBb0ofah352seQRhbs+UnG9AhDlvIlcTTEtiAUDmDDUR35U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=CaoQcW8r; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 02FB5C116B1; Sat, 15 Jun 2024 12:14:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718453667; bh=OXaRvGK9YhpiNpQtteaABhrLSobVro6J5d7sXvHNJio=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=CaoQcW8r9AUGO/lMuYBfEA61Ve8JKozJglBw7OdZsJVSFzrjRedqgUa1xV86rGDtA 9IK8B6cNUjnIHqsatPlkGZpKj0VSaXA9CHU2z3jG8g4Ye3s5gDljuoF6kcDBenBVUk JEFGmWFi82BnptYhILVkgEzhArBd3wXlZk+uCQdx7yEMgs6UWFCsifMXPkve4suz4R nWIJeintZNiho0Obbe3SOuMNxKHRoKY+58JsPS0+PWX3W8ju2/jhtdoBbFf37kck+E Fr1YeXrB1KL9LyKv71OL1900X5hRQXG4fVyoHQwGbujxdBRQ2ynz6QHeqBJvnVZSbs +dN7hHSuqa+Vw== Date: Sat, 15 Jun 2024 13:14:19 +0100 From: Jonathan Cameron To: David Lechner Cc: Nuno =?UTF-8?B?U8Oh?= , Marcelo Schmitt , Nuno =?UTF-8?B?U8Oh?= , Michael Hennerich , Mark Brown , Liam Girdwood , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 3/5] iio: adc: ad7292: use devm_regulator_get_enable_read_voltage Message-ID: <20240615131419.459532df@jic23-huawei> In-Reply-To: References: <20240612-iio-adc-ref-supply-refactor-v2-0-fa622e7354e9@baylibre.com> <20240612-iio-adc-ref-supply-refactor-v2-3-fa622e7354e9@baylibre.com> X-Mailer: Claws Mail 4.3.0 (GTK 3.24.42; 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=UTF-8 Content-Transfer-Encoding: quoted-printable On Fri, 14 Jun 2024 10:16:26 -0500 David Lechner wrote: > On 6/14/24 10:11 AM, Nuno S=C3=A1 wrote: > > On Wed, 2024-06-12 at 16:03 -0500, David Lechner wrote: =20 > >> This makes use of the new devm_regulator_get_enable_read_voltage() > >> function to reduce boilerplate code. > >> > >> Signed-off-by: David Lechner > >> --- > >> v2 changes: > >> * avoid else in return value check > >> * use macro instead of comment to document internal reference voltage > >> --- > >> =C2=A0drivers/iio/adc/ad7292.c | 36 ++++++----------------------------= -- > >> =C2=A01 file changed, 6 insertions(+), 30 deletions(-) > >> > >> diff --git a/drivers/iio/adc/ad7292.c b/drivers/iio/adc/ad7292.c > >> index 6aadd14f459d..87ffe66058a1 100644 > >> --- a/drivers/iio/adc/ad7292.c > >> +++ b/drivers/iio/adc/ad7292.c > >> @@ -17,6 +17,8 @@ > >> =C2=A0 > >> =C2=A0#define ADI_VENDOR_ID 0x0018 > >> =C2=A0 > >> +#define AD7292_INTERNAL_REF_MV 1250 > >> + > >> =C2=A0/* AD7292 registers definition */ > >> =C2=A0#define AD7292_REG_VENDOR_ID 0x00 > >> =C2=A0#define AD7292_REG_CONF_BANK 0x05 > >> @@ -79,7 +81,6 @@ static const struct iio_chan_spec ad7292_channels_di= ff[] =3D { > >> =C2=A0 > >> =C2=A0struct ad7292_state { > >> =C2=A0 struct spi_device *spi; > >> - struct regulator *reg; > >> =C2=A0 unsigned short vref_mv; > >> =C2=A0 > >> =C2=A0 __be16 d16 __aligned(IIO_DMA_MINALIGN); > >> @@ -250,13 +251,6 @@ static const struct iio_info ad7292_info =3D { > >> =C2=A0 .read_raw =3D ad7292_read_raw, > >> =C2=A0}; > >> =C2=A0 > >> -static void ad7292_regulator_disable(void *data) > >> -{ > >> - struct ad7292_state *st =3D data; > >> - > >> - regulator_disable(st->reg); > >> -} > >> - > >> =C2=A0static int ad7292_probe(struct spi_device *spi) > >> =C2=A0{ > >> =C2=A0 struct ad7292_state *st; > >> @@ -277,29 +271,11 @@ static int ad7292_probe(struct spi_device *spi) > >> =C2=A0 return -EINVAL; > >> =C2=A0 } > >> =C2=A0 > >> - st->reg =3D devm_regulator_get_optional(&spi->dev, "vref"); > >> - if (!IS_ERR(st->reg)) { > >> - ret =3D regulator_enable(st->reg); > >> - if (ret) { > >> - dev_err(&spi->dev, > >> - "Failed to enable external vref supply\n"); > >> - return ret; > >> - } > >> - > >> - ret =3D devm_add_action_or_reset(&spi->dev, > >> - =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ad7292_regulator_disable, s= t); > >> - if (ret) > >> - return ret; > >> - > >> - ret =3D regulator_get_voltage(st->reg); > >> - if (ret < 0) > >> - return ret; > >> + ret =3D devm_regulator_get_enable_read_voltage(&spi->dev, "vref"); > >> + if (ret < 0 && ret =3D=3D -ENODEV) =20 > >=20 > > ret !=3D -ENODEV? =20 >=20 > yup, I messed this one up Fixed up whilst applying. Applied >=20 > >=20 > > - Nuno S=C3=A1 > > =20 >=20