Skip to content

Commit 5713556

Browse files
Kylene Jo HallLinus Torvalds
authored andcommitted
[PATCH] tpm: add interrupt module parameter
This patch adds a boolean module parameter that allows the user to turn interrupt support on and off. The default behavior is to attempt to use interrupts. Signed-off-by: Kylene Hall <kjhall@us.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
1 parent cb53542 commit 5713556

1 file changed

Lines changed: 43 additions & 35 deletions

File tree

‎drivers/char/tpm/tpm_tis.c‎

Lines changed: 43 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
* published by the Free Software Foundation, version 2 of the
1717
* License.
1818
*/
19+
#include <linux/init.h>
20+
#include <linux/module.h>
21+
#include <linux/moduleparam.h>
1922
#include <linux/pnp.h>
2023
#include <linux/interrupt.h>
2124
#include <linux/wait.h>
@@ -424,6 +427,10 @@ static irqreturn_t tis_int_handler(int irq, void *dev_id, struct pt_regs *regs)
424427
return IRQ_HANDLED;
425428
}
426429

430+
static int interrupts = 1;
431+
module_param(interrupts, bool, 0444);
432+
MODULE_PARM_DESC(interrupts, "Enable interrupts");
433+
427434
static int __devinit tpm_tis_pnp_init(struct pnp_dev *pnp_dev,
428435
const struct pnp_device_id *pnp_id)
429436
{
@@ -510,44 +517,44 @@ static int __devinit tpm_tis_pnp_init(struct pnp_dev *pnp_dev,
510517
iowrite32(intmask,
511518
chip->vendor.iobase +
512519
TPM_INT_ENABLE(chip->vendor.locality));
520+
if (interrupts) {
521+
chip->vendor.irq =
522+
ioread8(chip->vendor.iobase +
523+
TPM_INT_VECTOR(chip->vendor.locality));
524+
525+
for (i = 3; i < 16 && chip->vendor.irq == 0; i++) {
526+
iowrite8(i, chip->vendor.iobase +
527+
TPM_INT_VECTOR(chip->vendor.locality));
528+
if (request_irq
529+
(i, tis_int_probe, SA_SHIRQ,
530+
chip->vendor.miscdev.name, chip) != 0) {
531+
dev_info(chip->dev,
532+
"Unable to request irq: %d for probe\n",
533+
i);
534+
continue;
535+
}
513536

514-
chip->vendor.irq =
515-
ioread8(chip->vendor.iobase +
516-
TPM_INT_VECTOR(chip->vendor.locality));
517-
518-
for (i = 3; i < 16 && chip->vendor.irq == 0; i++) {
519-
iowrite8(i,
520-
chip->vendor.iobase +
521-
TPM_INT_VECTOR(chip->vendor.locality));
522-
if (request_irq
523-
(i, tis_int_probe, SA_SHIRQ,
524-
chip->vendor.miscdev.name, chip) != 0) {
525-
dev_info(chip->dev,
526-
"Unable to request irq: %d for probe\n",
527-
i);
528-
continue;
529-
}
530-
531-
/* Clear all existing */
532-
iowrite32(ioread32
533-
(chip->vendor.iobase +
534-
TPM_INT_STATUS(chip->vendor.locality)),
535-
chip->vendor.iobase +
536-
TPM_INT_STATUS(chip->vendor.locality));
537+
/* Clear all existing */
538+
iowrite32(ioread32
539+
(chip->vendor.iobase +
540+
TPM_INT_STATUS(chip->vendor.locality)),
541+
chip->vendor.iobase +
542+
TPM_INT_STATUS(chip->vendor.locality));
537543

538-
/* Turn on */
539-
iowrite32(intmask | TPM_GLOBAL_INT_ENABLE,
540-
chip->vendor.iobase +
541-
TPM_INT_ENABLE(chip->vendor.locality));
544+
/* Turn on */
545+
iowrite32(intmask | TPM_GLOBAL_INT_ENABLE,
546+
chip->vendor.iobase +
547+
TPM_INT_ENABLE(chip->vendor.locality));
542548

543-
/* Generate Interrupts */
544-
tpm_gen_interrupt(chip);
549+
/* Generate Interrupts */
550+
tpm_gen_interrupt(chip);
545551

546-
/* Turn off */
547-
iowrite32(intmask,
548-
chip->vendor.iobase +
549-
TPM_INT_ENABLE(chip->vendor.locality));
550-
free_irq(i, chip);
552+
/* Turn off */
553+
iowrite32(intmask,
554+
chip->vendor.iobase +
555+
TPM_INT_ENABLE(chip->vendor.locality));
556+
free_irq(i, chip);
557+
}
551558
}
552559
if (chip->vendor.irq) {
553560
iowrite8(chip->vendor.irq,
@@ -557,7 +564,8 @@ static int __devinit tpm_tis_pnp_init(struct pnp_dev *pnp_dev,
557564
(chip->vendor.irq, tis_int_handler, SA_SHIRQ,
558565
chip->vendor.miscdev.name, chip) != 0) {
559566
dev_info(chip->dev,
560-
"Unable to request irq: %d for use\n", i);
567+
"Unable to request irq: %d for use\n",
568+
chip->vendor.irq);
561569
chip->vendor.irq = 0;
562570
} else {
563571
/* Clear all existing */

0 commit comments

Comments
 (0)