| 266 | } |
| 267 | |
| 268 | rt_err_t rt_bypass_unregister(struct rt_serial_bypass_head* bypass, rt_uint8_t level) |
| 269 | { |
| 270 | struct rt_list_node* node; |
| 271 | struct rt_serial_bypass_func* temp_curr = RT_NULL; |
| 272 | int flags; |
| 273 | |
| 274 | /*Can not unregister protect level in bypass it general be msh or tty*/ |
| 275 | if (level > RT_BYPASS_PROTECT_LEVEL_1) |
| 276 | return -RT_ERROR; |
| 277 | |
| 278 | if (!bypass) |
| 279 | return -RT_ERROR; |
| 280 | |
| 281 | node = bypass->head.next; |
| 282 | flags = rt_spin_lock_irqsave(&(bypass->spinlock)); |
| 283 | |
| 284 | do { |
| 285 | temp_curr = rt_container_of(node, struct rt_serial_bypass_func, node); |
| 286 | |
| 287 | if (level == temp_curr->level) |
| 288 | { |
| 289 | rt_list_remove(node); |
| 290 | rt_spin_unlock_irqrestore(&(bypass->spinlock), flags); |
| 291 | rt_free(temp_curr); |
| 292 | return RT_EOK; |
| 293 | } |
| 294 | |
| 295 | node = node->next; |
| 296 | } while (node != &bypass->head); |
| 297 | |
| 298 | LOG_E("Can't find bypass with level [%d]", level); |
| 299 | rt_spin_unlock_irqrestore(&(bypass->spinlock), flags); |
| 300 | return -RT_ERROR; |
| 301 | } |
| 302 | |
| 303 | rt_err_t rt_bypass_upper_unregister(struct rt_serial_device* serial, rt_uint8_t level) |
| 304 | { |
no test coverage detected