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 54582CD1292 for ; Thu, 4 Apr 2024 07:15:12 +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=9jMP0lYFbkAqx6qGU414+ACBBZrPnYGP2nx9Ed8XXvM=; b=sngWlEF76Zc6qo HkgL4gr9mVZABduwSDrsPVJpLIO3BQInM8MwBxYAaTZx4yxV1Qllorzai16AeCRAv5bB31DV+6gJf nlXmKvaWx9xnsUdIL3E4vFIAcPneXLRjxpt1jFiqruZaP7hyIaJHAz3KOkS2NewqfOWOYaY9Z0PN4 MeeWTHxMrlCxbPefeBi6UBwS0LrMxvPJ1ncqvTnQ9MQZ2+09No2uvnwz8t7PTXMyJEQW4KAYBwUAq VnvSgWGW2n35BCiNJfH0bJLkgjDNUpIbPWuDZKDWV70SsBbZBGMgT1txmo6m505qfBZhAI0U7oF4j Jjmsh71ne0LaQmibzv9w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rsHJK-00000001axk-4BsY; Thu, 04 Apr 2024 07:14:59 +0000 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rsHJG-00000001awn-3oTv for linux-arm-kernel@lists.infradead.org; Thu, 04 Apr 2024 07:14:56 +0000 Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-6e6ca2ac094so655371b3a.0 for ; Thu, 04 Apr 2024 00:14:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712214891; x=1712819691; 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=gPsiPELCBmPe+inzzwVVOC2M0IyyDSE04BMeZYanz5U=; b=DQkDhARUtLx7oxQmYKY9/Xcv0XMu9EPznSeRp+G2ud2lA8WYI0iAAJtkI0xtDD3rWw TInPfXT8Co1gX+EI2cdsPQjz6CxJXLXk4vQHn6KvlpVU6pPJ3QNRsO8aMeEEPS5GvaKG QOCUgi8t7gG1PSdwhA0pl6YPtcP9JD5QS6qJC2Dm5MmXxrfJ8pzAd+FReHJmQNvisJxI t2pCcAyNczlaCYH5Lbe6SbhRnITqpVCY+1M1o5Y4/beEThVYPx3RZnCwjAXSumHLSp/J SiwbmisyruKw248/E5RFpTG18CMSvTW0PjOv8bOoNwee7gO/s23RhrEfw398a1rV6GuV rklw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712214891; x=1712819691; 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=gPsiPELCBmPe+inzzwVVOC2M0IyyDSE04BMeZYanz5U=; b=prdfCDxW0tfaFbWjD1VbWcQAZKfepoOW6yvl7oUxISZUrk8mHUNkMQ19u0pBRn06GW EkPXxqNUKyvLEPSdB/W6BXSMObiQooJMFYs0CK0BykALeNiZ50MBPuNFO9D5Zgtow7I9 zJ3eB0/9768vsFkHcjlwCP4fXPNf6/o5VQkdcb4FhgMpJlNwli8cvcl/38htvyTWJ7i2 nNkesruS/1edtjis5fJYLBwEB9gRiWDqF8MFjvjt6tjWi/UnvGDVI1R7OF/PtxJn6cv8 XyI6JSJya6/T7VjL9jKva7SY7vp+E43WkivGXlzAozIn87/JYmhIPdkSbK4GT/Zzexu6 gfUw== X-Forwarded-Encrypted: i=1; AJvYcCUs0+mvcbDb9SV9IXXWz5VagngsGFWPutuvitfnlu/BJQsnmjCT399QpprtnAuc7HC1EGMc/Qcnerhkgt+nSUmSerqr9FLtS2PQE5pMnjdV3EIzV/U= X-Gm-Message-State: AOJu0YycDU4lSJRhTAMiRRClpUscU7zLh2jXurxEKE8dR8nibV59moou t/LKqinOhf6rCnhSFd2LNBhDmhXKYYac6l5/fZOluiZJKrMec41H X-Google-Smtp-Source: AGHT+IEOUU0nmmBZv0QGpPzeOsGA0kvWFTC8435Koof082b4jzgNWQOx1hwsm6KroWSjntyQkUqNXg== X-Received: by 2002:a05:6a20:8407:b0:1a3:4863:f70e with SMTP id c7-20020a056a20840700b001a34863f70emr1909375pzd.46.1712214891652; Thu, 04 Apr 2024 00:14:51 -0700 (PDT) Received: from localhost.localdomain ([113.30.217.222]) by smtp.gmail.com with ESMTPSA id h20-20020a170902f2d400b001e26c4823d0sm5220873plc.52.2024.04.04.00.14.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 00:14:51 -0700 (PDT) From: Anand Moon To: Alan Stern , 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 1/6] usb: ehci-exynos: Use devm_clk_get_enabled() helpers Date: Thu, 4 Apr 2024 12:43:17 +0530 Message-ID: <20240404071350.4242-2-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_001455_145849_96613333 X-CRM114-Status: GOOD ( 17.31 ) 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(). While at it, use dev_err_probe consistently, and use its return value to return the error code. Signed-off-by: Anand Moon --- 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 | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/drivers/usb/host/ehci-exynos.c b/drivers/usb/host/ehci-exynos.c index f644b131cc0b..f00bfd0b13dc 100644 --- a/drivers/usb/host/ehci-exynos.c +++ b/drivers/usb/host/ehci-exynos.c @@ -159,20 +159,15 @@ static int exynos_ehci_probe(struct platform_device *pdev) err = exynos_ehci_get_phy(&pdev->dev, exynos_ehci); if (err) - goto fail_clk; - - exynos_ehci->clk = devm_clk_get(&pdev->dev, "usbhost"); + goto fail_io; + 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; + usb_put_hcd(hcd); + return dev_err_probe(&pdev->dev, PTR_ERR(exynos_ehci->clk), + "Failed to get usbhost clock\n"); } - 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 +218,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 +233,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