Re: [PATCH] uio_pdrv: Unique IRQ Mode

From: Paul Mundt
Date: Tue Jun 10 2008 - 13:35:24 EST


On Tue, Jun 10, 2008 at 09:10:32AM +0200, Uwe Kleine-K?nig wrote:
> Signed-off-by: Uwe Kleine-K?nig <Uwe.Kleine-Koenig@xxxxxxxx>
> ---
> include/linux/uio_driver.h | 33 +++++++++++++++++++++++++++++++++
> 1 files changed, 33 insertions(+), 0 deletions(-)
>
> diff --git a/include/linux/uio_driver.h b/include/linux/uio_driver.h
> index cdf338d..671a7a8 100644
> --- a/include/linux/uio_driver.h
> +++ b/include/linux/uio_driver.h
> @@ -63,6 +63,7 @@ struct uio_info {
> long irq;
> unsigned long irq_flags;
> void *priv;
> + unsigned int flags;
> irqreturn_t (*handler)(int irq, struct uio_info *dev_info);
> int (*mmap)(struct uio_info *info, struct vm_area_struct *vma);
> int (*open)(struct uio_info *info, struct inode *inode);

This should be unsigned long.

> @@ -92,4 +93,36 @@ extern void uio_event_notify(struct uio_info *info);
> #define UIO_MEM_LOGICAL 2
> #define UIO_MEM_VIRTUAL 3
>
> +/* defines for uio_info->flags */
> +#define UIO_FLAGS_IRQDISABLED 0
> +
> +static inline irqreturn_t uio_userirq_handler(int irq,
> + struct uio_info *dev_info)
> +{
> + int ret;
> +
> + if (likely(dev_info->irqcontrol)) {
> + ret = dev_info->irqcontrol(dev_info, 0);
> + if (ret) {
> + pr_warning("%s: failed to disable irq\n", __func__);
> + return IRQ_NONE;
> + } else
> + return IRQ_HANDLED;
> + } else
> + return IRQ_NONE;
> +}
> +
You can simplify this by just using IRQ_RETVAL() on
dev_info->irqcontrol(...). The printk() shouldn't be necessary, as the
other layers should already catch that.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/