#ifdef HAVE_DEVICE_CREATE
typedef struct class spl_class;
+typedef struct device spl_device;
#define spl_class_create(mod, name) class_create(mod, name)
#define spl_class_destroy(cls) class_destroy(cls)
-#define spl_device_create(cls, parent, devt, device, fmt, args...) \
+#define spl_device_create(cls, parent, devt, device, fmt, args...) \
device_create(cls, parent, devt, fmt, ## args)
-#define spl_device_destroy(cls, devt) device_destroy(cls, devt)
+#define spl_device_destroy(cls, cls_dev, devt) \
+ device_destroy(cls, devt)
/*
* Preferred API from 2.6.13 to 2.6.17
#ifdef HAVE_CLASS_DEVICE_CREATE
typedef struct class spl_class;
+typedef struct class_device spl_device;
#define spl_class_create(mod, name) class_create(mod, name)
#define spl_class_destroy(cls) class_destroy(cls)
-#define spl_device_create(cls, parent, devt, device, fmt, args...) \
- class_device_create(cls, parent, devt, device, fmt, ## args)
-#define spl_device_destroy(cls, devt) class_device_destroy(cls, devt)
+#define spl_device_create(cls, parent, devt, device, fmt, args...) \
+ class_device_create(cls, devt, device, fmt, ## args)
+#define spl_device_destroy(cls, cls_dev, devt) \
+ class_device_unregister(cls_dev)
/*
* Prefered API from 2.6.0 to 2.6.12
#else /* Legacy API */
typedef struct class_simple spl_class;
+typedef struct class_device spl_class_device;
#define spl_class_create(mod, name) class_simple_create(mod, name)
#define spl_class_destroy(cls) class_simple_destroy(cls)
-#define spl_device_create(cls, parent, devt, device, fmt, args...) \
+#define spl_device_create(cls, parent, devt, device, fmt, args...) \
class_simple_device_add(cls, devt, device, fmt, ## args)
-#define spl_device_destroy(cls, devt) class_simple_device_remove(devt)
+#define spl_device_destroy(cls, cls_dev, devt) \
+ class_simple_device_remove(devt)
#endif
#endif
/* Do not append a 0 to devices with minor nums of 0 */
if (di->di_minor == 0) {
- spl_device_create(di->di_class, NULL, di->di_dev,
- NULL, "%s", name);
+ di->di_device = spl_device_create(di->di_class, NULL,
+ di->di_dev, NULL,
+ "%s", name);
} else {
- spl_device_create(di->di_class, NULL, di->di_dev,
- NULL, "%s%d", name, di->di_minor);
+ di->di_device = spl_device_create(di->di_class, NULL,
+ di->di_dev, NULL,
+ "%s%d", name, di->di_minor);
}
di->di_cdev = cdev;
__ddi_remove_minor_node_locked(dev_info_t *di, char *name)
{
if (di->di_class) {
- spl_device_destroy(di->di_class, di->di_dev);
+ spl_device_destroy(di->di_class, di->di_device, di->di_dev);
spl_class_destroy(di->di_class);
di->di_class = NULL;
#include "splat-internal.h"
static spl_class *splat_class;
+static spl_device *splat_device;
static struct list_head splat_module_list;
static spinlock_t splat_module_lock;
goto error;
}
- spl_device_create(splat_class, NULL, MKDEV(SPLAT_MAJOR, 0),
- NULL, SPLAT_NAME);
+ splat_device = spl_device_create(splat_class, NULL,
+ MKDEV(SPLAT_MAJOR, 0),
+ NULL, SPLAT_NAME);
printk(KERN_INFO "splat: Loaded Solaris Porting LAyer "
"Tests v%s\n", VERSION);
{
dev_t dev = MKDEV(SPLAT_MAJOR, 0);
- spl_device_destroy(splat_class, dev);
+ spl_device_destroy(splat_class, splat_device, dev);
spl_class_destroy(splat_class);
cdev_del(&splat_cdev);
unregister_chrdev_region(dev, SPLAT_MINORS);