On 11 June 2015 at 13:47, Al Stone al.stone@linaro.org wrote:
On 06/11/2015 11:07 AM, Ashwin Chaugule wrote:
On 10 June 2015 at 23:28, al.stone@linaro.org wrote:
From: Al Stone al.stone@linaro.org
Add the ACPI_SPEC_VERSION() macro to build a proper version number from a major and minor revision number. Add also the ACPI_FADT_SPEC_VERSION that constructs a proper version number from the entries in the current FADT.
These macros are added in order to simplify retrieving and comparing ACPI specification version numbers, since this is becoming a more frequent need. In particular, there are some architectures that require at least a certain version of the spec, and there are differences in some structure sizes that have changed with recent versions but can only be tracked by spec version number.
Signed-off-by: Al Stone al.stone@linaro.org
include/linux/acpi.h | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/include/linux/acpi.h b/include/linux/acpi.h index a4acb55..33ed313 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -48,6 +48,11 @@ #include <acpi/acpi_io.h> #include <asm/acpi.h>
+#define ACPI_SPEC_VERSION(major, minor) ((major<<8)|minor) +#define ACPI_FADT_SPEC_VERSION \
ACPI_SPEC_VERSION(acpi_gbl_FADT.header.revision, \
acpi_gbl_FADT.minor_revision)
Would it be better to make this a function to avoid using this macro before the acpi_gbl* stuff is initialized?
Perhaps. Couldn't that happen even as a function, though? I think this would have to be an __init function which is why I'm not sure it would make a difference. Or am I misunderstanding something? It's happened at least once before :)...
Right. Sorry I should've been clear. It could be a multi line macro too I guess (could get messy though). I was suggesting checking if acpi_gbl* is initialized and returning -EINVAL or something, would probably be better than assuming it is always sane. I dont know if this macro would/can ever be used very early on before acpi_gbl* is populated so I'll let you guys take a call whether stricter checking is necessary or not. :)