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 12E28C4345F for ; Fri, 12 Apr 2024 14:23:57 +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=xVyKwThkDYGJHujchE3hFEbjTehuYLeUTYviRT4ejDQ=; b=dtiCKX4bilTYeu PhFocwKrgPl8Y5K80vvX0I3gDkrBLiPvUN69/crMBrv45bNcoQqEzlMDc0oghsV9x3sYaMHoHq1PU 1Vr+abMuGd6JYjkujtuZAkXTeGzEiy7ACOD++zsOFfSn2Fo8SwxfO0hx0AR4aRt+L/JOS5Wr9jfg3 GqyKEp88jsA8dxnNY79hCuGBsJSx58Wm8SLXLCHesWSDdVFC6fnW4I0VdS76Le26iEVLYhwyPO7DI s74EL+0pmyF9yf60MXWTP/6haD1zlGG1LWrEDlx7a+NiNNkqlJ+pEUKuJnbrkw+zLskvsAgwscV3y dU0ODqLMvrDRQvkklJPg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rvHog-0000000HXlD-0syS; Fri, 12 Apr 2024 14:23:46 +0000 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rvHod-0000000HXjL-2VHA for linux-arm-kernel@lists.infradead.org; Fri, 12 Apr 2024 14:23:44 +0000 Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-6e782e955adso946332b3a.3 for ; Fri, 12 Apr 2024 07:23:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712931821; x=1713536621; 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=YbcIWXIZQhqjePjNygTPT5SO2Zgomq/T2Ylg5jMiQ34=; b=UBICzAsCOcQALOZpu8gJVZ9E02DgQ7laJD7/5OwitwWnyWfEm57B1ZZ7MkHgdRuQb0 I0rTwRwXjPms+/qOFL4P1FYnE9Jc6mfy56oqiQ2YhKEr08dRK6VwuXcFWd4tO6dXWNP7 39LYG5X34+Kvp4vnq00o0p1ngAaGU0/2uwzOsS8/bDhhqUrE8nbRAM1KS1Cb23Ye9Boq cQ2jV83OSXciES2sLnRExPUnIvKmc+KD/jxaII09nvc/NUUo8xXvJd2edr9FIX+DrP9y tUIBAwQXRXsGr1zF7YJYMZLdEhYDhSfSj7LU65jjeXqwARf5zDLQklfGBpoOD0n3Nmie t5XQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712931821; x=1713536621; 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=YbcIWXIZQhqjePjNygTPT5SO2Zgomq/T2Ylg5jMiQ34=; b=gC+bwVPnQYoNjKs4+teoX7de2y2j4X3guQJ0h/V0eMCHaKEOhRFs7J64WT6sF0Xb/i tlTHeELgQa5nN9cgqmP0gxuMEQMfNhdtZIlEwFi+jwWCSTfqvGz5kEIjZql24KAEdAbE jQRQ3D0Qnk0JmgelDpHJHu82n+WkJlPVvgyNc+f04NopIP9+nqUv/9g6OCzQVmM8Oxl/ QLxIXn1hnnuyZZGPRF+RwQ27YwN9a2JAcznrSqJdRFwPaeJjAIIs1f+VzydNE6tzGtUU 8vBTQRQMcyb+/tbjjUCLllZxe+BPben1wLKdQ7n3QiI3vIJ8iS1LidvNZi4tPeeOKqWd VQBQ== X-Forwarded-Encrypted: i=1; AJvYcCXpah69pCohThVuJn0zBgMrBvj6MH6HU6q3X2i5jA3o6JaQf24c2T8T7kQ7eJtUzThDRQjlUJDhmJig+Gxfi3K7aXoq7RxKIw+TdAJVHIiaR8tAP9Q= X-Gm-Message-State: AOJu0YyTJA0XgNj9YjyOZOSCLblELG/+55nc275SrRjaig9tF+oRFBkn wyAztQDLe3ZwAQIRfleprkp8eDm1+j0szNaOiMfV7hELALsX22of X-Google-Smtp-Source: AGHT+IEIWwkiKFZ0hzuBzAJRk9Ofk9JFitFBkWwieWH2JxFuFxdmYqQ6OtOWlIDk1o1/OEoLCXoo5Q== X-Received: by 2002:a05:6a21:99b:b0:1a7:6894:cec3 with SMTP id li27-20020a056a21099b00b001a76894cec3mr2899249pzb.32.1712931820933; Fri, 12 Apr 2024 07:23:40 -0700 (PDT) Received: from localhost.localdomain ([113.30.217.222]) by smtp.gmail.com with ESMTPSA id n43-20020a056a000d6b00b006e5af565b1dsm2946952pfv.201.2024.04.12.07.23.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 07:23:40 -0700 (PDT) From: Anand Moon To: Alan Stern , Greg Kroah-Hartman , Krzysztof Kozlowski , Alim Akhtar Cc: Anand Moon , Christophe JAILLET , Johan Hovold , Thinh Nguyen , linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 1/5] usb: ehci-exynos: Use devm_clk_get_enabled() helpers Date: Fri, 12 Apr 2024 19:52:50 +0530 Message-ID: <20240412142317.5191-2-linux.amoon@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240412142317.5191-1-linux.amoon@gmail.com> References: <20240412142317.5191-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-20240412_072343_656725_D289313C X-CRM114-Status: GOOD ( 17.79 ) 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 The devm_clk_get_enabled() helpers: - call devm_clk_get() - call clk_prepare_enable() and register what is needed in order to call clk_disable_unprepare() when needed, as a managed resource. This simplifies the code and avoids the calls to clk_disable_unprepare(). Signed-off-by: Anand Moon --- v3: drop dev_err_probe to simplify the error handle. v2: drop the clk_disable_unprepare in suspend/resume functions fix the usb_put_hcd return before the devm_clk_get_enabled --- drivers/usb/host/ehci-exynos.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/drivers/usb/host/ehci-exynos.c b/drivers/usb/host/ehci-exynos.c index f644b131cc0b..e2303757bc0f 100644 --- a/drivers/usb/host/ehci-exynos.c +++ b/drivers/usb/host/ehci-exynos.c @@ -159,20 +159,16 @@ static int exynos_ehci_probe(struct platform_device *pdev) err = exynos_ehci_get_phy(&pdev->dev, exynos_ehci); if (err) - goto fail_clk; + goto fail_io; - exynos_ehci->clk = devm_clk_get(&pdev->dev, "usbhost"); + exynos_ehci->clk = devm_clk_get_enabled(&pdev->dev, "usbhost"); if (IS_ERR(exynos_ehci->clk)) { dev_err(&pdev->dev, "Failed to get usbhost clock\n"); err = PTR_ERR(exynos_ehci->clk); - goto fail_clk; + goto fail_io; } - err = clk_prepare_enable(exynos_ehci->clk); - if (err) - goto fail_clk; - hcd->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res); if (IS_ERR(hcd->regs)) { err = PTR_ERR(hcd->regs); @@ -223,8 +219,6 @@ static int exynos_ehci_probe(struct platform_device *pdev) exynos_ehci_phy_disable(&pdev->dev); pdev->dev.of_node = exynos_ehci->of_node; fail_io: - clk_disable_unprepare(exynos_ehci->clk); -fail_clk: usb_put_hcd(hcd); return err; } @@ -240,8 +234,6 @@ static void exynos_ehci_remove(struct platform_device *pdev) exynos_ehci_phy_disable(&pdev->dev); - clk_disable_unprepare(exynos_ehci->clk); - usb_put_hcd(hcd); } -- 2.44.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel