Skip to content

Commit 0c7415c

Browse files
committed
Merge tag 'tpmdd-next-v5.8-rc4' of git://git.infradead.org/users/jjs/linux-tpmdd
Pull tpm fixes from Jarkko Sakkinen: "These are just fixes for bugs found lately. All of them are small scale things here and there, and all of them are for previous kernel releases (the oldest appeared in v2.6.17)" * tag 'tpmdd-next-v5.8-rc4' of git://git.infradead.org/users/jjs/linux-tpmdd: tpm_tis: Remove the HID IFX0102 tpm_tis_spi: Prefer async probe tpm: ibmvtpm: Wait for ready buffer before probing for TPM2 attributes tpm/st33zp24: fix spelling mistake "drescription" -> "description" tpm_tis: extra chip->ops check on error path in tpm_tis_core_init tpm_tis_spi: Don't send anything during flow control tpm: Fix TIS locality timeout problems
2 parents 0dce884 + e918e57 commit 0c7415c

File tree

8 files changed

+26
-28
lines changed

8 files changed

+26
-28
lines changed

drivers/char/tpm/st33zp24/i2c.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ static int st33zp24_i2c_request_resources(struct i2c_client *client)
210210

211211
/*
212212
* st33zp24_i2c_probe initialize the TPM device
213-
* @param: client, the i2c_client drescription (TPM I2C description).
213+
* @param: client, the i2c_client description (TPM I2C description).
214214
* @param: id, the i2c_device_id struct.
215215
* @return: 0 in case of success.
216216
* -1 in other case.

drivers/char/tpm/st33zp24/spi.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ static int st33zp24_spi_request_resources(struct spi_device *dev)
329329

330330
/*
331331
* st33zp24_spi_probe initialize the TPM device
332-
* @param: dev, the spi_device drescription (TPM SPI description).
332+
* @param: dev, the spi_device description (TPM SPI description).
333333
* @return: 0 in case of success.
334334
* or a negative value describing the error.
335335
*/
@@ -378,7 +378,7 @@ static int st33zp24_spi_probe(struct spi_device *dev)
378378

379379
/*
380380
* st33zp24_spi_remove remove the TPM device
381-
* @param: client, the spi_device drescription (TPM SPI description).
381+
* @param: client, the spi_device description (TPM SPI description).
382382
* @return: 0 in case of success.
383383
*/
384384
static int st33zp24_spi_remove(struct spi_device *dev)

