Fix: stale dnode caching instance cause locked-up upon accessing (#52)
[lunaix-os.git] / lunaix-os / includes / hal / devtreem.h
1 #ifndef __LUNAIX_DEVTREE_TOP_H
2 #define __LUNAIX_DEVTREE_TOP_H
3
4 struct device_def;
5 struct device;
6
7 #ifdef CONFIG_USE_DEVICETREE
8
9 #include "devtree.h"
10 #include <lunaix/ds/hashtable.h>
11 #include <lunaix/ds/list.h>
12 #include <klibc/hash.h>
13
14 typedef struct dtn* devtree_link_t;
15
16 #define dt_node_morpher     morphable_attrs(dtn, mobj)
17
18 struct dtm_driver_info
19 {
20     struct list_node node;
21     const char* pattern;
22 };
23
24 struct dtm_driver_record
25 {
26     struct hlist_node node;
27     struct list_head infos;
28     struct device_def* def;
29 };
30
31 void
32 dtm_register_entry(struct device_def* def, const char* pattern);
33
34 #else
35
36 #include <lunaix/types.h>
37
38 typedef void* devtree_link_t;
39
40 static inline void
41 dtm_register_entry(struct device_def* def, const char* pattern)
42 {
43     return;
44 }
45
46 #endif
47
48 #endif /* __LUNAIX_DEVTREE_TOP_H */