From 02ae1382882f08c5804b996ca9c8d79b399dbe36 Mon Sep 17 00:00:00 2001 From: Nayna Jain Date: Mon, 14 Nov 2016 05:00:54 -0500 Subject: tpm: redefine read_log() to handle ACPI/OF at runtime Currently, read_log() has two implementations: one for ACPI platforms and the other for device tree(OF) based platforms. The proper one is selected at compile time using Kconfig and #ifdef in the Makefile, which is not the recommended approach. This patch removes the #ifdef in the Makefile by defining a single read_log() method, which checks for ACPI/OF event log properties at runtime. [jarkko.sakkinen@linux.intel.com: added tpm_ prefix to read_log*] Suggested-by: Jason Gunthorpe Signed-off-by: Nayna Jain Reviewed-by: Jason Gunthorpe Reviewed-by: Jarkko Sakkinen Tested-by: Jarkko Sakkinen Signed-off-by: Jarkko Sakkinen --- drivers/char/tpm/tpm_eventlog.h | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'drivers/char/tpm/tpm_eventlog.h') diff --git a/drivers/char/tpm/tpm_eventlog.h b/drivers/char/tpm/tpm_eventlog.h index 6df2f8e79a8e..1660d74ea79a 100644 --- a/drivers/char/tpm/tpm_eventlog.h +++ b/drivers/char/tpm/tpm_eventlog.h @@ -73,20 +73,24 @@ enum tcpa_pc_event_ids { HOST_TABLE_OF_DEVICES, }; -int read_log(struct tpm_chip *chip); - -#if defined(CONFIG_TCG_IBMVTPM) || defined(CONFIG_TCG_IBMVTPM_MODULE) || \ - defined(CONFIG_ACPI) -extern int tpm_bios_log_setup(struct tpm_chip *chip); -extern void tpm_bios_log_teardown(struct tpm_chip *chip); +#if defined(CONFIG_ACPI) +int tpm_read_log_acpi(struct tpm_chip *chip); #else -static inline int tpm_bios_log_setup(struct tpm_chip *chip) +static inline int tpm_read_log_acpi(struct tpm_chip *chip) { - return 0; + return -ENODEV; } -static inline void tpm_bios_log_teardown(struct tpm_chip *chip) +#endif +#if defined(CONFIG_OF) +int tpm_read_log_of(struct tpm_chip *chip); +#else +static inline int tpm_read_log_of(struct tpm_chip *chip) { + return -ENODEV; } #endif +int tpm_bios_log_setup(struct tpm_chip *chip); +void tpm_bios_log_teardown(struct tpm_chip *chip); + #endif -- cgit v1.2.3-55-g7522