Re: [PATCH 1/2] Create UV efi_call macros

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* Ard Biesheuvel <ard.biesheuvel@xxxxxxxxxx> wrote:

> On 12 May 2016 at 08:46, Ingo Molnar <mingo@xxxxxxxxxx> wrote:
> >
> > * Alex Thorlton <athorlton@xxxxxxx> wrote:
> >
> >> +#define efi_call_virt(f, args...)                                    \
> >> +({                                                                   \
> >> +     efi_status_t __s;                                               \
> >> +     unsigned long flags;                                            \
> >> +     arch_efi_call_virt_setup();                                     \
> >> +     local_save_flags(flags);                                        \
> >> +     __s = arch_efi_call_virt(f, args);                              \
> >> +     efi_call_virt_check_flags(flags, __stringify(f));               \
> >> +     arch_efi_call_virt_teardown();                                  \
> >> +     __s;                                                            \
> >> +})
> >> +
> >> +#define __efi_call_virt(f, args...)                                  \
> >> +({                                                                   \
> >> +     unsigned long flags;                                            \
> >> +     arch_efi_call_virt_setup();                                     \
> >> +     local_save_flags(flags);                                        \
> >> +     arch_efi_call_virt(f, args);                                    \
> >> +     efi_call_virt_check_flags(flags, __stringify(f));               \
> >> +     arch_efi_call_virt_teardown();                                  \
> >> +})
> >> +
> >> +#define uv_call_virt(f, args...)                                     \
> >> +({                                                                   \
> >> +     efi_status_t __s;                                               \
> >> +     unsigned long flags;                                            \
> >> +     arch_efi_call_virt_setup();                                     \
> >> +     local_save_flags(flags);                                        \
> >> +     __s = uv_efi_call_virt(f, args);                                \
> >> +     efi_call_virt_check_flags(flags, __stringify(f));               \
> >> +     arch_efi_call_virt_teardown();                                  \
> >> +     __s;                                                            \
> >> +})
> >
> > Btw., a very (very!) small stylistic nit that caught my eyes, and I realize that
> > you just moved code, but could you please improve these macros a bit and make it
> > look like regular kernel code? I.e. something like:
> >
> > #define efi_call_virt(f, args...)                                       \
> > ({                                                                      \
> >         efi_status_t __s;                                               \
> >         unsigned long flags;                                            \
> >                                                                         \
> >         arch_efi_call_virt_setup();                                     \
> >                                                                         \
> >         local_save_flags(flags);                                        \
> >         __s = arch_efi_call_virt(f, args);                              \
> >         efi_call_virt_check_flags(flags, __stringify(f));               \
> >         arch_efi_call_virt_teardown();                                  \
> >                                                                         \
> >         __s;                                                            \
> > })
> >
> > This delineates the various blocks of code: variables, setup, the saving/calling
> > block plus the return code.
> >
> > (Assuming the EFI folks like the whole approach.)
> >
> 
> Fine by me, although having a newline after arch_efi_call_virt_setup()
> but not before arch_efi_call_virt_teardown() seems rather arbitrary

It's an oversight! :-)

#define efi_call_virt(f, args...)					\
({									\
	efi_status_t __s;						\
	unsigned long flags;						\
									\
	arch_efi_call_virt_setup();					\
									\
	local_save_flags(flags);					\
	__s = arch_efi_call_virt(f, args);				\
	efi_call_virt_check_flags(flags, __stringify(f));		\
									\
	arch_efi_call_virt_teardown();					\
									\
	__s;								\
})

But if it's too segmented this is fine too:

#define efi_call_virt(f, args...)					\
({									\
	efi_status_t __s;						\
	unsigned long flags;						\
									\
	arch_efi_call_virt_setup();					\
	local_save_flags(flags);					\
	__s = arch_efi_call_virt(f, args);				\
	efi_call_virt_check_flags(flags, __stringify(f));		\
	arch_efi_call_virt_teardown();					\
									\
	__s;								\
})

Thanks,

	Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-efi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux