1 /*****************************************************************************\
2 * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
3 * Copyright (C) 2007 The Regents of the University of California.
4 * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
5 * Written by Brian Behlendorf <behlendorf1@llnl.gov>.
8 * This file is part of the SPL, Solaris Porting Layer.
9 * For details, see <http://zfsonlinux.org/>.
11 * The SPL is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the
13 * Free Software Foundation; either version 2 of the License, or (at your
14 * option) any later version.
16 * The SPL is distributed in the hope that it will be useful, but WITHOUT
17 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 * You should have received a copy of the GNU General Public License along
22 * with the SPL. If not, see <http://www.gnu.org/licenses/>.
23 \*****************************************************************************/
28 #include <linux/device.h>
31 * Preferred API from 2.6.18 to 2.6.26+
33 #ifdef HAVE_DEVICE_CREATE
35 typedef struct class spl_class
;
36 typedef struct device spl_device
;
38 #define spl_class_create(mod, name) class_create(mod, name)
39 #define spl_class_destroy(cls) class_destroy(cls)
41 # ifdef HAVE_5ARGS_DEVICE_CREATE
42 # define spl_device_create(cls, parent, devt, drvdata, fmt, args...) \
43 device_create(cls, parent, devt, drvdata, fmt, ## args)
45 # define spl_device_create(cls, parent, devt, drvdata, fmt, args...) \
46 device_create(cls, parent, devt, fmt, ## args)
49 #define spl_device_destroy(cls, cls_dev, devt) \
50 device_destroy(cls, devt)
53 * Preferred API from 2.6.13 to 2.6.17
54 * Depricated in 2.6.18
58 #ifdef HAVE_CLASS_DEVICE_CREATE
60 typedef struct class spl_class
;
61 typedef struct class_device spl_device
;
63 #define spl_class_create(mod, name) class_create(mod, name)
64 #define spl_class_destroy(cls) class_destroy(cls)
65 #define spl_device_create(cls, parent, devt, device, fmt, args...) \
66 class_device_create(cls, parent, devt, device, fmt, ## args)
67 #define spl_device_destroy(cls, cls_dev, devt) \
68 class_device_unregister(cls_dev)
71 * Prefered API from 2.6.0 to 2.6.12
72 * Depricated in 2.6.13
75 #else /* Legacy API */
77 typedef struct class_simple spl_class
;
78 typedef struct class_device spl_class_device
;
80 #define spl_class_create(mod, name) class_simple_create(mod, name)
81 #define spl_class_destroy(cls) class_simple_destroy(cls)
82 #define spl_device_create(cls, parent, devt, device, fmt, args...) \
83 class_simple_device_add(cls, devt, device, fmt, ## args)
84 #define spl_device_destroy(cls, cls_dev, devt) \
85 class_simple_device_remove(devt)
87 #endif /* HAVE_CLASS_DEVICE_CREATE */
88 #endif /* HAVE_DEVICE_CREATE */
90 #endif /* _SPL_DEVICE_H */