From patchwork Fri Mar 1 19:38:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Moon X-Patchwork-Id: 777325 Received: from mail-pg1-f182.google.com (mail-pg1-f182.google.com [209.85.215.182]) (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 73FDA5C9A; Fri, 1 Mar 2024 19:39:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709321950; cv=none; b=ET9cywhHf69uYIstrHlvPT26iJew/3AjLz4u4r6HAt2bI0vFRR/qUMgAbpnHqffPUnWSxtXvFmWe4jw7FSLx62AuMhk476MSEg7Pa9LZbtHT3iCV0EjMPOS7ngt7jL/kco611Mi8nx8vwM9+0Td2BNpFwQ0aR2wA7bxiMScm2NY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709321950; c=relaxed/simple; bh=qzEiaIwCgvzo/jlLWGnfGMZS52j/5NljTf80U9c7pCY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=E52k/cfCoBnrmsVtVtIlI9+hZ/D/5c7lcydW1suk7TjFOY4hUCoXh3NKzkjFWOieNABEKYr4xvpEAuRZHevXOkO6Fjta862xwXz77z8JlxHyw7OxwMk6A4WVN+r7t6jeEqCgT35IP7wHn+Xc0QQnKd1mm1UkyQPj0Jk31b6jZjo= 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=T7CNgKJF; arc=none smtp.client-ip=209.85.215.182 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="T7CNgKJF" Received: by mail-pg1-f182.google.com with SMTP id 41be03b00d2f7-5e152c757a5so1759878a12.2; Fri, 01 Mar 2024 11:39:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709321949; x=1709926749; 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=+XmK1KXUIgEldgLQ9Dj7dEfcJRP25Vkl9HU6FEdalXs=; b=T7CNgKJF2ndd3WxavdWd7ssw71sUi6Epaif2SUi5oCPNTOetOran91fWM8AxZK8lO4 rbHtdNJN2PrU66X71FSjvYtz+lReLt0TUU42SeW2X9dbBhDeGMtGj95P0EZuu6sBTczW ThEkw7rUHfkROQBjTxDEcpA45+S3PjDg1PSN04N7SkriuwGYevMaTWcitzN6Kz6+SWdo xqk6XSkU7cO9K9EKnqxszHB9V/yYOIH/l5AaD68Zs8oVZrbZB4QoUTGFMXd4ZALw3avI GnKZiFNtNGlwO9yZSu08VKWudThqmP1SuKlB+qT6DDscXjsD3IEq0lKK1QXKoHvW84Wk +Ztg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709321949; x=1709926749; 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=+XmK1KXUIgEldgLQ9Dj7dEfcJRP25Vkl9HU6FEdalXs=; b=vEJyUfIPQcL8L5ClHUBjgfYsQJXMnFVbQag1x59FO8R2i5SOd1zQAjowG2yDkwkXwW GGrPLMqDP/NvMgDOUU1s/Xem2ZnS/T5xZvwFirDRPdiaEPHyylkfLGxbwrf7H/3raVfm CenJxI2WA3/fITHaRJP+qOqSSRYtZMb+OFV3odFbEGkR01u/2Nan/PMCRrhyuz2IInJV bWeZu1oP5ITNKeTRjOoMOAXa4DG0kv809g5ucJ7F13a0u+/mn/AkiOiBET23yoDsjFQT 1LoWL1l9gmj57PfQ7QiBkgbXWOt5u8ubEa1LKPS++iqTYp+5eEn4RA5LdVDGj8YykTE3 VASQ== X-Forwarded-Encrypted: i=1; AJvYcCXqHHTGvPXCqV90pIk5nB5GUk2YA0IjAmN70dE62RcESiFvhhJyQCLah7TRulevD24GchW9srVPEC2ylg/uuW/ElM5752I0nPFiJYRAz+Ci/mo/HSoLw4EmzKJucEXJT+5/xKreB4QHIEYTJQd6UdZOGDET9+BPr0mk1nQ6qVEKGBQpK85k0vsD5kc= X-Gm-Message-State: AOJu0YzVC/cU3oCS0wJfBav/wz9w2pDdz2NIrc9kVAafaqyZR75TiiS1 9yaL+IZYf6GRoJF4cyiYZGYnSqDLg6yecFd+/c5OMRbjy/NoZGn6 X-Google-Smtp-Source: AGHT+IFe/jusPETkAIAJswHE+vTyxv3T1WsrpeHoubCmcfJB1aHT1VfWeAn2Cx/qrh1L+SPHWwbrkg== X-Received: by 2002:a17:902:fe82:b0:1db:8fd9:ba0d with SMTP id x2-20020a170902fe8200b001db8fd9ba0dmr2177685plm.23.1709321948602; Fri, 01 Mar 2024 11:39:08 -0800 (PST) Received: from localhost.localdomain ([113.30.217.222]) by smtp.gmail.com with ESMTPSA id u8-20020a170902e5c800b001dca6d1d572sm3837474plf.63.2024.03.01.11.39.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 11:39:08 -0800 (PST) From: Anand Moon To: Alan Stern , Greg Kroah-Hartman , Krzysztof Kozlowski , Alim Akhtar Cc: Anand Moon , linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 1/4] usb: ehci-exynos: Use devm_clk_get_enabled() helpers Date: Sat, 2 Mar 2024 01:08:08 +0530 Message-ID: <20240301193831.3346-2-linux.amoon@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240301193831.3346-1-linux.amoon@gmail.com> References: <20240301193831.3346-1-linux.amoon@gmail.com> Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 --- drivers/usb/host/ehci-exynos.c | 30 +++++------------------------- 1 file changed, 5 insertions(+), 25 deletions(-) diff --git a/drivers/usb/host/ehci-exynos.c b/drivers/usb/host/ehci-exynos.c index f644b131cc0b..05aa3d9c2a3b 100644 --- a/drivers/usb/host/ehci-exynos.c +++ b/drivers/usb/host/ehci-exynos.c @@ -159,19 +159,12 @@ 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"); - - 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; + exynos_ehci->clk = devm_clk_get_enabled(&pdev->dev, "usbhost"); + if (IS_ERR(exynos_ehci->clk)) + return dev_err_probe(&pdev->dev, PTR_ERR(exynos_ehci->clk), + "Failed to get usbhost clock\n"); hcd->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res); if (IS_ERR(hcd->regs)) { @@ -223,8 +216,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 +231,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); } @@ -249,7 +238,6 @@ static void exynos_ehci_remove(struct platform_device *pdev) static int exynos_ehci_suspend(struct device *dev) { struct usb_hcd *hcd = dev_get_drvdata(dev); - struct exynos_ehci_hcd *exynos_ehci = to_exynos_ehci(hcd); bool do_wakeup = device_may_wakeup(dev); int rc; @@ -260,25 +248,17 @@ static int exynos_ehci_suspend(struct device *dev) exynos_ehci_phy_disable(dev); - clk_disable_unprepare(exynos_ehci->clk); - return rc; } static int exynos_ehci_resume(struct device *dev) { struct usb_hcd *hcd = dev_get_drvdata(dev); - struct exynos_ehci_hcd *exynos_ehci = to_exynos_ehci(hcd); int ret; - ret = clk_prepare_enable(exynos_ehci->clk); - if (ret) - return ret; - ret = exynos_ehci_phy_enable(dev); if (ret) { dev_err(dev, "Failed to enable USB phy\n"); - clk_disable_unprepare(exynos_ehci->clk); return ret; } From patchwork Fri Mar 1 19:38:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Moon X-Patchwork-Id: 778215 Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) (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 4192A3BB4C; Fri, 1 Mar 2024 19:39:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709321957; cv=none; b=u4kufTBVLX5AqD+Rni4eWf3qV0Nt8Ls2DQzb9JK1rXDP0u/6e7jjNPets4emhJoZZ6977a+kyrExWyT3naLJenQrfDxkRmqIVKGavxnuGWGIGdzAM4qbSKMfQtag/VQncUshIwCDIAV/+g7Sj9GGOuJRhi3XKRRsMoFe7XVvbmw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709321957; c=relaxed/simple; bh=gqPz4yvQ+t5mgEesD3379Ygl8s3Sjp/9uomF+8Ie42A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FKkJ5yGG31wKeyX3y76vO8SXRSfobMY51odmCjMad3ZwpSJXK7Nhqmhb5zn5wz87VW9t85PSsEu9CLTkO0E9TvZzpwOfeE/5lwkzZr40dZ7eTvqfowtUml/bDiN9wFj1hiryuEMBLBG2CzG/aqnoKjVSephJs+Op/mWUuo/C/qU= 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=UBzcPdVb; arc=none smtp.client-ip=209.85.214.171 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="UBzcPdVb" Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-1dc1e7c0e29so9213395ad.1; Fri, 01 Mar 2024 11:39:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709321955; x=1709926755; 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=HxDoTNYRXmT98FSYADPnI3hxRtweuOFNAxWJPLtCjpE=; b=UBzcPdVbwnODYw813IfKrAWRAZXBREFHBdh6wB/uFrr2vTo2ZpmdbKyrrPZIdVL7Ce z2pHe96VCcxSjImNPlxvIYAXZ9lrs1mu7MEZXN62iNesAKDwBk2offuMlMXmNbYoaHEK gGt8fi1Z3PLnyY7BSxDoduOwg+70XpAT26rCchlujRtL7cXZ1FOX9nalewaOp30Dwc28 DyMuRuCq40P4q4MRNsQJgkrGprLX2z+Ps3yZZMb34Mqfsee0Jn7eaDGwy/9tVdYYSeN5 DTv62T2eZxhhqn/5c1tuMnxjCkRTT7r0eoULTYGTjWSsHHZrhqgqe6ub4K9iBlpOtxS2 y34Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709321955; x=1709926755; 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=HxDoTNYRXmT98FSYADPnI3hxRtweuOFNAxWJPLtCjpE=; b=rMI+nG4siRakA4X783JLT7j473G1mEUwmKFD1cow5CNB+qc2tY9t7d1mEXTEI7ZFWK /Lz4KTTtAJLf8+VCaSrwGyqE5FWX+OiSqinFEU4Z/83KXPy8Q1wzx3COKpQMKSL3Gx1I ZGD1M2tGrQhIqTqUZNHCUSM2Mgb4Ve6u6B5BjP4INLsG2TPyeB6wcU/zHXktxMISIu/B srw0wKGIUzQUV/z9K3X5kYDLodkvqWiqyGLJrgrwaJgAdKe+QHN6iKj+wu9W2iqLqqyQ WtAbisomYQHufI5LDH0Cs3ZxflK396WZLxzvHhrIe8XulkPUvvExsEBdRNUwROn70Uyd DKbA== X-Forwarded-Encrypted: i=1; AJvYcCV/Mj9R69w6laZC9q031o8rnGmTL9InD6lAELpR+pl/f4B0SuAuFz2AW5MJES7u1QWSwUJWTzVhZWqkZo8MEt8x1DBePSvtQkbTLSV0emd9wY3IdMaG+zyIwoT3qJABdTzz2HzGJqDbW6XugyMlQtvzGP8Amlna+hjsEz3X1A6vpXXiIzWIFBwk9QM= X-Gm-Message-State: AOJu0Yw7qHU1Ff/7Gc9tNR5TYKfyMw5H/xgHTkRw4vr5JIYdMhugtb6n iJH4rAecapBD8JF/OLPZLGoNl6Msh+W6F9pnBa/ibuPZrvpto/1a9xLdtS29 X-Google-Smtp-Source: AGHT+IHV3s9Cx/ijBF4u/tKBzE9PLqaHiED312E1BkJOfy/2Oat9Li825A6zbvq7V+BUjdFNIg02eg== X-Received: by 2002:a17:902:db0e:b0:1dc:3c3f:c647 with SMTP id m14-20020a170902db0e00b001dc3c3fc647mr3442878plx.26.1709321955473; Fri, 01 Mar 2024 11:39:15 -0800 (PST) Received: from localhost.localdomain ([113.30.217.222]) by smtp.gmail.com with ESMTPSA id u8-20020a170902e5c800b001dca6d1d572sm3837474plf.63.2024.03.01.11.39.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 11:39:15 -0800 (PST) From: Anand Moon To: Alan Stern , Greg Kroah-Hartman , Krzysztof Kozlowski , Alim Akhtar Cc: Anand Moon , linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 2/4] usb: ehci-exynos: Switch from CONFIG_PM guards to pm_ptr() Date: Sat, 2 Mar 2024 01:08:09 +0530 Message-ID: <20240301193831.3346-3-linux.amoon@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240301193831.3346-1-linux.amoon@gmail.com> References: <20240301193831.3346-1-linux.amoon@gmail.com> Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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. Use RUNTIME_PM_OPS runtime macro for suspend/resume function. Signed-off-by: Anand Moon --- drivers/usb/host/ehci-exynos.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/usb/host/ehci-exynos.c b/drivers/usb/host/ehci-exynos.c index 05aa3d9c2a3b..4676f45655cd 100644 --- a/drivers/usb/host/ehci-exynos.c +++ b/drivers/usb/host/ehci-exynos.c @@ -234,7 +234,6 @@ static void exynos_ehci_remove(struct platform_device *pdev) usb_put_hcd(hcd); } -#ifdef CONFIG_PM static int exynos_ehci_suspend(struct device *dev) { struct usb_hcd *hcd = dev_get_drvdata(dev); @@ -268,14 +267,9 @@ 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, - .resume = exynos_ehci_resume, + RUNTIME_PM_OPS(exynos_ehci_suspend, exynos_ehci_resume, NULL) }; #ifdef CONFIG_OF @@ -292,7 +286,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 Fri Mar 1 19:38:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Moon X-Patchwork-Id: 777324 Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) (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 7E7F53A8E1; Fri, 1 Mar 2024 19:39:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709321965; cv=none; b=LkLn/wTY5Vdntg/f2hbJXCDNYTlOY6Q95djDTSWod37thAGHDrONUa/FkDhIlW+r8Ck11thrfMJitMDZVOwKkC91ALIT5Aj9tTMoJ/2Mod9fshZsh2wO0TDHJJOcE+4nY1CmUZ7z3yd+J/P1NYgwoYjbTHzIs3R6LuwAEdAaV1A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709321965; c=relaxed/simple; bh=u7ate3YnbRh4cS/ZoxbBaCkSYj8kc6vJSZdj383mVgs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Qh8LqUrHrel3xde/8gIC4XUFkTW+GKechg43X3Q3GHM27Vkjm9DXen9NSLH5Zg2BEZ3k7iouh5VgamgklsXj8/4M5op8JjOMzxUO9pwrmpyYWCVK9QSv4wSylBAonECd8cZjkT6ktyeG/VxpNkFuWvpJgrs9/NWTRou+D+PPEl4= 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=cJVK1JXZ; arc=none smtp.client-ip=209.85.214.182 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="cJVK1JXZ" Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-1dc0e5b223eso24311475ad.1; Fri, 01 Mar 2024 11:39:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709321963; x=1709926763; 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=hb4CG876O8rufa4kt9vTuzRMAqAQvWAjs5KW+CbhAMc=; b=cJVK1JXZxDMHmKrHAE3FcMqpRbDLI4OEkMtj0DmwxoXkPSgGN3j4pq96KkFBeo2+tL U/OPYGqz0MLrQV9vXmfk5yeTxNtoUzeRoMBQqCHMyKRpLPbpefHdrWP21Z7JKaD8lJES NwTv+VT66TERN2KbuDVkzhjK/ER7fzunQCLvHANeWsR3IrMaalPRk9znxs9CSnvKsEM6 FkVO1F5irQwrjVlna+aJIJGEmKeCrxdp3xh5DRdOZ+d633Q5qXpBGEpAPck3Wgrds9Na PGiaSRQjHic5WGUM/4RZmb0ueRHU6ogPPUBl8N8PLSAgphwzqnlr/lovfaE8xQfm0FKo KnOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709321963; x=1709926763; 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=hb4CG876O8rufa4kt9vTuzRMAqAQvWAjs5KW+CbhAMc=; b=NxJEQwsc18YvjRXk6RYaTBZwLjPWCVzXwhSHr4wWGj0ViLiNsnnZAj7oTq1vBJCTWo S68GLCmORLJYGoTAUFnz5Y2vibavy8osCv3k15N0ohDmD08DsokjeCSOb4K+QNfYdXd9 LO0YIMCmPkO+o9hy3YPhp7ewZSW3/FPdp2oAd8gIOp58vyGouVb22U3ugOb0x5dYBngL HcObhGXJjYujsNTXw1HbOR7PD4Zy/gH9Cojjah63K7aSvOXukSowprXZyTWDBlrCdjUH MgY2Bt1+X6xuUvKh5mAhTh8jvPGwKznLU3MhJV2UsSyy4S6XC/QE8YxtIO10tss1AAJD km0A== X-Forwarded-Encrypted: i=1; AJvYcCXmuD/mBvNmEBQncZyYUdTgqhCeAhwx/dh1OJHpz0+y+ou3djPr7bgo/aRqt1teg+MHkotuNm6rcELaRl8YK9OI80pVv1SeHwdX0ntY7SjmLLyTBWAjn5AFsAxYjlhMZKhFkOxW1yIq4V83BSMTzEgjf1IIJNDpc/YOspKcJ9tfGV0qa9/ouEEzbIE= X-Gm-Message-State: AOJu0YzZFozBAca2dtLGZIe7jOp7G3l6TDGuAz96ysCpa2HYc/ko0Oc5 o5ehATReleQ23LAiW6lmTsPGYIolU3O2udFUmjOdPbJcDfzWonqN X-Google-Smtp-Source: AGHT+IFgEXL5OrEpNcLcirx6onnuU3qA5IyL4Z8we5SXd8dy1goPwzAgll7JmWsxp1BQjtJuaRYtbg== X-Received: by 2002:a17:902:ed82:b0:1dc:2f30:e0dc with SMTP id e2-20020a170902ed8200b001dc2f30e0dcmr2171759plj.36.1709321962783; Fri, 01 Mar 2024 11:39:22 -0800 (PST) Received: from localhost.localdomain ([113.30.217.222]) by smtp.gmail.com with ESMTPSA id u8-20020a170902e5c800b001dca6d1d572sm3837474plf.63.2024.03.01.11.39.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 11:39:22 -0800 (PST) From: Anand Moon To: Thinh Nguyen , Greg Kroah-Hartman , Krzysztof Kozlowski , Alim Akhtar Cc: Anand Moon , linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 3/4] usb: dwc3: exynos: Use devm_regulator_bulk_get_enable() helper function Date: Sat, 2 Mar 2024 01:08:10 +0530 Message-ID: <20240301193831.3346-4-linux.amoon@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240301193831.3346-1-linux.amoon@gmail.com> References: <20240301193831.3346-1-linux.amoon@gmail.com> Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Use devm_regulator_bulk_get_enable() instead of open coded 'devm_regulator_get(), regulator_enable(), regulator_disable(). Signed-off-by: Anand Moon --- drivers/usb/dwc3/dwc3-exynos.c | 49 +++------------------------------- 1 file changed, 4 insertions(+), 45 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-exynos.c index 5d365ca51771..7c77f3c69825 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,9 @@ 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 +95,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 +116,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 +169,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 +177,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 Fri Mar 1 19:38:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anand Moon X-Patchwork-Id: 778214 Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) (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 43C4F3C699; Fri, 1 Mar 2024 19:39:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709321971; cv=none; b=qr4NvaRN363syjyKMRlebR8HyPBKtXLjp1OE75r4jVK8jtTexR48nIVkmysotjaby99kZuc0uezytX/N70cpHlSde8w4yJZjFGMW2E5vlQvVpGm5Xol7yjaIymhRwm/k4i0bTYuTIQSgS/9KiM1obrtmeg6PochGatyDz+Bgy+0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709321971; c=relaxed/simple; bh=Vi7NWkc1TXRnzVWtxToE3qHIrWqGeB926dS5d87nCDg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NQAxsAmgzrImCfbxhcKq7mIgEqGSMbFB3I4XK8nmsK/HnIwEmrV4toOD/tPiVgr0lE0AzdYUxWS1gmFewRlV4HgifCidmPAOf/aAyCzT2lfHZh7BDISXdCdUm9Zxa+WXS6v0q5eMmyZM0CZWcsnVTfIzLEx+K0gQm2hwxnzN5Hk= 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=PB98IRdM; arc=none smtp.client-ip=209.85.210.176 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="PB98IRdM" Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-6e56da425b5so1950211b3a.0; Fri, 01 Mar 2024 11:39:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709321969; x=1709926769; 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=dO4lQ3DX7Qu8zJWJNpEo7HKYrGAn8GSChMZFfiOVl1U=; b=PB98IRdMSadr0X8oqT3VlC4QOcBjKPg/JNJsbPsntoXpHwqAY9yfKh9Dwrp9WVhTgF 3d6/zK01TjKto331Z4U20eavh1DgttsX894/c3cZ2BJYpUqUqG5v3BgUmbQpKhk3ThoV apacQpHEnH2feDFpvuNkJswKcW88o1omzRqRVBhCnHjt4jYZpUyOMfaxy4Gu7Kdl9XPZ TYedtM8IA7Sg+UUJ76ogbVQ2g06r3ew34TfPkU6mUUpUBEcL02I6uLYZA7+eFRrXYIyI ZG2wxS5mdk8Da2VoWqqsn0mtuVAY8PHHaPFY2A2leSphu0EI4TkV0a872N9PN1lM3QzE 5Cvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709321969; x=1709926769; 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=dO4lQ3DX7Qu8zJWJNpEo7HKYrGAn8GSChMZFfiOVl1U=; b=XNS3/lO7guDKcIY88a2S4Umeq//d5q6cI4tnAVwEDn5q2HuZVU0VRvQWU9fV4aPvoY NW9yhKlDkZzIh42Pa3NKpyA519zwFVPdudfgJTnetAn3lpJgtpcQYjUxDZP3KseLh7rv 4FXmA4AcaVq646ZLqiWP5kP8rfOnfIRhEXgJ9igV/unJKM/lnfHNRKsG6TnH0SP7h4hM 1CM/4J5hclu9jKQ9In9qtLieLAYmKMgL+5kFoY7rV3M28owa69B57lQYu6FtufCwqEFh 83Ny/5nufPJBWYHGoOasOoNxA8VFcsVuOLRhPuuUvi3dL5gEnw39d4FcCirbryFwEliD Y6iA== X-Forwarded-Encrypted: i=1; AJvYcCV0Es3jwJPKSlLLgI5NTVHC0A1xcj65pAZwNsxvWYvrC4epj+uuM3E8hzNvBBXSFBEl+XFOg4lZTqBt/+bCtEP89zF9oTfCed2YqPLpNnKOe/WrmEX9wwPFUnZLtdbmclCj4hBcvqX0BmdT3lm8J+aut5Cn78Z605CYhlTXjlz3c1oT8MKQLW15gIU= X-Gm-Message-State: AOJu0Yy2YR8H2CWGscI7rkpPbHNBCp8FVBV54tCXlukk6uL/M3iF53TA DFxFGE5l0YSCbdpQzhNaYq/z594qEndVlZho86jMKY0OMH6PZROw X-Google-Smtp-Source: AGHT+IGde4M3wivnu/XUvD5PTHizKpooiRXEH/Qb75954pFaiKEAN13Gcv1lY/BXZ4UKV5NuULoYhA== X-Received: by 2002:a17:903:41c4:b0:1d9:a2b1:8693 with SMTP id u4-20020a17090341c400b001d9a2b18693mr2982968ple.23.1709321969651; Fri, 01 Mar 2024 11:39:29 -0800 (PST) Received: from localhost.localdomain ([113.30.217.222]) by smtp.gmail.com with ESMTPSA id u8-20020a170902e5c800b001dca6d1d572sm3837474plf.63.2024.03.01.11.39.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 11:39:29 -0800 (PST) From: Anand Moon To: Thinh Nguyen , Greg Kroah-Hartman , Krzysztof Kozlowski , Alim Akhtar Cc: Anand Moon , linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 4/4] usb: dwc3: exynos: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() Date: Sat, 2 Mar 2024 01:08:11 +0530 Message-ID: <20240301193831.3346-5-linux.amoon@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240301193831.3346-1-linux.amoon@gmail.com> References: <20240301193831.3346-1-linux.amoon@gmail.com> Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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 --- drivers/usb/dwc3/dwc3-exynos.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-exynos.c index 7c77f3c69825..645a4ec0cd92 100644 --- a/drivers/usb/dwc3/dwc3-exynos.c +++ b/drivers/usb/dwc3/dwc3-exynos.c @@ -160,7 +160,6 @@ 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) { struct dwc3_exynos *exynos = dev_get_drvdata(dev); @@ -193,18 +192,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), }, };