Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1955134rwb; Fri, 19 Aug 2022 12:21:01 -0700 (PDT) X-Google-Smtp-Source: AA6agR4MzZFcxHTagfmDWEn1Edkg7PntxfQaIHQvv8/tTGg9qSobQQq5AahdIRpio+7TsL1N8Dj+ X-Received: by 2002:a17:90b:1a90:b0:1f5:6233:eb5e with SMTP id ng16-20020a17090b1a9000b001f56233eb5emr10094768pjb.154.1660936860782; Fri, 19 Aug 2022 12:21:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660936860; cv=none; d=google.com; s=arc-20160816; b=JfJE8LvBjK7nLRB/LAoTJe79mYbdrwTW8Ug0E10+3rDSsIX1tIQ2t16MnLGXGTgRVe EdCMIRWVm5lYvVwxSTUmfml4ndqxVVG8+VpLiO+OVSXZwp1nrRYMO1AXh+N1+vhgaXc9 z9cjEsszXK5waQsjxtqi4GtPArsFB1UchcO0LuWC5u6M02wz+Iyr4uueEw8g5QqhKOeB kepqwJSRKFiNrBZD0eL82iFIP73sE606Vw0O9o4I9L0retb8qInR4nz79qECLW9K3kSd TyVnSLPYhd4oeKTWW4q4cXSh5E9CiyLUeZ6WRFPLUZImt77p8NbNhJTCRQiLcUi8tgBu cIEA== 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=jprm91vcKRJS/hTanVO5ROf+R1e6XJUOtpxFg5YEv3Q=; b=hgJeepx1dAQ8nXBHziuFeYXsL6jMHBt7PC7GJqYM34lu4rNROOykb5911cGE96In2g se+2C4tpPNPWM38pMKZBo9CCvUt7x59NO5wMz6kE79bPppJ0vG9xM/OEfWShpmVDsTgE 432ZiRiDoHkqs+NNOUOFc2Zyrx4ESMouCGbRvsuR6mNZJiVQlAguaCFGDMPT1QRprvmm CS+0YfMv21GptNBtkXFerpIlidGxQRpdrsdwNgiKb4IJmGrPvDbmFP7J3P6FwTI2luvi DyTfqPavXVZiS/Lvs1A555gExMUghrBWLIlno72MacebzoOGfnUzBw4fSMS6QqFvj8Re rgfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=k1sPKigi; 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 v128-20020a626186000000b0052b8a12a057si4461011pfb.287.2022.08.19.12.20.49; Fri, 19 Aug 2022 12:21:00 -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=k1sPKigi; 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 S1351390AbiHSTTv (ORCPT + 99 others); Fri, 19 Aug 2022 15:19:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350533AbiHSTTO (ORCPT ); Fri, 19 Aug 2022 15:19:14 -0400 Received: from mail-lj1-x236.google.com (mail-lj1-x236.google.com [IPv6:2a00:1450:4864:20::236]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE7595D0E7; Fri, 19 Aug 2022 12:18:35 -0700 (PDT) Received: by mail-lj1-x236.google.com with SMTP id e2so469794ljj.1; Fri, 19 Aug 2022 12:18:35 -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=jprm91vcKRJS/hTanVO5ROf+R1e6XJUOtpxFg5YEv3Q=; b=k1sPKigibldx7grJUyJGFstnb7Ggxn/iLAJ1ZHTnQb8djXRlbfs9QIFtn1Q3T5z/kR RC9hbp1CLpv2zMIXnLiAsztOoCC06uSpR93d0jUkGApWFC7wZcOF4T+18Reqm78hPwe1 rAVi908ZbARPe+9Pp+j+duDqQT6K29TPnvd/ekNjvkayO4H8Hmjxb/aM08JNsBZIPONz vxvZcec8gaTU22IZI/bvP/pNhp/JNhRa04cHqXcLfJ1Mw3kD4bsNzMMgNE8MsK+Xr4W7 1z/P2DkFvMufWOXoejoMXu2WfXYXNCKNTChHeUdVTUdjkeTlk7PbKnDovjd2OpPeX8TS hk+A== 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=jprm91vcKRJS/hTanVO5ROf+R1e6XJUOtpxFg5YEv3Q=; b=qaRuuGo+pqk/juOCpaOVDXQcLRxqvG7Tq+TMmsUhBNLZQRCCdr7ivY2zVmrCj1AE+x y1iAxRV+L9jSRl4QA3dqNylceLwigqXRP6dkY6IIv+i2vkbMGjnbjqUSCcl0sIw8V/XG fNJ2osY+JqVd2XhpwCPzO18pyzp1FQSVNo0gf8ULSgg4vDehNRLYSI3Z0M3KfLwNbk/l +E+D2Dr9fp9uYb7QO+Jb6PGUbr+XDwSQwoivMOSRhOf4z7Sn8MwrD2vy0UOtuBN/525d Tl9D1F6i7GefnViim4hqyRTFbtbmjD+kBHe0bBkn2N11+TzZfFLBsdmYGQSwIuWDgUyR zLbA== X-Gm-Message-State: ACgBeo3NdfLAA/JF/D6o5C6tHvXK9vus91ZbvcwAAhai/SOINchsSQBr VBQ25AjJN7aB0dXYyjGeR7s= X-Received: by 2002:a2e:a4aa:0:b0:261:a5d5:6699 with SMTP id g10-20020a2ea4aa000000b00261a5d56699mr2410541ljm.104.1660936713909; Fri, 19 Aug 2022 12:18:33 -0700 (PDT) Received: from dc75zzyyyyyyyyyyyyyyt-3.rev.dnainternet.fi (dc75zzyyyyyyyyyyyyyyt-3.rev.dnainternet.fi. [2001:14ba:16f3:4a00::1]) by smtp.gmail.com with ESMTPSA id o19-20020ac25e33000000b00492c463526dsm582723lfg.186.2022.08.19.12.18.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Aug 2022 12:18:33 -0700 (PDT) Date: Fri, 19 Aug 2022 22:18:27 +0300 From: Matti Vaittinen To: Matti Vaittinen , Matti Vaittinen Cc: Jean Delvare , Guenter Roeck , linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 04/14] hwmon: lm90: simplify using devm_regulator_get_enable() Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Kr7Dy4Xq/Tv4XywG" 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 --Kr7Dy4Xq/Tv4XywG 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(). Signed-off-by: Matti Vaittinen Acked-by: Guenter Roeck --- RFCv1 =3D> onwards: - No changes --- drivers/hwmon/lm90.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c index 221de01a327a..6356d92547e0 100644 --- a/drivers/hwmon/lm90.c +++ b/drivers/hwmon/lm90.c @@ -2749,24 +2749,13 @@ static int lm90_probe(struct i2c_client *client) struct device *dev =3D &client->dev; struct i2c_adapter *adapter =3D client->adapter; struct hwmon_channel_info *info; - struct regulator *regulator; struct device *hwmon_dev; struct lm90_data *data; int err; =20 - regulator =3D devm_regulator_get(dev, "vcc"); - if (IS_ERR(regulator)) - return PTR_ERR(regulator); - - err =3D regulator_enable(regulator); - if (err < 0) { - dev_err(dev, "Failed to enable regulator: %d\n", err); - return err; - } - - err =3D devm_add_action_or_reset(dev, lm90_regulator_disable, regulator); + err =3D devm_regulator_get_enable(dev, "vcc"); if (err) - return err; + return dev_err_probe(dev, err, "Failed to enable regulator\n"); =20 data =3D devm_kzalloc(dev, sizeof(struct lm90_data), GFP_KERNEL); if (!data) --=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 --Kr7Dy4Xq/Tv4XywG Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEIx+f8wZb28fLKEhTeFA3/03aocUFAmL/4gMACgkQeFA3/03a ocXn5QgAye6CEWo+fVIqvpitzJYV7WY2ka4g7odch1qUbFpAW3N1LaqrJUJJ2VPx tzpdOXBlAPbS5nYq4U9FYW5TUnnHWZn9UDyyMB9WrggEvHbuUxRhpq3SwVA8uPf/ H1Uu5b8C8jPiqici/X0SkoWqacY3eGKLzARaVZk07d3XOpo0N9kicxUxwSkflARg ArbRC6rqK0fMFGqaOokgQ/m8kpnjYBOaAO6meiWYz7TknRnS0O4cWTUIrEapExtF V3jBqZcVAWMD6cvFEXQv1xlzJSesFwmJ7fFcosF/r/BOkn/bGGc+ov+Hg5FCg0jx THqv8zUQNXeoX4BMaUBfWkvYfe7b8Q== =p1Mf -----END PGP SIGNATURE----- --Kr7Dy4Xq/Tv4XywG--