summaryrefslogtreecommitdiff
path: root/linux
diff options
context:
space:
mode:
authorDave Airlie <airlied@linux.ie>2004-08-10 11:14:07 +0000
committerDave Airlie <airlied@linux.ie>2004-08-10 11:14:07 +0000
commit9277f9eef388ffef26000ab455d30260bdf41c93 (patch)
tree1c5eadbba695295ac1b77a0b6d001e8ceb1d2ddb /linux
parent42e91874608f28246367207815eb7334574d7aa7 (diff)
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..
Diffstat (limited to 'linux')
-rw-r--r--linux/drm_drv.h28
-rw-r--r--linux/drm_stub.h5
2 files changed, 13 insertions, 20 deletions
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;