diff options
Diffstat (limited to 'linux')
-rw-r--r-- | linux/Makefile | 4 | ||||
-rw-r--r-- | linux/drmP.h | 6 | ||||
-rw-r--r-- | linux/drm_compat.h | 8 | ||||
-rw-r--r-- | linux/drm_drv.h | 35 | ||||
-rw-r--r-- | linux/drm_stub.h | 13 | ||||
-rw-r--r-- | linux/gamma_dma.c | 2 |
6 files changed, 37 insertions, 31 deletions
diff --git a/linux/Makefile b/linux/Makefile index 066766a7..1bb131d8 100644 --- a/linux/Makefile +++ b/linux/Makefile @@ -38,7 +38,9 @@ SHELL=/bin/sh ifndef LINUXDIR RUNNING_REL := $(shell uname -r) -LINUXDIR := /lib/modules/$(RUNNING_REL)/build +LINUXDIR := $(shell if [ -e /lib/modules/$(RUNNING_REL)/source ]; then \ + echo /lib/modules/$(RUNNING_REL)/source; \ + else echo /lib/modules/$(RUNNING_REL)/build; fi) endif ifndef O diff --git a/linux/drmP.h b/linux/drmP.h index 2f5bc8fd..75fb999a 100644 --- a/linux/drmP.h +++ b/linux/drmP.h @@ -521,8 +521,8 @@ typedef struct drm_vbl_sig { struct drm_device; struct drm_driver_fn { - int (*preinit)(struct drm_device *); - int (*postinit)(struct drm_device *); + int (*preinit)(struct drm_device *, unsigned long flags); + int (*postinit)(struct drm_device *, unsigned long flags); void (*prerelease)(struct drm_device *, struct file *filp); void (*pretakedown)(struct drm_device *); int (*postcleanup)(struct drm_device *); @@ -544,6 +544,7 @@ struct drm_driver_fn { int (*freelist_put)(struct drm_device *dev, drm_freelist_t *bl, drm_buf_t *buf); int (*freelist_destroy)(drm_freelist_t *bl); }; + /** * DRM device structure. */ @@ -706,6 +707,7 @@ extern int DRM(lock)(struct inode *inode, struct file *filp, extern int DRM(unlock)(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); extern int DRM(fb_loaded); +extern struct file_operations DRM(fops); /* Device support (drm_fops.h) */ extern int DRM(open_helper)(struct inode *inode, struct file *filp, diff --git a/linux/drm_compat.h b/linux/drm_compat.h index 3bb0b709..f6c113a9 100644 --- a/linux/drm_compat.h +++ b/linux/drm_compat.h @@ -120,12 +120,16 @@ struct device; #define class_simple_device_add(...) do {} while (0) -static inline void class_simple_device_remove(dev_t dev){}; +static inline void class_simple_device_remove(dev_t dev){} -static inline void class_simple_destroy(struct class_simple *cs){}; +static inline void class_simple_destroy(struct class_simple *cs){} static inline struct class_simple *class_simple_create(struct module *owner, char *name) { return (struct class_simple *)owner; } +static inline void drm_hotplug(void) {} + +static inline void class_simple_set_hotplug(struct class_simple *cs, void (*fn)(void)) {} + #ifndef pci_pretty_name #define pci_pretty_name(x) x->name #endif diff --git a/linux/drm_drv.h b/linux/drm_drv.h index 1d5bb86e..744fd14c 100644 --- a/linux/drm_drv.h +++ b/linux/drm_drv.h @@ -522,13 +522,6 @@ static int drm_probe(struct pci_dev *pdev, const struct pci_device_id *ent) sema_init( &dev->struct_sem, 1 ); sema_init( &dev->ctxlist_sem, 1 ); - if ((dev->minor = DRM(stub_register)(DRIVER_NAME, &DRM(fops),dev)) < 0) - { - retcode = -EPERM; - goto error_out; - } - - dev->device = MKDEV(DRM_MAJOR, dev->minor ); dev->name = DRIVER_NAME; dev->pdev = pdev; @@ -549,7 +542,7 @@ static int drm_probe(struct pci_dev *pdev, const struct pci_device_id *ent) DRM(driver_register_fns)(dev); if (dev->fn_tbl.preinit) - if ((retcode = dev->fn_tbl.preinit(dev))) + if ((retcode = dev->fn_tbl.preinit(dev, ent->driver_data))) goto error_out_unreg; #if __REALLY_HAVE_AGP @@ -577,6 +570,14 @@ static int drm_probe(struct pci_dev *pdev, const struct pci_device_id *ent) goto error_out_unreg; } #endif + if ((dev->minor = DRM(stub_register)(DRIVER_NAME, &DRM(fops),dev)) < 0) + { + retcode = -EPERM; + goto error_out; + } + + dev->device = MKDEV(DRM_MAJOR, dev->minor ); + DRM(numdevs)++; /* no errors, mark it reserved */ DRM_INFO( "Initialized %s %d.%d.%d %s on minor %d: %s\n", @@ -589,17 +590,11 @@ static int drm_probe(struct pci_dev *pdev, const struct pci_device_id *ent) pci_pretty_name(pdev) ); + /* drivers add secondary heads here if needed */ if (dev->fn_tbl.postinit) - if ((retcode = dev->fn_tbl.postinit(dev))) + if ((retcode = dev->fn_tbl.postinit(dev, ent->driver_data))) goto error_out_unreg; - - /* - * don't move this earlier, for upcoming hotplugging support - */ - class_simple_device_add(DRM(stub_info).drm_class, - MKDEV(DRM_MAJOR, dev->minor), &pdev->dev, "card%d", dev->minor); - return 0; error_out_unreg: @@ -699,11 +694,9 @@ static void __exit drm_cleanup( drm_device_t *dev ) } else { DRM_DEBUG( "minor %d unregistered\n", dev->minor); } - #if __HAVE_CTX_BITMAP DRM(ctxbitmap_cleanup)( dev ); #endif - #if __REALLY_HAVE_AGP && __REALLY_HAVE_MTRR if ( dev->agp && dev->agp->agp_mtrr >= 0) { int retval; @@ -713,8 +706,6 @@ static void __exit drm_cleanup( drm_device_t *dev ) DRM_DEBUG( "mtrr_del=%d\n", retval ); } #endif - - #if __REALLY_HAVE_AGP if ( dev->agp ) { DRM(agp_uninit)(); @@ -722,8 +713,8 @@ static void __exit drm_cleanup( drm_device_t *dev ) dev->agp = NULL; } #endif - - class_simple_device_remove(MKDEV(DRM_MAJOR, dev->minor)); + if (dev->fn_tbl.postcleanup) + dev->fn_tbl.postcleanup(dev); } static void __exit drm_exit (void) diff --git a/linux/drm_stub.h b/linux/drm_stub.h index d61f73ee..b94e6a70 100644 --- a/linux/drm_stub.h +++ b/linux/drm_stub.h @@ -76,10 +76,10 @@ static struct file_operations DRM(stub_fops) = { .open = DRM(stub_open) }; +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) static int drm_hotplug (struct class_device *dev, char **envp, int num_envp, char *buffer, int buffer_size) { - drm_device_t *ddev; struct pci_dev *pdev; char *scratch; int i = 0; @@ -128,7 +128,8 @@ static int drm_hotplug (struct class_device *dev, char **envp, int num_envp, return -ENOMEM; ++length; scratch += length; - +#if 0 + drm_device_t *ddev; ddev = pci_get_drvdata(pdev); if (ddev) { envp[i++] = scratch; @@ -137,11 +138,12 @@ static int drm_hotplug (struct class_device *dev, char **envp, int num_envp, if ((buffer_size - length <= 0) || (i >= num_envp)) return -ENOMEM; } +#endif envp[i] = 0; - DRM_DEBUG(" - ok\n"); return 0; } +#endif /** * Get a device minor number. @@ -177,6 +179,7 @@ static int DRM(stub_getminor)(const char *name, struct file_operations *fops, &DRM(stub_list)[i].dev_root); (*DRM(stub_info).info_count)++; DRM_DEBUG("info count increased %d\n", *DRM(stub_info).info_count); + return i; } } @@ -301,7 +304,10 @@ int DRM(stub_register)(const char *name, struct file_operations *fops, DRM_DEBUG("info_register failed, deregistered everything\n"); } DRM_DEBUG("info_register failed\n"); + return ret2; } + class_simple_device_add(DRM(stub_info).drm_class, + MKDEV(DRM_MAJOR, ret2), &dev->pdev->dev, "card%d", ret2); return ret2; } return -1; @@ -317,6 +323,7 @@ int DRM(stub_register)(const char *name, struct file_operations *fops, int DRM(stub_unregister)(int minor) { DRM_DEBUG("%d\n", minor); + class_simple_device_remove(MKDEV(DRM_MAJOR, minor)); if (DRM(stub_info).info_unregister) return DRM(stub_info).info_unregister(minor); return -1; diff --git a/linux/gamma_dma.c b/linux/gamma_dma.c index 9b58a44a..2a79f71b 100644 --- a/linux/gamma_dma.c +++ b/linux/gamma_dma.c @@ -912,7 +912,7 @@ void DRM(driver_irq_uninstall)( drm_device_t *dev ) { extern drm_ioctl_desc_t DRM(ioctls)[]; -static int gamma_driver_preinit(drm_device_t *dev) +static int gamma_driver_preinit(drm_device_t *dev, unsigned long flags) { /* reset the finish ioctl */ DRM(ioctls)[DRM_IOCTL_NR(DRM_IOCTL_FINISH)].func = DRM(finish); |