diff mbox

[RFC,2/9] tpm_tis_core: access single TIS registers before doing complex transfers

Message ID 20171208184658.9588-3-Alexander.Steffen@infineon.com (mailing list archive)
State Rejected
Headers show

Commit Message

Alexander Steffen Dec. 8, 2017, 6:46 p.m. UTC
There are several TIS registers that contain information on how exactly the
TPM implements the TIS protocol. Complex commands that are used by the
probe functions should only be sent to the TPM after all other registers
have been read and the driver is properly configured to handle those
transactions.

Signed-off-by: Alexander Steffen <Alexander.Steffen@infineon.com>
---
 drivers/char/tpm/tpm_tis_core.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

Comments

Jarkko Sakkinen Jan. 18, 2018, 5:16 p.m. UTC | #1
On Fri, Dec 08, 2017 at 07:46:51PM +0100, Alexander Steffen wrote:
> There are several TIS registers that contain information on how exactly the
> TPM implements the TIS protocol. Complex commands that are used by the
> probe functions should only be sent to the TPM after all other registers
> have been read and the driver is properly configured to handle those
> transactions.
> 
> Signed-off-by: Alexander Steffen <Alexander.Steffen@infineon.com>

The code change looks ok but the commit message does not describe what
the commit does. It describes a guideline and uses an abstract term
"complex command".

/Jarkko
diff mbox

Patch

diff --git a/drivers/char/tpm/tpm_tis_core.c b/drivers/char/tpm/tpm_tis_core.c
index ca6b2b5..d367016 100644
--- a/drivers/char/tpm/tpm_tis_core.c
+++ b/drivers/char/tpm/tpm_tis_core.c
@@ -781,10 +781,6 @@  int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
 	intmask &= ~TPM_GLOBAL_INT_ENABLE;
 	tpm_tis_write32(priv, TPM_INT_ENABLE(priv->locality), intmask);
 
-	rc = tpm2_probe(chip);
-	if (rc)
-		goto out_err;
-
 	rc = tpm_tis_read32(priv, TPM_DID_VID(0), &vendor);
 	if (rc < 0)
 		goto out_err;
@@ -795,16 +791,6 @@  int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
 	if (rc < 0)
 		goto out_err;
 
-	dev_info(dev, "%s TPM (device-id 0x%X, rev-id %d)\n",
-		 (chip->flags & TPM_CHIP_FLAG_TPM2) ? "2.0" : "1.2",
-		 vendor >> 16, rid);
-
-	probe = probe_itpm(chip);
-	if (probe < 0) {
-		rc = -ENODEV;
-		goto out_err;
-	}
-
 	/* Figure out the capabilities */
 	rc = tpm_tis_read32(priv, TPM_INTF_CAPS(priv->locality), &intfcaps);
 	if (rc < 0)
@@ -831,6 +817,20 @@  int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
 	if (intfcaps & TPM_INTF_DATA_AVAIL_INT)
 		dev_dbg(dev, "\tData Avail Int Support\n");
 
+	rc = tpm2_probe(chip);
+	if (rc)
+		goto out_err;
+
+	dev_info(dev, "%s TPM (device-id 0x%X, rev-id %d)\n",
+		 (chip->flags & TPM_CHIP_FLAG_TPM2) ? "2.0" : "1.2",
+		 vendor >> 16, rid);
+
+	probe = probe_itpm(chip);
+	if (probe < 0) {
+		rc = -ENODEV;
+		goto out_err;
+	}
+
 	/* INTERRUPT Setup */
 	init_waitqueue_head(&priv->read_queue);
 	init_waitqueue_head(&priv->int_queue);