Skip to contentSkip to conversation

spi: convert to subsys_platform_driver()

PATCH In review Brian Masney 3 participants 6 messages Nov 7 – Nov 10

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover spi: convert to subsys_platform_driver()

Reduce boilerplate code in these drivers and convert them over to use the macro subsys_platform_driver().

---
Brian Masney (2):
spi: omap-uwire: convert to subsys_platform_driver()
spi: pxa2xx: convert to subsys_platform_driver()

 drivers/spi/spi-omap-uwire.c      | 14 +-------------
 drivers/spi/spi-pxa2xx-platform.c | 14 ++------------
 2 files changed, 3 insertions(+), 25 deletions(-)

---
base-commit: ddfe51b0a0f5dc9e415cc2c8ad8db17532dd426b
base-tree: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
change-id: 20261106-spi-subsys-32156ad80403

Best regards,

Signature · 1 line
Brian Masney <[email protected]>
#1 lore raw

PATCH 1/2 spi: omap-uwire: convert to subsys_platform_driver()

Reduce boilerplate code in this driver and convert it over to use the macro subsys_platform_driver().

---
 drivers/spi/spi-omap-uwire.c | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)
drivers/spi/spi-omap-uwire.c +1 -13
index 83e263eb6069..91bd733ca15d 100644
@@ -528,19 +528,7 @@ static struct platform_driver uwire_driver = {
 	// resume ... use ck
 };
 
-static int __init omap_uwire_init(void)
-{
-	return platform_driver_register(&uwire_driver);
-}
-
-static void __exit omap_uwire_exit(void)
-{
-	platform_driver_unregister(&uwire_driver);
-}
-
-subsys_initcall(omap_uwire_init);
-module_exit(omap_uwire_exit);
+subsys_platform_driver(uwire_driver);
 
 MODULE_DESCRIPTION("MicroWire interface driver for OMAP");
 MODULE_LICENSE("GPL");
-
Signature · 1 line
2.56.0
#2 lore raw

PATCH 2/2 spi: pxa2xx: convert to subsys_platform_driver()

In reply to Brian Masney

Reduce boilerplate code in this driver and convert it over to use the macro subsys_platform_driver().

Note that this needs to rename the driver variable to pxa2xx_spi_driver to avoid a compilation error with the macro.

---
 drivers/spi/spi-pxa2xx-platform.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)
drivers/spi/spi-pxa2xx-platform.c +2 -12
index 849a14cd0343..2151ed168e57 100644
@@ -198,7 +198,7 @@ static const struct of_device_id pxa2xx_spi_of_match[] = {
 };
 MODULE_DEVICE_TABLE(of, pxa2xx_spi_of_match);
 
-static struct platform_driver driver = {
+static struct platform_driver pxa2xx_spi_driver = {
 	.driver = {
 		.name	= "pxa2xx-spi",
 		.pm	= pm_ptr(&pxa2xx_spi_pm_ops),
@@ -209,17 +209,7 @@ static struct platform_driver driver = {
 	.remove = pxa2xx_spi_platform_remove,
 };
 
-static int __init pxa2xx_spi_init(void)
-{
-	return platform_driver_register(&driver);
-}
-subsys_initcall(pxa2xx_spi_init);
-
-static void __exit pxa2xx_spi_exit(void)
-{
-	platform_driver_unregister(&driver);
-}
-module_exit(pxa2xx_spi_exit);
+subsys_platform_driver(pxa2xx_spi_driver);
 
 MODULE_AUTHOR("Stephen Street");
 MODULE_DESCRIPTION("PXA2xx SSP SPI Controller platform driver");
Signature · 1 line
2.56.0
maintainer
#3 lore raw
In reply to Brian Masney
Quoted 2 lines · Brian Masney

Reduce boilerplate code in these drivers and convert them over to use the macro subsys_platform_driver().

This doesn't apply against current code, please check and resend.

#4 lore raw

Hi Mark,

Quoted 5 lines · Mark Brown
Quoted 2 lines · Brian Masney

Reduce boilerplate code in these drivers and convert them over to use the macro subsys_platform_driver().

This doesn't apply against current code, please check and resend.

I see that Peng Fan already beat me to this! There's nothing else to add from my series, so there will be no follow up from me.

Peng: Just a heads up that I posted patches across the tree Friday for this migrated. I think I changed everything that can be easily migrated. I suspect we may have collided in other subsystems.

Brian

#5 lore raw

Hi Brian,

Quoted 7 lines · Brian Masney

Hi Mark,

Quoted 4 lines · Mark Brown
Quoted 2 lines · Brian Masney

Reduce boilerplate code in these drivers and convert them over to use the macro subsys_platform_driver().

Quoted 8 lines
Quoted 1 line

This doesn't apply against current code, please check and resend.

I see that Peng Fan already beat me to this! There's nothing else to add from my series, so there will be no follow up from me.

Peng: Just a heads up that I posted patches across the tree Friday for this migrated. I think I changed everything that can be easily migrated. I suspect we may have collided in other subsystems.

Thanks for the heads up.

I wasn't aware of your earlier treewide conversion series. Sorry for the duplicated effort.

I generated these conversions using a Coccinelle rule and it appears to have covered most of the straightforward subsys_platform_driver() conversions across the tree. If there are any overlaps in other subsystems, I can the corresponding parts from my series.

Thanks
Peng

Quoted 5 lines

Brian