}
info->device->minor = i;
csdev = COMEDI_DEVICE_CREATE(comedi_class, NULL,
- MKDEV(COMEDI_MAJOR, i), NULL, "comedi%i", i);
+ MKDEV(COMEDI_MAJOR, i), NULL, hardware_device, "comedi%i", i);
if(!IS_ERR(csdev)) {
info->device->class_dev = csdev;
- if(hardware_device)
- {
- sysfs_create_link(&csdev->kobj,
- &hardware_device->kobj, "device");
- }
}
return i;
}
{
if(dev->class_dev)
{
- sysfs_remove_link(&dev->class_dev->kobj, "device");
device_destroy(comedi_class, MKDEV(COMEDI_MAJOR, dev->minor));
}
comedi_device_cleanup(dev);
}
s->minor = i;
csdev = COMEDI_DEVICE_CREATE(comedi_class, dev->class_dev,
- MKDEV(COMEDI_MAJOR, i), NULL, "comedi%i_subd%i", dev->minor, s - dev->subdevices);
+ MKDEV(COMEDI_MAJOR, i), NULL, NULL, "comedi%i_subd%i", dev->minor, s - dev->subdevices);
if(!IS_ERR(csdev))
{
s->class_dev = csdev;
class_simple_destroy((struct class_simple *)(cs))
typedef struct class_device device_create_result_type;
-#define COMEDI_DEVICE_CREATE(cs, parent, devt, drvdata, fmt...) \
+#define COMEDI_DEVICE_CREATE(cs, parent, devt, drvdata, device, fmt...) \
class_simple_device_add((struct class_simple *)(cs), \
- devt, NULL, fmt)
+ devt, device, fmt)
#define device_destroy(cs, devt) \
class_simple_device_remove(devt)
#else
-/* versions earlier than 2.6.15 are currently broken as of 2008-10-16 FMH*/
+
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15)
typedef struct class_device device_create_result_type;
-#define COMEDI_DEVICE_CREATE(cs, parent, devt, drvdata, fmt...) \
- class_device_create(cs, devt, NULL, fmt)
+#define COMEDI_DEVICE_CREATE(cs, parent, devt, drvdata, device, fmt...) \
+ class_device_create(cs, devt, device, fmt)
#define device_destroy(cs, devt) \
class_device_destroy(cs, devt)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
typedef struct class_device device_create_result_type;
-#define COMEDI_DEVICE_CREATE(cs, parent, devt, drvdata, fmt...) \
+#define COMEDI_DEVICE_CREATE(cs, parent, devt, drvdata, device, fmt...) \
class_device_create( \
- cs, parent, devt, NULL, fmt)
+ cs, parent, devt, device, fmt)
#define device_destroy(cs, devt) \
class_device_destroy(cs, devt)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26)
typedef struct device device_create_result_type;
-#define COMEDI_DEVICE_CREATE(cs, parent, devt, drvdata, fmt...) \
- device_create(cs, parent, devt, fmt)
+#define COMEDI_DEVICE_CREATE(cs, parent, devt, drvdata, device, fmt...) \
+ device_create(cs, ((parent) ? (parent) : (device)), devt, fmt)
#else
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
typedef struct device device_create_result_type;
-#define COMEDI_DEVICE_CREATE(cs, parent, devt, drvdata, fmt...) \
- device_create_drvdata(cs, parent, devt, drvdata, fmt)
+#define COMEDI_DEVICE_CREATE(cs, parent, devt, drvdata, device, fmt...) \
+ device_create_drvdata(cs, ((parent) ? (parent) : (device)), devt, drvdata, fmt)
#else
-#define COMEDI_DEVICE_CREATE(cs, parent, devt, drvdata, fmt...) \
- device_create(cs, parent, devt, drvdata, fmt)
+#define COMEDI_DEVICE_CREATE(cs, parent, devt, drvdata, device, fmt...) \
+ device_create(cs, ((parent) ? (parent) : (device)), devt, drvdata, fmt)
#endif // LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)