mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kylene Jo Hall <kjhall@us.ibm.com>
To: linux-kernel <linux-kernel@vger.kernel.org>
Cc: akpm@osdl.org,
	TPM Device Driver List <tpmdd-devel@lists.sourceforge.net>
Subject: [PATCH] tpm: add interrupt module parameter
Date: Tue, 18 Apr 2006 15:56:15 -0500	[thread overview]
Message-ID: <1145393776.4829.19.camel@localhost.localdomain> (raw)

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>
---
 drivers/char/tpm/tpm_tis.c |   78 +++++++++++++++++++----------------
 1 files changed, 43 insertions(+), 35 deletions(-)

--- linux-2.6.17-rc1/drivers/char/tpm/tpm_tis.c	2006-04-18 15:24:27.850777000 -0500
+++ linux-2.6.17-rc1-tpm/drivers/char/tpm/tpm_tis.c	2006-04-18 15:38:33.719640500 -0500
@@ -16,6 +16,9 @@
  * published by the Free Software Foundation, version 2 of the
  * License.
  */
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/moduleparam.h>
 #include <linux/pnp.h>
 #include <linux/interrupt.h>
 #include <linux/wait.h>
@@ -424,6 +427,10 @@ static irqreturn_t tis_int_handler(int i
 	return IRQ_HANDLED;
 }
 
+static int interrupts = 1;
+module_param(interrupts, bool, 0444);
+MODULE_PARM_DESC(interrupts, "Enable interrupts");
+
 static int __devinit tpm_tis_pnp_init(struct pnp_dev *pnp_dev, const struct
 				      pnp_device_id *pnp_id)
 {
@@ -510,44 +517,44 @@ static int __devinit tpm_tis_pnp_init(st
 	iowrite32(intmask,
 		  chip->vendor.iobase +
 		  TPM_INT_ENABLE(chip->vendor.locality));
+	if (interrupts) {
+		chip->vendor.irq =
+		    ioread8(chip->vendor.iobase +
+			    TPM_INT_VECTOR(chip->vendor.locality));
+
+		for (i = 3; i < 16 && chip->vendor.irq == 0; i++) {
+			iowrite8(i, chip->vendor.iobase +
+				    TPM_INT_VECTOR(chip->vendor.locality));
+			if (request_irq
+			    (i, tis_int_probe, SA_SHIRQ,
+			     chip->vendor.miscdev.name, chip) != 0) {
+				dev_info(chip->dev,
+					 "Unable to request irq: %d for probe\n",
+					 i);
+				continue;
+			}
 
-	chip->vendor.irq =
-	    ioread8(chip->vendor.iobase +
-		    TPM_INT_VECTOR(chip->vendor.locality));
-
-	for (i = 3; i < 16 && chip->vendor.irq == 0; i++) {
-		iowrite8(i,
-			 chip->vendor.iobase +
-			 TPM_INT_VECTOR(chip->vendor.locality));
-		if (request_irq
-		    (i, tis_int_probe, SA_SHIRQ,
-		     chip->vendor.miscdev.name, chip) != 0) {
-			dev_info(chip->dev,
-				 "Unable to request irq: %d for probe\n",
-				 i);
-			continue;
-		}
-
-		/* Clear all existing */
-		iowrite32(ioread32
-			  (chip->vendor.iobase +
-			   TPM_INT_STATUS(chip->vendor.locality)),
-			  chip->vendor.iobase +
-			  TPM_INT_STATUS(chip->vendor.locality));
+			/* Clear all existing */
+			iowrite32(ioread32
+				  (chip->vendor.iobase +
+				   TPM_INT_STATUS(chip->vendor.locality)),
+				  chip->vendor.iobase +
+				  TPM_INT_STATUS(chip->vendor.locality));
 
-		/* Turn on */
-		iowrite32(intmask | TPM_GLOBAL_INT_ENABLE,
-			  chip->vendor.iobase +
-			  TPM_INT_ENABLE(chip->vendor.locality));
+			/* Turn on */
+			iowrite32(intmask | TPM_GLOBAL_INT_ENABLE,
+				  chip->vendor.iobase +
+				  TPM_INT_ENABLE(chip->vendor.locality));
 
-		/* Generate Interrupts */
-		tpm_gen_interrupt(chip);
+			/* Generate Interrupts */
+			tpm_gen_interrupt(chip);
 
-		/* Turn off */
-		iowrite32(intmask,
-			  chip->vendor.iobase +
-			  TPM_INT_ENABLE(chip->vendor.locality));
-		free_irq(i, chip);
+			/* Turn off */
+			iowrite32(intmask,
+				  chip->vendor.iobase +
+				  TPM_INT_ENABLE(chip->vendor.locality));
+			free_irq(i, chip);
+		}
 	}
 	if (chip->vendor.irq) {
 		iowrite8(chip->vendor.irq,
@@ -557,7 +564,8 @@ static int __devinit tpm_tis_pnp_init(st
 		    (chip->vendor.irq, tis_int_handler, SA_SHIRQ,
 		     chip->vendor.miscdev.name, chip) != 0) {
 			dev_info(chip->dev,
-				 "Unable to request irq: %d for use\n", i);
+				 "Unable to request irq: %d for use\n",
+				 chip->vendor.irq);
 			chip->vendor.irq = 0;
 		} else {
 			/* Clear all existing */



                 reply	other threads:[~2006-04-18 21:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1145393776.4829.19.camel@localhost.localdomain \
    --to=kjhall@us.ibm.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tpmdd-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®