From patchwork Thu Apr 4 07:13:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Moon X-Patchwork-Id: 13617338 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: , 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); } From patchwork Thu Apr 4 07:13:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Moon X-Patchwork-Id: 13617339 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 0A381CD1297 for ; Thu, 4 Apr 2024 07:15:15 +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=whsdZnTFJk7YOkF8pgspAZYpaKd1hEdXAyKd9UVGYOk=; b=MmMU8zPQsfMGR4 3le7sOOMgt/FgKA/0A6YuSTbZnLDhLABH9/6CoGTLil7hk+tIlfcxLvbYziUL9JVofZrXJCZZtHKA 7fAG9ZuMYUcePpJGWBk9fyerAVY1P8mQ95YfqyNOmcFf8S2YsY5RJOAWGSyqgywRWAQV3OjTmblrP j5FnlzWilSURbseBmUozmntm3o2tVnslN0wkueB9Wozs9U4ZfVEm7BPOIbUiU9n9L518ssDQ8/IQB 1zzWnmHvHeLAzAsaYl8gaie80CuP3MakHOzszGHnc/2XlUbYQuloTerGGQtd9Z1z/bKNL4x7ENn9U aRBnClfaYoOPpwvQFVfg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rsHJQ-00000001azE-0Fgq; Thu, 04 Apr 2024 07:15:04 +0000 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rsHJN-00000001axo-3Kjs for linux-arm-kernel@lists.infradead.org; Thu, 04 Apr 2024 07:15:03 +0000 Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-1e0f2798cd8so5831245ad.3 for ; Thu, 04 Apr 2024 00:14:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712214899; x=1712819699; 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=vZ4F7NXXW550+bos8lcUggXlnE8ksWoIQYNv7Dbni9Q=; b=jdbPlgoc5QXIZivuDecwgaaaEm6ReePZmNOFGobF35iaKzWWvs0YnAnbbweUP3KTQc TOgQZqfnv3GiM2iJDYFi1HSHi3wHuowP2DGQQFRLbXp2UYqLYqm1o1t+TtqJ9gaTUUrr 19LOJqKggWg7kS1kpAY4BTuFlwuRzr8aSlDp8xV9qO3Ltl1+vQQDmBYurTQj448HOPmp ly9bCCGmBEq+DVaNyyG+ECmvcgfgKV9SNRM8H9GXVVAlD2sOZcbgCqKs/ysI+/o9JUIX umQlVU5S/xZhgVY1ty0R4gB0BckhDroNpHOOKdxPNzE2sSLHf5UQ6dYXZ6cj9zRqEUSb V8Gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712214899; x=1712819699; 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=vZ4F7NXXW550+bos8lcUggXlnE8ksWoIQYNv7Dbni9Q=; b=D7WnULyPDJXkqZ4aZ22ZJbxJqk5jCFMBGq+O4vwgwPabo/pePZA0qly81alqpl0qck wXqyQriW/U9G38rf82wUtaMB5/BF/Jdg2dofbPozr/zurfTEkkTMjO1ewWPg9UoEnPfc 2k5qlrythfFG18W+pMhbFsR/zff4GbdYCCLaCR4O7UqBHyfQAA60ovI2vnejnjYlvX/n sggb/xUhEA8vnPs9+axDHZh5ibgPlgb1V73QO0ng73CjUPeGsCbJ0IT/11aI4W5hdV3l 6Ly7oIr3CbVuEXOCf3cYjTzeWXc/M35o9sAzVE8h8BmEA7RwXpFpZV1rXF1/rfg3vc3I huXw== X-Forwarded-Encrypted: i=1; AJvYcCUTLK2V0vQkDIa3Y9dGIAonyDdqKXpKfVWFT06TOy6SKEacHEiIFa0X3gr+aC8znZdS3tmfJo6QGNt2OfI2J7ya2zUR+iOw4M/AsHVchPSA4X3+12w= X-Gm-Message-State: AOJu0YxinlnMFPHdEbR1tSnTPqgLfJ6uDUspDrgGR4m1tHzbSzVfUrqt QTLO4N9rvXexOcmstQdjxKqfJmxwOEvAiJCFXqE02QC5QkPhfxVB X-Google-Smtp-Source: AGHT+IF4BglLZMXCnf9J9jEVYynLdLpCHS08eS/S41aNbkggt6yBZJUUl2YbEY/gGHbUJI38+3Orow== X-Received: by 2002:a17:902:ec83:b0:1e2:6240:fe46 with SMTP id x3-20020a170902ec8300b001e26240fe46mr1426005plg.56.1712214899018; Thu, 04 Apr 2024 00:14:59 -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.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 00:14:58 -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 2/6] usb: ehci-exynos: Switch from CONFIG_PM guards to pm_ptr() Date: Thu, 4 Apr 2024 12:43:18 +0530 Message-ID: <20240404071350.4242-3-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_001501_887767_71CE384D X-CRM114-Status: GOOD ( 17.59 ) 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 the new PM macros for the suspend and resume functions to be automatically dropped by the compiler when CONFIG_PM are disabled, without having to use #ifdef guards. If CONFIG_PM unused, they will simply be discarded by the compiler. Signed-off-by: Anand Moon Acked-by: Alan Stern --- v2: add __maybe_unused to suspend/resume functions in case CONFIG_PM is disabled. dropped RUNTIME_PM_OPS --- drivers/usb/host/ehci-exynos.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/usb/host/ehci-exynos.c b/drivers/usb/host/ehci-exynos.c index f00bfd0b13dc..4cfde1af32be 100644 --- a/drivers/usb/host/ehci-exynos.c +++ b/drivers/usb/host/ehci-exynos.c @@ -236,8 +236,7 @@ static void exynos_ehci_remove(struct platform_device *pdev) usb_put_hcd(hcd); } -#ifdef CONFIG_PM -static int exynos_ehci_suspend(struct device *dev) +static int __maybe_unused exynos_ehci_suspend(struct device *dev) { struct usb_hcd *hcd = dev_get_drvdata(dev); struct exynos_ehci_hcd *exynos_ehci = to_exynos_ehci(hcd); @@ -256,7 +255,7 @@ static int exynos_ehci_suspend(struct device *dev) return rc; } -static int exynos_ehci_resume(struct device *dev) +static int __maybe_unused exynos_ehci_resume(struct device *dev) { struct usb_hcd *hcd = dev_get_drvdata(dev); struct exynos_ehci_hcd *exynos_ehci = to_exynos_ehci(hcd); @@ -279,10 +278,6 @@ static int exynos_ehci_resume(struct device *dev) ehci_resume(hcd, false); return 0; } -#else -#define exynos_ehci_suspend NULL -#define exynos_ehci_resume NULL -#endif static const struct dev_pm_ops exynos_ehci_pm_ops = { .suspend = exynos_ehci_suspend, @@ -303,7 +298,7 @@ static struct platform_driver exynos_ehci_driver = { .shutdown = usb_hcd_platform_shutdown, .driver = { .name = "exynos-ehci", - .pm = &exynos_ehci_pm_ops, + .pm = pm_ptr(&exynos_ehci_pm_ops), .of_match_table = of_match_ptr(exynos_ehci_match), } }; From patchwork Thu Apr 4 07:13:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Moon X-Patchwork-Id: 13617340 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 0FFFFCD1284 for ; Thu, 4 Apr 2024 07:15:23 +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=gCaKDYngQmaq+LSnSPMkvXMrEXiNtzwD2wRRBKZ8Bn0=; b=JkuJFKDEdP8eHQ 8aIgouTFqsmZy9Im27df8i+Kk0/uc4pCtZGCGv6loE5b1O5TEvtTr6OxSyvj7eaIAOjELdM6FOB8R 8gpVwRvSu8EaPZwvbPfV23mXtRmEmaQSG4HTiG4dS/FJvXONZdFVeyNBcLYSbYlD6Egn9J6P9W51u dDWKb4TA3Q31XEDYAMDEfNSxwKHela1XEmP7oDqLduQ0SCP1oDiMyPo/cPrsEkZ8bnaovD/GR5Ybx jv3/vG0ZJ1nCuEJK60+bdLuZzyZb8zWoaFFw24KZbSv6E14NejNdtDbLJIzyxbddDUAI+We/MctLi CzsPFOtby+M0/EV1RJJw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rsHJY-00000001b3y-3sS5; Thu, 04 Apr 2024 07:15:12 +0000 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rsHJU-00000001b0d-2gAS for linux-arm-kernel@lists.infradead.org; Thu, 04 Apr 2024 07:15:10 +0000 Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-1e0d82d441bso5879935ad.3 for ; Thu, 04 Apr 2024 00:15:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712214906; x=1712819706; 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=rinkV9M1GdwvRaIXYpdNquzoQdVjkSfszcTQAo+0cCg=; b=kCGzcsz994OBpFjv0nH81Atu9SX6Ul5yy6NnZGMsFSNn4Rh90BshE1V9+z4PZjQBLK Q0b2VzbUocMPp0/rPTraukS+iA23F82i0O44bykJoBlWgv2drelzHDZwu07YG2Fr9n9f jhEzsa7+vK//LWCv3dlL6ISLsWswtKq3httR0hCHbzT1HImkYjsBQoZVU2SpYLYB7bKP OUoZcsrN9PJfmQ4sHrGVe1JeXgu81uGYP7q0qrK9o2E0db5JtYIF7YAfeebqF0KTiN59 dhLV7V6+IP4fGBXH6uLG6UZmNVX/XRFUGqeLVLOQHJY2QsWjMRVBk7KU8qCoiGsb9Eh7 MIdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712214906; x=1712819706; 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=rinkV9M1GdwvRaIXYpdNquzoQdVjkSfszcTQAo+0cCg=; b=jltr9OcHh9+mN9HAyxbnkFWh/hwqlY0ZsZAmxkqDYkj4FqQxd9D0nqCEiym7HQ+6RK 6dwYsCjnYxO7imGvMRNs3bBmS7E/88awCs26Wz6MtPR8L7HlzF5RT0zNTRduzMQVNfUH GepO7HEcuJyj0D/xY15wKK4KCrHav8nxQ5AR7uGP5lP5rUBJJnOdEyL+cNGpZ9/jvad5 NU/un82FOetyhQH3VMREQPnuTjSj0z8QVlz5MeC7gXZZS2NuBlpvby7eQ2rsSp+QCoTT fbLls6xgbm28Mlzw/rz9mFK/ZBWIYgb2pjHVy2F5SBvrmVJdI8ZB7bpe16Fmx6gyn4Fa JaMw== X-Forwarded-Encrypted: i=1; AJvYcCWQSXYArsr9dWkAs47HlP4DMO3BzdcOCYoUvaBlKEnL5bR13PuNqBJZkCviPQyb3sPEXeDtXGj/JNRMDWXr/QWiDeVA7EERRwiYpca9Runnm7bHDgw= X-Gm-Message-State: AOJu0YyA9SF+wQ3cK4YieSRm7dDf/FGSmBP2itnme9WvvPQ7hvXhT3LB nNYuuzJL22QssgIh3FtEHUf005bF1KQ/I287SlZ7ZmtgWKHWjBTd X-Google-Smtp-Source: AGHT+IE538Vd8oFoNsf4W8iPSGIGPmsJQtB4mfqWsgTvwN90yY9UPLOYOos5v0PPJN/c45lpauVNXw== X-Received: by 2002:a17:902:ca8d:b0:1e2:9d65:253f with SMTP id v13-20020a170902ca8d00b001e29d65253fmr1362119pld.29.1712214906423; Thu, 04 Apr 2024 00:15:06 -0700 (PDT) Received: from localhost.localdomain ([113.30.217.222]) by smtp.gmail.com with ESMTPSA id h20-20020a170902f2d400b001e26c4823d0sm5220873plc.52.2024.04.04.00.15.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 00:15:06 -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 3/6] usb: ohci-exynos: Use devm_clk_get_enabled() helpers Date: Thu, 4 Apr 2024 12:43:19 +0530 Message-ID: <20240404071350.4242-4-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_001508_732657_6FF2BD89 X-CRM114-Status: GOOD ( 17.16 ) 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 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: new changes in this series. --- drivers/usb/host/ohci-exynos.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c index 20e26a474591..85d04ae0ae40 100644 --- a/drivers/usb/host/ohci-exynos.c +++ b/drivers/usb/host/ohci-exynos.c @@ -135,20 +135,15 @@ static int exynos_ohci_probe(struct platform_device *pdev) err = exynos_ohci_get_phy(&pdev->dev, exynos_ohci); if (err) - goto fail_clk; - - exynos_ohci->clk = devm_clk_get(&pdev->dev, "usbhost"); + goto fail_io; + exynos_ohci->clk = devm_clk_get_enabled(&pdev->dev, "usbhost"); if (IS_ERR(exynos_ohci->clk)) { - dev_err(&pdev->dev, "Failed to get usbhost clock\n"); - err = PTR_ERR(exynos_ohci->clk); - goto fail_clk; + usb_put_hcd(hcd); + return dev_err_probe(&pdev->dev, PTR_ERR(exynos_ohci->clk), + "Failed to get usbhost clock\n"); } - err = clk_prepare_enable(exynos_ohci->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); @@ -191,8 +186,6 @@ static int exynos_ohci_probe(struct platform_device *pdev) exynos_ohci_phy_disable(&pdev->dev); pdev->dev.of_node = exynos_ohci->of_node; fail_io: - clk_disable_unprepare(exynos_ohci->clk); -fail_clk: usb_put_hcd(hcd); return err; } @@ -208,8 +201,6 @@ static void exynos_ohci_remove(struct platform_device *pdev) exynos_ohci_phy_disable(&pdev->dev); - clk_disable_unprepare(exynos_ohci->clk); - usb_put_hcd(hcd); } From patchwork Thu Apr 4 07:13:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Moon X-Patchwork-Id: 13617341 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 9C61DCD1284 for ; Thu, 4 Apr 2024 07:15:31 +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=fSYzejiL2rp84rS5VCth3Om9PwPjD9Y0QZoUmsJGAeI=; b=u5dABPP+VtIB+5 q9+GN4YZhHHV61qiebrZ+yfKki7qcKjVn/B6fYlHC4S7/6J6feT7AMRpk3AETjXkvY6BtS8ajvCXZ nhu+h+SpYjaXv6qA4jzQmBD63SMLOkPJx2mZ0FYZVG+WntCB/s1512NafnhrMm6ch1ZZSOGW5JMG3 IRqbZe5bQIqcNdRA+qjrefg6mjjarNa9slMXlstX9P0uA2g3EalvCB5cT4Vu/j9jG915RjcvgMcyT 38YKpZTPQq0ISP4wgW2IwqW2CpBgOQLtHaBp7VmSQSQMkZRKjT27NkoqPLGEOXa7u5WV8dBvtL86K c5kpgckRxkKzpZApmuoA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rsHJe-00000001b7B-0ypu; Thu, 04 Apr 2024 07:15:18 +0000 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rsHJb-00000001b4q-3mbe for linux-arm-kernel@lists.infradead.org; Thu, 04 Apr 2024 07:15:17 +0000 Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-1def89f0cfdso13774345ad.0 for ; Thu, 04 Apr 2024 00:15:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712214914; x=1712819714; 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=qXppvwNAhzN97k5Naw+YEyw1OS4lAQ4l14Ygn5h0IzM=; b=AvXlhD9lXnMDAHUeQLksryJLrDt5ADNvdnoLFMs8j21mrZL/hXqOQGDc9jYlz3udCM 2l86xUM6qXqj2jO6xYuotC2nkKk4O11p/bPLaiPP52czs+QlYfOdqD4Ke2DxKbkl24Mq 86YacnqrOteoFAUxnT3rt9G+CmvQdIDiYhfRT1Zhc27uyZI2kdOKT6NeKDvqwyRneU+o JNPI+lIR1IE7aBS1o2M6AlBGk+jEaT8SM9HJp5aUfxxf4sY15haRFP6qCN2/X1Kon7yt geS08BZY+0otv44bappbxRsq8/TKtgUvVkGEJ8lKYplGt7Ox7+SFT4Mqb/eg6zUsU3am d8Vw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712214914; x=1712819714; 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=qXppvwNAhzN97k5Naw+YEyw1OS4lAQ4l14Ygn5h0IzM=; b=dh/uoM/sOwSCjIl3/9RMKTiolh2gS6vmMPBoRUggiAEXTheUOQYCmA52XxXa7Q91DA gRinh60BSGyGj2Oo7Y9rQ4LKycYLpd2J9C/kLJ9Hs8TlIit5xnYlP4NxmqqIZFgObFhZ l5iD4vtO3Pq+bhFMEpqG/jY4Nc8lYA8EDgM8SnUSmGdt1rIWBoUVO8TBkqxBI50JP3AS /gDacz3xgFeSXXq2jCr9ba8aSgSOW3ZhLkhvQ7eRdc6skka8YZkd1z7uYP8zYz+ZwFAD cCWkwZfCdQkrM2+bwekAY9m6qcYbAL1nb/nhf8f0CAP15StI47hVkBJjcawdFUfjUMxT 8wXQ== X-Forwarded-Encrypted: i=1; AJvYcCVRfpubyGVtFW7RXzUjZLvGxV4FoS6nDNx+9CwxkMr8OV8fcYS+Lz1IvQ0K1MZ/nX67b5tNaZwUFSTni7yDE1PvxNhJ1zEpOs2zL80nfxhUKB3hYq4= X-Gm-Message-State: AOJu0YwIwqgxxN20ZFsmJdNutibFHkr9dwK1EhqiOiXt6DK6nT6yhzbq 2Za6HbykNVlC9a008JsT4G7wF9U6nC5OEZrEZ9q94eQoQZanOi03 X-Google-Smtp-Source: AGHT+IG026jtHHMrN+DwLrmD2VL2UxEvIawtAyzH9cBcIzRtMNoZHVr0l8h2fdo3y1I/kj5sABCjBA== X-Received: by 2002:a17:903:2350:b0:1e2:908f:5d6c with SMTP id c16-20020a170903235000b001e2908f5d6cmr2692549plh.10.1712214913748; Thu, 04 Apr 2024 00:15:13 -0700 (PDT) Received: from localhost.localdomain ([113.30.217.222]) by smtp.gmail.com with ESMTPSA id h20-20020a170902f2d400b001e26c4823d0sm5220873plc.52.2024.04.04.00.15.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 00:15:13 -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 4/6] usb: ohci-exynos: Switch from CONFIG_PM guards to pm_ptr() Date: Thu, 4 Apr 2024 12:43:20 +0530 Message-ID: <20240404071350.4242-5-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_001515_991833_F114C937 X-CRM114-Status: GOOD ( 17.67 ) 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 the new PM macros for the suspend and resume functions to be automatically dropped by the compiler when CONFIG_PM are disabled, without having to use #ifdef guards. If CONFIG_PM unused, they will simply be discarded by the compiler. Signed-off-by: Anand Moon Acked-by: Alan Stern --- v2: new changes in this series. --- drivers/usb/host/ohci-exynos.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/usb/host/ohci-exynos.c b/drivers/usb/host/ohci-exynos.c index 85d04ae0ae40..3e647e0b341d 100644 --- a/drivers/usb/host/ohci-exynos.c +++ b/drivers/usb/host/ohci-exynos.c @@ -212,8 +212,7 @@ static void exynos_ohci_shutdown(struct platform_device *pdev) hcd->driver->shutdown(hcd); } -#ifdef CONFIG_PM -static int exynos_ohci_suspend(struct device *dev) +static int __maybe_unused exynos_ohci_suspend(struct device *dev) { struct usb_hcd *hcd = dev_get_drvdata(dev); struct exynos_ohci_hcd *exynos_ohci = to_exynos_ohci(hcd); @@ -230,7 +229,7 @@ static int exynos_ohci_suspend(struct device *dev) return 0; } -static int exynos_ohci_resume(struct device *dev) +static int __maybe_unused exynos_ohci_resume(struct device *dev) { struct usb_hcd *hcd = dev_get_drvdata(dev); struct exynos_ohci_hcd *exynos_ohci = to_exynos_ohci(hcd); @@ -249,10 +248,6 @@ static int exynos_ohci_resume(struct device *dev) return 0; } -#else -#define exynos_ohci_suspend NULL -#define exynos_ohci_resume NULL -#endif static const struct ohci_driver_overrides exynos_overrides __initconst = { .extra_priv_size = sizeof(struct exynos_ohci_hcd), @@ -277,7 +272,7 @@ static struct platform_driver exynos_ohci_driver = { .shutdown = exynos_ohci_shutdown, .driver = { .name = "exynos-ohci", - .pm = &exynos_ohci_pm_ops, + .pm = pm_ptr(&exynos_ohci_pm_ops), .of_match_table = of_match_ptr(exynos_ohci_match), } }; From patchwork Thu Apr 4 07:13:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Moon X-Patchwork-Id: 13617342 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 73A8BCD1284 for ; Thu, 4 Apr 2024 07:15:37 +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=WgK4egLlRZo4FoDu79kYSdimC1RYJT2ky3QCrfVtE4M=; b=XhntqPhvLrnmPQ o0q/aIXmUpDvv1XmRhqNW8iZD56cpkXlqZZWfhAZuRYTc0ZTGSvSSG2Pa4ZvcxqskSfhPF6aeojwz BiW9Ba1Egx8Hn+DGz0a4kIl+BRnf5UDvPbBvozL1SkPaaeeuMX7QD9SRMDtW+BV1JUDRxEeq11Q9i 9AZmft+qoBzD/Ud9CEUasuvWlpXfGHawMvcYeM5puZzBipLdIjiobNA+p2Gtf1cw2nmX9g2PQi2wh xvIc/TVfl9RNnKt+TuMXhvtYOcylzp3THMa98XnB5i+NrGiq/ZoA1/iP4Z0O9uB/qU3cC805sl9Rr fJUKx0AhK1AKq2Djrr2A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rsHJn-00000001bDc-3OqD; Thu, 04 Apr 2024 07:15:27 +0000 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rsHJi-00000001b9U-0rI8 for linux-arm-kernel@lists.infradead.org; Thu, 04 Apr 2024 07:15:24 +0000 Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-1e2987e9d06so5465815ad.2 for ; Thu, 04 Apr 2024 00:15:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712214921; x=1712819721; 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=J5f9n7odinT4RWqYkmTS+WDxKhbPNOevirl7nLpKZ3Q=; b=PBtdcUKKEqIlVZe2vNEXOwLet9OAfYD8megxJF0nyrvhUj+3H5Hv5z4ny0dFAzOIm4 lMhfOIcuz9njm3GAD8zLrQbGBzhSEfgM3FtWjWdRmiWHBtERiKREbH/MMmFfL7DG0Oq3 RQjhmY6btLUiai1L1nodk++Wh7t/rijEnNlsa55rc64/BRxvUnWmyVjn7cUSb1JQDsF7 eyqmo0BL8GhPFXueidOZwB/82W/hl+s5ylZpF5QRi9NLKuIoRcs/OsFYXE+8i7kvSce1 VtL5xyu/jvm4nlhQAiuCKHk2/pB3Qb/4CxNDwnLRwXwc1NKuAy1/3qUBh49zQWCS8hOE A2Qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712214921; x=1712819721; 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=J5f9n7odinT4RWqYkmTS+WDxKhbPNOevirl7nLpKZ3Q=; b=ID6lZR6vCNl6h5lBWx7BPEaGHeGYDSmB6fJmcSHy/uPD3MG4gG/vCmL4MzlUFXnER/ efOWSWeipXZn52srWOCaCzsM8vkj7NcpDiWEed/VerAqiHotMoBsP+bVFMFa9Q4suxgw mXtlOvCa3pODVcEGnr76Il/TedT2WG+RiaJ5+0akH14hx9sH2ZafMEl/CV1zbesy3MDE mpA/cdz6HdGXsbcyAQhoLkO5vck0ST81/DP5jMj9aHYW0YyzSfh0ohfOvhTOQEmix3aA GCibNcpe0t4/YuJLoCzL/fXrKSUVml9BM3X8FgQrhlHVwdgHy43RbpjwlWOfT/rWkp7Q 3/Og== X-Forwarded-Encrypted: i=1; AJvYcCV+jo0jLbjz83qqAQPu77dc2m0FZz2pfYIt92/0MAM/aAd7fd9beCafN6LUpyAY5xShUdhRVzgimMYHUGYmhyBoUqdbA0B74LYsshMj/BFsw5CO5xw= X-Gm-Message-State: AOJu0YwToVh+fZwDDQ/a/vko4CfU3OOjh37dvhzGaCOSpltMsp9z/Z9/ wSkEOe8l+eW6sZAQcYhv9jLe7nYTuHK8uxv4lUseJ4MThyODz36KDMG+9gLG X-Google-Smtp-Source: AGHT+IHQ71BzPE2Jd50DpY5Uuexh9bB292p9+PnwiYCQnWyndjL0lunoEy0BKwsQ/jrKET916igh/Q== X-Received: by 2002:a17:902:db0e:b0:1e2:b1e6:4f69 with SMTP id m14-20020a170902db0e00b001e2b1e64f69mr518986plx.40.1712214921534; Thu, 04 Apr 2024 00:15:21 -0700 (PDT) Received: from localhost.localdomain ([113.30.217.222]) by smtp.gmail.com with ESMTPSA id h20-20020a170902f2d400b001e26c4823d0sm5220873plc.52.2024.04.04.00.15.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 00:15:21 -0700 (PDT) From: Anand Moon To: Thinh Nguyen , 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 5/6] usb: dwc3: exynos: Use devm_regulator_bulk_get_enable() helper function Date: Thu, 4 Apr 2024 12:43:21 +0530 Message-ID: <20240404071350.4242-6-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_001522_427726_37869540 X-CRM114-Status: GOOD ( 18.07 ) 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 --- V2: no changes, did not find any regression in pm suspend/resume. --- drivers/usb/dwc3/dwc3-exynos.c | 50 ++++------------------------------ 1 file changed, 5 insertions(+), 45 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-exynos.c index 5d365ca51771..2d341f0e22a3 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,10 @@ 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 +96,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 +117,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 +170,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 +178,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) { From patchwork Thu Apr 4 07:13:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Moon X-Patchwork-Id: 13617343 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 08ECBCD1292 for ; Thu, 4 Apr 2024 07:15:52 +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=MPQDbsaZiiP3PGke7BK3UAh4uqw/cEtEbIIehvKBrUY=; b=O5/OYdPDr9cdcS OfGeupMgMPtcL/RfxilAAlzMXk4ZH7JSSrO4aJwIir196HVFsN4XuHcACdbdt6FYxr2Eemt83vdpw NMThPrNF6tj6sRVfOJ6JZBkYllGzKigBjM1wYw8hjjlB+SzoZ+NJsjt76LLgJdDDTwgho2OShyHbH rybBlvMjT5tch3jM8BsfXWQg2rZ3hH1LtZwKZ/Czfa+2X+dfbwF81RHO24Am7QfOrKf16JnuizxAs s0nNV/Oy36T7j8upwrmhvKim91AXPglrATQ0XOUC6VYUUspXi/3Z8KOMdYoK44kZ0wYhcyw8p2VED MH2UZ4oTTToVibmSmzkg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rsHK1-00000001bN1-46Vc; Thu, 04 Apr 2024 07:15:41 +0000 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rsHJw-00000001bEp-3kMG for linux-arm-kernel@lists.infradead.org; Thu, 04 Apr 2024 07:15:40 +0000 Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-1def89f0cfdso13775905ad.0 for ; Thu, 04 Apr 2024 00:15:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712214929; x=1712819729; 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=J37xgQA9uGX+wBOKJnojy8QxNGELdhvGrNPpqIWXrM4=; b=Gr7z9+dpowzpKCVwygcEGTwqGKLmSlVuwN8k66RbZlvTZciefX2raPaAQZBSi9An5Y IxICiNNp2A4WShUDJrRtWc7pmx5htV9KXi+5XEumU0Qlq9lfYnz8zGnwEx5sSuw7BPhN 84kpSwfutziHMJf17mqz33k4DAokH/tk2iFmxASPMPvH3F3X8U0hl933eN1i05Y148hG cjT6D0bdmbrGIFDsNare6X0rsL8PIulLjEwEZVK5PCqCtwGUEoFxQz2ZrokcsDLUa3jI 7Plm6rXXQMJKt/0U0WL0hSj/fyCknsxNZ/sGJq5RJo16Df06bT5e8RE4qTYBpihVnUJm z7VQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712214929; x=1712819729; 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=J37xgQA9uGX+wBOKJnojy8QxNGELdhvGrNPpqIWXrM4=; b=fbDHGNOB0wKadwPN637dD1uDJKrtvHzLklPVV/AmZrXwQJKyAY8u8RwcVuXe3XaC4O C9yp5oxRIHplxzob1Mav3OhxRYbtSxHDbQ7fPnLk1cL5/JAGC5ph8ScqVd2PutO5EjXx 2gzIzL4wXFug5E+y+RkM4TjYaVJ8GNknsAYU7WA8AvnLONR+WQZXgdeUjFKi49STD1D+ cNFdLspHJWRvCZZtQhaRXJPk/MJIzCWLeN6TJkUCaJmuiBB61rDhfsbPSn/axqB8IvEU 7PSmfYHJOMFBLqXHPiCt0VfXkqxUqglkAomafVlCINjw6ujlwE5vwoZk3YH5TBi1uAtT N3NA== X-Forwarded-Encrypted: i=1; AJvYcCVWLX9U/OSMt7qgZo3VPlv8OQ2MJoAFtU5muVYR0QEhZ068BGdAGNMlxVrN62kVnpjbueBS7NLaBN6rpsnPNQ6CBAIm3Nyqw8sT4ZfU+zrGT++/9ms= X-Gm-Message-State: AOJu0YwHYFi1kwQvfxLuACslGW62cYIywa3qFGSaAT5ppu9niVUkRLB6 aHE1AUoJkVvlRPwx/c82Qji4s5rWzsAEvk+3pHm6r7ZTw2ja6G2q X-Google-Smtp-Source: AGHT+IFho3nsnGV/Vraj6b236VW0aMhIhz4R5zKUYzxQDKs11VTEws5/th4dV0E4KIv3/LNWrhSraQ== X-Received: by 2002:a17:903:32c8:b0:1e0:b628:a752 with SMTP id i8-20020a17090332c800b001e0b628a752mr6820836plr.7.1712214928864; Thu, 04 Apr 2024 00:15:28 -0700 (PDT) Received: from localhost.localdomain ([113.30.217.222]) by smtp.gmail.com with ESMTPSA id h20-20020a170902f2d400b001e26c4823d0sm5220873plc.52.2024.04.04.00.15.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 00:15:28 -0700 (PDT) From: Anand Moon To: Thinh Nguyen , 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 6/6] usb: dwc3: exynos: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() Date: Thu, 4 Apr 2024 12:43:22 +0530 Message-ID: <20240404071350.4242-7-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_001537_033056_F9FC86A4 X-CRM114-Status: GOOD ( 17.26 ) 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 the new PM macros for the suspend and resume functions to be automatically dropped by the compiler when CONFIG_PM_SLEEP are disabled, without having to use #ifdef guards. If CONFIG_PM_SLEEP unused, they will simply be discarded by the compiler. Signed-off-by: Anand Moon --- v2: add __maybe_unused to suspend/resume functions in case CONFIG_PM is disabled. --- drivers/usb/dwc3/dwc3-exynos.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-exynos.c index 2d341f0e22a3..90259ad1d0d9 100644 --- a/drivers/usb/dwc3/dwc3-exynos.c +++ b/drivers/usb/dwc3/dwc3-exynos.c @@ -161,8 +161,7 @@ static const struct of_device_id exynos_dwc3_match[] = { }; MODULE_DEVICE_TABLE(of, exynos_dwc3_match); -#ifdef CONFIG_PM_SLEEP -static int dwc3_exynos_suspend(struct device *dev) +static int __maybe_unused dwc3_exynos_suspend(struct device *dev) { struct dwc3_exynos *exynos = dev_get_drvdata(dev); int i; @@ -173,7 +172,7 @@ static int dwc3_exynos_suspend(struct device *dev) return 0; } -static int dwc3_exynos_resume(struct device *dev) +static int __maybe_unused dwc3_exynos_resume(struct device *dev) { struct dwc3_exynos *exynos = dev_get_drvdata(dev); int i, ret; @@ -194,18 +193,13 @@ static const struct dev_pm_ops dwc3_exynos_dev_pm_ops = { SET_SYSTEM_SLEEP_PM_OPS(dwc3_exynos_suspend, dwc3_exynos_resume) }; -#define DEV_PM_OPS (&dwc3_exynos_dev_pm_ops) -#else -#define DEV_PM_OPS NULL -#endif /* CONFIG_PM_SLEEP */ - static struct platform_driver dwc3_exynos_driver = { .probe = dwc3_exynos_probe, .remove_new = dwc3_exynos_remove, .driver = { .name = "exynos-dwc3", .of_match_table = exynos_dwc3_match, - .pm = DEV_PM_OPS, + .pm = pm_sleep_ptr(&dwc3_exynos_dev_pm_ops), }, };