diff options
-rw-r--r-- | sys/dev/pci/drm/drmP.h | 8 | ||||
-rw-r--r-- | sys/dev/pci/drm/drm_drv.c | 14 |
2 files changed, 13 insertions, 9 deletions
diff --git a/sys/dev/pci/drm/drmP.h b/sys/dev/pci/drm/drmP.h index 17dc727dc87..44c3513160b 100644 --- a/sys/dev/pci/drm/drmP.h +++ b/sys/dev/pci/drm/drmP.h @@ -101,14 +101,6 @@ #define DRM_READUNLOCK() rw_exit_read(&dev->dev_lock) #define DRM_MAXUNITS 8 -/* D_CLONE only supports one device, this will be fixed eventually */ -#define drm_get_device_from_kdev(_kdev) \ - (drm_cd.cd_ndevs > 0 ? drm_cd.cd_devs[0] : NULL) -#if 0 -#define drm_get_device_from_kdev(_kdev) \ - (minor(_kdev) < drm_cd.cd_ndevs) ? drm_cd.cd_devs[minor(_kdev)] : NULL -#endif - /* DRM_SUSER returns true if the user is superuser */ #define DRM_SUSER(p) (suser(p, 0) == 0) #define DRM_MTRR_WC MDF_WRITECOMBINE diff --git a/sys/dev/pci/drm/drm_drv.c b/sys/dev/pci/drm/drm_drv.c index 11c6a1b33ec..d8f919a10a1 100644 --- a/sys/dev/pci/drm/drm_drv.c +++ b/sys/dev/pci/drm/drm_drv.c @@ -56,6 +56,7 @@ int drm_debug_flag = 1; #endif +struct drm_device *drm_get_device_from_kdev(dev_t); int drm_firstopen(struct drm_device *); int drm_lastclose(struct drm_device *); void drm_attach(struct device *, struct device *, void *); @@ -326,6 +327,17 @@ drm_find_file_by_minor(struct drm_device *dev, int minor) return (SPLAY_FIND(drm_file_tree, &dev->files, &key)); } +struct drm_device * +drm_get_device_from_kdev(dev_t kdev) +{ + int unit = minor(kdev) & 0xff; + + if (unit < drm_cd.cd_ndevs) + return drm_cd.cd_devs[unit]; + + return NULL; +} + int drm_firstopen(struct drm_device *dev) { @@ -1761,7 +1773,7 @@ struct uvm_object * udv_attach_drm(void *arg, vm_prot_t accessprot, voff_t off, vsize_t size) { dev_t device = *((dev_t *)arg); - struct drm_device *dev = drm_get_device_from_kdev(kdev); + struct drm_device *dev = drm_get_device_from_kdev(device); struct drm_local_map *map; struct drm_obj *obj; |