Skip to contentSkip to conversation

hwmon: convert drivers/hwmon/* to use module_spi_driver()

PATCH In review Axel Lin 3 participants 3 messages Nov 25, 2011 – Nov 27, 2011 Hardware monitoring

lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 hwmon: convert drivers/hwmon/* to use module_spi_driver()

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

Cc Sonic Zhang <[email protected]>
Cc Marc Pignat <[email protected]>
Cc Paul Thomas <[email protected]>
Cc Eric Miao <[email protected]>
---
 drivers/hwmon/ad7314.c  |   12 +-----------
 drivers/hwmon/adcxx.c   |   13 +------------
 drivers/hwmon/ads7871.c |   13 +------------
 drivers/hwmon/lm70.c    |   13 +------------
 drivers/hwmon/max1111.c |   12 +-----------
 5 files changed, 5 insertions(+), 58 deletions(-)
drivers/hwmon/ad7314.c +1 -11
index 318e38e..4207c09 100644
@@ -168,17 +168,7 @@ static struct spi_driver ad7314_driver = {
 	.id_table = ad7314_id,
 };
 
-static __init int ad7314_init(void)
-{
-	return spi_register_driver(&ad7314_driver);
-}
-module_init(ad7314_init);
-
-static __exit void ad7314_exit(void)
-{
-	spi_unregister_driver(&ad7314_driver);
-}
-module_exit(ad7314_exit);
+module_spi_driver(ad7314_driver);
 
 MODULE_AUTHOR("Sonic Zhang <[email protected]>");
 MODULE_DESCRIPTION("Analog Devices AD7314, ADT7301 and ADT7302 digital"
drivers/hwmon/adcxx.c +1 -12
index b2cacbe..24f8cf4 100644
@@ -248,18 +248,7 @@ static struct spi_driver adcxx_driver = {
 	.remove	= __devexit_p(adcxx_remove),
 };
 
-static int __init init_adcxx(void)
-{
-	return spi_register_driver(&adcxx_driver);
-}
-
-static void __exit exit_adcxx(void)
-{
-	spi_unregister_driver(&adcxx_driver);
-}
-
-module_init(init_adcxx);
-module_exit(exit_adcxx);
+module_spi_driver(adcxx_driver);
 
 MODULE_AUTHOR("Marc Pignat");
 MODULE_DESCRIPTION("National Semiconductor adcxx8sxxx Linux driver");
drivers/hwmon/ads7871.c +1 -12
index 5231934..6a2ce1e4 100644
@@ -235,18 +235,7 @@ static struct spi_driver ads7871_driver = {
 	.remove = __devexit_p(ads7871_remove),
 };
 
-static int __init ads7871_init(void)
-{
-	return spi_register_driver(&ads7871_driver);
-}
-
-static void __exit ads7871_exit(void)
-{
-	spi_unregister_driver(&ads7871_driver);
-}
-
-module_init(ads7871_init);
-module_exit(ads7871_exit);
+module_spi_driver(ads7871_driver);
 
 MODULE_AUTHOR("Paul Thomas <[email protected]>");
 MODULE_DESCRIPTION("TI ADS7871 A/D driver");
drivers/hwmon/lm70.c +1 -12
index c274ea2..b813022d 100644
@@ -213,18 +213,7 @@ static struct spi_driver lm70_driver = {
 	.remove	= __devexit_p(lm70_remove),
 };
 
-static int __init init_lm70(void)
-{
-	return spi_register_driver(&lm70_driver);
-}
-
-static void __exit cleanup_lm70(void)
-{
-	spi_unregister_driver(&lm70_driver);
-}
-
-module_init(init_lm70);
-module_exit(cleanup_lm70);
+module_spi_driver(lm70_driver);
 
 MODULE_AUTHOR("Kaiwan N Billimoria");
 MODULE_DESCRIPTION("NS LM70 / TI TMP121/TMP123 Linux driver");
drivers/hwmon/max1111.c +1 -11
index 5586cca..d0f4ef6 100644
@@ -227,17 +227,7 @@ static struct spi_driver max1111_driver = {
 	.remove		= __devexit_p(max1111_remove),
 };
 
-static int __init max1111_init(void)
-{
-	return spi_register_driver(&max1111_driver);
-}
-module_init(max1111_init);
-
-static void __exit max1111_exit(void)
-{
-	spi_unregister_driver(&max1111_driver);
-}
-module_exit(max1111_exit);
+module_spi_driver(max1111_driver);
 
 MODULE_AUTHOR("Eric Miao <[email protected]>");
 MODULE_DESCRIPTION("MAX1111 ADC Driver");
Signature · 9 lines
1.7.5.4




_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Acked-by on v1 1/1
#1 lore raw
Quoted 150 lines

-----Original Message-----
From: Axel Lin [mailto:[email protected]]
Sent: Friday, November 25, 2011 3:13 PM
To: [email protected]
Cc: Zhang, Sonic; Marc Pignat; Paul Thomas; Eric Miao; Jean Delvare; Guenter Roeck; [email protected]
Subject: [PATCH] hwmon: convert drivers/hwmon/* to use module_spi_driver()

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

Cc Sonic Zhang <[email protected]>
Cc Marc Pignat <[email protected]>
Cc Paul Thomas <[email protected]>
Cc Eric Miao <[email protected]>

---

drivers/hwmon/ad7314.c  |   12 +-----------
drivers/hwmon/adcxx.c   |   13 +------------
drivers/hwmon/ads7871.c |   13 +------------
drivers/hwmon/lm70.c    |   13 +------------
drivers/hwmon/max1111.c |   12 +-----------
5 files changed, 5 insertions(+), 58 deletions(-)
drivers/hwmon/ad7314.c +1 -11
index 318e38e..4207c09 100644
@@ -168,17 +168,7 @@ static struct spi_driver ad7314_driver = {
      .id_table = ad7314_id,
 };
 
-static __init int ad7314_init(void)
-{
-      return spi_register_driver(&ad7314_driver);
-}
-module_init(ad7314_init);
-
-static __exit void ad7314_exit(void)
-{
-      spi_unregister_driver(&ad7314_driver);
-}
-module_exit(ad7314_exit);
+module_spi_driver(ad7314_driver);
 
 MODULE_AUTHOR("Sonic Zhang <[email protected]>");

MODULE_DESCRIPTION("Analog Devices AD7314, ADT7301 and ADT7302 digital"

drivers/hwmon/adcxx.c +1 -12
index b2cacbe..24f8cf4 100644
@@ -248,18 +248,7 @@ static struct spi_driver adcxx_driver = {
      .remove = __devexit_p(adcxx_remove),
 };
 
-static int __init init_adcxx(void)
-{
-      return spi_register_driver(&adcxx_driver);
-}
-
-static void __exit exit_adcxx(void)
-{
-      spi_unregister_driver(&adcxx_driver);
-}
-
-module_init(init_adcxx);
-module_exit(exit_adcxx);
+module_spi_driver(adcxx_driver);
 
 MODULE_AUTHOR("Marc Pignat");

MODULE_DESCRIPTION("National Semiconductor adcxx8sxxx Linux driver"); diff --git a/drivers/hwmon/ads7871.c b/drivers/hwmon/ads7871.c index 5231934..6a2ce1e4 100644

drivers/hwmon/ads7871.c +1 -12
@@ -235,18 +235,7 @@ static struct spi_driver ads7871_driver = {
      .remove = __devexit_p(ads7871_remove),  };
 
-static int __init ads7871_init(void)
-{
-      return spi_register_driver(&ads7871_driver);
-}
-
-static void __exit ads7871_exit(void)
-{
-      spi_unregister_driver(&ads7871_driver);
-}
-
-module_init(ads7871_init);
-module_exit(ads7871_exit);
+module_spi_driver(ads7871_driver);
 
 MODULE_AUTHOR("Paul Thomas <[email protected]>");

MODULE_DESCRIPTION("TI ADS7871 A/D driver"); diff --git a/drivers/hwmon/lm70.c b/drivers/hwmon/lm70.c index c274ea2..b813022d 100644

drivers/hwmon/lm70.c +1 -12
@@ -213,18 +213,7 @@ static struct spi_driver lm70_driver = {
      .remove = __devexit_p(lm70_remove),
 };
 
-static int __init init_lm70(void)
-{
-      return spi_register_driver(&lm70_driver);
-}
-
-static void __exit cleanup_lm70(void)
-{
-      spi_unregister_driver(&lm70_driver);
-}
-
-module_init(init_lm70);
-module_exit(cleanup_lm70);
+module_spi_driver(lm70_driver);
 
 MODULE_AUTHOR("Kaiwan N Billimoria");

MODULE_DESCRIPTION("NS LM70 / TI TMP121/TMP123 Linux driver"); diff --git a/drivers/hwmon/max1111.c b/drivers/hwmon/max1111.c index 5586cca..d0f4ef6 100644

drivers/hwmon/max1111.c +1 -12
@@ -227,17 +227,7 @@ static struct spi_driver max1111_driver = {
      .remove         = __devexit_p(max1111_remove),
 };
 
-static int __init max1111_init(void)
-{
-      return spi_register_driver(&max1111_driver);
-}
-module_init(max1111_init);
-
-static void __exit max1111_exit(void)
-{
-      spi_unregister_driver(&max1111_driver);
-}
-module_exit(max1111_exit);
+module_spi_driver(max1111_driver);
 
 MODULE_AUTHOR("Eric Miao <[email protected]>");
 MODULE_DESCRIPTION("MAX1111 ADC Driver");
--

1.7.5.4

#2 lore raw
In reply to Axel Lin
Quoted 9 lines · Axel Lin

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

Cc Sonic Zhang <[email protected]>
Cc Marc Pignat <[email protected]>
Cc Paul Thomas <[email protected]>
Cc Eric Miao <[email protected]>

module_spi_driver() is not (yet) available in mainline, so this patch can not be applied right now.

It would probably make sense to resubmit the patch once the code necessary to support it is available, to make sure it does not miss any new drivers.

Guenter

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors