Blame view

include/linux/of_device.h 3.04 KB
b24413180   Greg Kroah-Hartman   License cleanup: ...
1
  /* SPDX-License-Identifier: GPL-2.0 */
f898f8dbc   Stephen Rothwell   Begin consolidati...
2
3
  #ifndef _LINUX_OF_DEVICE_H
  #define _LINUX_OF_DEVICE_H
f898f8dbc   Stephen Rothwell   Begin consolidati...
4

bd00860e9   Sudeep KarkadaNagesha   of/device: add he...
5
  #include <linux/cpu.h>
f9f5a4669   Grant Likely   of/device: Move s...
6
  #include <linux/platform_device.h>
295960429   Grant Likely   of: remove asm/of...
7
  #include <linux/of_platform.h> /* temporary until merge */
b505ff5e7   Grant Likely   of: kill struct o...
8

f9f5a4669   Grant Likely   of/device: Move s...
9
10
  #include <linux/of.h>
  #include <linux/mod_devicetable.h>
f898f8dbc   Stephen Rothwell   Begin consolidati...
11

313162d0b   Paul Gortmaker   device.h: audit a...
12
  struct device;
ba166e900   Rob Herring   of: remove CONFIG...
13
  #ifdef CONFIG_OF
f898f8dbc   Stephen Rothwell   Begin consolidati...
14
  extern const struct of_device_id *of_match_device(
44504b2be   Grant Likely   of: change of_mat...
15
  	const struct of_device_id *matches, const struct device *dev);
f898f8dbc   Stephen Rothwell   Begin consolidati...
16

8cec0e7b4   Grant Likely   of/device: Add OF...
17
18
19
20
21
  /**
   * of_driver_match_device - Tell if a driver's of_match_table matches a device.
   * @drv: the device_driver structure to test
   * @dev: the device structure to match against
   */
b826291c1   Grant Likely   drivercore/dt: ad...
22
  static inline int of_driver_match_device(struct device *dev,
8cec0e7b4   Grant Likely   of/device: Add OF...
23
24
  					 const struct device_driver *drv)
  {
b1608d69c   Grant Likely   drivercore: rever...
25
  	return of_match_device(drv->of_match_table, dev) != NULL;
8cec0e7b4   Grant Likely   of/device: Add OF...
26
  }
94a0cb1fc   Grant Likely   of/device: Replac...
27
28
  extern struct platform_device *of_dev_get(struct platform_device *dev);
  extern void of_dev_put(struct platform_device *dev);
f898f8dbc   Stephen Rothwell   Begin consolidati...
29

7096d0422   Grant Likely   of/device: Rework...
30
  extern int of_device_add(struct platform_device *pdev);
94a0cb1fc   Grant Likely   of/device: Replac...
31
32
  extern int of_device_register(struct platform_device *ofdev);
  extern void of_device_unregister(struct platform_device *ofdev);
fec738dd4   Joachim Fenkes   [POWERPC] Move of...
33

3386e0fa9   Joachim Eastwood   of: add helper fu...
34
  extern const void *of_device_get_match_data(const struct device *dev);
0634c2958   Rob Herring   of: Add function ...
35
  extern ssize_t of_device_modalias(struct device *dev, char *str, ssize_t len);
9c829c097   Stephen Boyd   of: device: Suppo...
36
  extern int of_device_request_module(struct device *dev);
dd27dcda3   Grant Likely   of/device: merge ...
37

07d57a32f   Grant Likely   drivercore: Outpu...
38
39
  extern void of_device_uevent(struct device *dev, struct kobj_uevent_env *env);
  extern int of_device_uevent_modalias(struct device *dev, struct kobj_uevent_env *env);
dd27dcda3   Grant Likely   of/device: merge ...
40

7096d0422   Grant Likely   of/device: Rework...
41
42
43
44
  static inline void of_device_node_put(struct device *dev)
  {
  	of_node_put(dev->of_node);
  }
dd27dcda3   Grant Likely   of/device: merge ...
45

