MCPcopy Create free account
hub / github.com/apache/nuttx / rpmsg_device_destory

Function rpmsg_device_destory

drivers/rpmsg/rpmsg.c:448–510  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

446}
447
448void rpmsg_device_destory(FAR struct rpmsg_s *rpmsg)
449{
450 FAR struct rpmsg_device *rdev = rpmsg_get_rdev_by_rpmsg(rpmsg);
451 FAR struct metal_list *node;
452 FAR struct metal_list *tmp;
453 FAR struct rpmsg_endpoint *ept;
454
455#ifdef CONFIG_RPMSG_PING
456 rpmsg_ping_deinit(&rpmsg->ping);
457#endif
458
459#ifdef CONFIG_RPMSG_TEST
460 rpmsg_test_deinit(&rpmsg->test);
461#endif
462
463 nxrmutex_lock(&rpmsg->lock);
464 metal_list_for_each_safe(&rpmsg->bind, tmp, node)
465 {
466 FAR struct rpmsg_bind_s *bind =
467 metal_container_of(node, struct rpmsg_bind_s, node);
468
469 metal_list_del(node);
470 kmm_free(bind);
471 }
472
473 nxrmutex_unlock(&rpmsg->lock);
474
475 /* Broadcast device_destroy to all registers */
476
477 down_write(&g_rpmsg_lock);
478 rpmsg->init = false;
479 downgrade_write(&g_rpmsg_lock);
480 metal_list_for_each_safe(&g_rpmsg_cb, tmp, node)
481 {
482 FAR struct rpmsg_cb_s *cb =
483 metal_container_of(node, struct rpmsg_cb_s, node);
484
485 if (cb->device_destroy)
486 {
487 cb->device_destroy(rdev, cb->priv);
488 }
489 }
490
491 up_read(&g_rpmsg_lock);
492
493 /* Release all ept attached to current rpmsg device */
494
495 metal_mutex_acquire(&rdev->lock);
496 metal_list_for_each_safe(&rdev->endpoints, tmp, node)
497 {
498 ept = metal_container_of(node, struct rpmsg_endpoint, node);
499 if (ept->ns_unbind_cb)
500 {
501 ept->ns_unbind_cb(ept);
502 }
503 else
504 {
505 rpmsg_destroy_ept(ept);

Callers 3

rpmsg_virtio_removeFunction · 0.85
rpmsg_port_unregisterFunction · 0.85

Calls 9

rpmsg_get_rdev_by_rpmsgFunction · 0.85
rpmsg_ping_deinitFunction · 0.85
rpmsg_test_deinitFunction · 0.85
nxrmutex_lockFunction · 0.85
kmm_freeFunction · 0.85
nxrmutex_unlockFunction · 0.85
down_writeFunction · 0.85
downgrade_writeFunction · 0.85
up_readFunction · 0.85

Tested by

no test coverage detected