]>
Commit | Line | Data |
---|---|---|
4d88a97a DW |
1 | /* |
2 | * Copyright(c) 2013-2015 Intel Corporation. All rights reserved. | |
3 | * | |
4 | * This program is free software; you can redistribute it and/or modify | |
5 | * it under the terms of version 2 of the GNU General Public License as | |
6 | * published by the Free Software Foundation. | |
7 | * | |
8 | * This program is distributed in the hope that it will be useful, but | |
9 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
11 | * General Public License for more details. | |
12 | */ | |
13 | #ifndef __LINUX_ND_H__ | |
14 | #define __LINUX_ND_H__ | |
15 | #include <linux/ndctl.h> | |
16 | #include <linux/device.h> | |
17 | ||
18 | struct nd_device_driver { | |
19 | struct device_driver drv; | |
20 | unsigned long type; | |
21 | int (*probe)(struct device *dev); | |
22 | int (*remove)(struct device *dev); | |
23 | }; | |
24 | ||
25 | static inline struct nd_device_driver *to_nd_device_driver( | |
26 | struct device_driver *drv) | |
27 | { | |
28 | return container_of(drv, struct nd_device_driver, drv); | |
3d88002e DW |
29 | }; |
30 | ||
31 | struct nd_namespace_io { | |
32 | struct device dev; | |
33 | struct resource res; | |
34 | }; | |
35 | ||
36 | static inline struct nd_namespace_io *to_nd_namespace_io(struct device *dev) | |
37 | { | |
38 | return container_of(dev, struct nd_namespace_io, dev); | |
4d88a97a DW |
39 | } |
40 | ||
41 | #define MODULE_ALIAS_ND_DEVICE(type) \ | |
42 | MODULE_ALIAS("nd:t" __stringify(type) "*") | |
43 | #define ND_DEVICE_MODALIAS_FMT "nd:t%d" | |
44 | ||
45 | int __must_check __nd_driver_register(struct nd_device_driver *nd_drv, | |
46 | struct module *module, const char *mod_name); | |
47 | #define nd_driver_register(driver) \ | |
48 | __nd_driver_register(driver, THIS_MODULE, KBUILD_MODNAME) | |
49 | #endif /* __LINUX_ND_H__ */ |