From: "Hans J. Koch" <hjk@linutronix.de>
To: Magnus Damm <magnus.damm@gmail.com>
Cc: linux-kernel@vger.kernel.org, Uwe.Kleine-Koenig@digi.com,
gregkh@suse.de, akpm@linux-foundation.org, hjk@linutronix.de,
lethal@linux-sh.org, tglx@linutronix.de
Subject: Re: [PATCH] uio_pdrv: Unique IRQ Mode
Date: Wed, 4 Jun 2008 12:11:45 +0200 [thread overview]
Message-ID: <20080604101144.GA3207@local> (raw)
In-Reply-To: <20080604060826.17162.46972.sendpatchset@rx1.opensource.se>
On Wed, Jun 04, 2008 at 03:08:26PM +0900, Magnus Damm wrote:
> From: Magnus Damm <damm@igel.co.jp>
>
> This patch adds a "Unique IRQ Mode" to the uio_pdrv UIO platform driver.
> In this mode the user space driver is responsible for acknowledging and
> re-enabling the interrupt. Shared interrupts are not supported.
I still don't see any gain in this. This only works for embedded
devices, so a user has to setup hardware specific code in his board
support anyway. With your code, we would have to add something like this
to the docs:
IF you define an irq AND ommit the irq handler THEN we silently add a
handler that blindly assumes the irq is not shared...
In my opinion, this is confusing, and all it does is saving the need for a
three-lines irq handler in the board support.
So, NAK to this until somebody convinces me that I completely missed the
point.
Thanks,
Hans
>
> Signed-off-by: Magnus Damm <damm@igel.co.jp>
> ---
>
> Think of this as V2 of "[PATCH 00/03][RFC] Reusable UIO Platform Driver".
> Needs "[PATCH 0/1] UIO: Add a write() function to enable/disable interrupts"
>
> drivers/uio/uio_pdrv.c | 43 +++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 43 insertions(+)
>
> --- 0006/drivers/uio/uio_pdrv.c
> +++ work/drivers/uio/uio_pdrv.c 2008-06-04 14:51:56.000000000 +0900
> @@ -16,8 +16,34 @@
>
> struct uio_platdata {
> struct uio_info *uioinfo;
> + unsigned long irq_disabled;
> };
>
> +static irqreturn_t uio_pdrv_unique_handler(int irq, struct uio_info *dev_info)
> +{
> + struct uio_platdata *priv = dev_info->priv;
> +
> + /* In "Unique IRQ Mode", just disable the interrupt and remember
> + * the state so we can enable it later.
> + */
> + disable_irq(irq);
> + set_bit(0, &priv->irq_disabled);
> + return IRQ_HANDLED;
> +}
> +
> +static int uio_pdrv_unique_irqcontrol(struct uio_info *dev_info, s32 irq_on)
> +{
> + struct uio_platdata *priv = dev_info->priv;
> +
> + /* "Unique IRQ Mode" allows re-enabling of the interrupt */
> + if (irq_on && test_and_clear_bit(0, &priv->irq_disabled)) {
> + enable_irq(dev_info->irq);
> + return 0;
> + }
> +
> + return -ENOSYS;
> +}
> +
> static int uio_pdrv_probe(struct platform_device *pdev)
> {
> struct uio_info *uioinfo = pdev->dev.platform_data;
> @@ -68,6 +94,23 @@ static int uio_pdrv_probe(struct platfor
>
> pdata->uioinfo->priv = pdata;
>
> + /* This driver supports a special "Unique IRQ Mode".
> + *
> + * In this mode, no hardware specific kernel code is required to
> + * acknowledge interrupts. Instead, the interrupt is disabled by
> + * the interrupt handler. User space is responsible for performing
> + * hardware specific acknowledge and enabling of interrupts.
> + *
> + * Interrupt sharing is _not_ supported by the "Unique IRQ Mode".
> + *
> + * Enable this mode by passing IRQ number but omitting irq callbacks.
> + */
> + if (!uioinfo->handler && !uioinfo->irqcontrol && uioinfo->irq >= 0) {
> + uioinfo->irq_flags = IRQF_DISABLED;
> + uioinfo->handler = uio_pdrv_unique_handler;
> + uioinfo->irqcontrol = uio_pdrv_unique_irqcontrol;
> + }
> +
> ret = uio_register_device(&pdev->dev, pdata->uioinfo);
>
> if (ret) {
next prev parent reply other threads:[~2008-06-04 10:12 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-04 6:08 [PATCH] uio_pdrv: Unique IRQ Mode Magnus Damm
2008-06-04 10:11 ` Hans J. Koch [this message]
2008-06-05 1:25 ` Magnus Damm
2008-06-05 6:49 ` Uwe Kleine-König
2008-06-06 2:55 ` Magnus Damm
2008-06-06 10:04 ` Hans J. Koch
2008-06-08 10:03 ` Magnus Damm
2008-06-05 9:09 ` Hans J. Koch
2008-06-05 9:46 ` Magnus Damm
2008-06-05 11:27 ` Hans J. Koch
2008-06-08 10:19 ` Magnus Damm
2008-06-08 20:54 ` Hans J. Koch
2008-06-09 1:12 ` Magnus Damm
2008-06-09 8:44 ` Hans J. Koch
2008-06-09 9:01 ` Paul Mundt
2008-06-09 12:34 ` Uwe Kleine-König
2008-06-10 3:12 ` Greg KH
2008-06-10 4:40 ` Magnus Damm
2008-06-10 7:10 ` Uwe Kleine-König
2008-06-10 7:14 ` [PATCH] UIO: minor style and comment fixes Uwe Kleine-König
2008-06-10 9:07 ` Hans J. Koch
2008-06-10 13:50 ` [PATCH] uio_pdrv: Unique IRQ Mode Magnus Damm
2008-06-10 17:32 ` Paul Mundt
2008-06-10 19:24 ` Uwe Kleine-König
2008-06-09 4:09 ` Paul Mundt
2008-06-09 7:57 ` Uwe Kleine-König
2008-06-09 8:00 ` Paul Mundt
2008-06-09 9:54 ` Hans J. Koch
2008-06-09 12:32 ` Uwe Kleine-König
2008-06-09 14:20 ` Hans J. Koch
2008-06-10 6:11 ` Uwe Kleine-König
2008-06-10 9:01 ` Hans J. Koch
2008-06-05 11:33 ` Uwe Kleine-König
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=20080604101144.GA3207@local \
--to=hjk@linutronix.de \
--cc=Uwe.Kleine-Koenig@digi.com \
--cc=akpm@linux-foundation.org \
--cc=gregkh@suse.de \
--cc=lethal@linux-sh.org \
--cc=linux-kernel@vger.kernel.org \
--cc=magnus.damm@gmail.com \
--cc=tglx@linutronix.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox