Okay I think drmfntbl-0-0-1 is ready for its first merge back to the
trunk, it removes what I consider to be the low hanging fruit macros,
There are no more DRM_IOREMAP*, DRM_FIND_MAP, HAVE_DMA_FREELIST,
HAVE_DMA_WAITLIST, HAVE_DMA_SCHEDULE, DRIVER_CTX_[CD]TOR,
HAVE_KERNEL_CTX_SWITCH, DRIVER_BUF_PRIV_T, DRIVER_AGP_BUFFERS_MAP
as well as moving a lot of the driver routines to the structure..
I'll probably be able to fixup BSD to at least compile before I merge
back..
The only open issue I have is the ugliness of the
if (dev->fn_tbl.my_func)
dev->fn_tbl.my_func(xxxxx)
Using a standard no-op is a bit tricky as some fn return an int and some
void, but maybe I can use something like the attached patch? the other
options given is to use a macro to do it ala
#define driver_call_func(func, ...) \
if (dev->fn_tbl.func) \
dev->fn_tbl.func(...)
that macro won't work but you get the idea of what it should do...
but we'd still have to mess with it for the return values..
I'm not so sure the construct is really that ugly, having a big load of
inlines as someone suggested previously is way more hassle to maintain..
Dave.
--
David Airlie, Software Engineer
http://www.skynet.ie/~airlied / airlied at skynet.ie
pam_smb / Linux DECstation / Linux VAX / ILUG person
? drm_fn_table_noops.diff
? bsd/i915/bus_if.h
? bsd/i915/device_if.h
? bsd/i915/export_syms
? bsd/i915/i915.kld
? bsd/i915/i915.ko
? bsd/i915/opt_drm.h
? bsd/i915/pci_if.h
? linux/.tmp_versions
? linux/drm_pciids.h
Index: linux/drm_drv.h
===================================================================
RCS file: /cvs/dri/drm/linux/drm_drv.h,v
retrieving revision 1.66.2.6
diff -u -r1.66.2.6 drm_drv.h
--- linux/drm_drv.h 10 Aug 2004 10:52:18 -0000 1.66.2.6
+++ linux/drm_drv.h 12 Aug 2004 04:20:28 -0000
@@ -502,6 +502,18 @@
DRM(PCI_IDS)
};
+static void drm_fntbl_void(struct drm_device *, ...){}
+
+static void drm_fntbl_int(struct drm_device *, ...){ return 0;}
+
+static void drm_fill_function_table_noops(struct drm_device *dev)
+{
+ dev->fn_tbl.preinit = drm_fntbl_int;
+ dev->fn_tbl.postinit = drm_fntbl_int;
+ dev->fn_tbl.prerelease = drm_fntbl_void;
+
+}
+
static int drm_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
{
drm_device_t *dev;
@@ -546,6 +558,8 @@
/* dev_priv_size can be changed by a driver in driver_register_fns */
dev->dev_priv_size = sizeof(u32);
+
+ drm_fill_function_table_noops(dev);
DRM(driver_register_fns)(dev);
if (dev->fn_tbl.preinit)