mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] genirq: Give warning when setup an already-setup non-shared irq
@ 2013-01-10 15:55 Chuansheng Liu
  2013-01-14 11:16 ` Thomas Gleixner
  0 siblings, 1 reply; 3+ messages in thread
From: Chuansheng Liu @ 2013-01-10 15:55 UTC (permalink / raw)
  To: tglx; +Cc: linux-kernel, chuansheng.liu


Meet the case when the request_threaded_irq() with the same irq
is called twice continually, get the below mismatch info:
"IRQ handler type mismatch for IRQ 323"

Here give a right warning that like below:
"Trying to setup already-setup non-shared IRQ 323"

Signed-off-by: liu chuansheng <chuansheng.liu@intel.com>
---
 kernel/irq/manage.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index e49a288..6802ce1 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -999,6 +999,16 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new)
 	old_ptr = &desc->action;
 	old = *old_ptr;
 	if (old) {
+		/* Give warning when setup an irq which has been setup
+		 * already.
+		 */
+		if (!(old->flags & IRQF_SHARED)) {
+			ret = -EINVAL;
+			WARN(1, "Trying to setup already-setup non-shared IRQ %d\n",
+				irq);
+			goto out_mask;
+		}
+
 		/*
 		 * Can't share interrupts unless both agree to and are
 		 * the same type (level, edge, polarity). So both flag
-- 
1.7.0.4




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

* Re: [PATCH] genirq: Give warning when setup an already-setup non-shared irq
  2013-01-10 15:55 [PATCH] genirq: Give warning when setup an already-setup non-shared irq Chuansheng Liu
@ 2013-01-14 11:16 ` Thomas Gleixner
  2013-01-15  0:54   ` Liu, Chuansheng
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Gleixner @ 2013-01-14 11:16 UTC (permalink / raw)
  To: Chuansheng Liu; +Cc: linux-kernel

On Thu, 10 Jan 2013, Chuansheng Liu wrote:
> 
> Meet the case when the request_threaded_irq() with the same irq
> is called twice continually, get the below mismatch info:
> "IRQ handler type mismatch for IRQ 323"

I have no idea where you get that from. The mismatch is printed with:

        if (!(new->flags & IRQF_PROBE_SHARED)) {
	   pr_err("Flags mismatch irq %d. %08x (%s) vs. %08x (%s)\n",
                       irq, new->flags, new->name, old->flags, old->name);

And its only printed when IRQF_PROBE_SHARED is not set. Your change
would cause printouts where no printouts are due and it'd change the
return value from EBUSY to EINVAL.

Thanks,

	tglx

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

* RE: [PATCH] genirq: Give warning when setup an already-setup non-shared irq
  2013-01-14 11:16 ` Thomas Gleixner
@ 2013-01-15  0:54   ` Liu, Chuansheng
  0 siblings, 0 replies; 3+ messages in thread
From: Liu, Chuansheng @ 2013-01-15  0:54 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: linux-kernel



> -----Original Message-----
> From: Thomas Gleixner [mailto:tglx@linutronix.de]
> Sent: Monday, January 14, 2013 7:16 PM
> To: Liu, Chuansheng
> Cc: linux-kernel@vger.kernel.org
> Subject: Re: [PATCH] genirq: Give warning when setup an already-setup
> non-shared irq
> 
> On Thu, 10 Jan 2013, Chuansheng Liu wrote:
> >
> > Meet the case when the request_threaded_irq() with the same irq
> > is called twice continually, get the below mismatch info:
> > "IRQ handler type mismatch for IRQ 323"
> 
> I have no idea where you get that from. The mismatch is printed with:
> 
>         if (!(new->flags & IRQF_PROBE_SHARED)) {
> 	   pr_err("Flags mismatch irq %d. %08x (%s) vs. %08x (%s)\n",
>                        irq, new->flags, new->name, old->flags,
> old->name);
	if (!(new->flags & IRQF_PROBE_SHARED)) {
		printk(KERN_ERR "IRQ handler type mismatch for IRQ %d\n", irq);
		if (old_name)
			printk(KERN_ERR "current handler: %s\n", old_name);
		dump_stack();
	}
The "IRQ handler type mismatch for IRQ 323" message is coming from the above code,
which is something older than you pasted, but it is the same place.

> 
> And its only printed when IRQF_PROBE_SHARED is not set. Your change
> would cause printouts where no printouts are due and it'd change the
> return value from EBUSY to EINVAL.
My test case is below:
request_irq(323, func1,
				IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING,
				name, dev);
After succeeded, then called it again:
request_irq(323, func1,
				IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING,
				name, dev);

After the test case, I will get the "mismatch" info.
But in this case, it should not be the "mismatch" case, so I want to give another warning
in case of duplicated setup the same irq with non-shared.
Not sure if it is right. Thanks your pointing out.
> 
> Thanks,
> 
> 	tglx

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

end of thread, other threads:[~2013-01-15  0:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-10 15:55 [PATCH] genirq: Give warning when setup an already-setup non-shared irq Chuansheng Liu
2013-01-14 11:16 ` Thomas Gleixner
2013-01-15  0:54   ` Liu, Chuansheng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®