Received: by 2002:ab2:2441:0:b0:1f3:1f8c:d0c6 with SMTP id k1csp97969lqe; Thu, 4 Apr 2024 00:15:04 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUK0bGRn+09vtvUZ9xlnKnW51UBarfFOCw0gKjg4Or53v+WlVFhkfZPAJr48TozcYLOrQY2Qn58eEmNqvFunVy1lzSILs+bbzybamTAVw== X-Google-Smtp-Source: AGHT+IEmB/SDfs5/iRtjO+dBKwHWM03+pM44RpLGE2mDzxY3hM8AEZAP5U4o5wL6nqLwsZRtDvkE X-Received: by 2002:a50:99dc:0:b0:568:9ba8:8f1a with SMTP id n28-20020a5099dc000000b005689ba88f1amr1119973edb.7.1712214904563; Thu, 04 Apr 2024 00:15:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712214904; cv=pass; d=google.com; s=arc-20160816; b=ODrvslqiPzEnW9RbULUJD4xtDDTupxpAl6U13GSLIGLeoDetfYXKmNGKLlj4NPKv2d VIsyf4R+3/zxtURAIo+K6UhsvTa76fkbweyY00F8T+5rCYY+OIA7r5Bdaut+jcXapTG4 gLHGWvxjBn4ZJO9/35WFxEZjmn8SZBSGI8uE6xayo75ZlLMnh8hV914YsiL9PMm8AuoK TcuKdons0D06pLwOh0vLssoGWCDJjYaqTU5sAetcYxzHLhTac9KlCx8+fFGWzfbeOANL qJ60VPxBY65Q2dE52Lno6WcFn2FPuveQ14rtZJJKiktJUY5v2Jw5GNujJ5bxmRF5IHej 5LtQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=gPsiPELCBmPe+inzzwVVOC2M0IyyDSE04BMeZYanz5U=; fh=y0NGOZhWs7ROr/qa/J765BML4NfDNW6nuDmPBAsdYso=; b=gWvDMDSqKUjDNbB5FURBabebtWnm0prCzohNKZBxlkK6v9+3tARjiPXAwA5PrdLgUm TVxftdOVqsybV4EJGbEssHSuDyDEDgKtAX0pQqv2mRPerNBc2Co9OwA3/HTT9odk1rhE 3kV20ukwRMmCmYSzb6XPoAPj6IzrjRc/gr+0KFF1lwvzIKyBqI/Hp8aV0woU0fDBWWcd cNZrRNNZwzep5+c+IJN5Wa60bM9vUdyRpJPcL6qxQrBB8sQ1JlDp+Hr3ohxdQAzIZ+Rj hn5noUTzXi5aa2nd2kNHxDH3U4wZvnibIVICmjpCJMSAd1bue82MNyjcf9fye8cec8hz YnCA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=EhZo5lNE; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-131015-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-131015-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id g20-20020a0564021ed400b0056dc70da30asi4971270edg.161.2024.04.04.00.15.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 00:15:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-131015-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=EhZo5lNE; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-131015-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-131015-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 4625C1F22B89 for ; Thu, 4 Apr 2024 07:15:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9254D56B7C; Thu, 4 Apr 2024 07:14:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="EhZo5lNE" Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5C09E548F1; Thu, 4 Apr 2024 07:14:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712214893; cv=none; b=HUrYkLZjWcW9IlXHHYcZBbjIrj6Z/YoFONRBANl/dtZS9ojfkXWWk1atSB6Ru+3NxHEqWp3Vz2I6jOFKmqVFvMGsvhEELrsWgt1VMmaEmePdWqqt42z7HXUk83CpEe4BdUDZQKvOG0e19zHiesSWEOZfLaw82C2RuJTAqKws0Ms= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712214893; c=relaxed/simple; bh=0bCffHZydn92x8yoNUXuHk+MA8fJZmpo7AjWbrkLjnw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=h8gv5RKoPyIaN1Srp4sdOUNWD+34Y+d5YVhtd1n4n3g2b5CKijwifSfgNSL2y278CGWtH0jFb5dmkrwbADlhTo9frhEZPdLKac15Ez/xccxq5q+y5/umaA+YMhG1ZyOH88MWPJp/Gl+P97xgKbG/ZPCIWFIhTAiIxBuPxcVuhwo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=EhZo5lNE; arc=none smtp.client-ip=209.85.210.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-f170.google.com with SMTP id d2e1a72fcca58-6e709e0c123so563174b3a.1; 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=vger.kernel.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=EhZo5lNEZTKmNt2pPaqRzICEP3DiaZ9rJk5WLcu7RRi44ltMTerLOmZf2LmeBZMzQH lItpmypOvpU5k2dknF7XjHMePoxUMsdYLCKe3rJsjFtlAkgR5vDdHc1AlXVHFXMu96op vplcX0FQIdRSroWBrUvwkCw7td2uV1rXPBvdR6rUinTsJwSH37sJSsOOBg++KPReZNW7 z3Qi2HvshGaYPtPgeVTXELyCk0xxQBAUN8ZMhupCBV3PZy+ZjVQxwyKui+IjWijTSABH ariSbNhJpglRftsQOw/L5KMd9f3O0A9yOksarUajVVGmofYpTRGYjrI20skRCWM+acfa f+BQ== 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=Jonw7l+KhaOUTzTC9jsYXXdDBN0rMCtVTxk3F+1Dk+OwVoeh2YYqeObi5sWhmaZpia qZKA9U2BDXXDY6hhQrd9+zqYSLsc2C4EE8gGBMEKX45DvaUOwS7UGfwfedRf1n4XhetV xSFhIFiBK5KWnFPMD+X6yPGgFpY4nNPXj2HgNZ9+FpM7/S0+mafkXesHGRcoN+QZAdi1 jNdxbEg5a24fnBRMscb8UjBNxO95v9U3uyVP39EgGcabpOJ75uZOrLBhn9JerrIO0rHP sq/D6WhwpGpyDE9EroaFDh8SN/VpUu2HSAFTntdOrPkUwmlqDNUfWuh2JHY/deSAGDuu +AHw== X-Forwarded-Encrypted: i=1; AJvYcCW5LOmQDOjo+Yn8qavgpywm6f116taAI7cqThSUVFP12JK5ZuxxAJX80qL7laS1rGZdgsrN5qhR6pJGvT+BufoPQhRwYBejpLAqGVIRZtSk14XlNiqpvVr9k4+IQxwzLSINDD3FKxqwN5aAFy3znQEEve8dLkYayFG9AeQr7J2VrgMqcRNiMx9zByE= X-Gm-Message-State: AOJu0Yy0gRS5Nd+N24tX+xq8qf5OE5SA2OauxQzLlcLL32U7NNJWkeZu ikeEjc0GzKnr3VysaDAlSTON2EAI5AvFx2cdQ9/iLUDZtbCIx/te 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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