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 D64AEC4345F for ; Sun, 21 Apr 2024 13:48:44 +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=QBYoYxXKj7Ve05WOEoVe5c7bSo3O+uGpAl7aC6o+xqs=; b=ZCEV2MeRRPNQ4l SkINd3osIvEmOQDa/3rhj0cSuWa0SEmC66LRN+V3hiSCPCYftylunMuD6JMgLbJo/Eu5O7+RaKr7L P3P6IdUPm8VtsnXWqBtfU72rZz0vo0mTknR+nqs6NC0TUdRZ2BuvYPEZJtE3HtoOqrRc+yMeLhEk+ S2X+/Xwjap+7yKkABNRWHYtpDSjxUxidUHYLJrmVm7B6zeJ2SwnrZXCBXxOvu2Uf45xtcGWPwc54/ B+6PCmeABGWYQNsNGUoE4urxUvoy0DG9VIzCNXu/3XpCu9gDg+C/5E2dXv9LnUHStb0445dwxJz9b KYdhSAnYigvTgLi+Mo2Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1ryXYZ-0000000Aal4-29k1; Sun, 21 Apr 2024 13:48:35 +0000 Received: from mail-pg1-x52c.google.com ([2607:f8b0:4864:20::52c]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1ryXYW-0000000Aajd-3OCC for linux-arm-kernel@lists.infradead.org; Sun, 21 Apr 2024 13:48:34 +0000 Received: by mail-pg1-x52c.google.com with SMTP id 41be03b00d2f7-5d8b519e438so2773237a12.1 for ; Sun, 21 Apr 2024 06:48:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713707311; x=1714312111; 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=WcTvBG8QtewVblIlyVX39beMUKrTk6jsd2Uev9rHf/0=; b=gzaHoYe2yKp1A3Xo25L7MFTvcDq4lh/RLV8aLjUan82Id5p91f6oWE4yMd4VAPmfG9 1hSHSChtuoG2u3xxScuEZ4AH1zB848d0chAV7eTXitgPem6x02Nsq9vae+K89EvPeLF3 zZEWj+kxsyIq/hMaxGKEyEEFy8GPYww8Ez7jywldHACcj6Bn8ja9szOoY/HEuc7dDV4v 3Ae4tVhZmBmIO/gB600j9P7SLPmfY9qo+U7PtjKNti2Kp9AucHByAki/y8uCEiacNSL+ SDGw58Ij4VpstgHMaUnqd09ZlsLnSXblugcZo5UFIs7LNjIW4VTy1d6BAZi/ouJTecdz NJQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713707311; x=1714312111; 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=WcTvBG8QtewVblIlyVX39beMUKrTk6jsd2Uev9rHf/0=; b=jpIhS0DAOc70wLYRVgbJFKaGfmQRk/2RXnThq/CQKY6jbeTKbIJnywfL34nq0Eymg3 h0whFSElIOd4c6MqAJ3L5q6gAnb0bVL/66oe8j5HhyHpob7LSCrCGh3jitcboynf2m6F nwlHLyNjhK+PLD7XqM4yn40j6oS+kzUej3gSTp+lcWrRycaJIa3NYwZF1V/d4xm/c7Ao kNeqBqNF+WUDckJZi4U3Ebfj7HqXw8EW+P4s/bZJXShT7zDguJ+TTDTerTe5ojxIZu6v ISrkTbNJmiKjWLInRl3UHjWn2zmNiKn/9kOiAkVxX/QvJjKuP2s2nYsvI5/mK0wBB5yt PgZg== X-Forwarded-Encrypted: i=1; AJvYcCVsqVYtCFksT7HvMlb1u3PFLy8RHiPDOYrovtqvC7PFM2yAjDQP9flXwfBtD14iWZQG0uFcnMHQ8AaVVBZxN7tKfO4s2ku0ui7r68gsJX27lAykN74= X-Gm-Message-State: AOJu0YwjjDqIVQtYyJRfrnlTzsSo/GUEqWKk9UDcswle9KNsjXxa4dan WR5+yp0T/kuA9uJBMdvNoHbYz4gKiiR4/eWiGsSb2+ofu8j26Zyd X-Google-Smtp-Source: AGHT+IEyPxwqw/6TXGpzi8WH9F4lH1JxYg6WoBnEpf5NAK/vkuPgmJrfQekLV8WaNKlLanS22PkK4g== X-Received: by 2002:a05:6a20:9191:b0:1a3:c3a9:53b7 with SMTP id v17-20020a056a20919100b001a3c3a953b7mr7874675pzd.55.1713707310911; Sun, 21 Apr 2024 06:48:30 -0700 (PDT) Received: from localhost.localdomain ([113.30.217.222]) by smtp.gmail.com with ESMTPSA id o13-20020a056a001b4d00b006e6c733bde9sm6175043pfv.155.2024.04.21.06.48.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Apr 2024 06:48:30 -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 v4 1/5] usb: ehci-exynos: Use devm_clk_get_enabled() helpers Date: Sun, 21 Apr 2024 19:17:30 +0530 Message-ID: <20240421134752.2652-2-linux.amoon@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240421134752.2652-1-linux.amoon@gmail.com> References: <20240421134752.2652-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-20240421_064832_930862_E5A7D407 X-CRM114-Status: GOOD ( 17.47 ) 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(). Reviewed-by: Alan Stern Signed-off-by: Anand Moon --- v4: Add Rb Alan Stern 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