Merge tag 'xfs-6.4-rc1-fixes' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux
[linux-block.git] / include / linux / of_device.h
CommitLineData
b2441318 1/* SPDX-License-Identifier: GPL-2.0 */
f898f8db
SR
2#ifndef _LINUX_OF_DEVICE_H
3#define _LINUX_OF_DEVICE_H
f898f8db 4
f9f5a466 5#include <linux/platform_device.h>
29596042 6#include <linux/of_platform.h> /* temporary until merge */
b505ff5e 7
f9f5a466 8#include <linux/of.h>
f898f8db 9
313162d0 10struct device;
2e8fff66
RH
11struct of_device_id;
12struct kobj_uevent_env;
313162d0 13
ba166e90 14#ifdef CONFIG_OF
f898f8db 15extern const struct of_device_id *of_match_device(
44504b2b 16 const struct of_device_id *matches, const struct device *dev);
f898f8db 17
8cec0e7b
GL
18/**
19 * of_driver_match_device - Tell if a driver's of_match_table matches a device.
20 * @drv: the device_driver structure to test
21 * @dev: the device structure to match against
22 */
b826291c 23static inline int of_driver_match_device(struct device *dev,
8cec0e7b
GL
24 const struct device_driver *drv)
25{
b1608d69 26 return of_match_device(drv->of_match_table, dev) != NULL;
8cec0e7b
GL
27}
28
0634c295 29extern ssize_t of_device_modalias(struct device *dev, char *str, ssize_t len);
dd27dcda 30
9f041c5d 31extern void of_device_uevent(const struct device *dev, struct kobj_uevent_env *env);
a77ad4bf 32extern int of_device_uevent_modalias(const struct device *dev, struct kobj_uevent_env *env);
dd27dcda 33
a081bd4a 34int of_dma_configure_id(struct device *dev,
3d6ce86e 35 struct device_node *np,
a081bd4a
LP
36 bool force_dma, const u32 *id);
37static inline int of_dma_configure(struct device *dev,
38 struct device_node *np,
39 bool force_dma)
40{
41 return of_dma_configure_id(dev, np, force_dma, NULL);
42}
ba166e90 43#else /* CONFIG_OF */
8cec0e7b
GL
44
45static 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 51static inline void of_device_uevent(const struct device *dev,
07d57a32
GL
52 struct kobj_uevent_env *env) { }
53
0634c295
RH
54static inline int of_device_modalias(struct device *dev,
55 char *str, ssize_t len)
b9f73067
ZR
56{
57 return -ENODEV;
58}
59
a77ad4bf 60static 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 66static 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 72static 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
79static inline int of_dma_configure(struct device *dev,
80 struct device_node *np,
81 bool force_dma)
7b07cbef
LP
82{
83 return 0;
84}
ba166e90 85#endif /* CONFIG_OF */
09e67ca2 86
f898f8db 87#endif /* _LINUX_OF_DEVICE_H */