Skip to contentSkip to conversation

staging: unisys/visorbus: add __init/__exit annotations

PATCH In review Arnd Bergmann 2 participants 2 messages Sep 15, 2017 – Sep 27, 2017 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: unisys/visorbus: add __init/__exit annotations

gcc-4.6 causes a harmless warning about the init function:

WARNING: vmlinux.o(.text+0xed62c2): Section mismatch in reference from the function init_unisys() to the function .init.text:visorutil_spar_detect() The function init_unisys() references
the function __init visorutil_spar_detect().
This is often because init_unisys lacks a __init
annotation or the annotation of visorutil_spar_detect is wrong.

It appears that newer versions inline visorutil_spar_detect(), end up with an empty __init section. This marks the module entry points as __init and __exit respectively, which avoids the warning and slightly reduces the runtime code size.

---
 drivers/staging/unisys/visorbus/visorchipset.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/unisys/visorbus/visorchipset.c +2 -2
index 74cce4f1a7bd..27ecf6fb49fd 100644
@@ -1826,7 +1826,7 @@ static __init int visorutil_spar_detect(void)
 	return 0;
 }
 
-static int init_unisys(void)
+static int __init init_unisys(void)
 {
 	int result;
 
@@ -1841,7 +1841,7 @@ static int init_unisys(void)
 	return 0;
 };
 
-static void exit_unisys(void)
+static void __exit exit_unisys(void)
 {
 	acpi_bus_unregister_driver(&unisys_acpi_driver);
 }
Signature · 1 line
2.9.0
Acked-by on v1 1/1
#1 lore raw
Quoted 14 lines

-----Original Message-----
From: Arnd Bergmann [mailto:[email protected]]
Sent: Friday, September 15, 2017 3:23 PM
To: Kershner, David A <[email protected]>; Greg Kroah-Hartman <[email protected]>
Cc: Arnd Bergmann <[email protected]>; Sell, Timothy C <[email protected]>; Wadgaonkar, Sameer Laxmikant <[email protected]>; Binder, David Anthony <[email protected]>; Thompson, Bryan E. <[email protected]>; *S-Par-Maintainer <[email protected]>; [email protected]; linux- [email protected]
Subject: [PATCH] staging: unisys/visorbus: add __init/__exit annotations

Quoted 4 lines

gcc-4.6 causes a harmless warning about the init function:

WARNING: vmlinux.o(.text+0xed62c2): Section mismatch in reference from the function init_unisys() to the function

.init.text:visorutil_spar_detect()

Quoted 11 lines

The function init_unisys() references
the function __init visorutil_spar_detect().
This is often because init_unisys lacks a __init annotation or the annotation of visorutil_spar_detect is wrong.

It appears that newer versions inline visorutil_spar_detect(), end up with an empty __init section. This marks the module entry points as __init and __exit respectively, which avoids the warning and slightly reduces the runtime code size.

Thanks,
David Kershner

Quoted 29 lines
---
 drivers/staging/unisys/visorbus/visorchipset.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/unisys/visorbus/visorchipset.c +2 -3
index 74cce4f1a7bd..27ecf6fb49fd 100644
@@ -1826,7 +1826,7 @@ static __init int visorutil_spar_detect(void)
 	return 0;
 }
 
-static int init_unisys(void)
+static int __init init_unisys(void)
 {
 	int result;
 
@@ -1841,7 +1841,7 @@ static int init_unisys(void)
 	return 0;
 };
 
-static void exit_unisys(void)
+static void __exit exit_unisys(void)
 {
 	acpi_bus_unregister_driver(&unisys_acpi_driver);
 }
--

2.9.0