Skip to contentSkip to conversation

tpm: Move tpm_tis_reenable_interrupts out of CONFIG_PNP block

PATCH In review Stefan Berger 3 participants 4 messages Jul 17, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tpm: Move tpm_tis_reenable_interrupts out of CONFIG_PNP block

This patch moves the tpm_tis_reenable_interrupts function out of the CONFIG_PNP-surrounded #define block. This solves a compilation error in case CONFIG_PNP is not defined.

---
 drivers/char/tpm/tpm_tis.c |   45 +++++++++++++++++++++++----------------------
 1 file changed, 23 insertions(+), 22 deletions(-)
drivers/char/tpm/tpm_tis.c +23 -22
Index: linux-2.6/drivers/char/tpm/tpm_tis.c
===================================================================
@@ -731,6 +731,29 @@ out_err:
 	tpm_remove_hardware(chip->dev);
 	return rc;
 }
+
+static void tpm_tis_reenable_interrupts(struct tpm_chip *chip)
+{
+	u32 intmask;
+
+	/* reenable interrupts that device may have lost or
+	   BIOS/firmware may have disabled */
+	iowrite8(chip->vendor.irq, chip->vendor.iobase +
+		 TPM_INT_VECTOR(chip->vendor.locality));
+
+	intmask =
+	    ioread32(chip->vendor.iobase +
+		     TPM_INT_ENABLE(chip->vendor.locality));
+
+	intmask |= TPM_INTF_CMD_READY_INT
+	    | TPM_INTF_LOCALITY_CHANGE_INT | TPM_INTF_DATA_AVAIL_INT
+	    | TPM_INTF_STS_VALID_INT | TPM_GLOBAL_INT_ENABLE;
+
+	iowrite32(intmask,
+		  chip->vendor.iobase + TPM_INT_ENABLE(chip->vendor.locality));
+}
+
+
 #ifdef CONFIG_PNP
 static int __devinit tpm_tis_pnp_init(struct pnp_dev *pnp_dev,
 				      const struct pnp_device_id *pnp_id)
@@ -757,28 +780,6 @@ static int tpm_tis_pnp_suspend(struct pn
 	return tpm_pm_suspend(&dev->dev, msg);
 }
 
-static void tpm_tis_reenable_interrupts(struct tpm_chip *chip)
-{
-	u32 intmask;
-
-	/* reenable interrupts that device may have lost or
-	   BIOS/firmware may have disabled */
-	iowrite8(chip->vendor.irq, chip->vendor.iobase +
-		 TPM_INT_VECTOR(chip->vendor.locality));
-
-	intmask =
-	    ioread32(chip->vendor.iobase +
-		     TPM_INT_ENABLE(chip->vendor.locality));
-
-	intmask |= TPM_INTF_CMD_READY_INT
-	    | TPM_INTF_LOCALITY_CHANGE_INT | TPM_INTF_DATA_AVAIL_INT
-	    | TPM_INTF_STS_VALID_INT | TPM_GLOBAL_INT_ENABLE;
-
-	iowrite32(intmask,
-		  chip->vendor.iobase + TPM_INT_ENABLE(chip->vendor.locality));
-}
-
-
 static int tpm_tis_pnp_resume(struct pnp_dev *dev)
 {
 	struct tpm_chip *chip = pnp_get_drvdata(dev);
Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · On Sun, 17 Jul 2011 01:04:24 -0400 Stefan Berger wrote:

This patch moves the tpm_tis_reenable_interrupts function out of the CONFIG_PNP-surrounded #define block. This solves a compilation error in case CONFIG_PNP is not defined.

New warning:
drivers/char/tpm/tpm_tis.c:97: warning: 'is_itpm' defined but not used

Thanks.

Quoted 60 lines
---
 drivers/char/tpm/tpm_tis.c |   45 +++++++++++++++++++++++----------------------
 1 file changed, 23 insertions(+), 22 deletions(-)

Index: linux-2.6/drivers/char/tpm/tpm_tis.c
===================================================================

drivers/char/tpm/tpm_tis.c +23 -17
@@ -731,6 +731,29 @@ out_err:
 	tpm_remove_hardware(chip->dev);
 	return rc;
 }
+
+static void tpm_tis_reenable_interrupts(struct tpm_chip *chip)
+{
+	u32 intmask;
+
+	/* reenable interrupts that device may have lost or
+	   BIOS/firmware may have disabled */
+	iowrite8(chip->vendor.irq, chip->vendor.iobase +
+		 TPM_INT_VECTOR(chip->vendor.locality));
+
+	intmask =
+	    ioread32(chip->vendor.iobase +
+		     TPM_INT_ENABLE(chip->vendor.locality));
+
+	intmask |= TPM_INTF_CMD_READY_INT
+	    | TPM_INTF_LOCALITY_CHANGE_INT | TPM_INTF_DATA_AVAIL_INT
+	    | TPM_INTF_STS_VALID_INT | TPM_GLOBAL_INT_ENABLE;
+
+	iowrite32(intmask,
+		  chip->vendor.iobase + TPM_INT_ENABLE(chip->vendor.locality));
+}
+
+
 #ifdef CONFIG_PNP
 static int __devinit tpm_tis_pnp_init(struct pnp_dev *pnp_dev,
 				      const struct pnp_device_id *pnp_id)
