Received: by 2002:a05:6359:322:b0:b3:69d0:12d8 with SMTP id ef34csp78086rwb; Wed, 10 Aug 2022 05:13:54 -0700 (PDT) X-Google-Smtp-Source: AA6agR7muyMADaGJoTErW4W9Eb+ioaD7vpp5+TDMsUNSLnGW1n2CdvQ5Gi4Y4NZfPJbhVgxbHYRD X-Received: by 2002:a17:907:628a:b0:72f:678d:6047 with SMTP id nd10-20020a170907628a00b0072f678d6047mr19614291ejc.456.1660133633745; Wed, 10 Aug 2022 05:13:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660133633; cv=none; d=google.com; s=arc-20160816; b=yOB7JX7oQIFCD5t3KsbahLdZU3O0Xl2+33v3ohhDo3O7ms8zA7hnmmltHypzQ2/lYF i0UBfAiryIlm5XLdOdaoY/zb62FRinicVg2HtOE5kiBsQOI5EzMy59qwS3qLOZ+HO2TW s8IJTcQvd6NGX3cHzwpZCtFZgGAo9DIxistZR1W8Jo0OQuI71/YVWtbXXcYbynRry1Y1 s+VNj7zAFke2YOvbw/6aaHS1QFL0SYXL7Q/PVbYMIJjGinkBTmBjriZIBlklUqoWSMmL +DJ9ycWGLFUdRvo2n4dOmju9XVpaqJF+ADA43e5DEgTw86Y/F4euGLd2uSjcEXNwoBDg CQBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=g2OJvOZZHZIxUC/pgYnk9p8BpXsVB+Oo8nJt9r6IY80=; b=gu3a9z3PepGBhVhpVI08EMINUPX/EZyTWsgz/+vtWeunW1sidIwZK90Ebbt/6tyLwx BDvrWANI2nq+xYXsK0lEPy+h9mcZ3a9GgNNreEcdYHIwT2tlZ7jP+trYoDnOpKRm8jrn tfYmSUb2GFF8mVr1Y9HYsJoLfAS5R8ZwbQt8eHC0xvvKiDDFGqYY6qN02xNRKRk3WqNH GyBOVUuspinlollH8AzhjHGskeCOTuxL4ZGGGwbbkeUf4fdYJ6jLfm3i3GZvRUstAZrm j8I5YuYuaI9MHZ15pE9lvE5VWLuBAWvhlBLINI6EBqIVLO66nsKKYO5YAVhfmKw5htZI eJ6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=NSGsGPyT; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hs25-20020a1709073e9900b00730df55b69fsi5305586ejc.767.2022.08.10.05.13.27; Wed, 10 Aug 2022 05:13:53 -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 header.i=@gmail.com header.s=20210112 header.b=NSGsGPyT; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230183AbiHJLdU (ORCPT + 99 others); Wed, 10 Aug 2022 07:33:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232134AbiHJLdG (ORCPT ); Wed, 10 Aug 2022 07:33:06 -0400 Received: from mail-lj1-x22a.google.com (mail-lj1-x22a.google.com [IPv6:2a00:1450:4864:20::22a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89CA775FED; Wed, 10 Aug 2022 04:33:05 -0700 (PDT) Received: by mail-lj1-x22a.google.com with SMTP id j3so8613315ljo.0; Wed, 10 Aug 2022 04:33:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc; bh=g2OJvOZZHZIxUC/pgYnk9p8BpXsVB+Oo8nJt9r6IY80=; b=NSGsGPyT4xwwMmbAE+M4xP1n8h/WRufFIaybXJLwRWeuynTXVnNFE9ZGER+xYFWZzr TX2PM8oTgJ0wo96tXegmpoHDHfmy1/l6BPF2xwjKj/y9gvMJJoxoSHxh82j2WlM1P6nn 5pCPWAdJ/Oko3EUHWbXtBkz3T5fiblQB4VW3pRt9zzCAHeItc6vh1MJ7m/LCV7RfPoST W8c68l23tBQlVRll49YKBbJkjiNgStsDLK9jWKsrfqKZEkcBe/zXUI8rYVB+AUqwZeSo i5jlIHxcn1JzYyXq3dwmDYoJ34C7LbSYRLwUgaLe7Yyom5jTN0Z8kJGUjG2H/EqEXnSv ukEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc; bh=g2OJvOZZHZIxUC/pgYnk9p8BpXsVB+Oo8nJt9r6IY80=; b=ezSwY5ok0KBJxiZNdSY3pv6ngMn4gx+OJfOOfatilgzQi7ip7z/2WRXIraXZATH877 d/tTUAB/BRgFeaVvV44GzX18o2bEgWEvpdCXy7LM3JnEPYWFil5pQ9reu/KzttrrG1ns XdWJTCVHBEQoB9iZ5LNXd5Pn4pHmoZ6fUHM29f2u5fqM4JkvXXPZJWRkIUSt+jWTleWY X1FlwQmS3b/PXH5nkWARhn4uDL6P/YdKWl5ETpEdrsLifRWMPuo/Rqx+Qr0GYDAw0TT2 LCizO5Ih/0Mgy1Loa9FhJVe0OMtRKKXDkxD4HOXGDT1jdNDIOxsuqzNiRFnYqUD0n8ML qj9A== X-Gm-Message-State: ACgBeo1sMIdAADUHMEU3ZqNHahel0jbEYpg7DFMX0HhB2ml70c5AMG97 nRnfQubnEXcB8PRHwen9NIQ= X-Received: by 2002:a2e:bf01:0:b0:25f:df1a:f39d with SMTP id c1-20020a2ebf01000000b0025fdf1af39dmr4312867ljr.365.1660131183928; Wed, 10 Aug 2022 04:33:03 -0700 (PDT) Received: from fedora ([213.255.186.46]) by smtp.gmail.com with ESMTPSA id c6-20020a056512074600b0048b309aeb09sm306204lfs.226.2022.08.10.04.33.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Aug 2022 04:33:03 -0700 (PDT) Date: Wed, 10 Aug 2022 14:32:49 +0300 From: Matti Vaittinen To: matti.vaittinen@fi.rohmeurope.com, mazziesaccount@gmail.com Cc: Alexandru Tachici , Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH 7/7] adc: ad7192: simplify using devm_regulator_get_enable() Message-ID: <7ca58a7014a2149a3190336247b13e683fdf6e33.1660127865.git.mazziesaccount@gmail.com> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="AlIRRVcwMTECGNfK" Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,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 --AlIRRVcwMTECGNfK Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Drop open-coded pattern: 'devm_regulator_get(), regulator_enable(), add_action_or_reset(regulator_disable)' and use the devm_regulator_get_enable_optional(). Also drop the seemingly unused struct member 'dvdd'. Signed-off-by: Matti Vaittinen --- drivers/iio/adc/ad7192.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/drivers/iio/adc/ad7192.c b/drivers/iio/adc/ad7192.c index d71977be7d22..8a52c0dec3f9 100644 --- a/drivers/iio/adc/ad7192.c +++ b/drivers/iio/adc/ad7192.c @@ -177,7 +177,6 @@ struct ad7192_chip_info { struct ad7192_state { const struct ad7192_chip_info *chip_info; struct regulator *avdd; - struct regulator *dvdd; struct clk *mclk; u16 int_vref_mv; u32 fclk; @@ -1015,19 +1014,9 @@ static int ad7192_probe(struct spi_device *spi) if (ret) return ret; =20 - st->dvdd =3D devm_regulator_get(&spi->dev, "dvdd"); - if (IS_ERR(st->dvdd)) - return PTR_ERR(st->dvdd); - - ret =3D regulator_enable(st->dvdd); - if (ret) { - dev_err(&spi->dev, "Failed to enable specified DVdd supply\n"); - return ret; - } - - ret =3D devm_add_action_or_reset(&spi->dev, ad7192_reg_disable, st->dvdd); + ret =3D devm_regulator_get_enable(&spi->dev, "dvdd"); if (ret) - return ret; + return dev_err_probe(&spi->dev, ret, "Failed to enable specified DVdd su= pply\n"); =20 ret =3D regulator_get_voltage(st->avdd); if (ret < 0) { --=20 2.37.1 --=20 Matti Vaittinen, Linux device drivers ROHM Semiconductors, Finland SWDC Kiviharjunlenkki 1E 90220 OULU FINLAND ~~~ "I don't think so," said Rene Descartes. Just then he vanished ~~~ Simon says - in Latin please. ~~~ "non cogito me" dixit Rene Descarte, deinde evanescavit ~~~ Thanks to Simon Glass for the translation =3D]=20 --AlIRRVcwMTECGNfK Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEIx+f8wZb28fLKEhTeFA3/03aocUFAmLzl2EACgkQeFA3/03a ocWJzggAuNdP+4gZx9YJtU8uytBkhkDgWYzALjcpMwvRUK7cUe2AwcfXRTxrDAFw Gy8Jf1M77P9kTtErYASrn81QYDcudYUqAITwf9HMFMQKJu6LlytffVyDO45E/mkr X68cwNVou5IfMU3++b3yCd5sQ3QL816BmS9NTM5MddX9/oBsoZIFaZLIzcYFIkLg JyBlgMUE6hcNfJAjIuJBMBRwL3+11KLMl4xPCv0Ygxrh5QUrVkeCdAeTGoTPjOrw 953B4+RRtfzdcWM+CfBL97tXscPGquOcZcQFyh6JQD9AOvsghGTFK3Qjool9FTxR 6IAWbNGUgqjPD5nGWy7baDJDQpi+9w== =4mV1 -----END PGP SIGNATURE----- --AlIRRVcwMTECGNfK--