From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 73A8BCD1284 for ; Thu, 4 Apr 2024 07:15:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=WgK4egLlRZo4FoDu79kYSdimC1RYJT2ky3QCrfVtE4M=; b=XhntqPhvLrnmPQ o0q/aIXmUpDvv1XmRhqNW8iZD56cpkXlqZZWfhAZuRYTc0ZTGSvSSG2Pa4ZvcxqskSfhPF6aeojwz BiW9Ba1Egx8Hn+DGz0a4kIl+BRnf5UDvPbBvozL1SkPaaeeuMX7QD9SRMDtW+BV1JUDRxEeq11Q9i 9AZmft+qoBzD/Ud9CEUasuvWlpXfGHawMvcYeM5puZzBipLdIjiobNA+p2Gtf1cw2nmX9g2PQi2wh xvIc/TVfl9RNnKt+TuMXhvtYOcylzp3THMa98XnB5i+NrGiq/ZoA1/iP4Z0O9uB/qU3cC805sl9Rr fJUKx0AhK1AKq2Djrr2A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rsHJn-00000001bDc-3OqD; Thu, 04 Apr 2024 07:15:27 +0000 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rsHJi-00000001b9U-0rI8 for linux-arm-kernel@lists.infradead.org; Thu, 04 Apr 2024 07:15:24 +0000 Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-1e2987e9d06so5465815ad.2 for ; Thu, 04 Apr 2024 00:15:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712214921; x=1712819721; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=J5f9n7odinT4RWqYkmTS+WDxKhbPNOevirl7nLpKZ3Q=; b=PBtdcUKKEqIlVZe2vNEXOwLet9OAfYD8megxJF0nyrvhUj+3H5Hv5z4ny0dFAzOIm4 lMhfOIcuz9njm3GAD8zLrQbGBzhSEfgM3FtWjWdRmiWHBtERiKREbH/MMmFfL7DG0Oq3 RQjhmY6btLUiai1L1nodk++Wh7t/rijEnNlsa55rc64/BRxvUnWmyVjn7cUSb1JQDsF7 eyqmo0BL8GhPFXueidOZwB/82W/hl+s5ylZpF5QRi9NLKuIoRcs/OsFYXE+8i7kvSce1 VtL5xyu/jvm4nlhQAiuCKHk2/pB3Qb/4CxNDwnLRwXwc1NKuAy1/3qUBh49zQWCS8hOE A2Qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712214921; x=1712819721; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=J5f9n7odinT4RWqYkmTS+WDxKhbPNOevirl7nLpKZ3Q=; b=ID6lZR6vCNl6h5lBWx7BPEaGHeGYDSmB6fJmcSHy/uPD3MG4gG/vCmL4MzlUFXnER/ efOWSWeipXZn52srWOCaCzsM8vkj7NcpDiWEed/VerAqiHotMoBsP+bVFMFa9Q4suxgw mXtlOvCa3pODVcEGnr76Il/TedT2WG+RiaJ5+0akH14hx9sH2ZafMEl/CV1zbesy3MDE mpA/cdz6HdGXsbcyAQhoLkO5vck0ST81/DP5jMj9aHYW0YyzSfh0ohfOvhTOQEmix3aA GCibNcpe0t4/YuJLoCzL/fXrKSUVml9BM3X8FgQrhlHVwdgHy43RbpjwlWOfT/rWkp7Q 3/Og== X-Forwarded-Encrypted: i=1; AJvYcCV+jo0jLbjz83qqAQPu77dc2m0FZz2pfYIt92/0MAM/aAd7fd9beCafN6LUpyAY5xShUdhRVzgimMYHUGYmhyBoUqdbA0B74LYsshMj/BFsw5CO5xw= X-Gm-Message-State: AOJu0YwToVh+fZwDDQ/a/vko4CfU3OOjh37dvhzGaCOSpltMsp9z/Z9/ wSkEOe8l+eW6sZAQcYhv9jLe7nYTuHK8uxv4lUseJ4MThyODz36KDMG+9gLG X-Google-Smtp-Source: AGHT+IHQ71BzPE2Jd50DpY5Uuexh9bB292p9+PnwiYCQnWyndjL0lunoEy0BKwsQ/jrKET916igh/Q== X-Received: by 2002:a17:902:db0e:b0:1e2:b1e6:4f69 with SMTP id m14-20020a170902db0e00b001e2b1e64f69mr518986plx.40.1712214921534; Thu, 04 Apr 2024 00:15:21 -0700 (PDT) Received: from localhost.localdomain ([113.30.217.222]) by smtp.gmail.com with ESMTPSA id h20-20020a170902f2d400b001e26c4823d0sm5220873plc.52.2024.04.04.00.15.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 00:15:21 -0700 (PDT) From: Anand Moon To: Thinh Nguyen , Greg Kroah-Hartman , Krzysztof Kozlowski , Alim Akhtar Cc: Anand Moon , Christophe JAILLET , Johan Hovold , linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 5/6] usb: dwc3: exynos: Use devm_regulator_bulk_get_enable() helper function Date: Thu, 4 Apr 2024 12:43:21 +0530 Message-ID: <20240404071350.4242-6-linux.amoon@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240404071350.4242-1-linux.amoon@gmail.com> References: <20240404071350.4242-1-linux.amoon@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240404_001522_427726_37869540 X-CRM114-Status: GOOD ( 18.07 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use devm_regulator_bulk_get_enable() instead of open coded 'devm_regulator_get(), regulator_enable(), regulator_disable(). Signed-off-by: Anand Moon --- V2: no changes, did not find any regression in pm suspend/resume. --- drivers/usb/dwc3/dwc3-exynos.c | 50 ++++------------------------------ 1 file changed, 5 insertions(+), 45 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-exynos.c index 5d365ca51771..2d341f0e22a3 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,10 @@ 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 +96,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 +117,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 +170,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); - return 0; } @@ -207,17 +178,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) { -- 2.44.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel