2008-08-10 03:50:36 +00:00
|
|
|
#ifndef _SPL_DEVICE_H
|
|
|
|
#define _SPL_DEVICE_H
|
|
|
|
|
|
|
|
#include <linux/device.h>
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Preferred API from 2.6.18 to 2.6.26+
|
|
|
|
*/
|
|
|
|
#ifdef HAVE_DEVICE_CREATE
|
|
|
|
|
|
|
|
typedef struct class spl_class;
|
2008-08-11 23:47:44 +00:00
|
|
|
typedef struct device spl_device;
|
2008-08-10 03:50:36 +00:00
|
|
|
|
|
|
|
#define spl_class_create(mod, name) class_create(mod, name)
|
|
|
|
#define spl_class_destroy(cls) class_destroy(cls)
|
2009-03-13 20:38:43 +00:00
|
|
|
|
|
|
|
# ifdef HAVE_5ARGS_DEVICE_CREATE
|
|
|
|
# define spl_device_create(cls, parent, devt, drvdata, fmt, args...) \
|
|
|
|
device_create(cls, parent, devt, drvdata, fmt, ## args)
|
|
|
|
# else
|
|
|
|
# define spl_device_create(cls, parent, devt, drvdata, fmt, args...) \
|
2008-08-10 03:50:36 +00:00
|
|
|
device_create(cls, parent, devt, fmt, ## args)
|
2009-03-13 20:38:43 +00:00
|
|
|
# endif
|
|
|
|
|
2008-08-11 23:47:44 +00:00
|
|
|
#define spl_device_destroy(cls, cls_dev, devt) \
|
|
|
|
device_destroy(cls, devt)
|
2008-08-10 03:50:36 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Preferred API from 2.6.13 to 2.6.17
|
|
|
|
* Depricated in 2.6.18
|
|
|
|
* Removed in 2.6.26
|
|
|
|
*/
|
|
|
|
#else
|
|
|
|
#ifdef HAVE_CLASS_DEVICE_CREATE
|
|
|
|
|
|
|
|
typedef struct class spl_class;
|
2008-08-11 23:47:44 +00:00
|
|
|
typedef struct class_device spl_device;
|
2008-08-10 03:50:36 +00:00
|
|
|
|
|
|
|
#define spl_class_create(mod, name) class_create(mod, name)
|
|
|
|
#define spl_class_destroy(cls) class_destroy(cls)
|
2008-08-11 23:47:44 +00:00
|
|
|
#define spl_device_create(cls, parent, devt, device, fmt, args...) \
|
2009-05-20 18:54:40 +00:00
|
|
|
class_device_create(cls, parent, devt, device, fmt, ## args)
|
2008-08-11 23:47:44 +00:00
|
|
|
#define spl_device_destroy(cls, cls_dev, devt) \
|
|
|
|
class_device_unregister(cls_dev)
|
2008-08-10 03:50:36 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Prefered API from 2.6.0 to 2.6.12
|
|
|
|
* Depricated in 2.6.13
|
|
|
|
* Removed in 2.6.13
|
|
|
|
*/
|
|
|
|
#else /* Legacy API */
|
|
|
|
|
|
|
|
typedef struct class_simple spl_class;
|
2008-08-11 23:47:44 +00:00
|
|
|
typedef struct class_device spl_class_device;
|
2008-08-10 03:50:36 +00:00
|
|
|
|
|
|
|
#define spl_class_create(mod, name) class_simple_create(mod, name)
|
|
|
|
#define spl_class_destroy(cls) class_simple_destroy(cls)
|
2008-08-11 23:47:44 +00:00
|
|
|
#define spl_device_create(cls, parent, devt, device, fmt, args...) \
|
2008-08-10 03:50:36 +00:00
|
|
|
class_simple_device_add(cls, devt, device, fmt, ## args)
|
2008-08-11 23:47:44 +00:00
|
|
|
#define spl_device_destroy(cls, cls_dev, devt) \
|
|
|
|
class_simple_device_remove(devt)
|
2008-08-10 03:50:36 +00:00
|
|
|
|
2009-05-20 18:54:40 +00:00
|
|
|
#endif /* HAVE_CLASS_DEVICE_CREATE */
|
|
|
|
#endif /* HAVE_DEVICE_CREATE */
|
2008-08-10 03:50:36 +00:00
|
|
|
|
|
|
|
#endif /* _SPL_DEVICE_H */
|