| 82 | } |
| 83 | |
| 84 | static 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 | } |
| 117 | static void ofw_prop_destroy(struct rt_ofw_prop *prop) |
| 118 | { |
| 119 | struct rt_ofw_prop *next; |
no test coverage detected