Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
f898f8db SR |
2 | #ifndef _LINUX_OF_DEVICE_H |
3 | #define _LINUX_OF_DEVICE_H | |
f898f8db | 4 | |
ef175b29 | 5 | #include <linux/device/driver.h> |
f898f8db | 6 | |
313162d0 | 7 | struct device; |
2e8fff66 RH |
8 | struct of_device_id; |
9 | struct kobj_uevent_env; | |
313162d0 | 10 | |
ba166e90 | 11 | #ifdef CONFIG_OF |
f898f8db | 12 | extern const struct of_device_id *of_match_device( |
44504b2b | 13 | const struct of_device_id *matches, const struct device *dev); |
f898f8db | 14 | |
8cec0e7b GL |
15 | /** |
16 | * of_driver_match_device - Tell if a driver's of_match_table matches a device. | |
17 | * @drv: the device_driver structure to test | |
18 | * @dev: the device structure to match against | |
19 | */ | |
b826291c | 20 | static inline int of_driver_match_device(struct device *dev, |
8cec0e7b GL |
21 | const struct device_driver *drv) |
22 | { | |
b1608d69 | 23 | return of_match_device(drv->of_match_table, dev) != NULL; |
8cec0e7b GL |
24 | } |
25 | ||
0634c295 | 26 | extern ssize_t of_device_modalias(struct device *dev, char *str, ssize_t len); |
dd27dcda | 27 | |
9f041c5d | 28 | extern void of_device_uevent(const struct device *dev, struct kobj_uevent_env *env); |
a77ad4bf | 29 | extern int of_device_uevent_modalias(const struct device *dev, struct kobj_uevent_env *env); |
dd27dcda | 30 | |
a081bd4a | 31 | int of_dma_configure_id(struct device *dev, |
3d6ce86e | 32 | struct device_node *np, |
a081bd4a LP |
33 | bool force_dma, const u32 *id); |
34 | static inline int of_dma_configure(struct device *dev, | |
35 | struct device_node *np, | |
36 | bool force_dma) | |
37 | { | |
38 | return of_dma_configure_id(dev, np, force_dma, NULL); | |
39 | } | |
7f38b700 MR |
40 | |
41 | void of_device_make_bus_id(struct device *dev); | |
42 | ||
ba166e90 | 43 | #else /* CONFIG_OF */ |
8cec0e7b GL |
44 | |
45 | static inline int of_driver_match_device(struct device *dev, | |
35068ce8 | 46 | const struct device_driver *drv) |
8cec0e7b GL |
47 | { |
48 | return 0; | |
49 | } | |
50 | ||
9f041c5d | 51 | static inline void of_device_uevent(const struct device *dev, |
07d57a32 GL |
52 | struct kobj_uevent_env *env) { } |
53 | ||
0634c295 RH |
54 | static inline int of_device_modalias(struct device *dev, |
55 | char *str, ssize_t len) | |
b9f73067 ZR |
56 | { |
57 | return -ENODEV; | |
58 | } | |
59 | ||
a77ad4bf | 60 | static inline int of_device_uevent_modalias(const struct device *dev, |
eca39301 GL |
61 | struct kobj_uevent_env *env) |
62 | { | |
63 | return -ENODEV; | |
64 | } | |
65 | ||
c52eef0b | 66 | static inline const struct of_device_id *of_match_device( |
b1608d69 GL |
67 | const struct of_device_id *matches, const struct device *dev) |
68 | { | |
69 | return NULL; | |
70 | } | |
bd00860e | 71 | |
a081bd4a | 72 | static inline int of_dma_configure_id(struct device *dev, |
40bfe7a8 TR |
73 | struct device_node *np, |
74 | bool force_dma, | |
75 | const u32 *id) | |
a081bd4a LP |
76 | { |
77 | return 0; | |
78 | } | |
3d6ce86e CH |
79 | static inline int of_dma_configure(struct device *dev, |
80 | struct device_node *np, | |
81 | bool force_dma) | |
7b07cbef LP |
82 | { |
83 | return 0; | |
84 | } | |
7f38b700 MR |
85 | |
86 | static inline void of_device_make_bus_id(struct device *dev) {} | |
87 | ||
ba166e90 | 88 | #endif /* CONFIG_OF */ |
09e67ca2 | 89 | |
f898f8db | 90 | #endif /* _LINUX_OF_DEVICE_H */ |