All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] add irq validity check in tpm_i2c_nuvoton driver
@ 2016-06-29  9:58 andrew zamansky
       [not found] ` <1467194329-5543-1-git-send-email-andrew.zamansky-KrzQf0k3Iz9BDgjK7y7TUQ@public.gmane.org>
  0 siblings, 1 reply; 10+ messages in thread
From: andrew zamansky @ 2016-06-29  9:58 UTC (permalink / raw)
  To: jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA,
	tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: andrew.zamansky-KrzQf0k3Iz9BDgjK7y7TUQ,
	gcwilson-r/Jw6+rmf7HQT0dZR+AlfA, azamansk-KrzQf0k3Iz9BDgjK7y7TUQ,
	Dan.Morav-KrzQf0k3Iz9BDgjK7y7TUQ, stimpy1-Re5JQEeQqe8AvxtiuMwx3w

*** BLURB HERE ***

Christophe Ricard (1):
  tpm: drop 'irq' from struct tpm_vendor_specific

andrew zamansky (1):
  add irq validity check in tpm_i2c_nuvoton driver

 drivers/char/tpm/st33zp24/st33zp24.c | 23 ++++++++---------------
 drivers/char/tpm/st33zp24/st33zp24.h | 10 ++++++++++
 drivers/char/tpm/tpm-interface.c     |  4 ++--
 drivers/char/tpm/tpm.h               |  3 +--
 drivers/char/tpm/tpm_i2c_atmel.c     |  1 -
 drivers/char/tpm/tpm_i2c_infineon.c  |  3 ---
 drivers/char/tpm/tpm_i2c_nuvoton.c   | 30 ++++++++++++++++++------------
 drivers/char/tpm/tpm_tis.c           | 30 +++++++++++++++++-------------
 drivers/char/tpm/xen-tpmfront.c      |  7 ++++---
 9 files changed, 60 insertions(+), 51 deletions(-)

-- 
1.9.1


------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/2] tpm: drop 'irq' from struct tpm_vendor_specific
       [not found] ` <1467194329-5543-1-git-send-email-andrew.zamansky-KrzQf0k3Iz9BDgjK7y7TUQ@public.gmane.org>
@ 2016-06-29  9:58   ` andrew zamansky
  2016-06-29  9:58   ` [PATCH 2/2] add irq validity check in tpm_i2c_nuvoton driver andrew zamansky
  1 sibling, 0 replies; 10+ messages in thread
From: andrew zamansky @ 2016-06-29  9:58 UTC (permalink / raw)
  To: jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA,
	tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: Christophe Ricard, andrew.zamansky-KrzQf0k3Iz9BDgjK7y7TUQ,
	Christophe Ricard, gcwilson-r/Jw6+rmf7HQT0dZR+AlfA,
	azamansk-KrzQf0k3Iz9BDgjK7y7TUQ,
	Dan.Morav-KrzQf0k3Iz9BDgjK7y7TUQ, stimpy1-Re5JQEeQqe8AvxtiuMwx3w

From: Christophe Ricard <christophe.ricard-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

Dropped the field 'irq' from struct tpm_vendor_specific and make it
available to the various private structures in the drivers using irqs.

A dedicated flag TPM_CHIP_FLAG_IRQ is added for the upper layers.

In st33zp24, struct st33zp24_dev declaration is moved to st33zp24.h in
order to make accessible irq from other phy's(i2c, spi).

In tpm_i2c_nuvoton, chip->vendor.priv is not directly allocated. We can
access irq field from priv_data in a cleaner way.

Signed-off-by: Christophe Ricard <christophe-h.ricard-qxv4g6HH51o@public.gmane.org>
Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
---
 drivers/char/tpm/st33zp24/st33zp24.c | 23 ++++++++---------------
 drivers/char/tpm/st33zp24/st33zp24.h | 10 ++++++++++
 drivers/char/tpm/tpm-interface.c     |  4 ++--
 drivers/char/tpm/tpm.h               |  3 +--
 drivers/char/tpm/tpm_i2c_atmel.c     |  1 -
 drivers/char/tpm/tpm_i2c_infineon.c  |  3 ---
 drivers/char/tpm/tpm_i2c_nuvoton.c   | 28 ++++++++++++++++------------
 drivers/char/tpm/tpm_tis.c           | 30 +++++++++++++++++-------------
 drivers/char/tpm/xen-tpmfront.c      |  7 ++++---
 9 files changed, 58 insertions(+), 51 deletions(-)

diff --git a/drivers/char/tpm/st33zp24/st33zp24.c b/drivers/char/tpm/st33zp24/st33zp24.c
index 9e91ca7..f4a44ad 100644
--- a/drivers/char/tpm/st33zp24/st33zp24.c
+++ b/drivers/char/tpm/st33zp24/st33zp24.c
@@ -73,14 +73,6 @@ enum tis_defaults {
 	TIS_LONG_TIMEOUT = 2000,
 };
 
-struct st33zp24_dev {
-	struct tpm_chip *chip;
-	void *phy_id;
-	const struct st33zp24_phy_ops *ops;
-	u32 intrs;
-	int io_lpcpd;
-};
-
 /*
  * clear_interruption clear the pending interrupt.
  * @param: tpm_dev, the tpm device device.
@@ -288,10 +280,10 @@ static int wait_for_stat(struct tpm_chip *chip, u8 mask, unsigned long timeout,
 
 	stop = jiffies + timeout;
 
-	if (chip->vendor.irq) {
+	if (chip->flags & TPM_CHIP_FLAG_IRQ) {
 		cur_intrs = tpm_dev->intrs;
 		clear_interruption(tpm_dev);
-		enable_irq(chip->vendor.irq);
+		enable_irq(tpm_dev->irq);
 
 		do {
 			if (ret == -ERESTARTSYS && freezing(current))
@@ -314,7 +306,7 @@ static int wait_for_stat(struct tpm_chip *chip, u8 mask, unsigned long timeout,
 			}
 		} while (ret == -ERESTARTSYS && freezing(current));
 
-		disable_irq_nosync(chip->vendor.irq);
+		disable_irq_nosync(tpm_dev->irq);
 
 	} else {
 		do {
@@ -376,7 +368,7 @@ static irqreturn_t tpm_ioserirq_handler(int irq, void *dev_id)
 
 	tpm_dev->intrs++;
 	wake_up_interruptible(&chip->vendor.read_queue);
-	disable_irq_nosync(chip->vendor.irq);
+	disable_irq_nosync(tpm_dev->irq);
 
 	return IRQ_HANDLED;
 } /* tpm_ioserirq_handler() */
