summaryrefslogtreecommitdiff
path: root/linux-core
diff options
context:
space:
mode:
authorDave Airlie <airlied@linux.ie>2004-07-14 12:34:55 +0000
committerDave Airlie <airlied@linux.ie>2004-07-14 12:34:55 +0000
commitbb5112b616080033ab9f09092098527f2aa09b70 (patch)
treebe7285c94d1161d16f387a8b2a6c8b19360d1f60 /linux-core
parente86fc9f47f05f47375d5a306fe979012e3b7e8e4 (diff)
Fix reference counting for stub for new Linux PCI probe
Diffstat (limited to 'linux-core')
-rw-r--r--linux-core/drm_drv.c2
-rw-r--r--linux-core/drm_stub.c12
2 files changed, 12 insertions, 2 deletions
diff --git a/linux-core/drm_drv.c b/linux-core/drm_drv.c
index 1a01db56..c4d4391d 100644
--- a/linux-core/drm_drv.c
+++ b/linux-core/drm_drv.c
@@ -152,6 +152,7 @@ struct drm_stub_info {
drm_device_t *dev);
int (*info_unregister)(int minor);
struct class_simple *drm_class;
+ int *info_count;
};
extern struct drm_stub_info DRM(stub_info);
@@ -778,6 +779,7 @@ static void __exit drm_cleanup( drm_device_t *dev )
static void __exit drm_exit (void)
{
+ DRM_DEBUG( "\n" );
if (DRM(fb_loaded)==1)
{
int i;
diff --git a/linux-core/drm_stub.c b/linux-core/drm_stub.c
index 96fd7275..1426af02 100644
--- a/linux-core/drm_stub.c
+++ b/linux-core/drm_stub.c
@@ -111,6 +111,7 @@ static int DRM(stub_getminor)(const char *name, struct file_operations *fops,
DRM(stub_root) = DRM(proc_init)(dev, i, DRM(stub_root),
&DRM(stub_list)[i]
.dev_root);
+ *DRM(stub_info).info_count++;
return i;
}
}
@@ -134,7 +135,10 @@ static int DRM(stub_putminor)(int minor)
DRM(stub_list)[minor].fops = NULL;
DRM(proc_cleanup)(minor, DRM(stub_root),
DRM(stub_list)[minor].dev_root);
- if (minor) {
+
+ *DRM(stub_info).info_count--;
+
+ if ((*DRM(stub_info).info_count)!=0) {
inter_module_put("drm");
} else {
inter_module_unregister("drm");
@@ -180,8 +184,9 @@ int DRM(stub_register)(const char *name, struct file_operations *fops,
DRM(stub_info).info_register = i->info_register;
DRM(stub_info).info_unregister = i->info_unregister;
DRM(stub_info).drm_class = i->drm_class;
+ DRM(stub_info).info_count = i->info_count;
DRM_DEBUG("already registered\n");
- } else if (DRM(stub_info).drm_class == NULL) {
+ } else if (*DRM(stub_info).info_count == 0) {
DRM(stub_info).drm_class = class_simple_create(THIS_MODULE, "drm");
if (IS_ERR(DRM(stub_info).drm_class)) {
printk (KERN_ERR "Error creating drm class.\n");
@@ -221,9 +226,12 @@ int DRM(stub_unregister)(int minor)
return -1;
}
+int DRM(stub_count);
+
/** Stub information */
struct drm_stub_info DRM(stub_info) = {
.info_register = DRM(stub_getminor),
.info_unregister = DRM(stub_putminor),
.drm_class = NULL,
+ .info_count = &DRM(stub_count),
};