software/drivers/sd8887/src/bluetooth/bt/bt_main.c
/**
 *  @brief This function closes the wrapper device
 *
 *  @param m_dev   A pointer to m_dev structure
 *
 *  @return    BT_STATUS_SUCCESS
 */
@brief This function closes the wrapper device
@param m_dev   A pointer to m_dev structure


@brief This function closes the wrapper device @param m_dev A pointer to m_dev structure
static int
mdev_close(struct m_dev *m_dev)
{
	ENTER();
	mdev_req_lock(m_dev);
	if (!test_and_clear_bit(HCI_UP, &m_dev->flags)) {
		mdev_req_unlock(m_dev);
		LEAVE();
		return 0;
	}
	if (m_dev->flush)
		m_dev->flush(m_dev);
	wake_up_interruptible(&m_dev->req_wait_q);
	skb_queue_purge(&m_dev->rx_q);
	if (!test_and_clear_bit(HCI_RUNNING, &m_dev->flags)) {
		mdev_req_unlock(m_dev);
		LEAVE();
		return 0;
	}
	module_put(THIS_MODULE);
	m_dev->flags = 0;
	mdev_req_unlock(m_dev);
	LEAVE();
	return BT_STATUS_SUCCESS;
}
static int mdev_close ( struct m_dev * m_dev ) { ENTER ( ) ; mdev_req_lock ( m_dev ) ; if ( ! test_and_clear_bit ( HCI_UP , & m_dev -> flags ) ) { mdev_req_unlock ( m_dev ) ; LEAVE ( ) ; return 0 ; } if ( m_dev -> flush ) m_dev -> flush ( m_dev ) ; wake_up_interruptible ( & m_dev -> req_wait_q ) ; skb_queue_purge ( & m_dev -> rx_q ) ; if ( ! test_and_clear_bit ( HCI_RUNNING , & m_dev -> flags ) ) { mdev_req_unlock ( m_dev ) ; LEAVE ( ) ; return 0 ; } module_put ( THIS_MODULE ) ; m_dev -> flags = 0 ; mdev_req_unlock ( m_dev ) ; LEAVE ( ) ; return BT_STATUS_SUCCESS ; }
@brief This function closes the wrapper device
  @param m_dev   A pointer to m_dev structure
@brief This function closes the wrapper device @param m_dev A pointer to m_dev structure
/* wait up pending read and unregister char dev */ /* Drop queues */