Skip to contentSkip to conversation

thermal/drivers/int340x/processor_thermal: Switch to use module_pci_driver() macro

PATCH Applied Shang XiaoJing 2 participants 2 messages Sep 22, 2022 – Sep 24, 2022 Thermal

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 thermal/drivers/int340x/processor_thermal: Switch to use module_pci_driver() macro

Since pci provides the helper macro module_pci_driver(), we may replace the module_init/exit with it.

---
 .../int340x_thermal/processor_thermal_device_pci.c  | 13 +------------
 .../processor_thermal_device_pci_legacy.c           | 13 +------------
 2 files changed, 2 insertions(+), 24 deletions(-)
drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c +1 -12
index c2dc4c158b9d..bf1b1cdfade4 100644
@@ -373,18 +373,7 @@ static struct pci_driver proc_thermal_pci_driver = {
 	.driver.pm	= &proc_thermal_pci_pm,
 };
 
-static int __init proc_thermal_init(void)
-{
-	return pci_register_driver(&proc_thermal_pci_driver);
-}
-
-static void __exit proc_thermal_exit(void)
-{
-	pci_unregister_driver(&proc_thermal_pci_driver);
-}
-
-module_init(proc_thermal_init);
-module_exit(proc_thermal_exit);
+module_pci_driver(proc_thermal_pci_driver);
 
 MODULE_AUTHOR("Srinivas Pandruvada <[email protected]>");
 MODULE_DESCRIPTION("Processor Thermal Reporting Device Driver");
drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci_legacy.c +1 -12
index 4571a1a53b84..09e032f822f3 100644
@@ -151,18 +151,7 @@ static struct pci_driver proc_thermal_pci_driver = {
 	.driver.pm	= &proc_thermal_pci_pm,
 };
 
-static int __init proc_thermal_init(void)
-{
-	return pci_register_driver(&proc_thermal_pci_driver);
-}
-
-static void __exit proc_thermal_exit(void)
-{
-	pci_unregister_driver(&proc_thermal_pci_driver);
-}
-
-module_init(proc_thermal_init);
-module_exit(proc_thermal_exit);
+module_pci_driver(proc_thermal_pci_driver);
 
 MODULE_AUTHOR("Srinivas Pandruvada <[email protected]>");
 MODULE_DESCRIPTION("Processor Thermal Reporting Device Driver");
Signature · 1 line
2.17.1
maintainer Applied
#1 lore raw
Quoted 49 lines · Shang XiaoJing

Since pci provides the helper macro module_pci_driver(), we may replace the module_init/exit with it.

---
 .../int340x_thermal/processor_thermal_device_pci.c  | 13 +------------
 .../processor_thermal_device_pci_legacy.c           | 13 +------------
 2 files changed, 2 insertions(+), 24 deletions(-)
drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c +1 -12
index c2dc4c158b9d..bf1b1cdfade4 100644
@@ -373,18 +373,7 @@ static struct pci_driver proc_thermal_pci_driver = {
        .driver.pm      = &proc_thermal_pci_pm,
 };
 
-static int __init proc_thermal_init(void)
-{
-       return pci_register_driver(&proc_thermal_pci_driver);
-}
-
-static void __exit proc_thermal_exit(void)
-{
-       pci_unregister_driver(&proc_thermal_pci_driver);
-}
-
-module_init(proc_thermal_init);
-module_exit(proc_thermal_exit);
+module_pci_driver(proc_thermal_pci_driver);
 
 MODULE_AUTHOR("Srinivas Pandruvada <[email protected]>");
 MODULE_DESCRIPTION("Processor Thermal Reporting Device Driver");
drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci_legacy.c +0 -7
index 4571a1a53b84..09e032f822f3 100644
@@ -151,18 +151,7 @@ static struct pci_driver proc_thermal_pci_driver = {
        .driver.pm      = &proc_thermal_pci_pm,
 };
 
-static int __init proc_thermal_init(void)
-{
-       return pci_register_driver(&proc_thermal_pci_driver);
-}
-
-static void __exit proc_thermal_exit(void)
-{

drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci_legacy.c static struct pci_driver proc_thermal_pci_driver = {

Quoted 10 lines
drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci_legacy.c +1 -6
-       pci_unregister_driver(&proc_thermal_pci_driver);
-}
-
-module_init(proc_thermal_init);
-module_exit(proc_thermal_exit);
+module_pci_driver(proc_thermal_pci_driver);
 
 MODULE_AUTHOR("Srinivas Pandruvada <[email protected]>");
 MODULE_DESCRIPTION("Processor Thermal Reporting Device Driver");
--

Applied as 6.1 material with some edits in the subject and changelog.

Thanks!