[PATCH 3/3] Makes lguest's irq handler typesafe
Rusty Russell
rusty at rustcorp.com.au
Fri Jan 18 17:17:38 EST 2008
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.
More information about the linux-pcmcia
mailing list