linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI: host-generic: Convert to platform remove callback returning void
@ 2023-10-20  9:21 Uwe Kleine-König
  2023-10-23 17:29 ` Will Deacon
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Uwe Kleine-König @ 2023-10-20  9:21 UTC (permalink / raw)
  To: Will Deacon, Krzysztof Wilczyński, Lorenzo Pieralisi, Bjorn Helgaas
  Cc: Rob Herring, linux-pci, kernel

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.

pci_host_common_remove() returned zero unconditionally. With that
converted to return void instead, the generic pci host driver can be
switched to .remove_new trivially.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/pci/controller/pci-host-common.c  | 4 +---
 drivers/pci/controller/pci-host-generic.c | 2 +-
 include/linux/pci-ecam.h                  | 2 +-
 3 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/pci/controller/pci-host-common.c b/drivers/pci/controller/pci-host-common.c
index 6be3266cd7b5..45b71806182d 100644
--- a/drivers/pci/controller/pci-host-common.c
+++ b/drivers/pci/controller/pci-host-common.c
@@ -85,7 +85,7 @@ int pci_host_common_probe(struct platform_device *pdev)
 }
 EXPORT_SYMBOL_GPL(pci_host_common_probe);
 
-int pci_host_common_remove(struct platform_device *pdev)
+void pci_host_common_remove(struct platform_device *pdev)
 {
 	struct pci_host_bridge *bridge = platform_get_drvdata(pdev);
 
@@ -93,8 +93,6 @@ int pci_host_common_remove(struct platform_device *pdev)
 	pci_stop_root_bus(bridge->bus);
 	pci_remove_root_bus(bridge->bus);
 	pci_unlock_rescan_remove();
-
-	return 0;
 }
 EXPORT_SYMBOL_GPL(pci_host_common_remove);
 
diff --git a/drivers/pci/controller/pci-host-generic.c b/drivers/pci/controller/pci-host-generic.c
index 63865aeb636b..41cb6a057f6e 100644
--- a/drivers/pci/controller/pci-host-generic.c
+++ b/drivers/pci/controller/pci-host-generic.c
@@ -82,7 +82,7 @@ static struct platform_driver gen_pci_driver = {
 		.of_match_table = gen_pci_of_match,
 	},
 	.probe = pci_host_common_probe,
-	.remove = pci_host_common_remove,
+	.remove_new = pci_host_common_remove,
 };
 module_platform_driver(gen_pci_driver);
 
diff --git a/include/linux/pci-ecam.h b/include/linux/pci-ecam.h
index 6b1301e2498e..3a4860bd2758 100644
--- a/include/linux/pci-ecam.h
+++ b/include/linux/pci-ecam.h
@@ -93,6 +93,6 @@ extern const struct pci_ecam_ops loongson_pci_ecam_ops; /* Loongson PCIe */
 #if IS_ENABLED(CONFIG_PCI_HOST_COMMON)
 /* for DT-based PCI controllers that support ECAM */
 int pci_host_common_probe(struct platform_device *pdev);
-int pci_host_common_remove(struct platform_device *pdev);
+void pci_host_common_remove(struct platform_device *pdev);
 #endif
 #endif

base-commit: 2030579113a1b1b5bfd7ff24c0852847836d8fd1
-- 
2.40.0.353.g56adddaa06d3


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] PCI: host-generic: Convert to platform remove callback returning void
  2023-10-20  9:21 [PATCH] PCI: host-generic: Convert to platform remove callback returning void Uwe Kleine-König
@ 2023-10-23 17:29 ` Will Deacon
  2023-11-20 21:22 ` Uwe Kleine-König
  2023-11-20 21:56 ` Bjorn Helgaas
  2 siblings, 0 replies; 10+ messages in thread
From: Will Deacon @ 2023-10-23 17:29 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Krzysztof Wilczyński, Lorenzo Pieralisi, Bjorn Helgaas,
	Rob Herring, linux-pci, kernel

On Fri, Oct 20, 2023 at 11:21:07AM +0200, Uwe Kleine-König wrote:
> 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.
> 
> pci_host_common_remove() returned zero unconditionally. With that
> converted to return void instead, the generic pci host driver can be
> switched to .remove_new trivially.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
>  drivers/pci/controller/pci-host-common.c  | 4 +---
>  drivers/pci/controller/pci-host-generic.c | 2 +-
>  include/linux/pci-ecam.h                  | 2 +-
>  3 files changed, 3 insertions(+), 5 deletions(-)

