Re: [PATCH] gdth update

From: Jörn Engel
Date: Wed Sep 29 2004 - 09:07:13 EST


On Wed, 29 September 2004 14:15:57 +0200, Leubner, Achim wrote:
>
> > > +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
> > > +static irqreturn_t gdth_interrupt(int irq, void *dev_id, struct
> pt_regs *regs);
> > > #else
> > > -static void gdth_interrupt(int irq,struct pt_regs *regs);
> > > +static void gdth_interrupt(int irq, void *dev_id, struct pt_regs
> *regs);
> > > #endif
> >
> > this really is the wrong way to do such irq prototype compatibility in
> > drivers. *really*
> >
> So please tell me what the right way should be. It works without any
> problem.

#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
#define irqreturn_t void
#define IRQ_NONE
#define IRQ_HANDLED
#endif

static irqreturn_t gdth_interrupt(int irq, void *_dev, struct pt_regs *regs)
{
if (/*not for me*/)
return IRQ_NONE;
/* some work */
return IRQ_HANDLED;
}

Magically get's converted to old driver code by the macros above.
Point is that all ugly parts are confined to some header and don't
pollute the driver proper.

Jörn

--
Do not stop an army on its way home.
-- Sun Tzu
-
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/