Skip to contentSkip to conversation

radio: Utilize the module_isa_driver macro

PATCH In review William Breathitt Gray 2 participants 9 messages Jul 18, 2016 – Jul 20, 2016

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover radio: Utilize the module_isa_driver macro

The module_isa_driver macro is a helper macro for ISA drivers which do not do anything special in module init/exit. This patchset eliminates a lot of ISA driver registration boilerplate code by utilizing module_isa_driver, which replaces module_init and module_exit.

William Breathitt Gray (6):
radio: terratec: Utilize the module_isa_driver macro
radio: rtrack2: Utilize the module_isa_driver macro
radio: trust: Utilize the module_isa_driver macro
radio: zoltrix: Utilize the module_isa_driver macro
radio: aztech: Utilize the module_isa_driver macro
radio: aimslab: Utilize the module_isa_driver macro

 drivers/media/radio/radio-aimslab.c  | 13 +------------
 drivers/media/radio/radio-aztech.c   | 13 +------------
 drivers/media/radio/radio-rtrack2.c  | 13 +------------
 drivers/media/radio/radio-terratec.c | 14 +-------------
 drivers/media/radio/radio-trust.c    | 13 +------------
 drivers/media/radio/radio-zoltrix.c  | 14 +-------------
 6 files changed, 6 insertions(+), 74 deletions(-)
Signature · 1 line
2.7.3
#1 lore raw

PATCH 1/6 radio: terratec: Utilize the module_isa_driver macro

This driver does not do anything special in module init/exit. This patch eliminates the module init/exit boilerplate code by utilizing the module_isa_driver macro.

---
 drivers/media/radio/radio-terratec.c | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)
drivers/media/radio/radio-terratec.c +1 -13
index be10a80..621bbb2 100644
@@ -155,16 +155,4 @@ static struct radio_isa_driver terratec_driver = {
 	.max_volume = 10,
 };
 
-static int __init terratec_init(void)
-{
-	return isa_register_driver(&terratec_driver.driver, 1);
-}
-
-static void __exit terratec_exit(void)
-{
-	isa_unregister_driver(&terratec_driver.driver);
-}
-
-module_init(terratec_init);
-module_exit(terratec_exit);
-
+module_isa_driver(terratec_driver.driver, 1);
Signature · 1 line
2.7.3
#2 lore raw

PATCH 2/6 radio: rtrack2: Utilize the module_isa_driver macro

In reply to William Breathitt Gray

This driver does not do anything special in module init/exit. This patch eliminates the module init/exit boilerplate code by utilizing the module_isa_driver macro.

---
 drivers/media/radio/radio-rtrack2.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
drivers/media/radio/radio-rtrack2.c +1 -12
index 09cfbc3..82b8794 100644
@@ -127,15 +127,4 @@ static struct radio_isa_driver rtrack2_driver = {
 	.has_stereo = true,
 };
 
-static int __init rtrack2_init(void)
-{
-	return isa_register_driver(&rtrack2_driver.driver, RTRACK2_MAX);
-}
-
-static void __exit rtrack2_exit(void)
-{
-	isa_unregister_driver(&rtrack2_driver.driver);
-}
-
-module_init(rtrack2_init);
-module_exit(rtrack2_exit);
+module_isa_driver(rtrack2_driver.driver, RTRACK2_MAX);
Signature · 1 line
2.7.3
#3 lore raw

PATCH 3/6 radio: trust: Utilize the module_isa_driver macro

In reply to William Breathitt Gray

This driver does not do anything special in module init/exit. This patch eliminates the module init/exit boilerplate code by utilizing the module_isa_driver macro.

---
 drivers/media/radio/radio-trust.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
drivers/media/radio/radio-trust.c +1 -12
index 26a8c60..e4bec5e 100644
@@ -229,15 +229,4 @@ static struct radio_isa_driver trust_driver = {
 	.max_volume = 31,
 };
 
-static int __init trust_init(void)
-{
-	return isa_register_driver(&trust_driver.driver, TRUST_MAX);
-}
-
-static void __exit trust_exit(void)
-{
-	isa_unregister_driver(&trust_driver.driver);
-}
-
-module_init(trust_init);
-module_exit(trust_exit);
+module_isa_driver(trust_driver.driver, TRUST_MAX);
Signature · 1 line
2.7.3
#4 lore raw

PATCH 4/6 radio: zoltrix: Utilize the module_isa_driver macro

In reply to William Breathitt Gray

This driver does not do anything special in module init/exit. This patch eliminates the module init/exit boilerplate code by utilizing the module_isa_driver macro.

---
 drivers/media/radio/radio-zoltrix.c | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)
drivers/media/radio/radio-zoltrix.c +1 -13
index 026e88e..597da26 100644
@@ -233,16 +233,4 @@ static struct radio_isa_driver zoltrix_driver = {
 	.max_volume = 15,
 };
 
