summaryrefslogtreecommitdiffstats
path: root/drivers/char/tpm/tpm-chip.c
diff options
context:
space:
mode:
authorJarkko Sakkinen2016-11-14 11:00:51 +0100
committerJarkko Sakkinen2016-11-28 00:31:32 +0100
commit7518a21a9da39dc605ae08714ad046bfeca26f9b (patch)
tree3ca263df64b869349e3de611966038891a871574 /drivers/char/tpm/tpm-chip.c
parenttpm: replace dynamically allocated bios_dir with a static array (diff)
downloadkernel-qcow2-linux-7518a21a9da39dc605ae08714ad046bfeca26f9b.tar.gz
kernel-qcow2-linux-7518a21a9da39dc605ae08714ad046bfeca26f9b.tar.xz
kernel-qcow2-linux-7518a21a9da39dc605ae08714ad046bfeca26f9b.zip
tpm: drop tpm1_chip_register(/unregister)
Check for TPM2 chip in tpm_sysfs_add_device, tpm_bios_log_setup and tpm_bios_log_teardown in order to make code flow cleaner and to enable to implement TPM 2.0 support later on. This is partially derived from the commit by Nayna Jain with the extension that also tpm1_chip_register is dropped. Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> Reviewed-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com> Reviewed-by: Nayna Jain <nayna@linux.vnet.ibm.com> Tested-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com> Tested-by: Nayna Jain <nayna@linux.vnet.ibm.com>
Diffstat (limited to 'drivers/char/tpm/tpm-chip.c')
-rw-r--r--drivers/char/tpm/tpm-chip.c31
1 files changed, 5 insertions, 26 deletions
diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c
index d0c187269ef4..250a651ebd95 100644
--- a/drivers/char/tpm/tpm-chip.c
+++ b/drivers/char/tpm/tpm-chip.c
@@ -276,28 +276,6 @@ static void tpm_del_char_device(struct tpm_chip *chip)
up_write(&chip->ops_sem);
}
-static int tpm1_chip_register(struct tpm_chip *chip)
-{
- int rc;
-
- if (chip->flags & TPM_CHIP_FLAG_TPM2)
- return 0;
-
- tpm_sysfs_add_device(chip);
-
- rc = tpm_bios_log_setup(chip);
-
- return rc;
-}
-
-static void tpm1_chip_unregister(struct tpm_chip *chip)
-{
- if (chip->flags & TPM_CHIP_FLAG_TPM2)
- return;
-
- tpm_bios_log_teardown(chip);
-}
-
static void tpm_del_legacy_sysfs(struct tpm_chip *chip)
{
struct attribute **i;
@@ -364,7 +342,9 @@ int tpm_chip_register(struct tpm_chip *chip)
return rc;
}
- rc = tpm1_chip_register(chip);
+ tpm_sysfs_add_device(chip);
+
+ rc = tpm_bios_log_setup(chip);
if (rc)
return rc;
@@ -372,7 +352,7 @@ int tpm_chip_register(struct tpm_chip *chip)
rc = tpm_add_char_device(chip);
if (rc) {
- tpm1_chip_unregister(chip);
+ tpm_bios_log_teardown(chip);
return rc;
}
@@ -402,8 +382,7 @@ EXPORT_SYMBOL_GPL(tpm_chip_register);
void tpm_chip_unregister(struct tpm_chip *chip)
{
tpm_del_legacy_sysfs(chip);
-
- tpm1_chip_unregister(chip);
+ tpm_bios_log_teardown(chip);
tpm_del_char_device(chip);
}
EXPORT_SYMBOL_GPL(tpm_chip_unregister);