From patchwork Fri Aug 19 19:18:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matti Vaittinen X-Patchwork-Id: 12949137 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E19C2C32771 for ; Fri, 19 Aug 2022 19:19:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351346AbiHSTTu (ORCPT ); Fri, 19 Aug 2022 15:19:50 -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-Google-Smtp-Source: AA6agR6SLF9Swby4h1bQ0oIDt7dX1fKvB10z8PCkXUiAR91Yht1nuWx8IfWzYUYerYygMl5dUqd16Q== 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-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org 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 => 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 = &client->dev; struct i2c_adapter *adapter = client->adapter; struct hwmon_channel_info *info; - struct regulator *regulator; struct device *hwmon_dev; struct lm90_data *data; int err; - regulator = devm_regulator_get(dev, "vcc"); - if (IS_ERR(regulator)) - return PTR_ERR(regulator); - - err = regulator_enable(regulator); - if (err < 0) { - dev_err(dev, "Failed to enable regulator: %d\n", err); - return err; - } - - err = devm_add_action_or_reset(dev, lm90_regulator_disable, regulator); + err = devm_regulator_get_enable(dev, "vcc"); if (err) - return err; + return dev_err_probe(dev, err, "Failed to enable regulator\n"); data = devm_kzalloc(dev, sizeof(struct lm90_data), GFP_KERNEL); if (!data)