@@ -456,7 +448,7 @@ static int st33zp24_send(struct tpm_chip *chip, unsigned char *buf,
 	if (ret < 0)
 		goto out_err;
 
-	if (chip->vendor.irq) {
+	if (chip->flags & TPM_CHIP_FLAG_IRQ) {
 		ordinal = be32_to_cpu(*((__be32 *) (buf + 6)));
 
 		ret = wait_for_stat(chip, TPM_STS_DATA_AVAIL | TPM_STS_VALID,
@@ -611,9 +603,10 @@ int st33zp24_probe(void *phy_id, const struct st33zp24_phy_ops *ops,
 		if (ret < 0)
 			goto _tpm_clean_answer;
 
-		chip->vendor.irq = irq;
+		tpm_dev->irq = irq;
+		chip->flags |= TPM_CHIP_FLAG_IRQ;
 
-		disable_irq_nosync(chip->vendor.irq);
+		disable_irq_nosync(tpm_dev->irq);
 
 		tpm_gen_interrupt(chip);
 	}
diff --git a/drivers/char/tpm/st33zp24/st33zp24.h b/drivers/char/tpm/st33zp24/st33zp24.h
index bcbd5ff..27e7564 100644
--- a/drivers/char/tpm/st33zp24/st33zp24.h
+++ b/drivers/char/tpm/st33zp24/st33zp24.h
@@ -21,6 +21,16 @@
 #define TPM_WRITE_DIRECTION             0x80
 #define TPM_BUFSIZE                     2048
 
+struct st33zp24_dev {
+	struct tpm_chip *chip;
+	void *phy_id;
+	const struct st33zp24_phy_ops *ops;
+	int irq;
+	u32 intrs;
+	int io_lpcpd;
+};
+
+
 struct st33zp24_phy_ops {
 	int (*send)(void *phy_id, u8 tpm_register, u8 *tpm_data, int tpm_size);
 	int (*recv)(void *phy_id, u8 tpm_register, u8 *tpm_data, int tpm_size);
diff --git a/drivers/char/tpm/tpm-interface.c b/drivers/char/tpm/tpm-interface.c
index 5397b64..101bb47 100644
--- a/drivers/char/tpm/tpm-interface.c
+++ b/drivers/char/tpm/tpm-interface.c
@@ -359,7 +359,7 @@ ssize_t tpm_transmit(struct tpm_chip *chip, const char *buf,
 		goto out;
 	}
 
-	if (chip->vendor.irq)
+	if (chip->flags & TPM_CHIP_FLAG_IRQ)
 		goto out_recv;
 
 	if (chip->flags & TPM_CHIP_FLAG_TPM2)
@@ -890,7 +890,7 @@ int wait_for_tpm_stat(struct tpm_chip *chip, u8 mask, unsigned long timeout,
 
 	stop = jiffies + timeout;
 
-	if (chip->vendor.irq) {
+	if (chip->flags & TPM_CHIP_FLAG_IRQ) {
 again:
 		timeout = stop - jiffies;
 		if ((long)timeout <= 0)
diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h
index 357ac14..ad4799c 100644
--- a/drivers/char/tpm/tpm.h
+++ b/drivers/char/tpm/tpm.h
@@ -131,8 +131,6 @@ enum tpm2_startup_types {
 struct tpm_chip;
 
 struct tpm_vendor_specific {
-	int irq;
-
 	int locality;
 	unsigned long timeout_a, timeout_b, timeout_c, timeout_d; /* jiffies */
 	bool timeout_adjusted;
@@ -154,6 +152,7 @@ struct tpm_vendor_specific {
 enum tpm_chip_flags {
 	TPM_CHIP_FLAG_REGISTERED	= BIT(0),
 	TPM_CHIP_FLAG_TPM2		= BIT(1),
+	TPM_CHIP_FLAG_IRQ		= BIT(2),
 };
 
 struct tpm_chip {
diff --git a/drivers/char/tpm/tpm_i2c_atmel.c b/drivers/char/tpm/tpm_i2c_atmel.c
index dd8f0eb..55fa51f 100644
--- a/drivers/char/tpm/tpm_i2c_atmel.c
+++ b/drivers/char/tpm/tpm_i2c_atmel.c
@@ -173,7 +173,6 @@ static int i2c_atmel_probe(struct i2c_client *client,
 	chip->vendor.timeout_b = msecs_to_jiffies(TPM_I2C_LONG_TIMEOUT);
 	chip->vendor.timeout_c = msecs_to_jiffies(TPM_I2C_SHORT_TIMEOUT);
 	chip->vendor.timeout_d = msecs_to_jiffies(TPM_I2C_SHORT_TIMEOUT);
-	chip->vendor.irq = 0;
 
 	/* There is no known way to probe for this device, and all version
 	 * information seems to be read via TPM commands. Thus we rely on the
diff --git a/drivers/char/tpm/tpm_i2c_infineon.c b/drivers/char/tpm/tpm_i2c_infineon.c
index e74f1c1..093daf9 100644
--- a/drivers/char/tpm/tpm_i2c_infineon.c
+++ b/drivers/char/tpm/tpm_i2c_infineon.c
@@ -585,9 +585,6 @@ static int tpm_tis_i2c_init(struct device *dev)
 	if (IS_ERR(chip))
 		return PTR_ERR(chip);
 
-	/* Disable interrupts */
-	chip->vendor.irq = 0;
-
 	/* Default timeouts */
 	chip->vendor.timeout_a = msecs_to_jiffies(TIS_SHORT_TIMEOUT);
 	chip->vendor.timeout_b = msecs_to_jiffies(TIS_LONG_TIMEOUT);
diff --git a/drivers/char/tpm/tpm_i2c_nuvoton.c b/drivers/char/tpm/tpm_i2c_nuvoton.c
index a43b5f3..75a80e466 100644
--- a/drivers/char/tpm/tpm_i2c_nuvoton.c
+++ b/drivers/char/tpm/tpm_i2c_nuvoton.c
@@ -55,6 +55,7 @@
 #define I2C_DRIVER_NAME "tpm_i2c_nuvoton"
 
 struct priv_data {
+	int irq;
 	unsigned int intrs;
 };
 
@@ -176,12 +177,12 @@ static bool i2c_nuvoton_check_status(struct tpm_chip *chip, u8 mask, u8 value)
 static int i2c_nuvoton_wait_for_stat(struct tpm_chip *chip, u8 mask, u8 value,
 				     u32 timeout, wait_queue_head_t *queue)
 {
-	if (chip->vendor.irq && queue) {
+	if ((chip->flags & TPM_CHIP_FLAG_IRQ) && queue) {
 		s32 rc;
 		struct priv_data *priv = chip->vendor.priv;
 		unsigned int cur_intrs = priv->intrs;
 
-		enable_irq(chip->vendor.irq);
+		enable_irq(priv->irq);
 		rc = wait_event_interruptible_timeout(*queue,
 						      cur_intrs != priv->intrs,
 						      timeout);
@@ -477,7 +478,7 @@ static irqreturn_t i2c_nuvoton_int_handler(int dummy, void *dev_id)
 
 	priv->intrs++;
 	wake_up(&chip->vendor.read_queue);
-	disable_irq_nosync(chip->vendor.irq);
+	disable_irq_nosync(priv->irq);
 	return IRQ_HANDLED;
 }
 
@@ -521,6 +522,7 @@ static int i2c_nuvoton_probe(struct i2c_client *client,
 	int rc;
 	struct tpm_chip *chip;
 	struct device *dev = &client->dev;
+	struct priv_data *priv;
 	u32 vid = 0;
 
 	rc = get_vid(client, &vid);
@@ -534,10 +536,10 @@ static int i2c_nuvoton_probe(struct i2c_client *client,
 	if (IS_ERR(chip))
 		return PTR_ERR(chip);
 
-	chip->vendor.priv = devm_kzalloc(dev, sizeof(struct priv_data),
-					 GFP_KERNEL);
-	if (!chip->vendor.priv)
+	priv = devm_kzalloc(dev, sizeof(struct priv_data), GFP_KERNEL);
+	if (!priv)
 		return -ENOMEM;
+	chip->vendor.priv = priv;
 
 	init_waitqueue_head(&chip->vendor.read_queue);
 
@@ -552,19 +554,21 @@ static int i2c_nuvoton_probe(struct i2c_client *client,
 	 *   TPM_INTF_INT_LEVEL_LOW | TPM_INTF_DATA_AVAIL_INT
 	 * The IRQ should be set in the i2c_board_info (which is done
 	 * automatically in of_i2c_register_devices, for device tree users */
-	chip->vendor.irq = client->irq;
+	chip->flags |= TPM_CHIP_FLAG_IRQ;
+	priv->irq = client->irq;
 
-	if (chip->vendor.irq) {
-		dev_dbg(dev, "%s() chip-vendor.irq\n", __func__);
-		rc = devm_request_irq(dev, chip->vendor.irq,
+	if (chip->flags & TPM_CHIP_FLAG_IRQ) {
+		dev_dbg(dev, "%s() priv->irq\n", __func__);
+		rc = devm_request_irq(dev, client->irq,
 				      i2c_nuvoton_int_handler,
 				      IRQF_TRIGGER_LOW,
 				      dev_name(&chip->dev),
 				      chip);
 		if (rc) {
 			dev_err(dev, "%s() Unable to request irq: %d for use\n",
-				__func__, chip->vendor.irq);
-			chip->vendor.irq = 0;
+				__func__, priv->irq);
+			chip->flags &= ~TPM_CHIP_FLAG_IRQ;
+			priv->irq = 0;
 		} else {
 			/* Clear any pending interrupt */
 			i2c_nuvoton_ready(chip);
diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
index 41c4b60..ee511f1 100644
--- a/drivers/char/tpm/tpm_tis.c
+++ b/drivers/char/tpm/tpm_tis.c
@@ -96,6 +96,7 @@ struct tpm_info {
 struct priv_data {
 	void __iomem *iobase;
 	u16 manufacturer_id;
+	int irq;
 	bool irq_tested;
 	wait_queue_head_t int_queue;
 };
@@ -177,7 +178,7 @@ static int request_locality(struct tpm_chip *chip, int l)
 
 	stop = jiffies + chip->vendor.timeout_a;
 
-	if (chip->vendor.irq) {
+	if (chip->flags & TPM_CHIP_FLAG_IRQ) {
 again:
 		timeout = stop - jiffies;
 		if ((long)timeout <= 0)
@@ -385,8 +386,9 @@ static void disable_interrupts(struct tpm_chip *chip)
 	intmask &= ~TPM_GLOBAL_INT_ENABLE;
 	iowrite32(intmask,
 		  priv->iobase + TPM_INT_ENABLE(chip->vendor.locality));
-	devm_free_irq(&chip->dev, chip->vendor.irq, chip);
-	chip->vendor.irq = 0;
+	devm_free_irq(&chip->dev, priv->irq, chip);
+	priv->irq = 0;
+	chip->flags &= ~TPM_CHIP_FLAG_IRQ;
 }
 
 /*
@@ -409,7 +411,7 @@ static int tpm_tis_send_main(struct tpm_chip *chip, u8 *buf, size_t len)
 	iowrite8(TPM_STS_GO,
 		 priv->iobase + TPM_STS(chip->vendor.locality));
 
-	if (chip->vendor.irq) {
+	if (chip->flags & TPM_CHIP_FLAG_IRQ) {
 		ordinal = be32_to_cpu(*((__be32 *) (buf + 6)));
 
 		if (chip->flags & TPM_CHIP_FLAG_TPM2)
@@ -436,14 +438,16 @@ static int tpm_tis_send(struct tpm_chip *chip, u8 *buf, size_t len)
 	int rc, irq;
 	struct priv_data *priv = chip->vendor.priv;
 
-	if (!chip->vendor.irq || priv->irq_tested)
+	if (!(chip->flags & TPM_CHIP_FLAG_IRQ) || priv->irq_tested)
 		return tpm_tis_send_main(chip, buf, len);
 
 	/* Verify receipt of the expected IRQ */
-	irq = chip->vendor.irq;
-	chip->vendor.irq = 0;
+	irq = priv->irq;
+	priv->irq = 0;
+	chip->flags &= ~TPM_CHIP_FLAG_IRQ;
 	rc = tpm_tis_send_main(chip, buf, len);
-	chip->vendor.irq = irq;
+	priv->irq = irq;
+	chip->flags |= TPM_CHIP_FLAG_IRQ;
 	if (!priv->irq_tested)
 		msleep(1);
 	if (!priv->irq_tested)
@@ -605,7 +609,7 @@ static int tpm_tis_probe_irq_single(struct tpm_chip *chip, u32 intmask,
 			 irq);
 		return -1;
 	}
-	chip->vendor.irq = irq;
+	priv->irq = irq;
 
 	original_int_vec = ioread8(priv->iobase +
 				   TPM_INT_VECTOR(chip->vendor.locality));
@@ -634,7 +638,7 @@ static int tpm_tis_probe_irq_single(struct tpm_chip *chip, u32 intmask,
 	/* tpm_tis_send will either confirm the interrupt is working or it
 	 * will call disable_irq which undoes all of the above.
 	 */
-	if (!chip->vendor.irq) {
+	if (!(chip->flags & TPM_CHIP_FLAG_IRQ)) {
 		iowrite8(original_int_vec,
 			 priv->iobase + TPM_INT_VECTOR(chip->vendor.locality));
 		return 1;
@@ -797,7 +801,7 @@ static int tpm_tis_init(struct device *dev, struct tpm_info *tpm_info,
 		if (tpm_info->irq) {
 			tpm_tis_probe_irq_single(chip, intmask, IRQF_SHARED,
 						 tpm_info->irq);
-			if (!chip->vendor.irq)
+			if (!(chip->flags & TPM_CHIP_FLAG_IRQ))
 				dev_err(&chip->dev, FW_BUG
 					"TPM interrupt not working, polling instead\n");
 		} else
@@ -841,7 +845,7 @@ static void tpm_tis_reenable_interrupts(struct tpm_chip *chip)
 
 	/* reenable interrupts that device may have lost or
 	   BIOS/firmware may have disabled */
-	iowrite8(chip->vendor.irq, priv->iobase +
+	iowrite8(priv->irq, priv->iobase +
 		 TPM_INT_VECTOR(chip->vendor.locality));
 
 	intmask =
@@ -860,7 +864,7 @@ static int tpm_tis_resume(struct device *dev)
 	struct tpm_chip *chip = dev_get_drvdata(dev);
 	int ret;
 
-	if (chip->vendor.irq)
+	if (chip->flags & TPM_CHIP_FLAG_IRQ)
 		tpm_tis_reenable_interrupts(chip);
 
 	ret = tpm_pm_resume(dev);
diff --git a/drivers/char/tpm/xen-tpmfront.c b/drivers/char/tpm/xen-tpmfront.c
index 3111f27..329941d 100644
--- a/drivers/char/tpm/xen-tpmfront.c
+++ b/drivers/char/tpm/xen-tpmfront.c
@@ -28,6 +28,7 @@ struct tpm_private {
 	unsigned int evtchn;
 	int ring_ref;
 	domid_t backend_id;
+	int irq;
 };
 
 enum status_bits {
@@ -217,7 +218,7 @@ static int setup_ring(struct xenbus_device *dev, struct tpm_private *priv)
 		xenbus_dev_fatal(dev, rv, "allocating TPM irq");
 		return rv;
 	}
-	priv->chip->vendor.irq = rv;
+	priv->irq = rv;
 
  again:
 	rv = xenbus_transaction_start(&xbt);
@@ -277,8 +278,8 @@ static void ring_free(struct tpm_private *priv)
 	else
 		free_page((unsigned long)priv->shr);
 
-	if (priv->chip && priv->chip->vendor.irq)
-		unbind_from_irqhandler(priv->chip->vendor.irq, priv);
+	if (priv->irq)
+		unbind_from_irqhandler(priv->irq, priv);
 
 	kfree(priv);
 }
-- 
1.9.1


------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/2] add irq validity check in tpm_i2c_nuvoton driver
       [not found] ` <1467194329-5543-1-git-send-email-andrew.zamansky-KrzQf0k3Iz9BDgjK7y7TUQ@public.gmane.org>
  2016-06-29  9:58   ` [PATCH 1/2] tpm: drop 'irq' from struct tpm_vendor_specific andrew zamansky
@ 2016-06-29  9:58   ` andrew zamansky
       [not found]     ` <1467194329-5543-3-git-send-email-andrew.zamansky-KrzQf0k3Iz9BDgjK7y7TUQ@public.gmane.org>
  1 sibling, 1 reply; 10+ messages in thread
From: andrew zamansky @ 2016-06-29  9:58 UTC (permalink / raw)
  To: jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA,
	tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: andrew.zamansky-KrzQf0k3Iz9BDgjK7y7TUQ,
	gcwilson-r/Jw6+rmf7HQT0dZR+AlfA, azamansk-KrzQf0k3Iz9BDgjK7y7TUQ,
	Dan.Morav-KrzQf0k3Iz9BDgjK7y7TUQ, stimpy1-Re5JQEeQqe8AvxtiuMwx3w

if irq==0 (actualy invalid value) then error is printed to dmesg after
trying to register to 0 interrupt 

---
 drivers/char/tpm/tpm_i2c_nuvoton.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/char/tpm/tpm_i2c_nuvoton.c b/drivers/char/tpm/tpm_i2c_nuvoton.c
index 75a80e466..3081529 100644
--- a/drivers/char/tpm/tpm_i2c_nuvoton.c
+++ b/drivers/char/tpm/tpm_i2c_nuvoton.c
@@ -554,7 +554,9 @@ static int i2c_nuvoton_probe(struct i2c_client *client,
 	 *   TPM_INTF_INT_LEVEL_LOW | TPM_INTF_DATA_AVAIL_INT
 	 * The IRQ should be set in the i2c_board_info (which is done
 	 * automatically in of_i2c_register_devices, for device tree users */
-	chip->flags |= TPM_CHIP_FLAG_IRQ;
+	if(chip->flags)
+		chip->flags |= TPM_CHIP_FLAG_IRQ;
+
 	priv->irq = client->irq;
 
 	if (chip->flags & TPM_CHIP_FLAG_IRQ) {
-- 
1.9.1


------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/2] add irq validity check in tpm_i2c_nuvoton driver
       [not found]     ` <1467194329-5543-3-git-send-email-andrew.zamansky-KrzQf0k3Iz9BDgjK7y7TUQ@public.gmane.org>
@ 2016-06-29 14:03       ` Jarkko Sakkinen
       [not found]         ` <20160629140339.GA4589-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
  2016-06-29 18:20       ` Jason Gunthorpe
  1 sibling, 1 reply; 10+ messages in thread
From: Jarkko Sakkinen @ 2016-06-29 14:03 UTC (permalink / raw)
  To: andrew zamansky
  Cc: tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	gcwilson-r/Jw6+rmf7HQT0dZR+AlfA, azamansk-KrzQf0k3Iz9BDgjK7y7TUQ,
	Dan.Morav-KrzQf0k3Iz9BDgjK7y7TUQ, stimpy1-Re5JQEeQqe8AvxtiuMwx3w

On Wed, Jun 29, 2016 at 12:58:49PM +0300, andrew zamansky wrote:
> if irq==0 (actualy invalid value) then error is printed to dmesg after
> trying to register to 0 interrupt 
> 
> ---
>  drivers/char/tpm/tpm_i2c_nuvoton.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/char/tpm/tpm_i2c_nuvoton.c b/drivers/char/tpm/tpm_i2c_nuvoton.c
> index 75a80e466..3081529 100644
> --- a/drivers/char/tpm/tpm_i2c_nuvoton.c
> +++ b/drivers/char/tpm/tpm_i2c_nuvoton.c
> @@ -554,7 +554,9 @@ static int i2c_nuvoton_probe(struct i2c_client *client,
>  	 *   TPM_INTF_INT_LEVEL_LOW | TPM_INTF_DATA_AVAIL_INT
>  	 * The IRQ should be set in the i2c_board_info (which is done
>  	 * automatically in of_i2c_register_devices, for device tree users */
> -	chip->flags |= TPM_CHIP_FLAG_IRQ;
> +	if(chip->flags)
> +		chip->flags |= TPM_CHIP_FLAG_IRQ;
> +
>  	priv->irq = client->irq;
>  
>  	if (chip->flags & TPM_CHIP_FLAG_IRQ) {
> -- 
> 1.9.1
> 

Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>

PS. There's a style error. "if()" should be "if ()". I don't mind fixing
that. Just remember that next time.

/Jarkko

------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/2] add irq validity check in tpm_i2c_nuvoton driver
       [not found]     ` <1467194329-5543-3-git-send-email-andrew.zamansky-KrzQf0k3Iz9BDgjK7y7TUQ@public.gmane.org>
  2016-06-29 14:03       ` Jarkko Sakkinen
@ 2016-06-29 18:20       ` Jason Gunthorpe
  1 sibling, 0 replies; 10+ messages in thread
From: Jason Gunthorpe @ 2016-06-29 18:20 UTC (permalink / raw)
  To: andrew zamansky
  Cc: tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	gcwilson-r/Jw6+rmf7HQT0dZR+AlfA, azamansk-KrzQf0k3Iz9BDgjK7y7TUQ,
	Dan.Morav-KrzQf0k3Iz9BDgjK7y7TUQ, stimpy1-Re5JQEeQqe8AvxtiuMwx3w

On Wed, Jun 29, 2016 at 12:58:49PM +0300, andrew zamansky wrote:
> if irq==0 (actualy invalid value) then error is printed to dmesg after
> trying to register to 0 interrupt 

Missing Signed-off-by line.

And this patch should have:

Fixes: 570a36097f30 ("tpm: drop 'irq' from struct tpm_vendor_specific")

There is also no need to re-sent the patch that is being fixed.

> -	chip->flags |= TPM_CHIP_FLAG_IRQ;
> +	if(chip->flags)
> +		chip->flags |= TPM_CHIP_FLAG_IRQ;
> +

Don't forget to run checkpatch

Jason

------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/2] add irq validity check in tpm_i2c_nuvoton driver
       [not found]         ` <20160629140339.GA4589-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
@ 2016-07-01  8:39           ` Jarkko Sakkinen
  2016-07-12 17:33           ` Jason Gunthorpe
  1 sibling, 0 replies; 10+ messages in thread
From: Jarkko Sakkinen @ 2016-07-01  8:39 UTC (permalink / raw)
  To: andrew zamansky
  Cc: azamansk-KrzQf0k3Iz9BDgjK7y7TUQ,
	Dan.Morav-KrzQf0k3Iz9BDgjK7y7TUQ,
	tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	gcwilson-r/Jw6+rmf7HQT0dZR+AlfA, stimpy1-Re5JQEeQqe8AvxtiuMwx3w

On Wed, Jun 29, 2016 at 05:03:39PM +0300, Jarkko Sakkinen wrote:
> On Wed, Jun 29, 2016 at 12:58:49PM +0300, andrew zamansky wrote:
> > if irq==0 (actualy invalid value) then error is printed to dmesg after
> > trying to register to 0 interrupt 
> > 
> > ---
> >  drivers/char/tpm/tpm_i2c_nuvoton.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/char/tpm/tpm_i2c_nuvoton.c b/drivers/char/tpm/tpm_i2c_nuvoton.c
> > index 75a80e466..3081529 100644
> > --- a/drivers/char/tpm/tpm_i2c_nuvoton.c
> > +++ b/drivers/char/tpm/tpm_i2c_nuvoton.c
> > @@ -554,7 +554,9 @@ static int i2c_nuvoton_probe(struct i2c_client *client,
> >  	 *   TPM_INTF_INT_LEVEL_LOW | TPM_INTF_DATA_AVAIL_INT
> >  	 * The IRQ should be set in the i2c_board_info (which is done
> >  	 * automatically in of_i2c_register_devices, for device tree users */
> > -	chip->flags |= TPM_CHIP_FLAG_IRQ;
> > +	if(chip->flags)
> > +		chip->flags |= TPM_CHIP_FLAG_IRQ;
> > +
> >  	priv->irq = client->irq;
> >  
> >  	if (chip->flags & TPM_CHIP_FLAG_IRQ) {
> > -- 
> > 1.9.1
> > 
> 
> Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
> 
> PS. There's a style error. "if()" should be "if ()". I don't mind fixing
> that. Just remember that next time.

The commit was broken in two other in addition to those that Jason
already mentioned:

* the subject line was missing subsystem tag
* please adjust 'user.name' in your git config. it's broken

You clearly haven't studied

  https://www.kernel.org/doc/Documentation/SubmittingPatches

that I pointed you last time when I got broken commits.

Anyway, the commit is applied to my master branch and I fixed the
errors in your commit. Please try to do things better next time.
Thanks.

/Jarkko

------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/2] add irq validity check in tpm_i2c_nuvoton driver
       [not found]         ` <20160629140339.GA4589-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
  2016-07-01  8:39           ` Jarkko Sakkinen
@ 2016-07-12 17:33           ` Jason Gunthorpe
       [not found]             ` <20160712173326.GA9286-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
  1 sibling, 1 reply; 10+ messages in thread
From: Jason Gunthorpe @ 2016-07-12 17:33 UTC (permalink / raw)
  To: Jarkko Sakkinen
  Cc: andrew zamansky, tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	gcwilson-r/Jw6+rmf7HQT0dZR+AlfA, azamansk-KrzQf0k3Iz9BDgjK7y7TUQ,
	Dan.Morav-KrzQf0k3Iz9BDgjK7y7TUQ, stimpy1-Re5JQEeQqe8AvxtiuMwx3w

On Wed, Jun 29, 2016 at 05:03:39PM +0300, Jarkko Sakkinen wrote:
> On Wed, Jun 29, 2016 at 12:58:49PM +0300, andrew zamansky wrote:
> > if irq==0 (actualy invalid value) then error is printed to dmesg after
> > trying to register to 0 interrupt 
> > 
> >  drivers/char/tpm/tpm_i2c_nuvoton.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/char/tpm/tpm_i2c_nuvoton.c b/drivers/char/tpm/tpm_i2c_nuvoton.c
> > index 75a80e466..3081529 100644
> > +++ b/drivers/char/tpm/tpm_i2c_nuvoton.c
> > @@ -554,7 +554,9 @@ static int i2c_nuvoton_probe(struct i2c_client *client,
> >  	 *   TPM_INTF_INT_LEVEL_LOW | TPM_INTF_DATA_AVAIL_INT
> >  	 * The IRQ should be set in the i2c_board_info (which is done
> >  	 * automatically in of_i2c_register_devices, for device tree users */
> > -	chip->flags |= TPM_CHIP_FLAG_IRQ;
> > +	if(chip->flags)
> > +		chip->flags |= TPM_CHIP_FLAG_IRQ;
> > +
> >  	priv->irq = client->irq;
> >  
> >  	if (chip->flags & TPM_CHIP_FLAG_IRQ) {
> 
> Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
> 
> PS. There's a style error. "if()" should be "if ()". I don't mind fixing
> that. Just remember that next time.

Andrew/Jarkko:

Uhm, this looks wrong to me.. The original code was like this:

-       chip->vendor.irq = client->irq;
-       if (chip->vendor.irq) {

And was wrongly changed to this:

+       chip->flags |= TPM_CHIP_FLAG_IRQ;
+       priv->irq = client->irq;
+       if (chip->flags & TPM_CHIP_FLAG_IRQ) {

Jarkko, can you fold this into the patch to fix it please:

diff --git a/drivers/char/tpm/tpm_i2c_nuvoton.c b/drivers/char/tpm/tpm_i2c_nuvoton.c
index e63ea1652d8d..826698234336 100644
--- a/drivers/char/tpm/tpm_i2c_nuvoton.c
+++ b/drivers/char/tpm/tpm_i2c_nuvoton.c
@@ -559,12 +559,8 @@ static int i2c_nuvoton_probe(struct i2c_client *client,
 	 *   TPM_INTF_INT_LEVEL_LOW | TPM_INTF_DATA_AVAIL_INT
 	 * The IRQ should be set in the i2c_board_info (which is done
 	 * automatically in of_i2c_register_devices, for device tree users */
-	if(chip->flags)
-		chip->flags |= TPM_CHIP_FLAG_IRQ;
-
 	priv->irq = client->irq;
-
-	if (chip->flags & TPM_CHIP_FLAG_IRQ) {
+	if (client->irq) {
 		dev_dbg(dev, "%s() priv->irq\n", __func__);
 		rc = devm_request_irq(dev, client->irq,
 				      i2c_nuvoton_int_handler,
@@ -574,9 +570,9 @@ static int i2c_nuvoton_probe(struct i2c_client *client,
 		if (rc) {
 			dev_err(dev, "%s() Unable to request irq: %d for use\n",
 				__func__, priv->irq);
-			chip->flags &= ~TPM_CHIP_FLAG_IRQ;
 			priv->irq = 0;
 		} else {
+			chip->flags |= TPM_CHIP_FLAG_IRQ;
 			/* Clear any pending interrupt */
 			i2c_nuvoton_ready(chip);
 			/* - wait for TPM_STS==0xA0 (stsValid, commandReady) */

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports.http://sdm.link/zohodev2dev

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/2] add irq validity check in tpm_i2c_nuvoton driver
       [not found]             ` <20160712173326.GA9286-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
@ 2016-07-13 12:04               ` Jarkko Sakkinen
       [not found]                 ` <20160713120401.GA4387-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 10+ messages in thread
From: Jarkko Sakkinen @ 2016-07-13 12:04 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: andrew zamansky, tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	gcwilson-r/Jw6+rmf7HQT0dZR+AlfA, azamansk-KrzQf0k3Iz9BDgjK7y7TUQ,
	Dan.Morav-KrzQf0k3Iz9BDgjK7y7TUQ, stimpy1-Re5JQEeQqe8AvxtiuMwx3w

On Tue, Jul 12, 2016 at 11:33:26AM -0600, Jason Gunthorpe wrote:
> On Wed, Jun 29, 2016 at 05:03:39PM +0300, Jarkko Sakkinen wrote:
> > On Wed, Jun 29, 2016 at 12:58:49PM +0300, andrew zamansky wrote:
> > > if irq==0 (actualy invalid value) then error is printed to dmesg after
> > > trying to register to 0 interrupt 
> > > 
> > >  drivers/char/tpm/tpm_i2c_nuvoton.c | 4 +++-
> > >  1 file changed, 3 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/char/tpm/tpm_i2c_nuvoton.c b/drivers/char/tpm/tpm_i2c_nuvoton.c
> > > index 75a80e466..3081529 100644
> > > +++ b/drivers/char/tpm/tpm_i2c_nuvoton.c
> > > @@ -554,7 +554,9 @@ static int i2c_nuvoton_probe(struct i2c_client *client,
> > >  	 *   TPM_INTF_INT_LEVEL_LOW | TPM_INTF_DATA_AVAIL_INT
> > >  	 * The IRQ should be set in the i2c_board_info (which is done
> > >  	 * automatically in of_i2c_register_devices, for device tree users */
> > > -	chip->flags |= TPM_CHIP_FLAG_IRQ;
> > > +	if(chip->flags)
> > > +		chip->flags |= TPM_CHIP_FLAG_IRQ;
> > > +
> > >  	priv->irq = client->irq;
> > >  
> > >  	if (chip->flags & TPM_CHIP_FLAG_IRQ) {
> > 
> > Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
> > 
> > PS. There's a style error. "if()" should be "if ()". I don't mind fixing
> > that. Just remember that next time.
> 
> Andrew/Jarkko:
> 
> Uhm, this looks wrong to me.. The original code was like this:
> 
> -       chip->vendor.irq = client->irq;
> -       if (chip->vendor.irq) {
> 
> And was wrongly changed to this:
> 
> +       chip->flags |= TPM_CHIP_FLAG_IRQ;
> +       priv->irq = client->irq;
> +       if (chip->flags & TPM_CHIP_FLAG_IRQ) {
> 
> Jarkko, can you fold this into the patch to fix it please:

Right. Sure. It's not merged to my next nor it has been part of any pull
request so this is still doable.

/Jarkko

> diff --git a/drivers/char/tpm/tpm_i2c_nuvoton.c b/drivers/char/tpm/tpm_i2c_nuvoton.c
> index e63ea1652d8d..826698234336 100644
> --- a/drivers/char/tpm/tpm_i2c_nuvoton.c
> +++ b/drivers/char/tpm/tpm_i2c_nuvoton.c
> @@ -559,12 +559,8 @@ static int i2c_nuvoton_probe(struct i2c_client *client,
>  	 *   TPM_INTF_INT_LEVEL_LOW | TPM_INTF_DATA_AVAIL_INT
>  	 * The IRQ should be set in the i2c_board_info (which is done
>  	 * automatically in of_i2c_register_devices, for device tree users */
> -	if(chip->flags)
> -		chip->flags |= TPM_CHIP_FLAG_IRQ;
> -
>  	priv->irq = client->irq;
> -
> -	if (chip->flags & TPM_CHIP_FLAG_IRQ) {
> +	if (client->irq) {
>  		dev_dbg(dev, "%s() priv->irq\n", __func__);
>  		rc = devm_request_irq(dev, client->irq,
>  				      i2c_nuvoton_int_handler,
> @@ -574,9 +570,9 @@ static int i2c_nuvoton_probe(struct i2c_client *client,
>  		if (rc) {
>  			dev_err(dev, "%s() Unable to request irq: %d for use\n",
>  				__func__, priv->irq);
> -			chip->flags &= ~TPM_CHIP_FLAG_IRQ;
>  			priv->irq = 0;
>  		} else {
> +			chip->flags |= TPM_CHIP_FLAG_IRQ;
>  			/* Clear any pending interrupt */
>  			i2c_nuvoton_ready(chip);
>  			/* - wait for TPM_STS==0xA0 (stsValid, commandReady) */

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports.http://sdm.link/zohodev2dev

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/2] add irq validity check in tpm_i2c_nuvoton driver
       [not found]                 ` <20160713120401.GA4387-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
@ 2016-07-18 17:50                   ` Jarkko Sakkinen
       [not found]                     ` <20160718175053.GA7213-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 10+ messages in thread
From: Jarkko Sakkinen @ 2016-07-18 17:50 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: andrew zamansky, tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	gcwilson-r/Jw6+rmf7HQT0dZR+AlfA, azamansk-KrzQf0k3Iz9BDgjK7y7TUQ,
	Dan.Morav-KrzQf0k3Iz9BDgjK7y7TUQ, stimpy1-Re5JQEeQqe8AvxtiuMwx3w

On Wed, Jul 13, 2016 at 03:04:01PM +0300, Jarkko Sakkinen wrote:
> On Tue, Jul 12, 2016 at 11:33:26AM -0600, Jason Gunthorpe wrote:
> > On Wed, Jun 29, 2016 at 05:03:39PM +0300, Jarkko Sakkinen wrote:
> > > On Wed, Jun 29, 2016 at 12:58:49PM +0300, andrew zamansky wrote:
> > > > if irq==0 (actualy invalid value) then error is printed to dmesg after
> > > > trying to register to 0 interrupt 
> > > > 
> > > >  drivers/char/tpm/tpm_i2c_nuvoton.c | 4 +++-
> > > >  1 file changed, 3 insertions(+), 1 deletion(-)
> > > > 
> > > > diff --git a/drivers/char/tpm/tpm_i2c_nuvoton.c b/drivers/char/tpm/tpm_i2c_nuvoton.c
> > > > index 75a80e466..3081529 100644
> > > > +++ b/drivers/char/tpm/tpm_i2c_nuvoton.c
> > > > @@ -554,7 +554,9 @@ static int i2c_nuvoton_probe(struct i2c_client *client,
> > > >  	 *   TPM_INTF_INT_LEVEL_LOW | TPM_INTF_DATA_AVAIL_INT
> > > >  	 * The IRQ should be set in the i2c_board_info (which is done
> > > >  	 * automatically in of_i2c_register_devices, for device tree users */
> > > > -	chip->flags |= TPM_CHIP_FLAG_IRQ;
> > > > +	if(chip->flags)
> > > > +		chip->flags |= TPM_CHIP_FLAG_IRQ;
> > > > +
> > > >  	priv->irq = client->irq;
> > > >  
> > > >  	if (chip->flags & TPM_CHIP_FLAG_IRQ) {
> > > 
> > > Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
> > > 
> > > PS. There's a style error. "if()" should be "if ()". I don't mind fixing
> > > that. Just remember that next time.
> > 
> > Andrew/Jarkko:
> > 
> > Uhm, this looks wrong to me.. The original code was like this:
> > 
> > -       chip->vendor.irq = client->irq;
> > -       if (chip->vendor.irq) {
> > 
> > And was wrongly changed to this:
> > 
> > +       chip->flags |= TPM_CHIP_FLAG_IRQ;
> > +       priv->irq = client->irq;
> > +       if (chip->flags & TPM_CHIP_FLAG_IRQ) {
> > 
> > Jarkko, can you fold this into the patch to fix it please:
> 
> Right. Sure. It's not merged to my next nor it has been part of any pull
> request so this is still doable.

Done.

/Jarkko

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports.http://sdm.link/zohodev2dev

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/2] add irq validity check in tpm_i2c_nuvoton driver
       [not found]                     ` <20160718175053.GA7213-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
@ 2016-07-19 14:35                       ` Jarkko Sakkinen
  0 siblings, 0 replies; 10+ messages in thread
From: Jarkko Sakkinen @ 2016-07-19 14:35 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: andrew zamansky, tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	gcwilson-r/Jw6+rmf7HQT0dZR+AlfA, azamansk-KrzQf0k3Iz9BDgjK7y7TUQ,
	Dan.Morav-KrzQf0k3Iz9BDgjK7y7TUQ, stimpy1-Re5JQEeQqe8AvxtiuMwx3w

On Mon, Jul 18, 2016 at 08:50:53PM +0300, Jarkko Sakkinen wrote:
> On Wed, Jul 13, 2016 at 03:04:01PM +0300, Jarkko Sakkinen wrote:
> > On Tue, Jul 12, 2016 at 11:33:26AM -0600, Jason Gunthorpe wrote:
> > > On Wed, Jun 29, 2016 at 05:03:39PM +0300, Jarkko Sakkinen wrote:
> > > > On Wed, Jun 29, 2016 at 12:58:49PM +0300, andrew zamansky wrote:
> > > > > if irq==0 (actualy invalid value) then error is printed to dmesg after
> > > > > trying to register to 0 interrupt 
> > > > > 
> > > > >  drivers/char/tpm/tpm_i2c_nuvoton.c | 4 +++-
> > > > >  1 file changed, 3 insertions(+), 1 deletion(-)
> > > > > 
> > > > > diff --git a/drivers/char/tpm/tpm_i2c_nuvoton.c b/drivers/char/tpm/tpm_i2c_nuvoton.c
> > > > > index 75a80e466..3081529 100644
> > > > > +++ b/drivers/char/tpm/tpm_i2c_nuvoton.c
> > > > > @@ -554,7 +554,9 @@ static int i2c_nuvoton_probe(struct i2c_client *client,
> > > > >  	 *   TPM_INTF_INT_LEVEL_LOW | TPM_INTF_DATA_AVAIL_INT
> > > > >  	 * The IRQ should be set in the i2c_board_info (which is done
> > > > >  	 * automatically in of_i2c_register_devices, for device tree users */
> > > > > -	chip->flags |= TPM_CHIP_FLAG_IRQ;
> > > > > +	if(chip->flags)
> > > > > +		chip->flags |= TPM_CHIP_FLAG_IRQ;
> > > > > +
> > > > >  	priv->irq = client->irq;
> > > > >  
> > > > >  	if (chip->flags & TPM_CHIP_FLAG_IRQ) {
> > > > 
> > > > Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
> > > > 
> > > > PS. There's a style error. "if()" should be "if ()". I don't mind fixing
> > > > that. Just remember that next time.
> > > 
> > > Andrew/Jarkko:
> > > 
> > > Uhm, this looks wrong to me.. The original code was like this:
> > > 
> > > -       chip->vendor.irq = client->irq;
> > > -       if (chip->vendor.irq) {
> > > 
> > > And was wrongly changed to this:
> > > 
> > > +       chip->flags |= TPM_CHIP_FLAG_IRQ;
> > > +       priv->irq = client->irq;
> > > +       if (chip->flags & TPM_CHIP_FLAG_IRQ) {
> > > 
> > > Jarkko, can you fold this into the patch to fix it please:
> > 
> > Right. Sure. It's not merged to my next nor it has been part of any pull
> > request so this is still doable.
> 
> Done.

I rewrote the whole description as this is actually a bug fix for a
regression. I also added a fixes line.

/Jarkko

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports.http://sdm.link/zohodev2dev

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2016-07-19 14:35 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-29  9:58 [PATCH 0/2] add irq validity check in tpm_i2c_nuvoton driver andrew zamansky
     [not found] ` <1467194329-5543-1-git-send-email-andrew.zamansky-KrzQf0k3Iz9BDgjK7y7TUQ@public.gmane.org>
2016-06-29  9:58   ` [PATCH 1/2] tpm: drop 'irq' from struct tpm_vendor_specific andrew zamansky
2016-06-29  9:58   ` [PATCH 2/2] add irq validity check in tpm_i2c_nuvoton driver andrew zamansky
     [not found]     ` <1467194329-5543-3-git-send-email-andrew.zamansky-KrzQf0k3Iz9BDgjK7y7TUQ@public.gmane.org>
2016-06-29 14:03       ` Jarkko Sakkinen
     [not found]         ` <20160629140339.GA4589-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-07-01  8:39           ` Jarkko Sakkinen
2016-07-12 17:33           ` Jason Gunthorpe
     [not found]             ` <20160712173326.GA9286-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2016-07-13 12:04               ` Jarkko Sakkinen
     [not found]                 ` <20160713120401.GA4387-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-07-18 17:50                   ` Jarkko Sakkinen
     [not found]                     ` <20160718175053.GA7213-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-07-19 14:35                       ` Jarkko Sakkinen
2016-06-29 18:20       ` Jason Gunthorpe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.