summaryrefslogtreecommitdiffstats
path: root/drivers/char/tpm/tpm2-cmd.c
diff options
context:
space:
mode:
authorJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>2017-02-15 20:02:28 +0200
committerJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>2017-02-20 13:23:18 +0200
commit61841be6358c03e864ad4c386c9a102edbba9cb8 (patch)
tree12ab9207e177ab2ba5a371a8b6b8672f6b560012 /drivers/char/tpm/tpm2-cmd.c
parent51b0be640cf6e2cb63a7cf4d9c7c4acd3ad5afd0 (diff)
downloadlinux-stable-61841be6358c03e864ad4c386c9a102edbba9cb8.tar.gz
linux-stable-61841be6358c03e864ad4c386c9a102edbba9cb8.tar.bz2
linux-stable-61841be6358c03e864ad4c386c9a102edbba9cb8.zip
tpm: declare tpm2_get_pcr_allocation() as static
There's no need to export tpm2_get_pcr_alloation() because it is only a helper function for tpm2_auto_startup(). For the same reason it does not make much sense to maintain documentation for it. Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Diffstat (limited to 'drivers/char/tpm/tpm2-cmd.c')
-rw-r--r--drivers/char/tpm/tpm2-cmd.c94
1 files changed, 45 insertions, 49 deletions
diff --git a/drivers/char/tpm/tpm2-cmd.c b/drivers/char/tpm/tpm2-cmd.c
index 10f97e6a576b..881aea9732bf 100644
--- a/drivers/char/tpm/tpm2-cmd.c
+++ b/drivers/char/tpm/tpm2-cmd.c
@@ -997,61 +997,13 @@ int tpm2_probe(struct tpm_chip *chip)
}
EXPORT_SYMBOL_GPL(tpm2_probe);
-/**
- * tpm2_auto_startup - Perform the standard automatic TPM initialization
- * sequence
- * @chip: TPM chip to use
- *
- * Returns 0 on success, < 0 in case of fatal error.
- */
-int tpm2_auto_startup(struct tpm_chip *chip)
-{
- int rc;
-
- rc = tpm_get_timeouts(chip);
- if (rc)
- goto out;
-
- rc = tpm2_do_selftest(chip);
- if (rc != 0 && rc != TPM2_RC_INITIALIZE) {
- dev_err(&chip->dev, "TPM self test failed\n");
- goto out;
- }
-
- if (rc == TPM2_RC_INITIALIZE) {
- rc = tpm2_startup(chip, TPM2_SU_CLEAR);
- if (rc)
- goto out;
-
- rc = tpm2_do_selftest(chip);
- if (rc) {
- dev_err(&chip->dev, "TPM self test failed\n");
- goto out;
- }
- }
-
- rc = tpm2_get_pcr_allocation(chip);
-
-out:
- if (rc > 0)
- rc = -ENODEV;
- return rc;
-}
-
struct tpm2_pcr_selection {
__be16 hash_alg;
u8 size_of_select;
u8 pcr_select[3];
} __packed;
-/**
- * tpm2_get_pcr_allocation() - get TPM active PCR banks.
- *
- * @chip: TPM chip to use.
- *
- * Return: Same as with tpm_transmit_cmd.
- */
-ssize_t tpm2_get_pcr_allocation(struct tpm_chip *chip)
+static ssize_t tpm2_get_pcr_allocation(struct tpm_chip *chip)
{
struct tpm2_pcr_selection pcr_selection;
struct tpm_buf buf;
@@ -1114,3 +1066,47 @@ out:
return rc;
}
+
+/**
+ * tpm2_auto_startup - Perform the standard automatic TPM initialization
+ * sequence
+ * @chip: TPM chip to use
+ *
+ * Initializes timeout values for operation and command durations, conducts
+ * a self-test and reads the list of active PCR banks.
+ *
+ * Return: 0 on success. Otherwise, a system error code is returned.
+ */
+int tpm2_auto_startup(struct tpm_chip *chip)
+{
+ int rc;
+
+ rc = tpm_get_timeouts(chip);
+ if (rc)
+ goto out;
+
+ rc = tpm2_do_selftest(chip);
+ if (rc != 0 && rc != TPM2_RC_INITIALIZE) {
+ dev_err(&chip->dev, "TPM self test failed\n");
+ goto out;
+ }
+
+ if (rc == TPM2_RC_INITIALIZE) {
+ rc = tpm2_startup(chip, TPM2_SU_CLEAR);
+ if (rc)
+ goto out;
+
+ rc = tpm2_do_selftest(chip);
+ if (rc) {
+ dev_err(&chip->dev, "TPM self test failed\n");
+ goto out;
+ }
+ }
+
+ rc = tpm2_get_pcr_allocation(chip);
+
+out:
+ if (rc > 0)
+ rc = -ENODEV;
+ return rc;
+}