/src/barebox/include/of_device.h
Line | Count | Source |
1 | | /* SPDX-License-Identifier: GPL-2.0-only */ |
2 | | #ifndef __OF_DEVICE_H |
3 | | #define __OF_DEVICE_H |
4 | | |
5 | | #include <driver.h> |
6 | | #include <of.h> |
7 | | |
8 | | |
9 | | #ifdef CONFIG_OFTREE |
10 | | extern const struct of_device_id *of_match_device( |
11 | | const struct of_device_id *matches, const struct device *dev); |
12 | | |
13 | | /** |
14 | | * of_driver_match_device - Tell if a driver's of_match_table matches a device. |
15 | | * @drv: the device_driver structure to test |
16 | | * @dev: the device structure to match against |
17 | | */ |
18 | | static inline int of_driver_match_device(struct device *dev, |
19 | | const struct driver *drv) |
20 | 0 | { |
21 | 0 | return of_match_device(drv->of_compatible, dev) != NULL; |
22 | 0 | } Unexecuted instantiation: drv.c:of_driver_match_device Unexecuted instantiation: layouts.c:of_driver_match_device Unexecuted instantiation: platform.c:of_driver_match_device Unexecuted instantiation: device.c:of_driver_match_device |
23 | | |
24 | | extern const void *of_device_get_match_data(const struct device *dev); |
25 | | extern const char *of_device_get_match_compatible(const struct device *dev); |
26 | | void of_device_make_bus_id(struct device *dev); |
27 | | |
28 | | #else /* CONFIG_OFTREE */ |
29 | | |
30 | | static inline int of_driver_match_device(struct device *dev, |
31 | | const struct device *drv) |
32 | | { |
33 | | return 0; |
34 | | } |
35 | | |
36 | | static inline const void *of_device_get_match_data(const struct device *dev) |
37 | | { |
38 | | return NULL; |
39 | | } |
40 | | |
41 | | static inline const char *of_device_get_match_compatible(const struct device *dev) |
42 | | { |
43 | | return NULL; |
44 | | } |
45 | | |
46 | | static inline const struct of_device_id *__of_match_device( |
47 | | const struct of_device_id *matches, const struct device *dev) |
48 | | { |
49 | | return NULL; |
50 | | } |
51 | | #define of_match_device(matches, dev) \ |
52 | | __of_match_device(matches, (dev)) |
53 | | |
54 | | static inline void of_device_make_bus_id(struct device *dev) {} |
55 | | |
56 | | #endif /* CONFIG_OFTREE */ |
57 | | |
58 | | #endif /* _LINUX_OF_DEVICE_H */ |