From patchwork Fri Mar 1 19:38:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Moon X-Patchwork-Id: 13579055 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 88646C5475B for ; Fri, 1 Mar 2024 19:39:36 +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=DPv2hP76JksGZqSR7lAzvEG2VDVavSQoRScJYSh5bpw=; b=HDifQ2wOeriopx moU9CHINyutg5foeYVTkzMC1LiAY9rQACGXbKL5S7G7E+D9AlFcLS64ps8hJOY6PzBwkeZE2c5rvX cryJ73HqdrjRWdYLDc9VoSbKWmJXVqftN7/UPDF7HDcxj6CGzFaHs59jm93GcNmn2GMPZ+6k4FMX5 7p8QtkQyvG/pPZTFHbcMvYuT21Skc2SEWG5+RE3k92hjokvz3Luku9uKTBVKSoP4QbnfQf+j/5Dzd DGb5e1ahM5bDLHqDIAJhlJQDnLH5YWNm1MYhF3jVG2riT7xKeXM4RnlTLbtcm4y4TS6cPC5iHynN2 un1RYiEPCxdWL1omkDDA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rg8j9-00000001kv4-26SF; Fri, 01 Mar 2024 19:39:27 +0000 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rg8j5-00000001kt4-3pJM for linux-arm-kernel@lists.infradead.org; Fri, 01 Mar 2024 19:39:25 +0000 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-1dc49b00bdbso25590385ad.3 for ; Fri, 01 Mar 2024 11:39:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709321963; x=1709926763; 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=hb4CG876O8rufa4kt9vTuzRMAqAQvWAjs5KW+CbhAMc=; b=Ad4gzYV6bRhraVPNkobDiG8imJZGz7GozsWI4O+0FVLL/HE3eeiwVOJAsjylzj0eHo Vr/ITo3uw4/kQTlHad1G7h9ZFLplHZ4wQCxD08ni88Znpp8CUuZDmyacOLT0GyXx+v/m ASr2wtHapg28ljUouA0/MNDbSe0h66nDGMYIIrvMxEn6/kSPXOwbA4b/GVWm6TFvoeGm itjhar3/k9pPU9cMGzNasRPqjumrTdu1/J3NJZHRCeUpYES8rI2WT1jiKSKalKURTH4R kYiph2S57TYT9jiK41Fo02KlEKKf6hVq9EAmHluZjmh0/6pyAaXRnOUvs6/vA9dYp6rn jIeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709321963; x=1709926763; 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=hb4CG876O8rufa4kt9vTuzRMAqAQvWAjs5KW+CbhAMc=; b=mGLG2eS0tVry3+JEDl3Nuy9j/q/uUGIndahyHiUGGVVKSrAAOqorsEQsjcfwbzLsl7 WR+xL4SGCki708FE391OoyipFJgAHuBVhBIgN6YwOlKRasGrMR35o55+DzQdlXzr7VXB mQ83SAWrrxpln1RNZuD6EtY9gtpDMwE+CWleGJzKTIukTxfgsgnk0rBrAymq9m3+0MfH 5gzYDH+iIgrUV2zmDeIfNnG4Su0+oq3XxpPDYyzV6jRKrMmrdyYSAbwF9gjGEwicSuQP px9uad9ncWCZyGuhICED1PPa2KX6KzAHk0k/KnpCH/WkfXVPuRub16QWxMgaEsHcQQ4r qntA== X-Forwarded-Encrypted: i=1; AJvYcCW+M23PhS1bNFcraYrwnk94QTcCRkHu2dCcxVfLW7L7VHtg2vPA30OyVjiXNL3M5gsHPu5xBA0bCK2aplcWIE+7Rsl9Ae46Q4ODXwLtfo4aNY6BKzg= X-Gm-Message-State: AOJu0YzCLK7yYjq16Zl70WcUO5siBj0UZbJ5fJ15UwjxNG6qjwcE0raV +HDJfDQ3xuPBtNCy4q9sH8G3L/oDQf2YWuCm9WFk9q+bvpxfsNaa X-Google-Smtp-Source: AGHT+IFgEXL5OrEpNcLcirx6onnuU3qA5IyL4Z8we5SXd8dy1goPwzAgll7JmWsxp1BQjtJuaRYtbg== X-Received: by 2002:a17:902:ed82:b0:1dc:2f30:e0dc with SMTP id e2-20020a170902ed8200b001dc2f30e0dcmr2171759plj.36.1709321962783; Fri, 01 Mar 2024 11:39:22 -0800 (PST) Received: from localhost.localdomain ([113.30.217.222]) by smtp.gmail.com with ESMTPSA id u8-20020a170902e5c800b001dca6d1d572sm3837474plf.63.2024.03.01.11.39.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 11:39:22 -0800 (PST) From: Anand Moon To: Thinh Nguyen , Greg Kroah-Hartman , Krzysztof Kozlowski , Alim Akhtar Cc: Anand Moon , linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 3/4] usb: dwc3: exynos: Use devm_regulator_bulk_get_enable() helper function Date: Sat, 2 Mar 2024 01:08:10 +0530 Message-ID: <20240301193831.3346-4-linux.amoon@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240301193831.3346-1-linux.amoon@gmail.com> References: <20240301193831.3346-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-20240301_113923_979155_B33746E6 X-CRM114-Status: GOOD ( 17.36 ) 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: , 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 --- 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); - 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) {