Re: [rfc][patch] DRM initial function table support.

From: Ian Romanick
Date: Tue Aug 31 2004 - 11:09:00 EST


Dave Jones wrote:
On Tue, Aug 31, 2004 at 02:11:11PM +0100, Dave Airlie wrote:

One thing that would make things even nicer would be..

instead of this..

> +void gamma_driver_register_fns(drm_device_t *dev)
> +{
> + dev->fn_tbl.preinit = gamma_driver_preinit;
> + dev->fn_tbl.pretakedown = gamma_driver_pretakedown;
> + dev->fn_tbl.dma_ready = gamma_driver_dma_ready;
> + dev->fn_tbl.dma_quiescent = gamma_driver_dma_quiescent;
> + dev->fn_tbl.dma_flush_block_and_flush = gamma_flush_block_and_flush;
> + dev->fn_tbl.dma_flush_unblock = gamma_flush_unblock;
> +}

having a per-driver struct with regular C99 initialisers..

struct gamma_driver_fntbl {
.preinit = gamma_driver_preinit,
.pretakedown = gamma_driver_pretakedown,
.dma_ready = gamma_driver_dma_ready,
.dma_quiescent = gamma_driver_dma_quiescent,
.dma_flush_block_and_flush = gamma_flush_block_and_flush,
.dma_flush_unblock = gamma_flush_unblock,
};

I think the intention is to have default functions set in the device-independent code and have the device-dependent code over-ride them. Since the defaults may not always be NULL, doing a struct like that wouldn't really work. I suppose we could have a struct and a device-independent function that copies the non-NULL pointers from the per-device struct. Would that be better?

Thanks for doing this work, it really is starting to look a little more
like a Linux driver 8-)

I second 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/