From patchwork Fri Oct 21 13:18:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matti Vaittinen X-Patchwork-Id: 6716 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp699905wrr; Fri, 21 Oct 2022 06:32:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5zEwDKIK1LFibNgmfX+XxGIA12LS+fkogAkYD83qpCbAiqtvh+KyxVQ/rozoHpGA9OnTGy X-Received: by 2002:a17:90a:c250:b0:20a:e484:63aa with SMTP id d16-20020a17090ac25000b0020ae48463aamr22657586pjx.0.1666359129244; Fri, 21 Oct 2022 06:32:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666359129; cv=none; d=google.com; s=arc-20160816; b=Z03owFvoMfkYbuv/II35FS5+oh02WWDTU4ZtuQm9efUGuSvI4TIu6NcFbiwv0DFzpz U8swV05h9+S3SX6KkMvjNGagheLGaQIzDdjboLsvcrZCtoZUiG3WS0pJ7szke+ySP/yy N7e2YoeoQi7R/ZZJ01GEv7z4IH1O6ktX4gm7Jrc04tjWSY5yTRMObsRzXfWovYsLwBN3 fNYucYtNLWGcEHtmw3Sr4FeNf7/wp/ucgNi6YkQ9o+F6CCDJlJcoMvR3zXQ9+974ORId Ul88BC6IsTBFdzRJ/c9XkWdclI8azA+Ufp8WFADyi/szooJ6TMQFPtLhNrgT1/o3PzZF FPTA== 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=ihyfIhpnzq65oKa3RDOB7v3ysoQ+yvmg3Y0WFsPd1bw=; b=DYv6idxpm3Uc/e1Fq9t/8Eh469jNfhVMKqs31w4tdgzgFItdKzea7RrN0v0pOLKqvV wU5woyuOpZW+O3Du9yfLQ5x7qnkShTGyoJh31YWieo/JnFEZrgMOMfC6s3nmlbnDz5rz jK+H1AUOOKc/ly04NloRu8zWpLPFYgBB7IhlSZoPW/Z8FpIfSH5d4cHGHNRJYuju87Lz wlS0KhqdQQjLvPLHuyVzIeOy5PIhJqArQqeIQfC9ao28eVQTXE5epVgOdBgoxV/GbNU9 3mSybojKd5oIufe8LiVIn9ZdGqSGWKHSPJIOy5++ZhqtfQJScu5Qeymok6b8wU4zbG/h 9IIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=I9NeRnvm; 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 l5-20020a63f305000000b0045fdb4fca50si26906991pgh.330.2022.10.21.06.31.54; Fri, 21 Oct 2022 06:32:09 -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=I9NeRnvm; 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 S230431AbiJUNSv (ORCPT + 99 others); Fri, 21 Oct 2022 09:18:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230432AbiJUNSc (ORCPT ); Fri, 21 Oct 2022 09:18:32 -0400 Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [IPv6:2a00:1450:4864:20::132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4EF9027354E; Fri, 21 Oct 2022 06:18:10 -0700 (PDT) Received: by mail-lf1-x132.google.com with SMTP id b1so5049344lfs.7; Fri, 21 Oct 2022 06:18:10 -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=ihyfIhpnzq65oKa3RDOB7v3ysoQ+yvmg3Y0WFsPd1bw=; b=I9NeRnvmBddsliQwQ2JpFRY+yBhvSinkJq/RCwn5uMf4MgZObYFZAv/iOK3QP8HDji 9FhiOcX3yboLmgid/jqKyVngYBvuPvf5BkzKMNFWrL8KQT1Tl6iFXObUupxvMPyj6ipV hTwvZClXLoQOmaru2RChDi02M5YSHTfFduAL2+4oTQGWTpzWlEA43DlIrC6Xrq73NH5O 7Zs1g3PN9W+9D9GL2WBG90EoQeCFaYYsg3kjewxiPQUlMaz2PZmj+0fcCPZO2Un+43ag 2qgx1yDok3Bs6op5lq+uaO6uVmesvlIp5o4EQAeDUAca5dg6zkwSVqXiapNee7MfkIoj SUGA== 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=ihyfIhpnzq65oKa3RDOB7v3ysoQ+yvmg3Y0WFsPd1bw=; b=jVb9PcnpXr+uEaKDgc7OtKLl5ba5omCn5WlvLO1hVWXNw1jF8Pxl9sU64NjFke7OwZ haG4gaZI0rCSqapdDdj9So+Ib78bAdqYRlKDcxDfdmyBAfBDxPhg2VEBPpmzBDvRnmqk K5bHOPttgiGIlb5N3ndlhoXVAKeuUiDbR/Z9rlVb2hwarP3eHbblDyDNGWmSCgyMafb6 rmSg2+mJeSQKVZfzJwRGWdRW4ZO0Brfr9A/XzwlsUcJ33E4u9Nh91wBGaSAKuW1uQ6JS phV3F5a1nfJFKavn91hYeSKKDlnbcgO0lPES7EJ/n/yCn4FxGctovhTxciwpoYKzUr/H PPzA== X-Gm-Message-State: ACrzQf0L6qSqccQb1TD9EYuWqPnTUsGt/szVCz37x4LBkCLtgBnlFJK9 MWVbacdBtVHeWTxSaIExM8o= X-Received: by 2002:a05:6512:3085:b0:4a2:7d80:d4b4 with SMTP id z5-20020a056512308500b004a27d80d4b4mr7150541lfd.534.1666358288796; Fri, 21 Oct 2022 06:18:08 -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 a13-20020a056512200d00b00494747ba5f7sm2210665lfb.272.2022.10.21.06.18.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Oct 2022 06:18:07 -0700 (PDT) Date: Fri, 21 Oct 2022 16:18:01 +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 1/4] gpu: drm: meson: Use 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?1747304181047861852?= X-GMAIL-MSGID: =?utf-8?q?1747304190291200704?= Simplify using the devm_regulator_get_enable_optional(). Also drop the seemingly unused struct member 'hdmi_supply'. Signed-off-by: Matti Vaittinen --- v3 => v4: - split meson part to own patch RFCv1 => v2: - Change also sii902x to use devm_regulator_bulk_get_enable() Please note - this is only compile-tested due to the lack of HW. Careful review and testing is _highly_ appreciated. --- drivers/gpu/drm/meson/meson_dw_hdmi.c | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c index 5cd2b2ebbbd3..7642f740272b 100644 --- a/drivers/gpu/drm/meson/meson_dw_hdmi.c +++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c @@ -140,7 +140,6 @@ struct meson_dw_hdmi { struct reset_control *hdmitx_apb; struct reset_control *hdmitx_ctrl; struct reset_control *hdmitx_phy; - struct regulator *hdmi_supply; u32 irq_stat; struct dw_hdmi *hdmi; struct drm_bridge *bridge; @@ -665,11 +664,6 @@ static void meson_dw_hdmi_init(struct meson_dw_hdmi *meson_dw_hdmi) } -static void meson_disable_regulator(void *data) -{ - regulator_disable(data); -} - static void meson_disable_clk(void *data) { clk_disable_unprepare(data); @@ -723,20 +717,9 @@ static int meson_dw_hdmi_bind(struct device *dev, struct device *master, meson_dw_hdmi->data = match; dw_plat_data = &meson_dw_hdmi->dw_plat_data; - meson_dw_hdmi->hdmi_supply = devm_regulator_get_optional(dev, "hdmi"); - if (IS_ERR(meson_dw_hdmi->hdmi_supply)) { - if (PTR_ERR(meson_dw_hdmi->hdmi_supply) == -EPROBE_DEFER) - return -EPROBE_DEFER; - meson_dw_hdmi->hdmi_supply = NULL; - } else { - ret = regulator_enable(meson_dw_hdmi->hdmi_supply); - if (ret) - return ret; - ret = devm_add_action_or_reset(dev, meson_disable_regulator, - meson_dw_hdmi->hdmi_supply); - if (ret) - return ret; - } + ret = devm_regulator_get_enable_optional(dev, "hdmi"); + if (ret != -ENODEV) + return ret; meson_dw_hdmi->hdmitx_apb = devm_reset_control_get_exclusive(dev, "hdmitx_apb"); From patchwork Fri Oct 21 13:18:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matti Vaittinen X-Patchwork-Id: 6714 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp699829wrr; Fri, 21 Oct 2022 06:32:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7EaP8J01orw6aGcGmlQV06l/uh3oh0UcHc/HC9CRzt3XYYAYPVDE/G3X9H+0pDDPmQf/DN X-Received: by 2002:a17:90b:38c4:b0:20d:9dfa:4339 with SMTP id nn4-20020a17090b38c400b0020d9dfa4339mr54422314pjb.74.1666359133491; Fri, 21 Oct 2022 06:32:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666359133; cv=none; d=google.com; s=arc-20160816; b=KtzgbNbAdeEsXCQD97F/SNCBknklf1hBq2LKf7oPKHnM1U67psvvyarUPWxbkZCfTS YrPBEjDyzUCQEWg8VnlkTtAgYU4IIZ38jb022vFhRdLheYI0O4Q0q+vJ5dHmNKY6dS5/ +sdN8TG8rPBiMrQzb52NaPD/7nfDpQuokD2uXBRY8uJHafsPev6bhkU3cjw7J0WulPXI 9fsP/UFg+51iuqJkeXnmlSMbNkd2py4RSzsOFBQZG/60AYBgYxUXl1nzt7xqHoHO2xJ8 BvpedEgSTdth7q9HoLFf2aP5KdtiuDgrhuSo94g9VoiUIMn+CUDeX8GwKetCeQh3Rdfm YIeg== 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=qI3A82j8OlKFN8/s3EGSbVRexJ10lYyCFaVb3RuN9Is=; b=c426CDLpW8yjtP8wyb+klIjeRtO1Hxb3lHonx+CeYrqTXtcJS+1EOGE3trJvksu/mQ O9fQRRmjaumeDAc7uo7LxHd64Uvq7A1UnXmGrbz+0olXWre6IDbx999bsXE0FJDsijLb sZTpBdxwNfOcTSpLyb9lNV6gNxBeMPu+aOEb2Ssje2qbgsFxNWZQt7NZ607KSOrbSx/u qIlahQCtnIqKhWcIpWLMLB/fOkcLfeVM68mfRt3TvhrlD/DzeePs0b2H+VzzHu2ybqJ7 /FTAMc7BBw5Z1IOY/o+EWjcMz0l+OShEkDaXwuhQ7dcX+q8QxPZmId/xpMWKBS3VhoNu Mpbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="EddB7/l5"; 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 n8-20020a170902f60800b001786b70f913si25103416plg.164.2022.10.21.06.32.00; Fri, 21 Oct 2022 06:32:13 -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="EddB7/l5"; 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 S230195AbiJUNTU (ORCPT + 99 others); Fri, 21 Oct 2022 09:19:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230465AbiJUNSr (ORCPT ); Fri, 21 Oct 2022 09:18:47 -0400 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FD62270237; Fri, 21 Oct 2022 06:18:31 -0700 (PDT) Received: by mail-lf1-x134.google.com with SMTP id bu25so5097545lfb.3; Fri, 21 Oct 2022 06:18:31 -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=qI3A82j8OlKFN8/s3EGSbVRexJ10lYyCFaVb3RuN9Is=; b=EddB7/l5OXNdqlNUaGLu6aYnT5u8eGmGUOD2LYBqpyC6BKfPYZSYjogyqbQOlfXZZy LHTBXr9JUt6OuGdzhxu2SG3s5TacFmpQaIT2wnAsCqshT3K20Nz1wmhTvB9GJS4sniFw MxRcFTStp17cAXYvqFLjHmGbs8xL3sMUNhmIvnhfkDhZFVzcM5glxRRHXkgtIBJ6oAh8 UBDaGKp5DR2lqAnNbXK8Pcvnj2UP9k+BXMrycOGj30rNUmyjnz4tESR3q16OAi/4KVe4 B12c7lBrRPym7hKeHuI0FRXMOqSt7vyf2OGG5bbr0//KRXUEPOrAH9V2OeDs+00yCoX+ lJIg== 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=qI3A82j8OlKFN8/s3EGSbVRexJ10lYyCFaVb3RuN9Is=; b=NLghEedr8qJ5jBB/3yz0J0LyrXjBNejhUIe/QywqKf24n7aMoR6TAaNDP5Up8m1cMl P1Yrc29pI6xSK0rYJXFzqaF2fSsTTet9xKuvN5t/vEtov3+UHg9hMiSj8Z+vxi6H+T5o ZfOXCv3cFQFk1et4/isH82+u5hey6xCbda5pLL5QQu6OkN377YrSQgx+HXQoYs3bPuG2 gdO7yTvwQvytzXcVLjNUiRpFj5n1NxyKIQOqGBzAJYGki87YK9+bJNiut/pUnxM+X/jh 5TZokSdrtATMwG2J0LlvIl6DC9UHg7r7jywSdqXmESOTynlqc/z1eZi7P1lNlLPDHTwH hd8A== X-Gm-Message-State: ACrzQf2KeApwnVNDWPzK06bVgMx4nvwtb9yzZRXwHzZGKvey9FBEXcio GWPZ8H/Y7CoakZAt04bRZv4= X-Received: by 2002:a05:6512:681:b0:489:d509:e076 with SMTP id t1-20020a056512068100b00489d509e076mr7399577lfe.618.1666358309446; Fri, 21 Oct 2022 06:18:29 -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 f5-20020a2e9e85000000b0026dfdcbccdasm3400209ljk.14.2022.10.21.06.18.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Oct 2022 06:18:28 -0700 (PDT) Date: Fri, 21 Oct 2022 16:18:23 +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 2/4] gpu: drm: sii902x: Use devm_regulator_bulk_get_enable() Message-ID: <1ed8351c2cb4911fcda21b97f7a7b089e955c301.1666357434.git.mazziesaccount@gmail.com> 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?1747304194595149394?= X-GMAIL-MSGID: =?utf-8?q?1747304194595149394?= Simplify using devm_regulator_bulk_get_enable() Signed-off-by: Matti Vaittinen Reviewed-by: Robert Foss Acked-by: Robert Foss --- v3 => v4: - split to own patch. - return directly the value returned by the dev_err_probe() Please note - this is only compile-tested due to the lack of HW. Careful review and testing is _highly_ appreciated --- drivers/gpu/drm/bridge/sii902x.c | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/drivers/gpu/drm/bridge/sii902x.c b/drivers/gpu/drm/bridge/sii902x.c index 878fb7d3732b..f6e8b401069b 100644 --- a/drivers/gpu/drm/bridge/sii902x.c +++ b/drivers/gpu/drm/bridge/sii902x.c @@ -171,7 +171,6 @@ struct sii902x { struct drm_connector connector; struct gpio_desc *reset_gpio; struct i2c_mux_core *i2cmux; - struct regulator_bulk_data supplies[2]; bool sink_is_hdmi; /* * Mutex protects audio and video functions from interfering @@ -1072,6 +1071,7 @@ static int sii902x_probe(struct i2c_client *client, struct device *dev = &client->dev; struct device_node *endpoint; struct sii902x *sii902x; + static const char * const supplies[] = {"iovcc", "cvcc12"}; int ret; ret = i2c_check_functionality(client->adapter, @@ -1122,27 +1122,11 @@ static int sii902x_probe(struct i2c_client *client, mutex_init(&sii902x->mutex); - sii902x->supplies[0].supply = "iovcc"; - sii902x->supplies[1].supply = "cvcc12"; - ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(sii902x->supplies), - sii902x->supplies); + ret = devm_regulator_bulk_get_enable(dev, ARRAY_SIZE(supplies), supplies); if (ret < 0) - return ret; - - ret = regulator_bulk_enable(ARRAY_SIZE(sii902x->supplies), - sii902x->supplies); - if (ret < 0) { - dev_err_probe(dev, ret, "Failed to enable supplies"); - return ret; - } + return dev_err_probe(dev, ret, "Failed to enable supplies"); - ret = sii902x_init(sii902x); - if (ret < 0) { - regulator_bulk_disable(ARRAY_SIZE(sii902x->supplies), - sii902x->supplies); - } - - return ret; + return sii902x_init(sii902x); } static void sii902x_remove(struct i2c_client *client) @@ -1152,8 +1136,6 @@ static void sii902x_remove(struct i2c_client *client) i2c_mux_del_adapters(sii902x->i2cmux); drm_bridge_remove(&sii902x->bridge); - regulator_bulk_disable(ARRAY_SIZE(sii902x->supplies), - sii902x->supplies); } static const struct of_device_id sii902x_dt_ids[] = { 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) From patchwork Fri Oct 21 13:19:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matti Vaittinen X-Patchwork-Id: 6712 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp698234wrr; Fri, 21 Oct 2022 06:29:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6BMVQfeRypfTvJ2zSaow6KmADzIqyUnRyRU89YaMU23bNdS6R2oNaZcZ4pfgU0qPQ4bDi5 X-Received: by 2002:a17:90b:4f84:b0:20d:be54:f353 with SMTP id qe4-20020a17090b4f8400b0020dbe54f353mr43938023pjb.140.1666358947130; Fri, 21 Oct 2022 06:29:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666358947; cv=none; d=google.com; s=arc-20160816; b=AqOwtfNcDXlnZf14M3G3XPFUt12SJegud9hvOSt8XvIdPRP+zgJEKVpSn16f5o8eLd 6IRmVk5ypFBDSi/IZNi1yHvBlxJiYkQibJ+vhHUEBWK2uv6UI3cofHcDf0RlT8H6aDmR /ZE0tjF1onxoaHVCQi15z2bQ93hUC7ES05BK1utKudgenhSG5QYAbKPpbJ0kegS7bSeT y6aBo78m63qZWyhrP/ZUGBNJDKt8TBWYI9YkqPkvWTkU0MtH0igCkMn9AZ12pKXqP9SH wYM6anuKWAebkN+8bjJ+Y7PDCVRo9XhO2pLTPvr7ylvolCUxmm/Y4Y51jzi8AMGP6vz9 KY2A== 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=kSylMpx0YFsO31Hjkjkcjn2msnx+oITUaLGfh+0vVIE=; b=Shh66aybUPQDwpccIjUILRcnZt8nneTH8RygaO4tZv33yzWzyYs0M6SuEAankRALdi 7mSUoRW92EdcF2Xxz2PXd+FjooM2K91qdWrbAPoywIAqz4mKsdlEZOgcBrFTJl3ZcGha cOHReaChF4Tgb3WU0zYKRwzcPU4WTTqKvUwFcpTVWyDPGZhqShq1DeaRxnCohAQ6TsPT oeMI8p0fijWANxju2ZfKC0yMGwQ0CY4vut3WG3cj3SUq5vahR2uUmyaacXMZ/k8g0u9K T3S2b0n9qKu70a4QzJra+7l7f3EjwHoBjWqrdvEtDCD48IxXaSaov9Spdqpud7PiIRdT Diew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=pCPCyBdc; 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 e70-20020a636949000000b0043ce3d849fasi25925358pgc.663.2022.10.21.06.28.51; Fri, 21 Oct 2022 06:29:07 -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=pCPCyBdc; 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 S230394AbiJUNT2 (ORCPT + 99 others); Fri, 21 Oct 2022 09:19:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231173AbiJUNTO (ORCPT ); Fri, 21 Oct 2022 09:19:14 -0400 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0A6C5C9C3; Fri, 21 Oct 2022 06:19:12 -0700 (PDT) Received: by mail-lf1-x134.google.com with SMTP id f37so5022230lfv.8; Fri, 21 Oct 2022 06:19:12 -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=kSylMpx0YFsO31Hjkjkcjn2msnx+oITUaLGfh+0vVIE=; b=pCPCyBdcW1Dxce4rSpZGxMbdmm3k4A8+8OJ+rBpD3sbTSRkrm98zqrhlvRnQWFeiPg MvE5i8PbKLTNGMCyql6GsXQQQ4AR2ycbx55uOON8fjLAXKw1N1IBmzFeQxB0fFF0QTvZ sCGFD9eb/7U66Fpi96reXKRp56nrV4AmnyftOqBEv2yi3p1CsRspKkhJVvp6/3qJ1su6 pkHlAUz4/0AKk43eHoddYd1qtd+kWkhCaZublMPgaLlXzl7DWblkEvA7QSZTmVRiU630 2QBEo8/zjdrjSYeh4Rw9zactbfWk8r4o2nbgHhwqzAUkO1V/qtgpjOR8LbtCfaPN8YmA /Xtw== 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=kSylMpx0YFsO31Hjkjkcjn2msnx+oITUaLGfh+0vVIE=; b=IcTlfFt/B9gO994TEG10yP1jztBiFsAYwCQCoGZPJiYM2IVnYh3Z1ff38NBySwdrRG UD5RYZ3BJJmnnBMauXjHG7Kl39YnLdh160j7fwOcl/NJGWyuDZ4p/J6TlzTcQ2KaUP4N 3qlVtOBZ+Dj0h3+Co0CypKphHyOTDPsVlUHjkJe/aumcgJnDKuNIQMm3RnExkyi5KH2V n6+ADhHBOKI/v3/dfumtc/ji+d93Y7fgD1mLdtdfhwuyG8OXvxqHrHLNrqnOV1bgnFOY 6Kj9jRsL9kDlbLjRqcJVJKU+6GqnXHXiAZ0gRZIgjY7hsrrte9wb6TxjBzrv/xENWlPV PCRQ== X-Gm-Message-State: ACrzQf01QhQOGzTPhRXkAy5NO/nQmPIK/KmR0ITwaORGEUtTPITNqFYf x/hn8cQrYxcAYx6bgAxVT4g= X-Received: by 2002:a05:6512:1681:b0:4a2:1925:e3ff with SMTP id bu1-20020a056512168100b004a21925e3ffmr7580907lfb.517.1666358350758; Fri, 21 Oct 2022 06:19:10 -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 t28-20020a05651c205c00b0026e02eb613csm3398419ljo.18.2022.10.21.06.19.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Oct 2022 06:19:09 -0700 (PDT) Date: Fri, 21 Oct 2022 16:19:04 +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 4/4] hwmon: adm1177: simplify using devm_regulator_get_enable() Message-ID: <7773541795f280db31dd981ffc21df8a630b794a.1666357434.git.mazziesaccount@gmail.com> 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?1747303999318031792?= X-GMAIL-MSGID: =?utf-8?q?1747303999318031792?= Drop open-coded pattern: 'devm_regulator_get(), regulator_enable(), add_action_or_reset(regulator_disable)' and use the devm_regulator_get_enable() and drop the pointer to the regulator. This simplifies code and makes it less tempting to add manual control for the regulator which is also controlled by devm. Signed-off-by: Matti Vaittinen Acked-by: Guenter Roeck --- v2 => v3: New patch --- drivers/hwmon/adm1177.c | 27 +++------------------------ 1 file changed, 3 insertions(+), 24 deletions(-) diff --git a/drivers/hwmon/adm1177.c b/drivers/hwmon/adm1177.c index 0c5dbc5e33b4..be17a26a84f1 100644 --- a/drivers/hwmon/adm1177.c +++ b/drivers/hwmon/adm1177.c @@ -26,14 +26,12 @@ /** * struct adm1177_state - driver instance specific data * @client: pointer to i2c client - * @reg: regulator info for the power supply of the device * @r_sense_uohm: current sense resistor value * @alert_threshold_ua: current limit for shutdown * @vrange_high: internal voltage divider */ struct adm1177_state { struct i2c_client *client; - struct regulator *reg; u32 r_sense_uohm; u32 alert_threshold_ua; bool vrange_high; @@ -189,13 +187,6 @@ static const struct hwmon_chip_info adm1177_chip_info = { .info = adm1177_info, }; -static void adm1177_remove(void *data) -{ - struct adm1177_state *st = data; - - regulator_disable(st->reg); -} - static int adm1177_probe(struct i2c_client *client) { struct device *dev = &client->dev; @@ -210,21 +201,9 @@ static int adm1177_probe(struct i2c_client *client) st->client = client; - st->reg = devm_regulator_get_optional(&client->dev, "vref"); - if (IS_ERR(st->reg)) { - if (PTR_ERR(st->reg) == -EPROBE_DEFER) - return -EPROBE_DEFER; - - st->reg = NULL; - } else { - ret = regulator_enable(st->reg); - if (ret) - return ret; - ret = devm_add_action_or_reset(&client->dev, adm1177_remove, - st); - if (ret) - return ret; - } + ret = devm_regulator_get_enable_optional(&client->dev, "vref"); + if (ret == -EPROBE_DEFER) + return -EPROBE_DEFER; if (device_property_read_u32(dev, "shunt-resistor-micro-ohms", &st->r_sense_uohm))