All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: "Lorenzo Pieralisi" <lpieralisi@kernel.org>,
	"Krzysztof Wilczyński" <kw@linux.com>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Shawn Guo" <shawn.guo@linaro.org>,
	"Rahul Tanwar" <rtanwar@maxlinear.com>,
	"Manivannan Sadhasivam" <mani@kernel.org>,
	"Thierry Reding" <thierry.reding@gmail.com>,
	"Jonathan Hunter" <jonathanh@nvidia.com>,
	"Serge Semin" <Sergey.Semin@baikalelectronics.ru>,
	"Vidya Sagar" <vidyas@nvidia.com>,
	"Jisheng Zhang" <jszhang@kernel.org>,
	"Miaoqian Lin" <linmq006@gmail.com>
Cc: Rob Herring <robh@kernel.org>,
	linux-pci@vger.kernel.org, kernel@pengutronix.de,
	linux-arm-msm@vger.kernel.org, linux-tegra@vger.kernel.org
Subject: [PATCH 06/15] PCI: dwc/*: Convert to platform remove callback returning void
Date: Tue, 21 Mar 2023 20:31:59 +0100	[thread overview]
Message-ID: <20230321193208.366561-7-u.kleine-koenig@pengutronix.de> (raw)
In-Reply-To: <20230321193208.366561-1-u.kleine-koenig@pengutronix.de>

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is (mostly) ignored
and this typically results in resource leaks. To improve here there is a
quest to make the remove callback return void. In the first step of this
quest all drivers are converted to .remove_new() which already returns
void.

Trivially convert the dwc drivers from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/pci/controller/dwc/pcie-bt1.c      | 6 ++----
 drivers/pci/controller/dwc/pcie-histb.c    | 6 ++----
 drivers/pci/controller/dwc/pcie-intel-gw.c | 6 ++----
 drivers/pci/controller/dwc/pcie-qcom-ep.c  | 8 +++-----
 drivers/pci/controller/dwc/pcie-tegra194.c | 8 +++-----
 5 files changed, 12 insertions(+), 22 deletions(-)

diff --git a/drivers/pci/controller/dwc/pcie-bt1.c b/drivers/pci/controller/dwc/pcie-bt1.c
index 95a723a6fd46..17e696797ff5 100644
--- a/drivers/pci/controller/dwc/pcie-bt1.c
+++ b/drivers/pci/controller/dwc/pcie-bt1.c
@@ -617,13 +617,11 @@ static int bt1_pcie_probe(struct platform_device *pdev)
 	return bt1_pcie_add_port(btpci);
 }
 
-static int bt1_pcie_remove(struct platform_device *pdev)
+static void bt1_pcie_remove(struct platform_device *pdev)
 {
 	struct bt1_pcie *btpci = platform_get_drvdata(pdev);
 
 	bt1_pcie_del_port(btpci);
-
-	return 0;
 }
 
 static const struct of_device_id bt1_pcie_of_match[] = {
@@ -634,7 +632,7 @@ MODULE_DEVICE_TABLE(of, bt1_pcie_of_match);
 
 static struct platform_driver bt1_pcie_driver = {
 	.probe = bt1_pcie_probe,
-	.remove = bt1_pcie_remove,
+	.remove_new = bt1_pcie_remove,
 	.driver = {
 		.name	= "bt1-pcie",
 		.of_match_table = bt1_pcie_of_match,
diff --git a/drivers/pci/controller/dwc/pcie-histb.c b/drivers/pci/controller/dwc/pcie-histb.c
index 927ae05dc920..fd484cc7c481 100644
--- a/drivers/pci/controller/dwc/pcie-histb.c
+++ b/drivers/pci/controller/dwc/pcie-histb.c
@@ -421,7 +421,7 @@ static int histb_pcie_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int histb_pcie_remove(struct platform_device *pdev)
+static void histb_pcie_remove(struct platform_device *pdev)
 {
 	struct histb_pcie *hipcie = platform_get_drvdata(pdev);
 
@@ -429,8 +429,6 @@ static int histb_pcie_remove(struct platform_device *pdev)
 
 	if (hipcie->phy)
 		phy_exit(hipcie->phy);
-
-	return 0;
 }
 
 static const struct of_device_id histb_pcie_of_match[] = {
@@ -441,7 +439,7 @@ MODULE_DEVICE_TABLE(of, histb_pcie_of_match);
 
 static struct platform_driver histb_pcie_platform_driver = {
 	.probe	= histb_pcie_probe,
-	.remove	= histb_pcie_remove,
+	.remove_new = histb_pcie_remove,
 	.driver = {
 		.name = "histb-pcie",
 		.of_match_table = histb_pcie_of_match,
diff --git a/drivers/pci/controller/dwc/pcie-intel-gw.c b/drivers/pci/controller/dwc/pcie-intel-gw.c
index 333c33d98a70..9c7caed9e706 100644
--- a/drivers/pci/controller/dwc/pcie-intel-gw.c
+++ b/drivers/pci/controller/dwc/pcie-intel-gw.c
@@ -340,15 +340,13 @@ static void __intel_pcie_remove(struct intel_pcie *pcie)
 	phy_exit(pcie->phy);
 }
 
-static int intel_pcie_remove(struct platform_device *pdev)
+static void intel_pcie_remove(struct platform_device *pdev)
 {
 	struct intel_pcie *pcie = platform_get_drvdata(pdev);
 	struct dw_pcie_rp *pp = &pcie->pci.pp;
 
 	dw_pcie_host_deinit(pp);
 	__intel_pcie_remove(pcie);
-
-	return 0;
 }
 
 static int intel_pcie_suspend_noirq(struct device *dev)
@@ -443,7 +441,7 @@ static const struct of_device_id of_intel_pcie_match[] = {
 
 static struct platform_driver intel_pcie_driver = {
 	.probe = intel_pcie_probe,
-	.remove = intel_pcie_remove,
+	.remove_new = intel_pcie_remove,
 	.driver = {
 		.name = "intel-gw-pcie",
 		.of_match_table = of_intel_pcie_match,
diff --git a/drivers/pci/controller/dwc/pcie-qcom-ep.c b/drivers/pci/controller/dwc/pcie-qcom-ep.c
index 19b32839ea26..3e5f1b637aeb 100644
--- a/drivers/pci/controller/dwc/pcie-qcom-ep.c
+++ b/drivers/pci/controller/dwc/pcie-qcom-ep.c
@@ -784,7 +784,7 @@ static int qcom_pcie_ep_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int qcom_pcie_ep_remove(struct platform_device *pdev)
+static void qcom_pcie_ep_remove(struct platform_device *pdev)
 {
 	struct qcom_pcie_ep *pcie_ep = platform_get_drvdata(pdev);
 
@@ -794,11 +794,9 @@ static int qcom_pcie_ep_remove(struct platform_device *pdev)
 	debugfs_remove_recursive(pcie_ep->debugfs);
 
 	if (pcie_ep->link_status == QCOM_PCIE_EP_LINK_DISABLED)
-		return 0;
+		return;
 
 	qcom_pcie_disable_resources(pcie_ep);
-
-	return 0;
 }
 
 static const struct of_device_id qcom_pcie_ep_match[] = {
@@ -810,7 +808,7 @@ MODULE_DEVICE_TABLE(of, qcom_pcie_ep_match);
 
 static struct platform_driver qcom_pcie_ep_driver = {
 	.probe	= qcom_pcie_ep_probe,
-	.remove = qcom_pcie_ep_remove,
+	.remove_new = qcom_pcie_ep_remove,
 	.driver	= {
 		.name = "qcom-pcie-ep",
 		.of_match_table	= qcom_pcie_ep_match,
diff --git a/drivers/pci/controller/dwc/pcie-tegra194.c b/drivers/pci/controller/dwc/pcie-tegra194.c
index 09825b4a075e..f373a00e2ea3 100644
--- a/drivers/pci/controller/dwc/pcie-tegra194.c
+++ b/drivers/pci/controller/dwc/pcie-tegra194.c
@@ -2268,13 +2268,13 @@ static int tegra_pcie_dw_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int tegra_pcie_dw_remove(struct platform_device *pdev)
+static void tegra_pcie_dw_remove(struct platform_device *pdev)
 {
 	struct tegra_pcie_dw *pcie = platform_get_drvdata(pdev);
 
 	if (pcie->of_data->mode == DW_PCIE_RC_TYPE) {
 		if (!pcie->link_state)
-			return 0;
+			return;
 
 		debugfs_remove_recursive(pcie->debugfs);
 		tegra_pcie_deinit_controller(pcie);
@@ -2288,8 +2288,6 @@ static int tegra_pcie_dw_remove(struct platform_device *pdev)
 	tegra_bpmp_put(pcie->bpmp);
 	if (pcie->pex_refclk_sel_gpiod)
 		gpiod_set_value(pcie->pex_refclk_sel_gpiod, 0);
-
-	return 0;
 }
 
 static int tegra_pcie_dw_suspend_late(struct device *dev)
@@ -2483,7 +2481,7 @@ static const struct dev_pm_ops tegra_pcie_dw_pm_ops = {
 
 static struct platform_driver tegra_pcie_dw_driver = {
 	.probe = tegra_pcie_dw_probe,
-	.remove = tegra_pcie_dw_remove,
+	.remove_new = tegra_pcie_dw_remove,
 	.shutdown = tegra_pcie_dw_shutdown,
 	.driver = {
 		.name	= "tegra194-pcie",
-- 
2.39.2


  parent reply	other threads:[~2023-03-21 19:34 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-21 19:31 [PATCH 00/15] PCI: Convert to platform remove callback returning void Uwe Kleine-König
2023-03-21 19:31 ` Uwe Kleine-König
2023-03-21 19:31 ` Uwe Kleine-König
2023-03-21 19:31 ` [PATCH 01/15] PCI: aardvark: " Uwe Kleine-König
2023-03-21 19:31   ` Uwe Kleine-König
2023-03-21 19:36   ` Pali Rohár
2023-03-21 19:36     ` Pali Rohár
2023-03-21 21:08     ` Uwe Kleine-König
2023-03-21 21:08       ` Uwe Kleine-König
2023-03-21 19:31 ` [PATCH 02/15] PCI: altera: " Uwe Kleine-König
2023-03-21 19:31 ` [PATCH 03/15] PCI: altera-msi: " Uwe Kleine-König
2023-03-21 19:31 ` [PATCH 04/15] PCI: brcmstb: " Uwe Kleine-König
2023-03-21 19:31   ` Uwe Kleine-König
2023-03-21 21:37   ` Florian Fainelli
2023-03-21 21:37     ` Florian Fainelli
2023-03-21 19:31 ` [PATCH 05/15] PCI: cadence/j721e: " Uwe Kleine-König
2023-03-21 19:31   ` Uwe Kleine-König
2023-03-21 19:31 ` Uwe Kleine-König [this message]
2023-03-22 18:06   ` [PATCH 06/15] PCI: dwc/*: " Serge Semin
2023-03-21 19:32 ` [PATCH 07/15] PCI: hisi-error: " Uwe Kleine-König
2023-03-21 19:32 ` [PATCH 08/15] PCI: iproc: " Uwe Kleine-König
2023-03-21 19:32   ` Uwe Kleine-König
2023-03-21 21:37   ` Florian Fainelli
2023-03-21 21:37     ` Florian Fainelli
2023-03-21 19:32 ` [PATCH 09/15] PCI: mediatek: " Uwe Kleine-König
2023-03-21 19:32   ` Uwe Kleine-König
2023-03-21 19:32 ` [PATCH 10/15] PCI: mediatek-gen3: " Uwe Kleine-König
2023-03-21 19:32   ` Uwe Kleine-König
2023-03-21 19:32 ` [PATCH 11/15] PCI: mt7621: " Uwe Kleine-König
2023-03-21 19:32   ` Uwe Kleine-König
2023-03-22  6:40   ` Sergio Paracuellos
2023-03-22  6:40     ` Sergio Paracuellos
2023-03-21 19:32 ` [PATCH 12/15] PCI: mvebu: " Uwe Kleine-König
2023-03-21 19:32   ` Uwe Kleine-König
2023-03-21 19:32 ` [PATCH 13/15] PCI: rockchip-host: " Uwe Kleine-König
2023-03-21 19:32   ` Uwe Kleine-König
2023-03-21 19:32   ` Uwe Kleine-König
2023-03-21 19:32 ` [PATCH 14/15] PCI: tegra: " Uwe Kleine-König
2023-03-21 19:32 ` [PATCH 15/15] PCI: xgene-msi: " Uwe Kleine-König
2023-03-21 19:32   ` Uwe Kleine-König
2023-05-30 14:07 ` [PATCH 00/15] PCI: " Uwe Kleine-König
2023-05-30 14:07   ` Uwe Kleine-König
2023-05-30 14:07   ` Uwe Kleine-König
2023-06-02 21:37   ` Bjorn Helgaas
2023-06-02 21:37     ` Bjorn Helgaas
2023-06-02 21:37     ` Bjorn Helgaas
2023-06-06 16:02     ` Uwe Kleine-König
2023-06-06 16:02       ` Uwe Kleine-König
2023-06-06 16:02       ` Uwe Kleine-König
2023-06-24 14:23       ` Krzysztof Wilczyński
2023-06-24 14:23         ` Krzysztof Wilczyński
2023-06-24 14:23         ` Krzysztof Wilczyński
2023-06-11 13:24     ` Pali Rohár
2023-06-11 13:24       ` Pali Rohár
2023-06-12 16:19       ` Bjorn Helgaas
2023-06-12 16:19         ` Bjorn Helgaas
2023-06-12 16:19         ` Bjorn Helgaas
2023-06-12 18:17         ` Pali Rohár
2023-06-12 18:17           ` Pali Rohár
2023-06-12 18:17           ` Pali Rohár
2023-06-24 14:19 ` Krzysztof Wilczyński
2023-06-24 14:19   ` Krzysztof Wilczyński
2023-06-24 14:19   ` Krzysztof Wilczyński

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230321193208.366561-7-u.kleine-koenig@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=Sergey.Semin@baikalelectronics.ru \
    --cc=bhelgaas@google.com \
    --cc=jonathanh@nvidia.com \
    --cc=jszhang@kernel.org \
    --cc=kernel@pengutronix.de \
    --cc=kw@linux.com \
    --cc=linmq006@gmail.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=mani@kernel.org \
    --cc=robh@kernel.org \
    --cc=rtanwar@maxlinear.com \
    --cc=shawn.guo@linaro.org \
    --cc=thierry.reding@gmail.com \
    --cc=vidyas@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.