[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>

authored by Kylene Jo Hall and committed by Linus Torvalds 57135568 cb535425

+44 -36
+44 -36
drivers/char/tpm/tpm_tis.c
··· 16 16 * published by the Free Software Foundation, version 2 of the 17 17 * License. 18 18 */ 19 + #include <linux/init.h> 20 + #include <linux/module.h> 21 + #include <linux/moduleparam.h> 19 22 #include <linux/pnp.h> 20 23 #include <linux/interrupt.h> 21 24 #include <linux/wait.h> ··· 427 424 return IRQ_HANDLED; 428 425 } 429 426 427 + static int interrupts = 1; 428 + module_param(interrupts, bool, 0444); 429 + MODULE_PARM_DESC(interrupts, "Enable interrupts"); 430 + 430 431 static int __devinit tpm_tis_pnp_init(struct pnp_dev *pnp_dev, 431 432 const struct pnp_device_id *pnp_id) 432 433 { ··· 517 510 iowrite32(intmask, 518 511 chip->vendor.iobase + 519 512 TPM_INT_ENABLE(chip->vendor.locality)); 513 + if (interrupts) { 514 + chip->vendor.irq = 515 + ioread8(chip->vendor.iobase + 516 + TPM_INT_VECTOR(chip->vendor.locality)); 520 517 521 - chip->vendor.irq = 522 - ioread8(chip->vendor.iobase + 523 - TPM_INT_VECTOR(chip->vendor.locality)); 518 + for (i = 3; i < 16 && chip->vendor.irq == 0; i++) { 519 + iowrite8(i, chip->vendor.iobase + 520 + TPM_INT_VECTOR(chip->vendor.locality)); 521 + if (request_irq 522 + (i, tis_int_probe, SA_SHIRQ, 523 + chip->vendor.miscdev.name, chip) != 0) { 524 + dev_info(chip->dev, 525 + "Unable to request irq: %d for probe\n", 526 + i); 527 + continue; 528 + } 524 529 525 - for (i = 3; i < 16 && chip->vendor.irq == 0; i++) { 526 - iowrite8(i, 527 - chip->vendor.iobase + 528 - TPM_INT_VECTOR(chip->vendor.locality)); 529 - if (request_irq 530 - (i, tis_int_probe, SA_SHIRQ, 531 - chip->vendor.miscdev.name, chip) != 0) { 532 - dev_info(chip->dev, 533 - "Unable to request irq: %d for probe\n", 534 - i); 535 - continue; 530 + /* Clear all existing */ 531 + iowrite32(ioread32 532 + (chip->vendor.iobase + 533 + TPM_INT_STATUS(chip->vendor.locality)), 534 + chip->vendor.iobase + 535 + TPM_INT_STATUS(chip->vendor.locality)); 536 + 537 + /* Turn on */ 538 + iowrite32(intmask | TPM_GLOBAL_INT_ENABLE, 539 + chip->vendor.iobase + 540 + TPM_INT_ENABLE(chip->vendor.locality)); 541 + 542 + /* Generate Interrupts */ 543 + tpm_gen_interrupt(chip); 544 + 545 + /* Turn off */ 546 + iowrite32(intmask, 547 + chip->vendor.iobase + 548 + TPM_INT_ENABLE(chip->vendor.locality)); 549 + free_irq(i, chip); 536 550 } 537 - 538 - /* Clear all existing */ 539 - iowrite32(ioread32 540 - (chip->vendor.iobase + 541 - TPM_INT_STATUS(chip->vendor.locality)), 542 - chip->vendor.iobase + 543 - TPM_INT_STATUS(chip->vendor.locality)); 544 - 545 - /* Turn on */ 546 - iowrite32(intmask | TPM_GLOBAL_INT_ENABLE, 547 - chip->vendor.iobase + 548 - TPM_INT_ENABLE(chip->vendor.locality)); 549 - 550 - /* Generate Interrupts */ 551 - tpm_gen_interrupt(chip); 552 - 553 - /* Turn off */ 554 - iowrite32(intmask, 555 - chip->vendor.iobase + 556 - TPM_INT_ENABLE(chip->vendor.locality)); 557 - free_irq(i, chip); 558 551 } 559 552 if (chip->vendor.irq) { 560 553 iowrite8(chip->vendor.irq, ··· 564 557 (chip->vendor.irq, tis_int_handler, SA_SHIRQ, 565 558 chip->vendor.miscdev.name, chip) != 0) { 566 559 dev_info(chip->dev, 567 - "Unable to request irq: %d for use\n", i); 560 + "Unable to request irq: %d for use\n", 561 + chip->vendor.irq); 568 562 chip->vendor.irq = 0; 569 563 } else { 570 564 /* Clear all existing */