From: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
To: Jarkko Sakkinen
<jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
Cc: andrew zamansky
<andrew.zamansky-KrzQf0k3Iz9BDgjK7y7TUQ@public.gmane.org>,
tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
gcwilson-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org,
azamansk-KrzQf0k3Iz9BDgjK7y7TUQ@public.gmane.org,
Dan.Morav-KrzQf0k3Iz9BDgjK7y7TUQ@public.gmane.org,
stimpy1-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Subject: Re: [PATCH 2/2] add irq validity check in tpm_i2c_nuvoton driver
Date: Tue, 12 Jul 2016 11:33:26 -0600 [thread overview]
Message-ID: <20160712173326.GA9286@obsidianresearch.com> (raw)
In-Reply-To: <20160629140339.GA4589-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
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
next prev parent reply other threads:[~2016-07-12 17:33 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
[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
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=20160712173326.GA9286@obsidianresearch.com \
--to=jgunthorpe-epgobjl8dl3ta4ec/59zmfatqe2ktcn/@public.gmane.org \
--cc=Dan.Morav-KrzQf0k3Iz9BDgjK7y7TUQ@public.gmane.org \
--cc=andrew.zamansky-KrzQf0k3Iz9BDgjK7y7TUQ@public.gmane.org \
--cc=azamansk-KrzQf0k3Iz9BDgjK7y7TUQ@public.gmane.org \
--cc=gcwilson-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org \
--cc=jarkko.sakkinen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
--cc=stimpy1-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
/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 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.