summaryrefslogtreecommitdiffstats
path: root/drivers/char/tpm/tpm_eventlog.h
diff options
context:
space:
mode:
authorNayna Jain2016-11-14 11:00:54 +0100
committerJarkko Sakkinen2016-11-28 00:31:32 +0100
commit02ae1382882f08c5804b996ca9c8d79b399dbe36 (patch)
tree092dc7aa55337443505ab350a297e801edfc80e8 /drivers/char/tpm/tpm_eventlog.h
parenttpm: fix the missing .owner in tpm_bios_measurements_ops (diff)
downloadkernel-qcow2-linux-02ae1382882f08c5804b996ca9c8d79b399dbe36.tar.gz
kernel-qcow2-linux-02ae1382882f08c5804b996ca9c8d79b399dbe36.tar.xz
kernel-qcow2-linux-02ae1382882f08c5804b996ca9c8d79b399dbe36.zip
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 <jgunthorpe@obsidianresearch.com> Signed-off-by: Nayna Jain <nayna@linux.vnet.ibm.com> Reviewed-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com> Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> Tested-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Diffstat (limited to 'drivers/char/tpm/tpm_eventlog.h')
-rw-r--r--drivers/char/tpm/tpm_eventlog.h22
1 files changed, 13 insertions, 9 deletions
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