Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp937816lqg; Sat, 2 Mar 2024 07:50:39 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVz2FqoLH2a3iWvzRPoI+f9gVlbKcxnjdVYDwHamllQVaGv+tb7woqQq1G8n6ac3qc/4+aBLOf5hjAq8SFBVvEn5cJgYYeF0OhcCgeJgg== X-Google-Smtp-Source: AGHT+IGpeLRNyl5i+GWYdOJV8JA7MP5Iy+zjpgdwxpELdefyIhutMUN10Xr5AOCDCZUs9KvOXYQu X-Received: by 2002:aa7:d597:0:b0:566:76e4:bafd with SMTP id r23-20020aa7d597000000b0056676e4bafdmr3556305edq.39.1709394638803; Sat, 02 Mar 2024 07:50:38 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709394638; cv=pass; d=google.com; s=arc-20160816; b=RAUbjgFIdnXxtsclrGriUOug9wJgm7n3I29LBd+XoliMxeWJ3MObP851j5K4VAePEX kqqDv1kRo7gF49Wm99Ud2vbkA4a0ECaxhmkCzEANnQHxxFksWinj6c0wnxtxRbMGufH3 smYBcx9DQ3N7MDNa6WGjwZcXMbwsdNMg3UeHCAfCb7ekn6cQVW31NES/qOzBKcinqU+Y Oo7TMXHlNemAcRGaNRRLB5AtEPv787NQ4eWOM2H550HoC6pStfGKrTf8mSlLIUMESo0j VO8cUn8+XdL9XZ/Qkgpf78rMb45qemIBxpTuSyOAv2ChxSFZTxEZwM+QkrOmyg3U5Vjv nXgw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=Qv/ssscVV7fGs0JMzWV8vaTZi3w3mSOL334YpDMghuU=; fh=CGLxkxMfEVuOTWZkG+B0abA9mg3ducmYZZ5GjrZHHT8=; b=HvxEj1l2xp6nBWMTNq/jrNi9S5GDmtNonDTuvBFjdY0DczsFJ7eixDYMGtMc4cBHTW aOI9uZ8T95xxHGtauFVW4mVkif7m5nhuVErOnzz4sZxDzV0HTHIUzuFDKgbKsTcV9CUQ 1UJcmW7Gf9eXdm0JyB5HdcNhLie0fUt/in4//UTuDXle1CTb/IrlDdGPN6iYP9p5ST1g 9Ek+1Wyo4Dq3nhHEyxG8mpXDYJXKLSUBtOc+n5qwDnnKS8Q2sCcOlfw3EcZdRxnHyCu0 6BopgxfkAHi8Gjt+KMnRdcphOcdGkYRgclu0cH9adxMjeH5IEEukeHPhCskkwTordyiH fh8g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=M5Qh4XVd; arc=pass (i=1 spf=pass spfdomain=wanadoo.fr dkim=pass dkdomain=wanadoo.fr dmarc=pass fromdomain=wanadoo.fr); spf=pass (google.com: domain of linux-kernel+bounces-89486-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-89486-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=wanadoo.fr Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id g18-20020a0564021ed200b00563d423605esi2581970edg.276.2024.03.02.07.50.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Mar 2024 07:50:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-89486-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=M5Qh4XVd; arc=pass (i=1 spf=pass spfdomain=wanadoo.fr dkim=pass dkdomain=wanadoo.fr dmarc=pass fromdomain=wanadoo.fr); spf=pass (google.com: domain of linux-kernel+bounces-89486-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-89486-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=wanadoo.fr Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 5B8F71F21749 for ; Sat, 2 Mar 2024 15:50:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 32B3B18E37; Sat, 2 Mar 2024 15:50:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b="M5Qh4XVd" Received: from smtp.smtpout.orange.fr (smtp-30.smtpout.orange.fr [80.12.242.30]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 771E518657 for ; Sat, 2 Mar 2024 15:50:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.12.242.30 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709394631; cv=none; b=deReMYnJBFSssXkZrMHBf5bftVAsQxVzMsfjPAF/HFtzsbg0k+gRV+vYRhV/tpfdTu278mnjovzeaibEJi5Z07Cm8oC+73HBc6fJKUtjmdQGkUor09FB1gy4BXEFnTHpkgovPjICXExcA6aeMab236x+436DNtOuGnY1WcbS1ns= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709394631; c=relaxed/simple; bh=mN2LAc9j8pitp4/pP5rakUYeQUXvQd/UY0ksJb5F/AY=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=pJkem1w21m3sLGtE46aRiwaNmCt9MHv8BCTH+WtzQgSct7TSwZxcGKGOM/fg+m7tn4PE1X4Mklv33qMSc6dTdrjqj03is79uMSb9F7M6RSxNCE8ZhQBh7/aoKTtxk9eI0gEH17G3DfBhrPAfq6fhRWG41lCFRrOIMGobiFa1NV8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wanadoo.fr; spf=pass smtp.mailfrom=wanadoo.fr; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b=M5Qh4XVd; arc=none smtp.client-ip=80.12.242.30 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wanadoo.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wanadoo.fr Received: from [192.168.1.18] ([92.140.202.140]) by smtp.orange.fr with ESMTPA id gRbkrY9aBQ6QsgRd4rNOK9; Sat, 02 Mar 2024 16:50:27 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1709394627; bh=Qv/ssscVV7fGs0JMzWV8vaTZi3w3mSOL334YpDMghuU=; h=Date:Subject:To:Cc:References:From:In-Reply-To; b=M5Qh4XVdS6CPVQ81wW+vqU6fBYIuJCy8mfyGplrusU67MKNuulUnmada7l0zc574r xvDL/a5djesp7qHh6m3Khpe0DA1+qArKAQrROkYAY+8IwnDRM9sg6HwUAvtnG4W4nz 3a9UftEkSeZbjVo0abo+ByJDl/+JcYoqMwNSaHAJwSb47dbcPVAW2CJTtidonOWjtW wRbWYlH8dliC/a+3hXdLGmLpbbRb/RXZqa/ixorXOuZz7GWC4HoeOjRb7hNWeYGtrQ QIDKmL0Ri1Dgk4eCl3o5Xvf5DyQXOY47I5XmDtheOlbAJrm4NtdS3SYV+vf2ULFNXV zrXr+L+f4Ff4g== X-ME-Helo: [192.168.1.18] X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sat, 02 Mar 2024 16:50:27 +0100 X-ME-IP: 92.140.202.140 Message-ID: <52158bf6-16fe-4ce2-b9b6-bbc6550a6e14@wanadoo.fr> Date: Sat, 2 Mar 2024 16:50:26 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1 3/4] usb: dwc3: exynos: Use devm_regulator_bulk_get_enable() helper function Content-Language: en-MW To: Anand Moon , Thinh Nguyen , Greg Kroah-Hartman , Krzysztof Kozlowski , Alim Akhtar Cc: linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org References: <20240301193831.3346-1-linux.amoon@gmail.com> <20240301193831.3346-4-linux.amoon@gmail.com> From: Christophe JAILLET In-Reply-To: <20240301193831.3346-4-linux.amoon@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Le 01/03/2024 à 20:38, Anand Moon a écrit : > Use devm_regulator_bulk_get_enable() instead of open coded > 'devm_regulator_get(), regulator_enable(), regulator_disable(). > > Signed-off-by: Anand Moon > --- > drivers/usb/dwc3/dwc3-exynos.c | 49 +++------------------------------- > 1 file changed, 4 insertions(+), 45 deletions(-) > > diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-exynos.c > index 5d365ca51771..7c77f3c69825 100644 > --- a/drivers/usb/dwc3/dwc3-exynos.c > +++ b/drivers/usb/dwc3/dwc3-exynos.c > @@ -32,9 +32,6 @@ struct dwc3_exynos { > struct clk *clks[DWC3_EXYNOS_MAX_CLOCKS]; > int num_clks; > int suspend_clk_idx; > - > - struct regulator *vdd33; > - struct regulator *vdd10; > }; > > static int dwc3_exynos_probe(struct platform_device *pdev) > @@ -44,6 +41,7 @@ static int dwc3_exynos_probe(struct platform_device *pdev) > struct device_node *node = dev->of_node; > const struct dwc3_exynos_driverdata *driver_data; > int i, ret; > + static const char * const regulators[] = { "vdd33", "vdd10" }; > > exynos = devm_kzalloc(dev, sizeof(*exynos), GFP_KERNEL); > if (!exynos) > @@ -78,27 +76,9 @@ static int dwc3_exynos_probe(struct platform_device *pdev) > if (exynos->suspend_clk_idx >= 0) > clk_prepare_enable(exynos->clks[exynos->suspend_clk_idx]); > > - exynos->vdd33 = devm_regulator_get(dev, "vdd33"); > - if (IS_ERR(exynos->vdd33)) { > - ret = PTR_ERR(exynos->vdd33); > - goto vdd33_err; > - } > - ret = regulator_enable(exynos->vdd33); > - if (ret) { > - dev_err(dev, "Failed to enable VDD33 supply\n"); > - goto vdd33_err; > - } > - > - exynos->vdd10 = devm_regulator_get(dev, "vdd10"); > - if (IS_ERR(exynos->vdd10)) { > - ret = PTR_ERR(exynos->vdd10); > - goto vdd10_err; > - } > - ret = regulator_enable(exynos->vdd10); > - if (ret) { > - dev_err(dev, "Failed to enable VDD10 supply\n"); > - goto vdd10_err; > - } > + ret = devm_regulator_bulk_get_enable(dev, ARRAY_SIZE(regulators), regulators); > + if (ret) > + return dev_err_probe(dev, ret, "Failed to enable regulators\n"); > > if (node) { > ret = of_platform_populate(node, NULL, NULL, dev); > @@ -115,10 +95,6 @@ static int dwc3_exynos_probe(struct platform_device *pdev) > return 0; > > populate_err: > - regulator_disable(exynos->vdd10); > -vdd10_err: > - regulator_disable(exynos->vdd33); > -vdd33_err: > for (i = exynos->num_clks - 1; i >= 0; i--) > clk_disable_unprepare(exynos->clks[i]); > > @@ -140,9 +116,6 @@ static void dwc3_exynos_remove(struct platform_device *pdev) > > if (exynos->suspend_clk_idx >= 0) > clk_disable_unprepare(exynos->clks[exynos->suspend_clk_idx]); > - > - regulator_disable(exynos->vdd33); > - regulator_disable(exynos->vdd10); > } > > static const struct dwc3_exynos_driverdata exynos5250_drvdata = { > @@ -196,9 +169,6 @@ static int dwc3_exynos_suspend(struct device *dev) > for (i = exynos->num_clks - 1; i >= 0; i--) > clk_disable_unprepare(exynos->clks[i]); > > - regulator_disable(exynos->vdd33); > - regulator_disable(exynos->vdd10); Hi, Same here, I don't think that removing regulator_[en|dis]able from the suspend and resume function is correct. The goal is to stop some hardware when the system is suspended, in order to save some power. Why did you removed it? CJ > - > return 0; > } > > @@ -207,17 +177,6 @@ static int dwc3_exynos_resume(struct device *dev) > struct dwc3_exynos *exynos = dev_get_drvdata(dev); > int i, ret; > > - ret = regulator_enable(exynos->vdd33); > - if (ret) { > - dev_err(dev, "Failed to enable VDD33 supply\n"); > - return ret; > - } > - ret = regulator_enable(exynos->vdd10); > - if (ret) { > - dev_err(dev, "Failed to enable VDD10 supply\n"); > - return ret; > - } > - > for (i = 0; i < exynos->num_clks; i++) { > ret = clk_prepare_enable(exynos->clks[i]); > if (ret) {