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_of.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'drivers/char/tpm/tpm_of.c') diff --git a/drivers/char/tpm/tpm_of.c b/drivers/char/tpm/tpm_of.c index 68d891ab55db..83c26bffb150 100644 --- a/drivers/char/tpm/tpm_of.c +++ b/drivers/char/tpm/tpm_of.c @@ -2,6 +2,7 @@ * Copyright 2012 IBM Corporation * * Author: Ashley Lai + * Nayna Jain * * Maintained by: * @@ -20,7 +21,7 @@ #include "tpm.h" #include "tpm_eventlog.h" -int read_log(struct tpm_chip *chip) +int tpm_read_log_of(struct tpm_chip *chip) { struct device_node *np; const u32 *sizep; @@ -28,11 +29,6 @@ int read_log(struct tpm_chip *chip) struct tpm_bios_log *log; log = &chip->log; - if (log->bios_event_log != NULL) { - pr_err("%s: ERROR - Eventlog already initialized\n", __func__); - return -EFAULT; - } - np = of_find_node_by_name(NULL, "vtpm"); if (!np) { pr_err("%s: ERROR - IBMVTPM not supported\n", __func__); -- cgit v1.2.1