@@ -757,28 +780,6 @@ static int tpm_tis_pnp_suspend(struct pn
 	return tpm_pm_suspend(&dev->dev, msg);
 }
 
-static void tpm_tis_reenable_interrupts(struct tpm_chip *chip)
-{
-	u32 intmask;
-
-	/* reenable interrupts that device may have lost or
-	   BIOS/firmware may have disabled */
-	iowrite8(chip->vendor.irq, chip->vendor.iobase +
-		 TPM_INT_VECTOR(chip->vendor.locality));
-
-	intmask =
-	    ioread32(chip->vendor.iobase +
-		     TPM_INT_ENABLE(chip->vendor.locality));
-
-	intmask |= TPM_INTF_CMD_READY_INT
-	    | TPM_INTF_LOCALITY_CHANGE_INT | TPM_INTF_DATA_AVAIL_INT
-	    | TPM_INTF_STS_VALID_INT | TPM_GLOBAL_INT_ENABLE;
-

drivers/char/tpm/tpm_tis.c static int tpm_tis_pnp_suspend(struct pn

Quoted 10 lines
drivers/char/tpm/tpm_tis.c +0 -6
-	iowrite32(intmask,
-		  chip->vendor.iobase + TPM_INT_ENABLE(chip->vendor.locality));
-}
-
-
 static int tpm_tis_pnp_resume(struct pnp_dev *dev)
 {
 	struct tpm_chip *chip = pnp_get_drvdata(dev);
 
--

---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***

#2 lore raw
Quoted 2 lines · Randy Dunlap

New warning:
drivers/char/tpm/tpm_tis.c:97: warning: 'is_itpm' defined but not used

From: Harry Wei <[email protected]>

This patch can fix above warning.

---
 drivers/char/tpm/tpm_tis.c |   20 --------------------
 1 files changed, 0 insertions(+), 20 deletions(-)
drivers/char/tpm/tpm_tis.c +0 -20
index dd21df5..5929bb2 100644
@@ -79,26 +79,6 @@ enum tis_defaults {
 static LIST_HEAD(tis_chips);
 static DEFINE_SPINLOCK(tis_lock);
 
-#ifdef CONFIG_ACPI
-static int is_itpm(struct pnp_dev *dev)
-{
-	struct acpi_device *acpi = pnp_acpi_device(dev);
-	struct acpi_hardware_id *id;
-
-	list_for_each_entry(id, &acpi->pnp.ids, list) {
-		if (!strcmp("INTC0102", id->id))
-			return 1;
-	}
-
-	return 0;
-}
-#else
-static int is_itpm(struct pnp_dev *dev)
-{
-	return 0;
-}
-#endif
-
 static int check_locality(struct tpm_chip *chip, int l)
 {
 	if ((ioread8(chip->vendor.iobase + TPM_ACCESS(l)) &
Signature · 1 line
1.7.0.4
#3 lore raw
Quoted 34 lines · Harry Wei
Quoted 2 lines · Randy Dunlap

New warning:
drivers/char/tpm/tpm_tis.c:97: warning: 'is_itpm' defined but not used

From: Harry Wei <[email protected]>

This patch can fix above warning.

---
 drivers/char/tpm/tpm_tis.c |   20 --------------------
 1 files changed, 0 insertions(+), 20 deletions(-)
drivers/char/tpm/tpm_tis.c +0 -13
index dd21df5..5929bb2 100644
@@ -79,26 +79,6 @@ enum tis_defaults {
 static LIST_HEAD(tis_chips);
 static DEFINE_SPINLOCK(tis_lock);
 
-#ifdef CONFIG_ACPI
-static int is_itpm(struct pnp_dev *dev)
-{
-	struct acpi_device *acpi = pnp_acpi_device(dev);
-	struct acpi_hardware_id *id;
-
-	list_for_each_entry(id, &acpi->pnp.ids, list) {
-		if (!strcmp("INTC0102", id->id))
-			return 1;
-	}
-
-	return 0;
-}

drivers/char/tpm/tpm_tis.c enum tis_defaults { · line 84

Quoted 10 lines
drivers/char/tpm/tpm_tis.c +0 -7
-#else
-static int is_itpm(struct pnp_dev *dev)
-{
-	return 0;
-}
-#endif
-
 static int check_locality(struct tpm_chip *chip, int l)
 {
 	if ((ioread8(chip->vendor.iobase + TPM_ACCESS(l)) &

It's not dead code. You'll get a compiler error once CONFIG_PNP is enabled. NACK.

Stefan