Acked-by: Will Deacon <will@kernel.org>

Will

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] PCI: host-generic: Convert to platform remove callback returning void
  2023-10-20  9:21 [PATCH] PCI: host-generic: Convert to platform remove callback returning void Uwe Kleine-König
  2023-10-23 17:29 ` Will Deacon
@ 2023-11-20 21:22 ` Uwe Kleine-König
  2023-11-20 21:30   ` Bjorn Helgaas
  2023-11-20 21:56 ` Bjorn Helgaas
  2 siblings, 1 reply; 10+ messages in thread
From: Uwe Kleine-König @ 2023-11-20 21:22 UTC (permalink / raw)
  To: Will Deacon, Krzysztof Wilczyński, Lorenzo Pieralisi, Bjorn Helgaas
  Cc: Rob Herring, kernel, linux-pci

[-- Attachment #1: Type: text/plain, Size: 1020 bytes --]

Hello,

On Fri, Oct 20, 2023 at 11:21:07AM +0200, Uwe Kleine-König wrote:
> 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.
> 
> pci_host_common_remove() returned zero unconditionally. With that
> converted to return void instead, the generic pci host driver can be
> switched to .remove_new trivially.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

who feels responsible to apply this patch?

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] PCI: host-generic: Convert to platform remove callback returning void
  2023-11-20 21:22 ` Uwe Kleine-König
@ 2023-11-20 21:30   ` Bjorn Helgaas
  2023-11-20 21:46     ` Uwe Kleine-König
  0 siblings, 1 reply; 10+ messages in thread
From: Bjorn Helgaas @ 2023-11-20 21:30 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Will Deacon, Krzysztof Wilczyński, Lorenzo Pieralisi,
	Bjorn Helgaas, Rob Herring, kernel, linux-pci

On Mon, Nov 20, 2023 at 10:22:24PM +0100, Uwe Kleine-König wrote:
> Hello,
> 
> On Fri, Oct 20, 2023 at 11:21:07AM +0200, Uwe Kleine-König wrote:
> > 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.
> > 
> > pci_host_common_remove() returned zero unconditionally. With that
> > converted to return void instead, the generic pci host driver can be
> > switched to .remove_new trivially.
> > 
> > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> 
> who feels responsible to apply this patch?

If you're ready to rename .remove_new() back to .remove(), you can
include this as part of that series with my ack:

Acked-by: Bjorn Helgaas <bhelgaas@google.com>

Or we can take it via the PCI tree for v6.8.

Bjorn

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] PCI: host-generic: Convert to platform remove callback returning void
  2023-11-20 21:30   ` Bjorn Helgaas
@ 2023-11-20 21:46     ` Uwe Kleine-König
  0 siblings, 0 replies; 10+ messages in thread
From: Uwe Kleine-König @ 2023-11-20 21:46 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Krzysztof Wilczyński, Rob Herring, linux-pci,
	Lorenzo Pieralisi, kernel, Bjorn Helgaas, Will Deacon

[-- Attachment #1: Type: text/plain, Size: 1744 bytes --]

Hello Bjorn,

On Mon, Nov 20, 2023 at 03:30:07PM -0600, Bjorn Helgaas wrote:
> On Mon, Nov 20, 2023 at 10:22:24PM +0100, Uwe Kleine-König wrote:
> > On Fri, Oct 20, 2023 at 11:21:07AM +0200, Uwe Kleine-König wrote:
> > > 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.
> > > 
> > > pci_host_common_remove() returned zero unconditionally. With that
> > > converted to return void instead, the generic pci host driver can be
> > > switched to .remove_new trivially.
> > > 
> > > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> > 
> > who feels responsible to apply this patch?
> 
> If you're ready to rename .remove_new() back to .remove(), you can
> include this as part of that series with my ack:
> 
> Acked-by: Bjorn Helgaas <bhelgaas@google.com>
> 
> Or we can take it via the PCI tree for v6.8.

The idea is that all drivers are converted to .remove_new() before
changing .remove() to return void. This way the commit changing struct
platform_driver doesn't has to touch the 1000+ platform drivers. So if
you take this patch via pci in the next merge window, that would be
good.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] PCI: host-generic: Convert to platform remove callback returning void
  2023-10-20  9:21 [PATCH] PCI: host-generic: Convert to platform remove callback returning void Uwe Kleine-König
  2023-10-23 17:29 ` Will Deacon
  2023-11-20 21:22 ` Uwe Kleine-König
@ 2023-11-20 21:56 ` Bjorn Helgaas
  2023-11-23 17:12   ` Uwe Kleine-König
  2 siblings, 1 reply; 10+ messages in thread
From: Bjorn Helgaas @ 2023-11-20 21:56 UTC (permalink / raw)
  To: Will Deacon, Krzysztof Wilczyński, Lorenzo Pieralisi,
	Uwe Kleine-König
  Cc: Bjorn Helgaas, Rob Herring, linux-pci, kernel

From: Bjorn Helgaas <bhelgaas@google.com>


On Fri, 20 Oct 2023 11:21:07 +0200, Uwe Kleine-König wrote:
> 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.
> 
> [...]

Applied to "enumeration" for v6.8, thanks!

[1/1] PCI: host-generic: Convert to platform remove callback returning void
      commit: d9dcdb4531fe39ce48919ef8c2c9369ee49f3ad2

Best regards,
-- 
Bjorn Helgaas <bhelgaas@google.com>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] PCI: host-generic: Convert to platform remove callback returning void
  2023-11-20 21:56 ` Bjorn Helgaas
