Skip to content

Commit 682e98f

Browse files
author
Jarkko Sakkinen
committed
tpm: drop int_queue from tpm_vendor_specific
Drop field int_queue from tpm_vendor_specific as it is used only by tpm_tis. Probably all of the fields should be eventually dropped and moved to the private structures of different drivers but it is better to do this one step at a time in order not to break anything. Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> Reviewed-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
1 parent 01fc5e8 commit 682e98f

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

drivers/char/tpm/tpm.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ struct tpm_vendor_specific {
148148
void *priv;
149149

150150
wait_queue_head_t read_queue;
151-
wait_queue_head_t int_queue;
152151

153152
u16 manufacturer_id;
154153
};

drivers/char/tpm/tpm_i2c_nuvoton.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,6 @@ static int i2c_nuvoton_probe(struct i2c_client *client,
540540
return -ENOMEM;
541541

542542
init_waitqueue_head(&chip->vendor.read_queue);
543-
init_waitqueue_head(&chip->vendor.int_queue);
544543

545544
/* Default timeouts */
546545
chip->vendor.timeout_a = msecs_to_jiffies(TPM_I2C_SHORT_TIMEOUT);

drivers/char/tpm/tpm_tis.c

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ struct tpm_info {
9595

9696
struct priv_data {
9797
bool irq_tested;
98+
wait_queue_head_t int_queue;
9899
};
99100

100101
#if defined(CONFIG_PNP) && defined(CONFIG_ACPI)
@@ -157,6 +158,7 @@ static void release_locality(struct tpm_chip *chip, int l, int force)
157158

158159
static int request_locality(struct tpm_chip *chip, int l)
159160
{
161+
struct priv_data *priv = chip->vendor.priv;
160162
unsigned long stop, timeout;
161163
long rc;
162164

@@ -173,7 +175,7 @@ static int request_locality(struct tpm_chip *chip, int l)
173175
timeout = stop - jiffies;
174176
if ((long)timeout <= 0)
175177
return -1;
176-
rc = wait_event_interruptible_timeout(chip->vendor.int_queue,
178+
rc = wait_event_interruptible_timeout(priv->int_queue,
177179
(check_locality
178180
(chip, l) >= 0),
179181
timeout);
@@ -249,6 +251,7 @@ static int recv_data(struct tpm_chip *chip, u8 *buf, size_t count)
249251

250252
static int tpm_tis_recv(struct tpm_chip *chip, u8 *buf, size_t count)
251253
{
254+
struct priv_data *priv = chip->vendor.priv;
252255
int size = 0;
253256
int expected, status;
254257

@@ -279,7 +282,7 @@ static int tpm_tis_recv(struct tpm_chip *chip, u8 *buf, size_t count)
279282
}
280283

281284
wait_for_tpm_stat(chip, TPM_STS_VALID, chip->vendor.timeout_c,
282-
&chip->vendor.int_queue, false);
285+
&priv->int_queue, false);
283286
status = tpm_tis_status(chip);
284287
if (status & TPM_STS_DATA_AVAIL) { /* retry? */
285288
dev_err(&chip->dev, "Error left over data\n");
@@ -304,6 +307,7 @@ MODULE_PARM_DESC(itpm, "Force iTPM workarounds (found on some Lenovo laptops)");
304307
*/
305308
static int tpm_tis_send_data(struct tpm_chip *chip, u8 *buf, size_t len)
306309
{
310+
struct priv_data *priv = chip->vendor.priv;
307311
int rc, status, burstcnt;
308312
size_t count = 0;
309313

@@ -315,7 +319,7 @@ static int tpm_tis_send_data(struct tpm_chip *chip, u8 *buf, size_t len)
315319
tpm_tis_ready(chip);
316320
if (wait_for_tpm_stat
317321
(chip, TPM_STS_COMMAND_READY, chip->vendor.timeout_b,
318-
&chip->vendor.int_queue, false) < 0) {
322+
&priv->int_queue, false) < 0) {
319323
rc = -ETIME;
320324
goto out_err;
321325
}
@@ -330,7 +334,7 @@ static int tpm_tis_send_data(struct tpm_chip *chip, u8 *buf, size_t len)
330334
}
331335

332336
wait_for_tpm_stat(chip, TPM_STS_VALID, chip->vendor.timeout_c,
333-
&chip->vendor.int_queue, false);
337+
&priv->int_queue, false);
334338
status = tpm_tis_status(chip);
335339
if (!itpm && (status & TPM_STS_DATA_EXPECT) == 0) {
336340
rc = -EIO;
@@ -342,7 +346,7 @@ static int tpm_tis_send_data(struct tpm_chip *chip, u8 *buf, size_t len)
342346
iowrite8(buf[count],
343347
chip->vendor.iobase + TPM_DATA_FIFO(chip->vendor.locality));
344348
wait_for_tpm_stat(chip, TPM_STS_VALID, chip->vendor.timeout_c,
345-
&chip->vendor.int_queue, false);
349+
&priv->int_queue, false);
346350
status = tpm_tis_status(chip);
347351
if ((status & TPM_STS_DATA_EXPECT) != 0) {
348352
rc = -EIO;
@@ -537,6 +541,7 @@ static const struct tpm_class_ops tpm_tis = {
537541
static irqreturn_t tis_int_handler(int dummy, void *dev_id)
538542
{
539543
struct tpm_chip *chip = dev_id;
544+
struct priv_data *priv = chip->vendor.priv;
540545
u32 interrupt;
541546
int i;
542547

@@ -556,7 +561,7 @@ static irqreturn_t tis_int_handler(int dummy, void *dev_id)
556561
if (interrupt &
557562
(TPM_INTF_LOCALITY_CHANGE_INT | TPM_INTF_STS_VALID_INT |
558563
TPM_INTF_CMD_READY_INT))
559-
wake_up_interruptible(&chip->vendor.int_queue);
564+
wake_up_interruptible(&priv->int_queue);
560565

561566
/* Clear interrupts handled with TPM_EOI */
562567
iowrite32(interrupt,
@@ -768,7 +773,7 @@ static int tpm_tis_init(struct device *dev, struct tpm_info *tpm_info,
768773

769774
/* INTERRUPT Setup */
770775
init_waitqueue_head(&chip->vendor.read_queue);
771-
init_waitqueue_head(&chip->vendor.int_queue);
776+
init_waitqueue_head(&priv->int_queue);
772777
if (interrupts && tpm_info->irq != -1) {
773778
if (tpm_info->irq) {
774779
tpm_tis_probe_irq_single(chip, intmask, IRQF_SHARED,

0 commit comments

Comments
 (0)