bd00860e9   Sudeep KarkadaNagesha   of/device: add he...
46
47
48
49
50
  static inline struct device_node *of_cpu_device_node_get(int cpu)
  {
  	struct device *cpu_dev;
  	cpu_dev = get_cpu_device(cpu);
  	if (!cpu_dev)
7467c9d95   Sudeep Holla   of: return of_get...
51
  		return of_get_cpu_node(cpu, NULL);
bd00860e9   Sudeep KarkadaNagesha   of/device: add he...
52
53
  	return of_node_get(cpu_dev->of_node);
  }
7b07cbefb   Laurent Pinchart   iommu: of: Handle...
54
  int of_dma_configure(struct device *dev, struct device_node *np);
3f1866779   Laurent Pinchart   of: dma: Make of_...
55
  void of_dma_deconfigure(struct device *dev);
ba166e900   Rob Herring   of: remove CONFIG...
56
  #else /* CONFIG_OF */
8cec0e7b4   Grant Likely   of/device: Add OF...
57
58
  
  static inline int of_driver_match_device(struct device *dev,
35068ce8c   Tomeu Vizoso   of: constify drv ...
59
  					 const struct device_driver *drv)
8cec0e7b4   Grant Likely   of/device: Add OF...
60
61
62
  {
  	return 0;
  }
07d57a32f   Grant Likely   drivercore: Outpu...
63
64
  static inline void of_device_uevent(struct device *dev,
  			struct kobj_uevent_env *env) { }
3386e0fa9   Joachim Eastwood   of: add helper fu...
65
66
67
68
  static inline const void *of_device_get_match_data(const struct device *dev)
  {
  	return NULL;
  }
0634c2958   Rob Herring   of: Add function ...
69
70
  static inline int of_device_modalias(struct device *dev,
  				     char *str, ssize_t len)
b9f73067f   Zhang Rui   platform: introdu...
71
72
73
  {
  	return -ENODEV;
  }
9c829c097   Stephen Boyd   of: device: Suppo...
74
75
76
77
  static inline int of_device_request_module(struct device *dev)
  {
  	return -ENODEV;
  }
07d57a32f   Grant Likely   drivercore: Outpu...
78
  static inline int of_device_uevent_modalias(struct device *dev,
eca393016   Grant Likely   of: Merge of_plat...
79
80
81
82
  				   struct kobj_uevent_env *env)
  {
  	return -ENODEV;
  }
7096d0422   Grant Likely   of/device: Rework...
83
  static inline void of_device_node_put(struct device *dev) { }
1db73ae39   Geert Uytterhoeven   of/device: Nullif...
84
  static inline const struct of_device_id *__of_match_device(
b1608d69c   Grant Likely   drivercore: rever...
85
86
87
88
  		const struct of_device_id *matches, const struct device *dev)
  {
  	return NULL;
  }
1db73ae39   Geert Uytterhoeven   of/device: Nullif...
89
90
  #define of_match_device(matches, dev)	\
  	__of_match_device(of_match_ptr(matches), (dev))
bd00860e9   Sudeep KarkadaNagesha   of/device: add he...
91
92
93
94
95
  
  static inline struct device_node *of_cpu_device_node_get(int cpu)
  {
  	return NULL;
  }
7b07cbefb   Laurent Pinchart   iommu: of: Handle...
96
97
98
99
100
  
  static inline int of_dma_configure(struct device *dev, struct device_node *np)
  {
  	return 0;
  }
3f1866779   Laurent Pinchart   of: dma: Make of_...
101
  static inline void of_dma_deconfigure(struct device *dev)
1f5c69aa5   Murali Karicheri   of: Move of_dma_c...
102
  {}
ba166e900   Rob Herring   of: remove CONFIG...
103
  #endif /* CONFIG_OF */
09e67ca2c   Stephen Rothwell   [POWERPC] Move of...
104

f898f8dbc   Stephen Rothwell   Begin consolidati...
105
  #endif /* _LINUX_OF_DEVICE_H */