All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: nvec: move to use request_irq by IRQF_NO_AUTOEN flag
@ 2021-04-07  6:34 Tian Tao
  2021-04-08  4:37 ` Michał Mirosław
  0 siblings, 1 reply; 4+ messages in thread
From: Tian Tao @ 2021-04-07  6:34 UTC (permalink / raw)
  To: marvin24, p.zabel; +Cc: ac100, linux-tegra, linux-staging, Tian Tao

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.

this patch is made base on "add IRQF_NO_AUTOEN for request_irq" which
is being merged: https://lore.kernel.org/patchwork/patch/1388765/

Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
---
 drivers/staging/nvec/nvec.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c
index a80996b..f23e127 100644
--- a/drivers/staging/nvec/nvec.c
+++ b/drivers/staging/nvec/nvec.c
@@ -831,13 +831,12 @@ static int tegra_nvec_probe(struct platform_device *pdev)
 		return PTR_ERR(nvec->gpiod);
 	}
 
-	err = devm_request_irq(dev, nvec->irq, nvec_interrupt, 0,
-			       "nvec", nvec);
+	err = devm_request_irq(dev, nvec->irq, nvec_interrupt,
+			       IRQF_NO_AUTOEN, "nvec", nvec);
 	if (err) {
 		dev_err(dev, "couldn't request irq\n");
 		return -ENODEV;
 	}
-	disable_irq(nvec->irq);
 
 	tegra_init_i2c_slave(nvec);
 
-- 
2.7.4


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

* Re: [PATCH] staging: nvec: move to use request_irq by IRQF_NO_AUTOEN flag
  2021-04-07  6:34 [PATCH] staging: nvec: move to use request_irq by IRQF_NO_AUTOEN flag Tian Tao
@ 2021-04-08  4:37 ` Michał Mirosław
  2021-04-09 18:51     ` Marc Dietrich
  0 siblings, 1 reply; 4+ messages in thread
From: Michał Mirosław @ 2021-04-08  4:37 UTC (permalink / raw)
  To: Tian Tao; +Cc: marvin24, p.zabel, ac100, linux-tegra, linux-staging

On Wed, Apr 07, 2021 at 02:34:19PM +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.
> 
> this patch is made base on "add IRQF_NO_AUTOEN for request_irq" which
> is being merged: https://lore.kernel.org/patchwork/patch/1388765/

This assumes that the interrupt is not shared. This could be fixed
by requesting the IRQ after init (and releasing before deinit).

Best Regards
Michał Mirosław

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

* Re: [PATCH] staging: nvec: move to use request_irq by IRQF_NO_AUTOEN flag
  2021-04-08  4:37 ` Michał Mirosław
@ 2021-04-09 18:51     ` Marc Dietrich
  0 siblings, 0 replies; 4+ messages in thread
From: Marc Dietrich @ 2021-04-09 18:51 UTC (permalink / raw)
  To: Michał Mirosław
  Cc: Tian Tao, marvin24, p.zabel, ac100, linux-tegra, linux-staging

[-- Attachment #1: Type: text/plain, Size: 1191 bytes --]

Hi,

On Thu, 8 Apr 2021, Michał Mirosław wrote:

> On Wed, Apr 07, 2021 at 02:34:19PM +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.
>>
>> this patch is made base on "add IRQF_NO_AUTOEN for request_irq" which
>> is being merged: https://lore.kernel.org/patchwork/patch/1388765/

thanks for you patch, Tao, which look good to me.

> This assumes that the interrupt is not shared. This could be fixed
> by requesting the IRQ after init (and releasing before deinit).

Michał, I understand your objections, and for the general case you are 
right. However, I think it would be good to keep the structure as close 
as possible to i2c-tegra [1], which does the same as Tao suggested. I'm 
also pretty sure that the interrupt is not shared on this (single) machine 
which this driver is made for.
So unless there are some strong arguments aginst it, I personally perfer 
his version.

Best wishes,

Marc Dietrich

[1] 
https://github.com/torvalds/linux/blob/17e7124aad766b3f158943acb51467f86220afe9/drivers/i2c/busses/i2c-tegra.c#L1740

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

* Re: [PATCH] staging: nvec: move to use request_irq by IRQF_NO_AUTOEN flag
@ 2021-04-09 18:51     ` Marc Dietrich
  0 siblings, 0 replies; 4+ messages in thread
From: Marc Dietrich @ 2021-04-09 18:51 UTC (permalink / raw)
  To: Michał Mirosław
  Cc: Tian Tao, marvin24, p.zabel, ac100, linux-tegra, linux-staging

[-- Attachment #1: Type: text/plain, Size: 1191 bytes --]

Hi,

On Thu, 8 Apr 2021, Michał Mirosław wrote:

> On Wed, Apr 07, 2021 at 02:34:19PM +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.
>>
>> this patch is made base on "add IRQF_NO_AUTOEN for request_irq" which
>> is being merged: https://lore.kernel.org/patchwork/patch/1388765/

thanks for you patch, Tao, which look good to me.

> This assumes that the interrupt is not shared. This could be fixed
> by requesting the IRQ after init (and releasing before deinit).

Michał, I understand your objections, and for the general case you are 
right. However, I think it would be good to keep the structure as close 
as possible to i2c-tegra [1], which does the same as Tao suggested. I'm 
also pretty sure that the interrupt is not shared on this (single) machine 
which this driver is made for.
So unless there are some strong arguments aginst it, I personally perfer 
his version.

Best wishes,

Marc Dietrich

[1] 
https://github.com/torvalds/linux/blob/17e7124aad766b3f158943acb51467f86220afe9/drivers/i2c/busses/i2c-tegra.c#L1740

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

end of thread, other threads:[~2021-04-09 19:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-07  6:34 [PATCH] staging: nvec: move to use request_irq by IRQF_NO_AUTOEN flag Tian Tao
2021-04-08  4:37 ` Michał Mirosław
2021-04-09 18:51   ` Marc Dietrich
2021-04-09 18:51     ` Marc Dietrich

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.