Re: [PATCH 3/3] Makes lguest's irq handler typesafe

From: Rusty Russell
Date: Fri Jan 18 2008 - 17:18:24 EST


On Saturday 19 January 2008 07:45:41 Jeff Garzik wrote:
> Rusty Russell wrote:
> > -static irqreturn_t lguest_interrupt(int irq, void *_vq)
> > +static irqreturn_t lguest_interrupt(int irq, struct virtqueue *vq)
> > {
> > - struct virtqueue *vq = _vq;
> > struct lguest_device_desc *desc = to_lgdev(vq->vdev)->desc;
>
> Ugh.
>
> This will be a compatibility nightmare. I don't see how void* is so
> evil for this, or timers.

The compiler checks types, and we should use it (though note that when I
typesafed the kthread code I didn't find any bugs, so safety arguments must
be muted). The gratuitous casts back and forth are annoying and silly.

The compatibility nightmare is one reason for the previous patch (which you
didn't understand, I hope it's now clear).

> It's not like there's a huge cost associated with a pointer alias.

True, but this is not about performance. It's about making code simpler and
compiler-checkable.

Rusty.
--
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/