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[] = {