software/drivers/sd8887/src/bluetooth/bt/bt_main.c
/**
 *  @brief This function removes the card.
 *
 *  @param card    A pointer to card
 *  @return        BT_STATUS_SUCCESS
 */
@brief This function removes the card.
@param card    A pointer to card
@return        BT_STATUS_SUCCESS
@brief This function removes the card . @param card A pointer to card @return BT_STATUS_SUCCESS
int
bt_remove_card(void *card)
{
	bt_private *priv = (bt_private *)card;
	int index;
	ENTER();
	if (!priv) {
		LEAVE();
		return BT_STATUS_SUCCESS;
	}
	priv->adapter->SurpriseRemoved = TRUE;
	bt_send_hw_remove_event(priv);
	wake_up_interruptible(&priv->adapter->cmd_wait_q);
	priv->adapter->SurpriseRemoved = TRUE;
	wake_up_interruptible(&priv->MainThread.waitQ);
	while (priv->MainThread.pid) {
		os_sched_timeout(1);
		wake_up_interruptible(&priv->MainThread.waitQ);
	}
	bt_proc_remove(priv);
	PRINTM(INFO, "Unregister device\n");
	sbi_unregister_dev(priv);
	clean_up_m_devs(priv);
	PRINTM(INFO, "Free Adapter\n");
	bt_free_adapter(priv);
	for (index = 0; index < MAX_BT_ADAPTER; index++) {
		if (m_priv[index] == priv) {
			m_priv[index] = NULL;
			break;
		}
	}
	bt_priv_put(priv);
	LEAVE();
	return BT_STATUS_SUCCESS;
}
int bt_remove_card ( void * card ) { bt_private * priv = ( bt_private * ) card ; int index ; ENTER ( ) ; if ( ! priv ) { LEAVE ( ) ; return BT_STATUS_SUCCESS ; } priv -> adapter -> SurpriseRemoved = TRUE ; bt_send_hw_remove_event ( priv ) ; wake_up_interruptible ( & priv -> adapter -> cmd_wait_q ) ; priv -> adapter -> SurpriseRemoved = TRUE ; wake_up_interruptible ( & priv -> MainThread . waitQ ) ; while ( priv -> MainThread . pid ) { os_sched_timeout ( 1 ) ; wake_up_interruptible ( & priv -> MainThread . waitQ ) ; } bt_proc_remove ( priv ) ; PRINTM ( INFO , " \n " ) ; sbi_unregister_dev ( priv ) ; clean_up_m_devs ( priv ) ; PRINTM ( INFO , " \n " ) ; bt_free_adapter ( priv ) ; for ( index = 0 ; index < MAX_BT_ADAPTER ; index ++ ) { if ( m_priv [ index ] == priv ) { m_priv [ index ] = NULL ; break ; } } bt_priv_put ( priv ) ; LEAVE ( ) ; return BT_STATUS_SUCCESS ; }
@brief This function removes the card.
@brief This function removes the card .