| 185 | } |
| 186 | |
| 187 | static void ofw_node_destroy(struct rt_ofw_node *np) |
| 188 | { |
| 189 | struct rt_ofw_node *prev; |
| 190 | |
| 191 | if (np->parent) |
| 192 | { |
| 193 | /* Ask parent and prev sibling we are destroy. */ |
| 194 | prev = np->parent->child; |
| 195 | |
| 196 | if (prev == np) |
| 197 | { |
| 198 | np->parent->child = RT_NULL; |
| 199 | } |
| 200 | else |
| 201 | { |
| 202 | while (prev->sibling != np) |
| 203 | { |
| 204 | prev = prev->sibling; |
| 205 | } |
| 206 | |
| 207 | prev->sibling = np->sibling; |
| 208 | } |
| 209 | } |
| 210 | |
| 211 | while (np) |
| 212 | { |
| 213 | if (rt_ofw_node_test_flag(np, RT_OFW_F_SYSTEM) == RT_FALSE) |
| 214 | { |
| 215 | LOG_E("%s is system node", np->full_name); |
| 216 | RT_ASSERT(0); |
| 217 | } |
| 218 | |
| 219 | prev = np; |
| 220 | |
| 221 | np = ofw_get_next_node(np); |
| 222 | |
| 223 | ofw_prop_destroy(prev->props); |
| 224 | rt_free(prev); |
| 225 | } |
| 226 | } |
| 227 | |
| 228 | rt_err_t rt_ofw_node_destroy(struct rt_ofw_node *np) |
| 229 | { |
no test coverage detected