mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] clocksource: convert to subsys_platform_driver()
@ 2026-11-06  1:32 Brian Masney
  0 siblings, 0 replies; 2+ messages in thread
From: Brian Masney @ 2026-11-06  1:32 UTC (permalink / raw)
  To: Daniel Lezcano, Thomas Gleixner; +Cc: linux-kernel, Brian Masney

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

Signed-off-by: Brian Masney <bmasney@redhat.com>
---
 drivers/clocksource/em_sti.c  | 13 +------------
 drivers/clocksource/sh_cmt.c  | 13 +------------
 drivers/clocksource/sh_mtu2.c | 13 +------------
 drivers/clocksource/sh_tmu.c  | 13 +------------
 4 files changed, 4 insertions(+), 48 deletions(-)

diff --git a/drivers/clocksource/em_sti.c b/drivers/clocksource/em_sti.c
index 73a3357d173d..b35c32fbc539 100644
--- a/drivers/clocksource/em_sti.c
+++ b/drivers/clocksource/em_sti.c
@@ -346,18 +346,7 @@ static struct platform_driver em_sti_device_driver = {
 	}
 };
 
-static int __init em_sti_init(void)
-{
-	return platform_driver_register(&em_sti_device_driver);
-}
-
-static void __exit em_sti_exit(void)
-{
-	platform_driver_unregister(&em_sti_device_driver);
-}
-
-subsys_initcall(em_sti_init);
-module_exit(em_sti_exit);
+subsys_platform_driver(em_sti_device_driver);
 
 MODULE_AUTHOR("Magnus Damm");
 MODULE_DESCRIPTION("Renesas Emma Mobile STI Timer Driver");
diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c
index 7977507f6ce3..0bca806f8405 100644
--- a/drivers/clocksource/sh_cmt.c
+++ b/drivers/clocksource/sh_cmt.c
@@ -1168,22 +1168,11 @@ static struct platform_driver sh_cmt_device_driver = {
 	.id_table	= sh_cmt_id_table,
 };
 
-static int __init sh_cmt_init(void)
-{
-	return platform_driver_register(&sh_cmt_device_driver);
-}
-
-static void __exit sh_cmt_exit(void)
-{
-	platform_driver_unregister(&sh_cmt_device_driver);
-}
+subsys_platform_driver(sh_cmt_device_driver);
 
 #ifdef CONFIG_SUPERH
 sh_early_platform_init("earlytimer", &sh_cmt_device_driver);
 #endif
 
-subsys_initcall(sh_cmt_init);
-module_exit(sh_cmt_exit);
-
 MODULE_AUTHOR("Magnus Damm");
 MODULE_DESCRIPTION("SuperH CMT Timer Driver");
diff --git a/drivers/clocksource/sh_mtu2.c b/drivers/clocksource/sh_mtu2.c
index 3aca86d6a2d4..a45bf9406581 100644
--- a/drivers/clocksource/sh_mtu2.c
+++ b/drivers/clocksource/sh_mtu2.c
@@ -505,22 +505,11 @@ static struct platform_driver sh_mtu2_device_driver = {
 	.id_table	= sh_mtu2_id_table,
 };
 
-static int __init sh_mtu2_init(void)
-{
-	return platform_driver_register(&sh_mtu2_device_driver);
-}
-
-static void __exit sh_mtu2_exit(void)
-{
-	platform_driver_unregister(&sh_mtu2_device_driver);
-}
+subsys_platform_driver(sh_mtu2_device_driver);
 
 #ifdef CONFIG_SUPERH
 sh_early_platform_init("earlytimer", &sh_mtu2_device_driver);
 #endif
 
-subsys_initcall(sh_mtu2_init);
-module_exit(sh_mtu2_exit);
-
 MODULE_AUTHOR("Magnus Damm");
 MODULE_DESCRIPTION("SuperH MTU2 Timer Driver");
diff --git a/drivers/clocksource/sh_tmu.c b/drivers/clocksource/sh_tmu.c
index 8b3cfa6727bd..38bfbe8d899d 100644
--- a/drivers/clocksource/sh_tmu.c
+++ b/drivers/clocksource/sh_tmu.c
@@ -636,22 +636,11 @@ static struct platform_driver sh_tmu_device_driver = {
 	.id_table	= sh_tmu_id_table,
 };
 
-static int __init sh_tmu_init(void)
-{
-	return platform_driver_register(&sh_tmu_device_driver);
-}
-
-static void __exit sh_tmu_exit(void)
-{
-	platform_driver_unregister(&sh_tmu_device_driver);
-}
+subsys_platform_driver(sh_tmu_device_driver);
 
 #ifdef CONFIG_SUPERH
 sh_early_platform_init("earlytimer", &sh_tmu_device_driver);
 #endif
 
-subsys_initcall(sh_tmu_init);
-module_exit(sh_tmu_exit);
-
 MODULE_AUTHOR("Magnus Damm");
 MODULE_DESCRIPTION("SuperH TMU Timer Driver");

---
base-commit: ddfe51b0a0f5dc9e415cc2c8ad8db17532dd426b
base-tree: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
change-id: 20261105-clocksource-subsys-1eaa83a476f0

Best regards,
--  
Brian Masney <bmasney@redhat.com>


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

