@@ -320,7 +320,6 @@ static int tpm_tis_send_data(struct tpm_chip *chip, const u8 *buf, size_t len)
{
struct tpm_tis_data *priv = dev_get_drvdata(&chip->dev);
int rc, status, burstcnt;
- size_t count = 0;
status = tpm_tis_status(chip);
if ((status & TPM_STS_COMMAND_READY) == 0) {
@@ -333,23 +332,23 @@ static int tpm_tis_send_data(struct tpm_chip *chip, const u8 *buf, size_t len)
}
}
- while (count < len) {
- burstcnt = get_burstcount(chip);
- if (burstcnt < 0) {
- dev_err(&chip->dev, "Unable to read burstcount\n");
- rc = burstcnt;
- goto out_err;
- }
- burstcnt = min_t(int, burstcnt, len - count);
- rc = tpm_tis_write_bytes(priv, ADD_LOCALITY(priv->fifo_address,
- priv->locality),
- burstcnt, buf + count);
- if (rc < 0)
- goto out_err;
-
- count += burstcnt;
+ /*
+ * Get the initial burstcount to ensure TPM is ready to
+ * accept data.
+ */
+ burstcnt = get_burstcount(chip);
+ if (burstcnt < 0) {
+ dev_err(&chip->dev, "Unable to read burstcount\n");
+ rc = burstcnt;
+ goto out_err;
}
+ rc = tpm_tis_write_bytes(priv, ADD_LOCALITY(priv->fifo_address,
+ priv->locality),
+ len, buf);
+ if (rc < 0)
+ goto out_err;
+
if (!(priv->flags & TPM_TIS_ITPM_WORKAROUND) &&
wait_for_tpm_stat(chip, TPM_STS_DATA_EXPECT | TPM_STS_VALID,
TPM_STS_VALID, chip->timeout_c, &priv->int_queue,