diff mbox series

char: tpm: move to use request_irq by IRQF_NO_AUTOEN flag

Message ID 1615971586-21039-1-git-send-email-tiantao6@hisilicon.com (mailing list archive)
State New
Headers show
Series char: tpm: move to use request_irq by IRQF_NO_AUTOEN flag | expand

Commit Message

Tian Tao March 17, 2021, 8:59 a.m. UTC
disable_irq() after request_irq() still has a time gap in which
interrupts can come. request_irq() with IRQF_NO_AUTOEN flag will
disable IRQ auto-enable because of requesting.

Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
---
 drivers/char/tpm/tpm_tis_i2c_cr50.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Jarkko Sakkinen March 17, 2021, 8:58 p.m. UTC | #1
On Wed, Mar 17, 2021 at 04:59:46PM +0800, Tian Tao wrote:
> disable_irq() after request_irq() still has a time gap in which
> interrupts can come. request_irq() with IRQF_NO_AUTOEN flag will
> disable IRQ auto-enable because of requesting.
> 
> Signed-off-by: Tian Tao <tiantao6@hisilicon.com>

Is this a new feature?

What would be great is a "Link:" tag to the patch set if it is fairly
recent (i.e. lore.kernel.org link).

/Jarkko

> ---
>  drivers/char/tpm/tpm_tis_i2c_cr50.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/char/tpm/tpm_tis_i2c_cr50.c b/drivers/char/tpm/tpm_tis_i2c_cr50.c
> index ec9a65e..25299e5 100644
> --- a/drivers/char/tpm/tpm_tis_i2c_cr50.c
> +++ b/drivers/char/tpm/tpm_tis_i2c_cr50.c
> @@ -705,14 +705,14 @@ static int tpm_cr50_i2c_probe(struct i2c_client *client,
>  
>  	if (client->irq > 0) {
>  		rc = devm_request_irq(dev, client->irq, tpm_cr50_i2c_int_handler,
> -				      IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
> +				      IRQF_TRIGGER_FALLING | IRQF_ONESHOT |
> +				      IRQF_NO_AUTOEN,
>  				      dev->driver->name, chip);
>  		if (rc < 0) {
>  			dev_err(dev, "Failed to probe IRQ %d\n", client->irq);
>  			return rc;
>  		}
>  
> -		disable_irq(client->irq);
>  		priv->irq = client->irq;
>  	} else {
>  		dev_warn(dev, "No IRQ, will use %ums delay for TPM ready\n",
> -- 
> 2.7.4
> 
>
tiantao (H) March 18, 2021, 12:50 a.m. UTC | #2
在 2021/3/18 4:58, Jarkko Sakkinen 写道:
> On Wed, Mar 17, 2021 at 04:59:46PM +0800, Tian Tao wrote:
>> disable_irq() after request_irq() still has a time gap in which
>> interrupts can come. request_irq() with IRQF_NO_AUTOEN flag will
>> disable IRQ auto-enable because of requesting.
>>
>> Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
> Is this a new feature?
yes ,you can see cbe16f35bee6880becca6f20d2ebf6b457148552 genirq: Add 
IRQF_NO_AUTOEN for request_irq/nmi()
> What would be great is a "Link:" tag to the patch set if it is fairly
> recent (i.e. lore.kernel.org link).
>
> /Jarkko
>
>> ---
>>   drivers/char/tpm/tpm_tis_i2c_cr50.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/char/tpm/tpm_tis_i2c_cr50.c b/drivers/char/tpm/tpm_tis_i2c_cr50.c
>> index ec9a65e..25299e5 100644
>> --- a/drivers/char/tpm/tpm_tis_i2c_cr50.c
>> +++ b/drivers/char/tpm/tpm_tis_i2c_cr50.c
>> @@ -705,14 +705,14 @@ static int tpm_cr50_i2c_probe(struct i2c_client *client,
>>   
>>   	if (client->irq > 0) {
>>   		rc = devm_request_irq(dev, client->irq, tpm_cr50_i2c_int_handler,
>> -				      IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
>> +				      IRQF_TRIGGER_FALLING | IRQF_ONESHOT |
>> +				      IRQF_NO_AUTOEN,
>>   				      dev->driver->name, chip);
>>   		if (rc < 0) {
>>   			dev_err(dev, "Failed to probe IRQ %d\n", client->irq);
>>   			return rc;
>>   		}
>>   
>> -		disable_irq(client->irq);
>>   		priv->irq = client->irq;
>>   	} else {
>>   		dev_warn(dev, "No IRQ, will use %ums delay for TPM ready\n",
>> -- 
>> 2.7.4
>>
>>
> .
>
Jarkko Sakkinen March 18, 2021, 2:43 a.m. UTC | #3
On Thu, Mar 18, 2021 at 08:50:28AM +0800, tiantao (H) wrote:
> 
> 在 2021/3/18 4:58, Jarkko Sakkinen 写道:
> > On Wed, Mar 17, 2021 at 04:59:46PM +0800, Tian Tao wrote:
> > > disable_irq() after request_irq() still has a time gap in which
> > > interrupts can come. request_irq() with IRQF_NO_AUTOEN flag will
> > > disable IRQ auto-enable because of requesting.
> > > 
> > > Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
> > Is this a new feature?
> yes ,you can see cbe16f35bee6880becca6f20d2ebf6b457148552 genirq: Add
> IRQF_NO_AUTOEN for request_irq/nmi()


Can you refine the patch by adding a "Link: <lore>" to the patch?

> > What would be great is a "Link:" tag to the patch set if it is fairly
> > recent (i.e. lore.kernel.org link).
> > 
> > /Jarkko
> > 
> > > ---
> > >   drivers/char/tpm/tpm_tis_i2c_cr50.c | 4 ++--
> > >   1 file changed, 2 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/drivers/char/tpm/tpm_tis_i2c_cr50.c b/drivers/char/tpm/tpm_tis_i2c_cr50.c
> > > index ec9a65e..25299e5 100644
> > > --- a/drivers/char/tpm/tpm_tis_i2c_cr50.c
> > > +++ b/drivers/char/tpm/tpm_tis_i2c_cr50.c
> > > @@ -705,14 +705,14 @@ static int tpm_cr50_i2c_probe(struct i2c_client *client,
> > >   	if (client->irq > 0) {
> > >   		rc = devm_request_irq(dev, client->irq, tpm_cr50_i2c_int_handler,
> > > -				      IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
> > > +				      IRQF_TRIGGER_FALLING | IRQF_ONESHOT |
> > > +				      IRQF_NO_AUTOEN,
> > >   				      dev->driver->name, chip);
> > >   		if (rc < 0) {
> > >   			dev_err(dev, "Failed to probe IRQ %d\n", client->irq);
> > >   			return rc;
> > >   		}
> > > -		disable_irq(client->irq);
> > >   		priv->irq = client->irq;
> > >   	} else {
> > >   		dev_warn(dev, "No IRQ, will use %ums delay for TPM ready\n",
> > > -- 
> > > 2.7.4
> > > 
> > > 
> > .
> > 
> 
>
diff mbox series

Patch

diff --git a/drivers/char/tpm/tpm_tis_i2c_cr50.c b/drivers/char/tpm/tpm_tis_i2c_cr50.c
index ec9a65e..25299e5 100644
--- a/drivers/char/tpm/tpm_tis_i2c_cr50.c
+++ b/drivers/char/tpm/tpm_tis_i2c_cr50.c
@@ -705,14 +705,14 @@  static int tpm_cr50_i2c_probe(struct i2c_client *client,
 
 	if (client->irq > 0) {
 		rc = devm_request_irq(dev, client->irq, tpm_cr50_i2c_int_handler,
-				      IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
+				      IRQF_TRIGGER_FALLING | IRQF_ONESHOT |
+				      IRQF_NO_AUTOEN,
 				      dev->driver->name, chip);
 		if (rc < 0) {
 			dev_err(dev, "Failed to probe IRQ %d\n", client->irq);
 			return rc;
 		}
 
-		disable_irq(client->irq);
 		priv->irq = client->irq;
 	} else {
 		dev_warn(dev, "No IRQ, will use %ums delay for TPM ready\n",