From: Stefan Berger <[email protected]>

Introduce 2 new flags that prevent the registration of TPM devices
with sysfs and securityfs. None of the exising devices set these flags.

Signed-off-by: Stefan Berger <[email protected]>
---
 drivers/char/tpm/tpm-chip.c | 14 +++++++++-----
 drivers/char/tpm/tpm.h      |  2 ++
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c
index fbd75c5..f2da376 100644
--- a/drivers/char/tpm/tpm-chip.c
+++ b/drivers/char/tpm/tpm-chip.c
@@ -182,11 +182,14 @@ static int tpm1_chip_register(struct tpm_chip *chip)
        if (chip->flags & TPM_CHIP_FLAG_TPM2)
                return 0;
 
-       rc = tpm_sysfs_add_device(chip);
-       if (rc)
-               return rc;
+       if (!(chip->flags & TPM_CHIP_FLAG_NO_SYSFS)) {
+               rc = tpm_sysfs_add_device(chip);
+               if (rc)
+                       return rc;
+       }
 
-       chip->bios_dir = tpm_bios_log_setup(chip->devname);
+       if (!(chip->flags & TPM_CHIP_FLAG_NO_LOG))
+               chip->bios_dir = tpm_bios_log_setup(chip->devname);
 
        return 0;
 }
@@ -199,7 +202,8 @@ static void tpm1_chip_unregister(struct tpm_chip *chip)
        if (chip->bios_dir)
                tpm_bios_log_teardown(chip->bios_dir);
 
-       tpm_sysfs_del_device(chip);
+       if (!(chip->flags & TPM_CHIP_FLAG_NO_SYSFS))
+               tpm_sysfs_del_device(chip);
 }
 
 /*
diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h
index a4257a3..dfa755b 100644
--- a/drivers/char/tpm/tpm.h
+++ b/drivers/char/tpm/tpm.h
@@ -168,6 +168,8 @@ struct tpm_vendor_specific {
 enum tpm_chip_flags {
        TPM_CHIP_FLAG_REGISTERED        = BIT(0),
        TPM_CHIP_FLAG_TPM2              = BIT(1),
+       TPM_CHIP_FLAG_NO_SYSFS          = BIT(3),
+       TPM_CHIP_FLAG_NO_LOG            = BIT(4),
 };
 
 struct tpm_chip {
-- 
2.4.3


------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
tpmdd-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tpmdd-devel

Reply via email to