@ 2023-11-23 17:12   ` Uwe Kleine-König
  2023-11-24  3:25     ` Bjorn Helgaas
  0 siblings, 1 reply; 10+ messages in thread
From: Uwe Kleine-König @ 2023-11-23 17:12 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Will Deacon, Krzysztof Wilczyński, Lorenzo Pieralisi,
	Bjorn Helgaas, Rob Herring, kernel, linux-pci

[-- Attachment #1: Type: text/plain, Size: 1111 bytes --]

On Mon, Nov 20, 2023 at 03:56:18PM -0600, Bjorn Helgaas wrote:
> From: Bjorn Helgaas <bhelgaas@google.com>
> 
> 
> On Fri, 20 Oct 2023 11:21:07 +0200, Uwe Kleine-König wrote:
> > 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.
> > 
> > [...]
> 
> Applied to "enumeration" for v6.8, thanks!
> 
> [1/1] PCI: host-generic: Convert to platform remove callback returning void
>       commit: d9dcdb4531fe39ce48919ef8c2c9369ee49f3ad2

Thanks! This branch isn't included in next. Is this on purpose?

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] PCI: host-generic: Convert to platform remove callback returning void
  2023-11-23 17:12   ` Uwe Kleine-König
@ 2023-11-24  3:25     ` Bjorn Helgaas
  2023-11-24  4:16       ` Philip Li
  2023-11-24  7:07       ` Uwe Kleine-König
  0 siblings, 2 replies; 10+ messages in thread
From: Bjorn Helgaas @ 2023-11-24  3:25 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Will Deacon, Krzysztof Wilczyński, Lorenzo Pieralisi,
	Bjorn Helgaas, Rob Herring, kernel, linux-pci, lkp

[+to lkp]

On Thu, Nov 23, 2023 at 06:12:36PM +0100, Uwe Kleine-König wrote:
> On Mon, Nov 20, 2023 at 03:56:18PM -0600, Bjorn Helgaas wrote:
> > From: Bjorn Helgaas <bhelgaas@google.com>
> > On Fri, 20 Oct 2023 11:21:07 +0200, Uwe Kleine-König wrote:
> > > 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.
> > > 
> > > [...]
> > 
> > Applied to "enumeration" for v6.8, thanks!
> > 
> > [1/1] PCI: host-generic: Convert to platform remove callback returning void
> >       commit: d9dcdb4531fe39ce48919ef8c2c9369ee49f3ad2
> 
> Thanks! This branch isn't included in next. Is this on purpose?

To reduce the workload of the folks maintaining "next", I wait for the
0-day bot to build test a branch before merging it into the PCI "next"
branch.

That usually takes a couple days after I push a branch to the
kernel.org repo.  I have these branches that are currently waiting to
be put into next:

  ecam            pushed 11/20     bot response 11/22
  resource        pushed 11/20     no bot response yet
  enumeration     pushed 11/20     no bot response yet
  p2pdma          pushed 11/20     no bot response yet
  switchtec       pushed 11/22     no bot response yet

Not sure if the 0-day bot is slower than usual right now, but I cc'd
the LKP folks in case something is wrong.

