[tip:irq/core] genirq: Introduce request_any_context_irq()

Previous thread: [PATCH] base firmware: Fix BUG from sysfs attributes change in commit a2db6842873c8e5a70652f278d469128cb52db70 by Larry Finger on Saturday, March 13, 2010 - 12:36 pm. (18 messages)

Next thread: Important: Email Account Verification Update!!!? by =?iso-8859-1?Q?Brostr=F6m_Carina?= on Saturday, March 13, 2010 - 1:50 pm. (1 message)
From: Thomas Gleixner
Date: Saturday, March 13, 2010 - 12:56 pm

Back to LKML

On Thu, 11 Mar 2010, akpm@linux-foundation.org wrote:


In general I have no objections, but one thing bothers me. We have no
way to let a driver know whether it runs in a nested threaded context
or in hard irq context. There might be (future) drivers which would be
happy to know that to apply context dependent optimizations etc.

What about a new function which solves your problem and returns that
information ? Something along the line:

int request_any_context_irq(....)
{
	...
	if (desc->status & IRQ_NESTED_THREAD) {
	   	ret = request_threaded_irq();
		if (!ret)
			ret = IRQ_IS_NESTED;

	} else {
		.....
			ret = IRQ_IS_NONTHREADED;
		else
			ret = IRQ_IS_THREADED;
			
	}
	...
	return ret;
}

You get the idea, right ?

It's a bit more code, but less magic and more flexible for further use
cases.

Thanks,

--

From: Marc Zyngier
Date: Tuesday, March 16, 2010 - 1:36 am

On Sat, 13 Mar 2010 20:56:19 +0100 (CET), Thomas Gleixner
<tglx@linutronix.de> wrote:


What about the attached (sorry, webmail crap) patch? I deliberately left
IS_THREADED out of the picture, as I have the feeling that the caller has
to know if it really wants a threaded handler, and I couldn't see a way to
guess its intent.

Please note that this patch has only been compile-tested, as I'm traveling
for the rest of the week and don't have access to my boards.

Thanks,

        M.
-- 
Who you jivin' with that Cosmik Debris?
From: Marc Zyngier
Date: Sunday, March 21, 2010 - 11:03 pm

On Tue, 16 Mar 2010 09:36:59 +0100

Any comment on this?

Thanks,

	M.
-- 
I'm the slime oozin' out from your TV set...
--

From: Thomas Gleixner
Date: Monday, March 22, 2010 - 1:17 am

Yes, I was traveling last week and this is in my mail backlog :)

Thanks,

	tglx
--

From: Trilok Soni
Date: Saturday, April 10, 2010 - 2:48 pm

Hi ,

Any updates on this patch?


-- 
---Trilok Soni
http://triloksoni.wordpress.com
http://www.linkedin.com/in/triloksoni
--

From: tip-bot for Marc Zyngier
Date: Tuesday, April 13, 2010 - 12:33 pm

Commit-ID:  ae731f8d0785ccd3380f511bae888933b6562e45
Gitweb:     http://git.kernel.org/tip/ae731f8d0785ccd3380f511bae888933b6562e45
Author:     Marc Zyngier <maz@misterjones.org>
AuthorDate: Mon, 15 Mar 2010 22:56:33 +0000
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 13 Apr 2010 16:36:39 +0200

genirq: Introduce request_any_context_irq()

Now that we enjoy threaded interrupts, we're starting to see irq_chip
implementations (wm831x, pca953x) that make use of threaded interrupts
for the controller, and nested interrupts for the client interrupt. It
all works very well, with one drawback:

Drivers requesting an IRQ must now know whether the handler will
run in a thread context or not, and call request_threaded_irq() or
request_irq() accordingly.

The problem is that the requesting driver sometimes doesn't know
about the nature of the interrupt, specially when the interrupt
controller is a discrete chip (typically a GPIO expander connected
over I2C) that can be connected to a wide variety of otherwise perfectly
supported hardware.

This patch introduces the request_any_context_irq() function that mostly
mimics the usual request_irq(), except that it checks whether the irq
level is configured as nested or not, and calls the right backend.
On success, it also returns either IRQC_IS_HARDIRQ or IRQC_IS_NESTED.

[ tglx: Made return value an enum, simplified code and made the export
  	of request_any_context_irq GPL ]

Signed-off-by: Marc Zyngier <maz@misterjones.org>
Cc: <joachim.eastwood@jotron.com>
LKML-Reference: <927ea285bd0c68934ddae1a47e44a9ba@localhost>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 include/linux/interrupt.h |   23 +++++++++++++++++++++++
 kernel/irq/manage.c       |   37 +++++++++++++++++++++++++++++++++++++
 2 files changed, 60 insertions(+), 0 deletions(-)

diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 75f3f00..d7e7a76 100644
--- a/include/linux/interrupt.h
+++ ...
Previous thread: [PATCH] base firmware: Fix BUG from sysfs attributes change in commit a2db6842873c8e5a70652f278d469128cb52db70 by Larry Finger on Saturday, March 13, 2010 - 12:36 pm. (18 messages)

Next thread: Important: Email Account Verification Update!!!? by =?iso-8859-1?Q?Brostr=F6m_Carina?= on Saturday, March 13, 2010 - 1:50 pm. (1 message)