@@ -95,6 +95,7 @@ struct tpm_info {
95
95
96
96
struct priv_data {
97
97
bool irq_tested ;
98
+ wait_queue_head_t int_queue ;
98
99
};
99
100
100
101
#if defined(CONFIG_PNP ) && defined(CONFIG_ACPI )
@@ -157,6 +158,7 @@ static void release_locality(struct tpm_chip *chip, int l, int force)
157
158
158
159
static int request_locality (struct tpm_chip * chip , int l )
159
160
{
161
+ struct priv_data * priv = chip -> vendor .priv ;
160
162
unsigned long stop , timeout ;
161
163
long rc ;
162
164
@@ -173,7 +175,7 @@ static int request_locality(struct tpm_chip *chip, int l)
173
175
timeout = stop - jiffies ;
174
176
if ((long )timeout <= 0 )
175
177
return -1 ;
176
- rc = wait_event_interruptible_timeout (chip -> vendor . int_queue ,
178
+ rc = wait_event_interruptible_timeout (priv -> int_queue ,
177
179
(check_locality
178
180
(chip , l ) >= 0 ),
179
181
timeout );
@@ -249,6 +251,7 @@ static int recv_data(struct tpm_chip *chip, u8 *buf, size_t count)
249
251
250
252
static int tpm_tis_recv (struct tpm_chip * chip , u8 * buf , size_t count )
251
253
{
254
+ struct priv_data * priv = chip -> vendor .priv ;
252
255
int size = 0 ;
253
256
int expected , status ;
254
257
@@ -279,7 +282,7 @@ static int tpm_tis_recv(struct tpm_chip *chip, u8 *buf, size_t count)
279
282
}
280
283
281
284
wait_for_tpm_stat (chip , TPM_STS_VALID , chip -> vendor .timeout_c ,
282
- & chip -> vendor . int_queue , false);
285
+ & priv -> int_queue , false);
283
286
status = tpm_tis_status (chip );
284
287
if (status & TPM_STS_DATA_AVAIL ) { /* retry? */
285
288
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)");
304
307
*/
305
308
static int tpm_tis_send_data (struct tpm_chip * chip , u8 * buf , size_t len )
306
309
{
310
+ struct priv_data * priv = chip -> vendor .priv ;
307
311
int rc , status , burstcnt ;
308
312
size_t count = 0 ;
309
313
@@ -315,7 +319,7 @@ static int tpm_tis_send_data(struct tpm_chip *chip, u8 *buf, size_t len)
315
319
tpm_tis_ready (chip );
316
320
if (wait_for_tpm_stat
317
321
(chip , TPM_STS_COMMAND_READY , chip -> vendor .timeout_b ,
318
- & chip -> vendor . int_queue , false) < 0 ) {
322
+ & priv -> int_queue , false) < 0 ) {
319
323
rc = - ETIME ;
320
324
goto out_err ;
321
325
}
@@ -330,7 +334,7 @@ static int tpm_tis_send_data(struct tpm_chip *chip, u8 *buf, size_t len)
330
334
}
331
335
332
336
wait_for_tpm_stat (chip , TPM_STS_VALID , chip -> vendor .timeout_c ,
333
- & chip -> vendor . int_queue , false);
337
+ & priv -> int_queue , false);
334
338
status = tpm_tis_status (chip );
335
339
if (!itpm && (status & TPM_STS_DATA_EXPECT ) == 0 ) {
336
340
rc = - EIO ;
@@ -342,7 +346,7 @@ static int tpm_tis_send_data(struct tpm_chip *chip, u8 *buf, size_t len)
342
346
iowrite8 (buf [count ],
343
347
chip -> vendor .iobase + TPM_DATA_FIFO (chip -> vendor .locality ));
344
348
wait_for_tpm_stat (chip , TPM_STS_VALID , chip -> vendor .timeout_c ,
345
- & chip -> vendor . int_queue , false);
349
+ & priv -> int_queue , false);
346
350
status = tpm_tis_status (chip );
347
351
if ((status & TPM_STS_DATA_EXPECT ) != 0 ) {
348
352
rc = - EIO ;
@@ -537,6 +541,7 @@ static const struct tpm_class_ops tpm_tis = {
537
541
static irqreturn_t tis_int_handler (int dummy , void * dev_id )
538
542
{
539
543
struct tpm_chip * chip = dev_id ;
544
+ struct priv_data * priv = chip -> vendor .priv ;
540
545
u32 interrupt ;
541
546
int i ;
542
547
@@ -556,7 +561,7 @@ static irqreturn_t tis_int_handler(int dummy, void *dev_id)
556
561
if (interrupt &
557
562
(TPM_INTF_LOCALITY_CHANGE_INT | TPM_INTF_STS_VALID_INT |
558
563
TPM_INTF_CMD_READY_INT ))
559
- wake_up_interruptible (& chip -> vendor . int_queue );
564
+ wake_up_interruptible (& priv -> int_queue );
560
565
561
566
/* Clear interrupts handled with TPM_EOI */
562
567
iowrite32 (interrupt ,
@@ -768,7 +773,7 @@ static int tpm_tis_init(struct device *dev, struct tpm_info *tpm_info,
768
773
769
774
/* INTERRUPT Setup */
770
775
init_waitqueue_head (& chip -> vendor .read_queue );
771
- init_waitqueue_head (& chip -> vendor . int_queue );
776
+ init_waitqueue_head (& priv -> int_queue );
772
777
if (interrupts && tpm_info -> irq != -1 ) {
773
778
if (tpm_info -> irq ) {
774
779
tpm_tis_probe_irq_single (chip , intmask , IRQF_SHARED ,
0 commit comments