/* This function deletes rpmsg endpoint and performs cleanup. */
void rpmsg_destroy_ept(struct rpmsg_endpoint *ept)
/* This function deletes rpmsg endpoint and performs cleanup. */
void rpmsg_destroy_ept(struct rpmsg_endpoint *ept)
{
	struct rpmsg_device *rdev;
	if (!ept)
		return;
	rdev = ept->rdev;
	if (ept->addr != RPMSG_NS_EPT_ADDR)
		(void)rpmsg_send_ns_message(ept, RPMSG_NS_DESTROY);
	metal_mutex_acquire(&rdev->lock);
	rpmsg_unregister_endpoint(ept);
	metal_mutex_release(&rdev->lock);
}