MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / ofw_phandle_next

Function ofw_phandle_next

components/drivers/ofw/base.c:84–116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82}
83
84static rt_phandle ofw_phandle_next(void)
85{
86 rt_phandle next;
87 static RT_DEFINE_SPINLOCK(op_lock);
88
89 rt_hw_spin_lock(&op_lock.lock);
90
91 RT_ASSERT(_phandle_next != OFW_PHANDLE_MAX);
92
93 if (_phandle_next <= _phandle_range[1])
94 {
95 next = _phandle_next++;
96 }
97 else
98 {
99 rt_err_t err = ofw_phandle_hash_reset(_phandle_range[0], _phandle_next);
100
101 if (!err)
102 {
103 next = _phandle_next++;
104 }
105 else
106 {
107 next = 0;
108 LOG_E("Expanded phandle hash[%u, %u] fail error = %s",
109 _phandle_range[0], _phandle_next + 1, rt_strerror(err));
110 }
111 }
112
113 rt_hw_spin_unlock(&op_lock.lock);
114
115 return next;
116}
117static void ofw_prop_destroy(struct rt_ofw_prop *prop)
118{
119 struct rt_ofw_prop *next;

Callers 1

rt_ofw_append_childFunction · 0.85

Calls 4

ofw_phandle_hash_resetFunction · 0.85
rt_strerrorFunction · 0.85
rt_hw_spin_lockFunction · 0.50
rt_hw_spin_unlockFunction · 0.50

Tested by

no test coverage detected