Don't assume class_device has a devt member.
authorFrank Mori Hess <fmhess@speakeasy.net>
Fri, 17 Nov 2006 14:03:42 +0000 (14:03 +0000)
committerFrank Mori Hess <fmhess@speakeasy.net>
Fri, 17 Nov 2006 14:03:42 +0000 (14:03 +0000)
comedi/comedi_fops.c
comedi/drivers.c

index 8385d09fbed8f28886949e497feaae949b18eb65..6c9a3009778ab6567ddece37044871817952c9fe 100644 (file)
@@ -1802,7 +1802,7 @@ static void __exit comedi_cleanup(void)
 
        for(i = 0; i < COMEDI_NDEVICES; i++){
                char name[20];
-               class_device_destroy(comedi_class, comedi_devices[i].class_dev->devt);
+               class_device_destroy(comedi_class, MKDEV(COMEDI_MAJOR, i));
                sprintf(name, "comedi%d", i);
        }
        class_destroy(comedi_class);
index f42a4036d8361ae39d34000145306f563e199c01..683fd0da646c8e317f3a96edca78f6706ca653b0 100644 (file)
@@ -73,7 +73,9 @@ static void cleanup_device_allocations(comedi_device *dev)
                        s = dev->subdevices + i;
                        if(s->class_dev)
                        {
-                               class_device_destroy(comedi_class, s->class_dev->devt);
+                               unsigned minor = comedi_construct_minor_for_subdevice(dev, i);
+                               dev_t devt = MKDEV(COMEDI_MAJOR, minor);
+                               class_device_destroy(comedi_class, devt);
                        }
                        if(s->async)
                        {