From patchwork Fri Oct 21 13:18:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matti Vaittinen X-Patchwork-Id: 6713 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp699718wrr; Fri, 21 Oct 2022 06:32:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6HInvaq9zDcZ/DOaaH44/VxViHH/1Nqz4sjF5adCQQsZMj4r0bkQwQUv8bfB3uSBYXtR8w X-Received: by 2002:a63:5a50:0:b0:429:8580:fc61 with SMTP id k16-20020a635a50000000b004298580fc61mr16672338pgm.215.1666359120788; Fri, 21 Oct 2022 06:32:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666359120; cv=none; d=google.com; s=arc-20160816; b=t0DlqVho89W7mw8MSkf6NLn041YBkNq3Pwmx/8m4rs3p3kfPsiHXq29toEotZihJ6I EF4tIh0Iz9cxJcCbsf8CuCI86sMRuX38YckF0nVmJuQpTCG4ZsI7WNARbNTR2Lk2NrwF cgbF0BoHYRP9UaKq2F7e5HflhfoiXqthJp3kIpGXHg4D0lNWMov30dcpWe2aVZac/FHM epmGzQvCo6ePkSTsceoWpATTt4Q9Bnn1KAWqxxIor2v3+YMoRR7J9+wiATVZOiQUZj5P S+TmhooCKHh7pL1r9gFyaNX2CRyTL08kMMsawcMk+FgdpYUHgJGGAyzmVwQH5wfoLxx6 OEDA== 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=pRkhXHMl4TQ/DqaAGRL8GCynFjjb+3hTJyL1LA0fGPI=; b=c72qNapsz2dRwxHgS4BbjYffT76rkfNRWzonNf2AgediIn2TonlIZ/1b/J9MF9+24o baX/MHuEPnVN29IV3aJaHIKzFcnt5OV2MpTtByw2HjU+sUJs0oR3ycxJquoYFbdj5jQe YRNUTb6D1NjCftF3bFtE9d2+788ZGgGiEeSlY6ji/QsE1cgUnojgy+Yl/m5Gmi4DlrVj mppkoXTdMMTH5vL6S5s11Q1kLgod7wSMWFcwflUv/dI5qlvSMY5aBJ3Lgu7kd3eiaO4Y ZqolHeBYO68BMC+5qAhugwpvkdSnwG5G6raDASLZkL8eMN1jj+hEL2cTzAoBFTDAr/R1 hMbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=WgobnPDd; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x11-20020aa79acb000000b0054875fd979bsi22385264pfp.216.2022.10.21.06.31.46; Fri, 21 Oct 2022 06:32: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=WgobnPDd; 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 S230372AbiJUNTX (ORCPT + 99 others); Fri, 21 Oct 2022 09:19:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230495AbiJUNTA (ORCPT ); Fri, 21 Oct 2022 09:19:00 -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 8DDCB270236; Fri, 21 Oct 2022 06:18:50 -0700 (PDT) Received: by mail-lj1-x236.google.com with SMTP id a25so3744635ljk.0; Fri, 21 Oct 2022 06:18:50 -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:subject:date:message-id:reply-to; bh=pRkhXHMl4TQ/DqaAGRL8GCynFjjb+3hTJyL1LA0fGPI=; b=WgobnPDdXrxxYqHttfwgpj1q5gAY72WGanvgflFsMOySjkHmZ4ZH4p7AB0RtJyA3KR LAQJzEZ7NujWLO07huI2EltfmcuGTsWpKfAxegLQF6ITGT5ldA3qdzhI3F4kFUq4yVGw zaIz7sxHn5cE8lamSLUKUO0ZVDZZNZAIVmGSTwuP4f8oGB8ATSsPMkGX2VDO/4i5MZNi bPGdh+ZVAvIhLxkO1TLvj50dkUl/1NOl0SeeLJjHwicmqljgCcVMVsjgf6Lg53kjC09m dNUk9rCAkhIQhKjM82dlPBTIwqx7IB9jFo3fTAy7E717X6RDH/DQOgQqpIuQ5070bUD0 Z6gA== 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:subject:date :message-id:reply-to; bh=pRkhXHMl4TQ/DqaAGRL8GCynFjjb+3hTJyL1LA0fGPI=; b=wAMVbd/DgFo3RgrZSCoGdGawxZiKoRWQCnL40dL69xlc/VgApLI5wF9yiXrkPWwBwg as2wNoE/oeCPRb5ij4V8tQNk9lKvA9BaJaS8R283zQSZeCuWgdDJX93Hz7zlkuOxFuh0 U8Nv9mdJjp9vI8ZmUTVAGFBhEC4sGFz4AN2Tsv1YA6LJzY197aGbrFyRPsgAZoBceXld XxhQUsAe+ORiv8hODTbS8SaEQwe9os0YjH/YhjxmjYzb7P3BpOByjWEOhim2vBklJLsy DuowOAtPnO4gj9Y6+wm9ZpoJ/puQVcdH5Qdi7YupRmPKHCC4Ns8ja5ldCCTENpvLQ+nZ vg2w== X-Gm-Message-State: ACrzQf2j36vyJRynPQtky/JV2sHtFKt0b3y9hVb/3pq9I/GWW5DvPTrc aX8liCgpGx9/6tF8XAQ+f14= X-Received: by 2002:a2e:a7d0:0:b0:26f:d241:483b with SMTP id x16-20020a2ea7d0000000b0026fd241483bmr6279663ljp.426.1666358328736; Fri, 21 Oct 2022 06:18:48 -0700 (PDT) Received: from dc75zzyyyyyyyyyyyyyby-3.rev.dnainternet.fi (dc75zzyyyyyyyyyyyyyby-3.rev.dnainternet.fi. [2001:14ba:16f3:4a00::2]) by smtp.gmail.com with ESMTPSA id 9-20020ac25f49000000b0049944ab6895sm3150402lfz.260.2022.10.21.06.18.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Oct 2022 06:18:47 -0700 (PDT) Date: Fri, 21 Oct 2022 16:18:43 +0300 From: Matti Vaittinen To: Matti Vaittinen , Matti Vaittinen Cc: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , David Airlie , Daniel Vetter , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Michael Hennerich , Jean Delvare , Guenter Roeck , Liam Girdwood , Mark Brown , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-amlogic@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-hwmon@vger.kernel.org Subject: [PATCH v4 3/4] hwmon: lm90: simplify using devm_regulator_get_enable() Message-ID: References: MIME-Version: 1.0 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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747304181332672483?= X-GMAIL-MSGID: =?utf-8?q?1747304181332672483?= 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 => v2: - No changes --- drivers/hwmon/lm90.c | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c index db595f7d01f8..a3f95ba00dbf 100644 --- a/drivers/hwmon/lm90.c +++ b/drivers/hwmon/lm90.c @@ -2663,11 +2663,6 @@ static void lm90_remove_pec(void *dev) device_remove_file(dev, &dev_attr_pec); } -static void lm90_regulator_disable(void *regulator) -{ - regulator_disable(regulator); -} - static int lm90_probe_channel_from_dt(struct i2c_client *client, struct device_node *child, struct lm90_data *data) @@ -2749,24 +2744,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)