-static int __init zoltrix_init(void)
-{
-	return isa_register_driver(&zoltrix_driver.driver, ZOLTRIX_MAX);
-}
-
-static void __exit zoltrix_exit(void)
-{
-	isa_unregister_driver(&zoltrix_driver.driver);
-}
-
-module_init(zoltrix_init);
-module_exit(zoltrix_exit);
-
+module_isa_driver(zoltrix_driver.driver, ZOLTRIX_MAX);
Signature · 1 line
2.7.3
#5 lore raw

PATCH 5/6 radio: aztech: Utilize the module_isa_driver macro

In reply to William Breathitt Gray

This driver does not do anything special in module init/exit. This patch eliminates the module init/exit boilerplate code by utilizing the module_isa_driver macro.

---
 drivers/media/radio/radio-aztech.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
drivers/media/radio/radio-aztech.c +1 -12
index 705dd6f..7b39655 100644
@@ -147,15 +147,4 @@ static struct radio_isa_driver aztech_driver = {
 	.max_volume = 3,
 };
 
-static int __init aztech_init(void)
-{
-	return isa_register_driver(&aztech_driver.driver, AZTECH_MAX);
-}
-
-static void __exit aztech_exit(void)
-{
-	isa_unregister_driver(&aztech_driver.driver);
-}
-
-module_init(aztech_init);
-module_exit(aztech_exit);
+module_isa_driver(aztech_driver.driver, AZTECH_MAX);
Signature · 1 line
2.7.3
#6 lore raw

PATCH 6/6 radio: aimslab: Utilize the module_isa_driver macro

In reply to William Breathitt Gray

This driver does not do anything special in module init/exit. This patch eliminates the module init/exit boilerplate code by utilizing the module_isa_driver macro.

---
 drivers/media/radio/radio-aimslab.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
drivers/media/radio/radio-aimslab.c +1 -12
index ea930879..d1566a3 100644
@@ -180,15 +180,4 @@ static struct radio_isa_driver rtrack_driver = {
 	.max_volume = 0xff,
 };
 
-static int __init rtrack_init(void)
-{
-	return isa_register_driver(&rtrack_driver.driver, RTRACK_MAX);
-}
-
-static void __exit rtrack_exit(void)
-{
-	isa_unregister_driver(&rtrack_driver.driver);
-}
-
-module_init(rtrack_init);
-module_exit(rtrack_exit);
+module_isa_driver(rtrack_driver.driver, RTRACK_MAX);
Signature · 1 line
2.7.3
#7 lore raw
In reply to William Breathitt Gray
Quoted 5 lines · William Breathitt Gray

The module_isa_driver macro is a helper macro for ISA drivers which do not do anything special in module init/exit. This patchset eliminates a lot of ISA driver registration boilerplate code by utilizing module_isa_driver, which replaces module_init and module_exit.

Quoted 7 lines

William Breathitt Gray (6):
radio: terratec: Utilize the module_isa_driver macro
radio: rtrack2: Utilize the module_isa_driver macro
radio: trust: Utilize the module_isa_driver macro
radio: zoltrix: Utilize the module_isa_driver macro
radio: aztech: Utilize the module_isa_driver macro
radio: aimslab: Utilize the module_isa_driver macro

Good idea, but it doesn't compile:

module_isa_driver(terratec_driver.driver, 1);

expands to:

static int __init terratec_driver.driver_init(void)

{
        return isa_register_driver(&(terratec_driver.driver), 1);
}

So now the function name contains a '.' and it won't compile.

Regards,

Hans

#8 lore raw
Quoted 25 lines · Hans Verkuil
Quoted 5 lines · William Breathitt Gray

The module_isa_driver macro is a helper macro for ISA drivers which do not do anything special in module init/exit. This patchset eliminates a lot of ISA driver registration boilerplate code by utilizing module_isa_driver, which replaces module_init and module_exit.

Quoted 7 lines

William Breathitt Gray (6):
radio: terratec: Utilize the module_isa_driver macro
radio: rtrack2: Utilize the module_isa_driver macro
radio: trust: Utilize the module_isa_driver macro
radio: zoltrix: Utilize the module_isa_driver macro
radio: aztech: Utilize the module_isa_driver macro
radio: aimslab: Utilize the module_isa_driver macro

Good idea, but it doesn't compile:

module_isa_driver(terratec_driver.driver, 1);

expands to:

static int __init terratec_driver.driver_init(void)

{
       return isa_register_driver(&(terratec_driver.driver), 1);
}
Quoted 5 lines

So now the function name contains a '.' and it won't compile.

Regards,

Hans

Oops, looks like I was a bit on autopilot there. I'll have to rethink this patchset at a later point to overcome the symbol naming issue.

Thank you,

William Breathitt Gray