Bjorn

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] PCI: host-generic: Convert to platform remove callback returning void
  2023-11-24  3:25     ` Bjorn Helgaas
@ 2023-11-24  4:16       ` Philip Li
  2023-11-24  7:07       ` Uwe Kleine-König
  1 sibling, 0 replies; 10+ messages in thread
From: Philip Li @ 2023-11-24  4:16 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Uwe Kleine-König, Will Deacon, Krzysztof Wilczyński,
	Lorenzo Pieralisi, Bjorn Helgaas, Rob Herring, kernel, linux-pci,
	lkp

On Thu, Nov 23, 2023 at 09:25:35PM -0600, Bjorn Helgaas wrote:
> [+to lkp]
> 
> On Thu, Nov 23, 2023 at 06:12:36PM +0100, Uwe Kleine-König wrote:
> > On Mon, Nov 20, 2023 at 03:56:18PM -0600, Bjorn Helgaas wrote:
> > > From: Bjorn Helgaas <bhelgaas@google.com>
> > > On Fri, 20 Oct 2023 11:21:07 +0200, Uwe Kleine-König wrote:
> > > > 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.
> > > > 
> > > > [...]
> > > 
> > > Applied to "enumeration" for v6.8, thanks!
> > > 
> > > [1/1] PCI: host-generic: Convert to platform remove callback returning void
> > >       commit: d9dcdb4531fe39ce48919ef8c2c9369ee49f3ad2
> > 
> > Thanks! This branch isn't included in next. Is this on purpose?
> 
> To reduce the workload of the folks maintaining "next", I wait for the
> 0-day bot to build test a branch before merging it into the PCI "next"
> branch.
> 
> That usually takes a couple days after I push a branch to the
> kernel.org repo.  I have these branches that are currently waiting to
> be put into next:
> 
>   ecam            pushed 11/20     bot response 11/22
>   resource        pushed 11/20     no bot response yet
>   enumeration     pushed 11/20     no bot response yet
>   p2pdma          pushed 11/20     no bot response yet
>   switchtec       pushed 11/22     no bot response yet
> 
> Not sure if the 0-day bot is slower than usual right now, but I cc'd
> the LKP folks in case something is wrong.

Sorry about the recent slowness, Bjorn. This is our side problem, we met some
issues and the whole cluster can't achieve its usual utilization. We are still
working on resolving the issues, the report time would be delayed, though hard
to tell right now the accurate time.

We will check the status of these branches, if they are in low risk, we will
send our the current test status.

> 
> Bjorn
> 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] PCI: host-generic: Convert to platform remove callback returning void
  2023-11-24  3:25     ` Bjorn Helgaas
  2023-11-24  4:16       ` Philip Li
@ 2023-11-24  7:07       ` Uwe Kleine-König
  1 sibling, 0 replies; 10+ messages in thread
From: Uwe Kleine-König @ 2023-11-24  7:07 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Krzysztof Wilczyński, lkp, Rob Herring, linux-pci,
	Lorenzo Pieralisi, kernel, Bjorn Helgaas, Will Deacon

[-- Attachment #1: Type: text/plain, Size: 948 bytes --]

Hello Bjorn,

On Thu, Nov 23, 2023 at 09:25:35PM -0600, Bjorn Helgaas wrote:
> On Thu, Nov 23, 2023 at 06:12:36PM +0100, Uwe Kleine-König wrote:
> > On Mon, Nov 20, 2023 at 03:56:18PM -0600, Bjorn Helgaas wrote:
> > > Applied to "enumeration" for v6.8, thanks!
> > > 
> > > [1/1] PCI: host-generic: Convert to platform remove callback returning void
> > >       commit: d9dcdb4531fe39ce48919ef8c2c9369ee49f3ad2
> > 
> > Thanks! This branch isn't included in next. Is this on purpose?
> 
> To reduce the workload of the folks maintaining "next", I wait for the
> 0-day bot to build test a branch before merging it into the PCI "next"
> branch.

If this isn't a mistake (or a hint to me that there are problems with
the patch) everything is fine on my side.

Thanks
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-11-24  7:07 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-20  9:21 [PATCH] PCI: host-generic: Convert to platform remove callback returning void Uwe Kleine-König
2023-10-23 17:29 ` Will Deacon
2023-11-20 21:22 ` Uwe Kleine-König
2023-11-20 21:30   ` Bjorn Helgaas
2023-11-20 21:46     ` Uwe Kleine-König
2023-11-20 21:56 ` Bjorn Helgaas
2023-11-23 17:12   ` Uwe Kleine-König
2023-11-24  3:25     ` Bjorn Helgaas
2023-11-24  4:16       ` Philip Li
2023-11-24  7:07       ` Uwe Kleine-König

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).