drivers/char/tpm/st33zp24/st33zp24.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ static const struct tpm_class_ops st33zp24_tpm = {
502502

503503
/*
504504
* st33zp24_probe initialize the TPM device
505-
* @param: client, the i2c_client drescription (TPM I2C description).
505+
* @param: client, the i2c_client description (TPM I2C description).
506506
* @param: id, the i2c_device_id struct.
507507
* @return: 0 in case of success.
508508
* -1 in other case.

drivers/char/tpm/tpm-dev-common.c

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -189,15 +189,6 @@ ssize_t tpm_common_write(struct file *file, const char __user *buf,
189189
goto out;
190190
}
191191

192-
/* atomic tpm command send and result receive. We only hold the ops
193-
* lock during this period so that the tpm can be unregistered even if
194-
* the char dev is held open.
195-
*/
196-
if (tpm_try_get_ops(priv->chip)) {
197-
ret = -EPIPE;
198-
goto out;
199-
}
200-
201192
priv->response_length = 0;
202193
priv->response_read = false;
203194
*off = 0;
@@ -211,11 +202,19 @@ ssize_t tpm_common_write(struct file *file, const char __user *buf,
211202
if (file->f_flags & O_NONBLOCK) {
212203
priv->command_enqueued = true;
213204
queue_work(tpm_dev_wq, &priv->async_work);
214-
tpm_put_ops(priv->chip);
215205
mutex_unlock(&priv->buffer_mutex);
216206
return size;
217207
}
218208

209+
/* atomic tpm command send and result receive. We only hold the ops
210+
* lock during this period so that the tpm can be unregistered even if
211+
* the char dev is held open.
212+
*/
213+
if (tpm_try_get_ops(priv->chip)) {
214+
ret = -EPIPE;
215+
goto out;
216+
}
217+
219218
ret = tpm_dev_transmit(priv->chip, priv->space, priv->data_buffer,
220219
sizeof(priv->data_buffer));
221220
tpm_put_ops(priv->chip);

drivers/char/tpm/tpm_ibmvtpm.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -683,20 +683,20 @@ static int tpm_ibmvtpm_probe(struct vio_dev *vio_dev,
683683
if (rc)
684684
goto init_irq_cleanup;
685685

686-
if (!strcmp(id->compat, "IBM,vtpm20")) {
687-
chip->flags |= TPM_CHIP_FLAG_TPM2;
688-
rc = tpm2_get_cc_attrs_tbl(chip);
689-
if (rc)
690-
goto init_irq_cleanup;
691-
}
692-
693686
if (!wait_event_timeout(ibmvtpm->crq_queue.wq,
694687
ibmvtpm->rtce_buf != NULL,
695688
HZ)) {
696689
dev_err(dev, "CRQ response timed out\n");
697690
goto init_irq_cleanup;
698691
}
699692

693+
if (!strcmp(id->compat, "IBM,vtpm20")) {
694+
chip->flags |= TPM_CHIP_FLAG_TPM2;
695+
rc = tpm2_get_cc_attrs_tbl(chip);
696+
if (rc)
697+
goto init_irq_cleanup;
698+
}
699+
700700
return tpm_chip_register(chip);
701701
init_irq_cleanup:
702702
do {

drivers/char/tpm/tpm_tis.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,6 @@ static int tpm_tis_pnp_init(struct pnp_dev *pnp_dev,
238238
static struct pnp_device_id tpm_pnp_tbl[] = {
239239
{"PNP0C31", 0}, /* TPM */
240240
{"ATM1200", 0}, /* Atmel */
241-
{"IFX0102", 0}, /* Infineon */
242241
{"BCM0101", 0}, /* Broadcom */
243242
{"BCM0102", 0}, /* Broadcom */
244243
{"NSC1200", 0}, /* National */

drivers/char/tpm/tpm_tis_core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1085,7 +1085,7 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
10851085

10861086
return 0;
10871087
out_err:
1088-
if ((chip->ops != NULL) && (chip->ops->clk_enable != NULL))
1088+
if (chip->ops->clk_enable != NULL)
10891089
chip->ops->clk_enable(chip, false);
10901090

10911091
tpm_tis_remove(chip);

drivers/char/tpm/tpm_tis_spi_main.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ static int tpm_tis_spi_flow_control(struct tpm_tis_spi_phy *phy,
5353

5454
if ((phy->iobuf[3] & 0x01) == 0) {
5555
// handle SPI wait states
56-
phy->iobuf[0] = 0;
57-
5856
for (i = 0; i < TPM_RETRY; i++) {
5957
spi_xfer->len = 1;
6058
spi_message_init(&m);
@@ -104,6 +102,8 @@ int tpm_tis_spi_transfer(struct tpm_tis_data *data, u32 addr, u16 len,
104102
if (ret < 0)
105103
goto exit;
106104

105+
/* Flow control transfers are receive only */
106+
spi_xfer.tx_buf = NULL;
107107
ret = phy->flow_control(phy, &spi_xfer);
108108
if (ret < 0)
109109
goto exit;
@@ -113,9 +113,8 @@ int tpm_tis_spi_transfer(struct tpm_tis_data *data, u32 addr, u16 len,
113113
spi_xfer.delay.value = 5;
114114
spi_xfer.delay.unit = SPI_DELAY_UNIT_USECS;
115115

116-
if (in) {
117-
spi_xfer.tx_buf = NULL;
118-
} else if (out) {
116+
if (out) {
117+
spi_xfer.tx_buf = phy->iobuf;
119118
spi_xfer.rx_buf = NULL;
120119
memcpy(phy->iobuf, out, transfer_len);
121120
out += transfer_len;
@@ -288,6 +287,7 @@ static struct spi_driver tpm_tis_spi_driver = {
288287
.pm = &tpm_tis_pm,
289288
.of_match_table = of_match_ptr(of_tis_spi_match),
290289
.acpi_match_table = ACPI_PTR(acpi_tis_spi_match),
290+
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
291291
},
292292
.probe = tpm_tis_spi_driver_probe,
293293
.remove = tpm_tis_spi_remove,

0 commit comments

Comments
 (0)