Skip to contentSkip to conversation

platform-drivers-x86: convert drivers/platform/x86/* to use module_platform_driver()

PATCH In review Axel Lin 2 participants 3 messages Nov 26, 2011 – Nov 28, 2011 x86 platform drivers

lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 platform-drivers-x86: convert drivers/platform/x86/* to use module_platform_driver()

This patch converts the drivers in drivers/platform/x86/* to use the module_platform_driver() macro which makes the code smaller and a bit simpler.

Cc Hong Liu <[email protected]>
Cc Durgadoss R <[email protected]>
Cc Daniel Drake <[email protected]>
---
 drivers/platform/x86/intel_mid_powerbtn.c |   12 +-----------
 drivers/platform/x86/intel_mid_thermal.c  |   13 +------------
 drivers/platform/x86/xo1-rfkill.c         |   13 +------------
 3 files changed, 3 insertions(+), 35 deletions(-)
drivers/platform/x86/intel_mid_powerbtn.c +1 -11
index f1ae507..ff3de34 100644
@@ -118,17 +118,7 @@ static struct platform_driver mfld_pb_driver = {
 	.remove	= __devexit_p(mfld_pb_remove),
 };
 
-static int __init mfld_pb_init(void)
-{
-	return platform_driver_register(&mfld_pb_driver);
-}
-module_init(mfld_pb_init);
-
-static void __exit mfld_pb_exit(void)
-{
-	platform_driver_unregister(&mfld_pb_driver);
-}
-module_exit(mfld_pb_exit);
+module_platform_driver(mfld_pb_driver);
 
 MODULE_AUTHOR("Hong Liu <[email protected]>");
 MODULE_DESCRIPTION("Intel Medfield Power Button Driver");
drivers/platform/x86/intel_mid_thermal.c +1 -12
index ccd7b1f..e4cc992 100644
@@ -565,18 +565,7 @@ static struct platform_driver mid_thermal_driver = {
 	.id_table = therm_id_table,
 };
 
-static int __init mid_thermal_module_init(void)
-{
-	return platform_driver_register(&mid_thermal_driver);
-}
-
-static void __exit mid_thermal_module_exit(void)
-{
-	platform_driver_unregister(&mid_thermal_driver);
-}
-
-module_init(mid_thermal_module_init);
-module_exit(mid_thermal_module_exit);
+module_platform_driver(mid_thermal_driver);
 
 MODULE_AUTHOR("Durgadoss R <[email protected]>");
 MODULE_DESCRIPTION("Intel Medfield Platform Thermal Driver");
drivers/platform/x86/xo1-rfkill.c +1 -12
index e549eee..41781ed 100644
@@ -67,19 +67,8 @@ static struct platform_driver xo1_rfkill_driver = {
 	.remove		= __devexit_p(xo1_rfkill_remove),
 };
 
-static int __init xo1_rfkill_init(void)
-{
-	return platform_driver_register(&xo1_rfkill_driver);
-}
-
-static void __exit xo1_rfkill_exit(void)
-{
-	platform_driver_unregister(&xo1_rfkill_driver);
-}
+module_platform_driver(xo1_rfkill_driver);
 
 MODULE_AUTHOR("Daniel Drake <[email protected]>");
 MODULE_LICENSE("GPL");
 MODULE_ALIAS("platform:xo1-rfkill");
-
-module_init(xo1_rfkill_init);
-module_exit(xo1_rfkill_exit);
Signature · 1 line
1.7.5.4
Acked-by on v1 1/1
#1 lore raw

Hi,

Thanks for the nice clean up for intel_mid_thermal.c

From which kernel version is this new macro supported ?

Quoted 13 lines

-----Original Message-----
From: Axel Lin [mailto:[email protected]]
Sent: Saturday, November 26, 2011 9:45 AM
To: [email protected]
Cc: Liu, Hong; R, Durgadoss; Daniel Drake; Matthew Garrett; platform-driver- [email protected]
Subject: [PATCH] platform-drivers-x86: convert drivers/platform/x86/* to use module_platform_driver()

This patch converts the drivers in drivers/platform/x86/* to use the module_platform_driver() macro which makes the code smaller and a bit simpler.

Quoted 5 lines
Cc Hong Liu <[email protected]>
Cc Durgadoss R <[email protected]>
Cc Daniel Drake <[email protected]>

---

Quoted 12 lines
drivers/platform/x86/intel_mid_thermal.c +0 -3
index ccd7b1f..e4cc992 100644
@@ -565,18 +565,7 @@ static struct platform_driver mid_thermal_driver = {
 	.id_table = therm_id_table,
 };
 
-static int __init mid_thermal_module_init(void)
-{
-	return platform_driver_register(&mid_thermal_driver);

drivers/platform/x86/intel_mid_thermal.c static struct platform_driver mid_thermal_driver = { · line 568

Quoted 10 lines
drivers/platform/x86/intel_mid_thermal.c +1 -9
-}
-
-static void __exit mid_thermal_module_exit(void)
-{
-	platform_driver_unregister(&mid_thermal_driver);
-}
-
-module_init(mid_thermal_module_init);
-module_exit(mid_thermal_module_exit);
+module_platform_driver(mid_thermal_driver);

Thanks,
Durga

author
#2 lore raw

2011/11/28 R, Durgadoss <[email protected]>:

Quoted 6 lines

Hi,

Thanks for the nice clean up for intel_mid_thermal.c

From which kernel version is this new macro supported ?

module_platform_driver() is already in current Linus's tree ( linux-3.2 rcX) Regards,
Axel