From 9277f9eef388ffef26000ab455d30260bdf41c93 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 10 Aug 2004 11:14:07 +0000 Subject: Patch from Jon Smirl to add attribute field to the pciids, and use this for certain radeon combinations - intel drivers can probably use this for dual head capable devices etc.. --- linux/drm_drv.h | 28 ++++++++-------------------- linux/drm_stub.h | 5 +++++ 2 files changed, 13 insertions(+), 20 deletions(-) (limited to 'linux') diff --git a/linux/drm_drv.h b/linux/drm_drv.h index a75566e8..6dcb6271 100644 --- a/linux/drm_drv.h +++ b/linux/drm_drv.h @@ -581,13 +581,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; @@ -631,6 +624,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", @@ -646,13 +647,6 @@ static int drm_probe(struct pci_dev *pdev, const struct pci_device_id *ent) if ((retcode = DRIVER_POSTINIT(dev))) 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: @@ -752,11 +746,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; @@ -766,8 +758,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)(); @@ -775,8 +765,6 @@ static void __exit drm_cleanup( drm_device_t *dev ) dev->agp = NULL; } #endif - - class_simple_device_remove(MKDEV(DRM_MAJOR, dev->minor)); } static void __exit drm_exit (void) diff --git a/linux/drm_stub.h b/linux/drm_stub.h index 9dbf5617..9a4430d3 100644 --- a/linux/drm_stub.h +++ b/linux/drm_stub.h @@ -179,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; } } @@ -303,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; @@ -319,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; -- cgit v1.2.3