[PATCH] We're getting efi_runtime build warnings with recent kernels:

Keng-Yü Lin keng-yu.lin at canonical.com
Mon Jul 8 08:33:46 UTC 2013


On Mon, Jul 8, 2013 at 3:37 PM, Colin Ian King <colin.king at canonical.com> wrote:
> On 05/07/13 13:08, Colin King wrote:
>> From: Colin Ian King <colin.king at canonical.com>
>>
>> make -C /lib/modules/`uname -r`/build M=`pwd` modules
>> make[1]: Entering directory `/usr/src/linux-headers-3.8.0-25-generic'
>>   CC [M] /home/king/tmp/fwts/efi_runtime/efi_runtime.o
>> /home/king/tmp/fwts/efi_runtime/efi_runtime.c: In function ‘efi_runtime_init’:
>> /home/king/tmp/fwts/efi_runtime/efi_runtime.c:364:6: warning: the address of ‘efi_enabled’ will always evaluate as ‘true’ [-Waddress]
>>
>> This occurs because of kernel commit 83e681897 which turned efi_enabled from an integer into a function, hence efi_enabled will always now evaluate as true.
>> The commit introduced macro EFI_RUNTIME_SERVICES so if this is defined we
>> call efi_enabled() otherwise efi_enabled is a plain int.  So use this macro
>> to determine if we are using historic or new efi_enabled for different kernel
>> versions.
>>
>> Signed-off-by: Colin Ian King <colin.king at canonical.com>
>> ---
>>  efi_runtime/efi_runtime.c | 11 ++++++++++-
>>  1 file changed, 10 insertions(+), 1 deletion(-)
>>
>> diff --git a/efi_runtime/efi_runtime.c b/efi_runtime/efi_runtime.c
>> index 63fea7b..73171df 100644
>> --- a/efi_runtime/efi_runtime.c
>> +++ b/efi_runtime/efi_runtime.c
>> @@ -34,6 +34,13 @@ MODULE_AUTHOR("Ivan Hu");
>>  MODULE_DESCRIPTION("EFI Runtime Driver");
>>  MODULE_LICENSE("GPL");
>>
>> +/* commit 83e681897 turned efi_enabled into a function, so abstract it */
>> +#ifdef EFI_RUNTIME_SERVICES
>> +#define EFI_RUNTIME_ENABLED  efi_enabled(EFI_RUNTIME_SERVICES)
>> +#else
>> +#define EFI_RUNTIME_ENABLED  efi_enabled
>> +#endif
>> +
>>  static void convert_from_efi_time(efi_time_t *eft, EFI_TIME *time)
>>  {
>>       memset(time, 0, sizeof(EFI_TIME));
>> @@ -361,8 +368,10 @@ static int __init efi_runtime_init(void)
>>
>>       printk(KERN_INFO "EFI_RUNTIME Driver v%s\n", EFI_FWTS_EFI_VERSION);
>>
>> -     if (!efi_enabled)
>> +     if (!EFI_RUNTIME_ENABLED) {
>> +             printk(KERN_INFO "EFI runtime services not enabled.\n");
>>               return -ENODEV;
>> +     }
>>
>>       ret = misc_register(&efi_runtime_dev);
>>       if (ret) {
>>
>
> Forgot to mention: LP: #1198168 for this patch, Keng-Yu, can you add
> that to the subject line of the patch before applying?
>
> Colin
>

No problem, and

Acked-by: Keng-Yu Lin <kengyu at canonical.com>



More information about the fwts-devel mailing list