[PATCH 2/2] spi: pxa2xx: convert to subsys_platform_driver()
From: Brian Masney
Date: Fri Nov 06 2026 - 19:33:45 EST
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.
Signed-off-by: Brian Masney <bmasney@xxxxxxxxxx>
---
drivers/spi/spi-pxa2xx-platform.c | 14 ++------------
1 file changed, 2 insertions(+), 12 deletions(-)
diff --git a/drivers/spi/spi-pxa2xx-platform.c b/drivers/spi/spi-pxa2xx-platform.c
index 849a14cd0343..2151ed168e57 100644
--- a/drivers/spi/spi-pxa2xx-platform.c
+++ b/drivers/spi/spi-pxa2xx-platform.c
@@ -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");
--
2.56.0