[Xen-devel,1/6] arm/setup: Add missing __init to add_boot_module

Message ID 1421425248-8727-2-git-send-email-julien.grall@linaro.org
State New
Headers show

Commit Message

Julien Grall Jan. 16, 2015, 4:20 p.m.
add_boot_module is calling a function which lies in the init section.
Furthermore, it's only used during Xen boot.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
---
 xen/arch/arm/setup.c        | 6 +++---
 xen/include/asm-arm/setup.h | 8 ++++----
 2 files changed, 7 insertions(+), 7 deletions(-)

Comments

Julien Grall Jan. 16, 2015, 4:33 p.m. | #1
On 16/01/15 16:28, Andrew Cooper wrote:
> On 16/01/15 16:20, Julien Grall wrote:
>> add_boot_module is calling a function which lies in the init section.
>> Furthermore, it's only used during Xen boot.
>>
>> Signed-off-by: Julien Grall <julien.grall@linaro.org>
>> ---
>>  xen/arch/arm/setup.c        | 6 +++---
>>  xen/include/asm-arm/setup.h | 8 ++++----
>>  2 files changed, 7 insertions(+), 7 deletions(-)
>>
>> diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
>> index f49569d..5fc27ce0 100644
>> --- a/xen/arch/arm/setup.c
>> +++ b/xen/arch/arm/setup.c
>> @@ -185,9 +185,9 @@ static void dt_unreserved_regions(paddr_t s, paddr_t e,
>>      cb(s, e);
>>  }
>>  
>> -struct bootmodule *add_boot_module(bootmodule_kind kind,
>> -                                   paddr_t start, paddr_t size,
>> -                                   const char *cmdline)
>> +struct bootmodule __init *add_boot_module(bootmodule_kind kind,
> 
> __init should be after the type, rather than spliced into the middle of it.

Ok.

> "struct bootmodule * __init add_boot_module(...)" should work.
> 
> However, only static functions should be annotated at the definition. 
> non-static functions can get their annotation from the declaration alone.

It's useful for documentation purpose... You directly know this function
should be only used during Xen boot time.

Regards,

Patch

diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index f49569d..5fc27ce0 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -185,9 +185,9 @@  static void dt_unreserved_regions(paddr_t s, paddr_t e,
     cb(s, e);
 }
 
-struct bootmodule *add_boot_module(bootmodule_kind kind,
-                                   paddr_t start, paddr_t size,
-                                   const char *cmdline)
+struct bootmodule __init *add_boot_module(bootmodule_kind kind,
+                                          paddr_t start, paddr_t size,
+                                          const char *cmdline)
 {
     struct bootmodules *mods = &bootinfo.modules;
     struct bootmodule *mod;
diff --git a/xen/include/asm-arm/setup.h b/xen/include/asm-arm/setup.h
index ba5a67d..ed2ba16 100644
--- a/xen/include/asm-arm/setup.h
+++ b/xen/include/asm-arm/setup.h
@@ -60,10 +60,10 @@  void discard_initial_modules(void);
 size_t __init boot_fdt_info(const void *fdt, paddr_t paddr);
 const char __init *boot_fdt_cmdline(const void *fdt);
 
-struct bootmodule *add_boot_module(bootmodule_kind kind,
-                                   paddr_t start, paddr_t size,
-                                   const char *cmdline);
-struct bootmodule *boot_module_find_by_kind(bootmodule_kind kind);
+struct bootmodule __init *add_boot_module(bootmodule_kind kind,
+                                          paddr_t start, paddr_t size,
+                                          const char *cmdline);
+struct bootmodule __init *boot_module_find_by_kind(bootmodule_kind kind);
 const char * __init boot_module_kind_as_string(bootmodule_kind kind);
 
 #endif