* [PATCH] clocksource: Convert to subsys_platform_driver()
@ 2026-11-04 11:32 Peng Fan (OSS)
  0 siblings, 0 replies; 2+ messages in thread
From: Peng Fan (OSS) @ 2026-11-04 11:32 UTC (permalink / raw)
  To: Daniel Lezcano, Thomas Gleixner; +Cc: linux-kernel

From: Peng Fan <peng.fan@nxp.com>

Replace the open-coded subsys_initcall()/module_exit() platform driver
registration with subsys_platform_driver().

No functional change.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 drivers/clocksource/em_sti.c  | 13 +------------
 drivers/clocksource/sh_cmt.c  | 13 +------------
 drivers/clocksource/sh_mtu2.c | 13 +------------
 drivers/clocksource/sh_tmu.c  | 13 +------------
 4 files changed, 4 insertions(+), 48 deletions(-)

diff --git a/drivers/clocksource/em_sti.c b/drivers/clocksource/em_sti.c
index 73a3357d173d..b35c32fbc539 100644
--- a/drivers/clocksource/em_sti.c
+++ b/drivers/clocksource/em_sti.c
@@ -346,18 +346,7 @@ static struct platform_driver em_sti_device_driver = {
 	}
 };
 
-static int __init em_sti_init(void)
-{
-	return platform_driver_register(&em_sti_device_driver);
-}
-
-static void __exit em_sti_exit(void)
-{
-	platform_driver_unregister(&em_sti_device_driver);
-}
-
-subsys_initcall(em_sti_init);
-module_exit(em_sti_exit);
+subsys_platform_driver(em_sti_device_driver);
 
 MODULE_AUTHOR("Magnus Damm");
 MODULE_DESCRIPTION("Renesas Emma Mobile STI Timer Driver");
diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c
index 7977507f6ce3..b7170c6b733f 100644
--- a/drivers/clocksource/sh_cmt.c
+++ b/drivers/clocksource/sh_cmt.c
@@ -1168,22 +1168,11 @@ static struct platform_driver sh_cmt_device_driver = {
 	.id_table	= sh_cmt_id_table,
 };
 
-static int __init sh_cmt_init(void)
-{
-	return platform_driver_register(&sh_cmt_device_driver);
-}
-
-static void __exit sh_cmt_exit(void)
-{
-	platform_driver_unregister(&sh_cmt_device_driver);
-}
-
 #ifdef CONFIG_SUPERH
 sh_early_platform_init("earlytimer", &sh_cmt_device_driver);
 #endif
 
-subsys_initcall(sh_cmt_init);
-module_exit(sh_cmt_exit);
+subsys_platform_driver(sh_cmt_device_driver);
 
 MODULE_AUTHOR("Magnus Damm");
 MODULE_DESCRIPTION("SuperH CMT Timer Driver");
diff --git a/drivers/clocksource/sh_mtu2.c b/drivers/clocksource/sh_mtu2.c
index 3aca86d6a2d4..c44338d8e938 100644
--- a/drivers/clocksource/sh_mtu2.c
+++ b/drivers/clocksource/sh_mtu2.c
@@ -505,22 +505,11 @@ static struct platform_driver sh_mtu2_device_driver = {
 	.id_table	= sh_mtu2_id_table,
 };
 
-static int __init sh_mtu2_init(void)
-{
-	return platform_driver_register(&sh_mtu2_device_driver);
-}
-
-static void __exit sh_mtu2_exit(void)
-{
-	platform_driver_unregister(&sh_mtu2_device_driver);
-}
-
 #ifdef CONFIG_SUPERH
 sh_early_platform_init("earlytimer", &sh_mtu2_device_driver);
 #endif
 
-subsys_initcall(sh_mtu2_init);
-module_exit(sh_mtu2_exit);
+subsys_platform_driver(sh_mtu2_device_driver);
 
 MODULE_AUTHOR("Magnus Damm");
 MODULE_DESCRIPTION("SuperH MTU2 Timer Driver");
diff --git a/drivers/clocksource/sh_tmu.c b/drivers/clocksource/sh_tmu.c
index 8b3cfa6727bd..b4a32961aa24 100644
--- a/drivers/clocksource/sh_tmu.c
+++ b/drivers/clocksource/sh_tmu.c
@@ -636,22 +636,11 @@ static struct platform_driver sh_tmu_device_driver = {
 	.id_table	= sh_tmu_id_table,
 };
 
-static int __init sh_tmu_init(void)
-{
-	return platform_driver_register(&sh_tmu_device_driver);
-}
-
-static void __exit sh_tmu_exit(void)
-{
-	platform_driver_unregister(&sh_tmu_device_driver);
-}
-
 #ifdef CONFIG_SUPERH
 sh_early_platform_init("earlytimer", &sh_tmu_device_driver);
 #endif
 
-subsys_initcall(sh_tmu_init);
-module_exit(sh_tmu_exit);
+subsys_platform_driver(sh_tmu_device_driver);
 
 MODULE_AUTHOR("Magnus Damm");
 MODULE_DESCRIPTION("SuperH TMU Timer Driver");
-- 
2.51.0


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

end of thread, other threads:[~2026-11-06  1:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-06  1:32 [PATCH] clocksource: convert to subsys_platform_driver() Brian Masney
  -- strict thread matches above, loose matches on Subject: below --
2026-11-04 11:32 [PATCH] clocksource: Convert " Peng Fan (OSS)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®