void xmd_ch_close(int chno) { if (hsi_channels[chno].read_happening == HSI_TRUE) { //spinlock may be used for read_happening #if MCM_DBG_LOG printk("\nmcm:locking read mutex for ch: %d\n",chno); #endif wait_event(hsi_channels[chno].read_wait, hsi_channels[chno].read_happening == HSI_FALSE); } hsi_ll_close(chno); spin_lock_bh(&hsi_channels[chno].lock); hsi_channels[chno].state = HSI_CH_FREE; spin_unlock_bh(&hsi_channels[chno].lock); }
void xmd_ch_close(int chno) { printk("\nmcm:closing channel %d.\n", chno); // #if defined(CONFIG_MACH_LGE) /* */ if((chno == 1)||(chno == 2)||(chno == 3) ||(chno == 4)||(chno == 5)||(chno == 8)||(chno == 11)){ #else if(chno == XMD_RIL_RECOVERY_CHANNEL) { #endif // #if MCM_DBG_ERR_RECOVERY_LOG printk("\nmcm: Ch %d closed so starting Recovery.\n", chno); #endif xmd_dlp_recovery(); } if (hsi_channels[chno].read_happening == HSI_TRUE) { #if MCM_DBG_LOG printk("\nmcm:locking read mutex for ch: %d\n",chno); #endif wait_event(hsi_channels[chno].read_wait, hsi_channels[chno].read_happening == HSI_FALSE); } hsi_ll_close(chno); spin_lock_bh(&hsi_channels[chno].lock); hsi_channels[chno].state = HSI_CH_FREE; spin_unlock_bh(&hsi_channels[chno].lock); } int xmd_ch_open(struct xmd_ch_info* info, void (*notify_cb)(int chno)) { int i; int size = ARRAY_SIZE(hsi_channels); for (i=0; i<size; i++) { if (hsi_channels[i].name) if (!strcmp(info->name, hsi_channels[i].name)) { if (hsi_channels[i].state == HSI_CH_BUSY || hsi_channels[i].state == HSI_CH_NOT_USED) { #if MCM_DBG_ERR_LOG printk("\nmcm:Channel state not suitable %d\n",i); #endif return -EINVAL; } // #if defined(CONFIG_MACH_LGE) /* */ if(((i == 1)||(i == 2)||(i == 3) ||(i == 4)||(i == 5)||(i == 8)||(i == 11)) && #else if ((i == XMD_RIL_RECOVERY_CHANNEL) && #endif // (hsi_mcm_state == HSI_MCM_STATE_ERR_RECOVERY)) { #if MCM_DBG_ERR_RECOVERY_LOG printk("\nmcm: Recovery completed by chno %d.\n", i); #endif xmd_ch_reinit(); } if (0 != hsi_ll_open(i)) { #if MCM_DBG_ERR_LOG printk("\nmcm:hsi_ll_open failed for channel %d\n",i); #endif return -EINVAL; } hsi_channels[i].info = info; spin_lock_bh(&hsi_channels[i].lock); hsi_channels[i].state = HSI_CH_BUSY; spin_unlock_bh(&hsi_channels[i].lock); hsi_channels[i].notify = notify_cb; switch(info->user) { case XMD_TTY: hsi_channels[i].read = hsi_ch_tty_read; hsi_channels[i].write = hsi_ch_tty_write; break; case XMD_NET: hsi_channels[i].read = hsi_ch_net_read; hsi_channels[i].write = hsi_ch_net_write; break; default: #if MCM_DBG_ERR_LOG printk("\nmcm:Neither TTY nor NET \n"); #endif return -EINVAL; } /* */ #if 0 /* ORIGINAL CODE */ INIT_WORK(&hsi_channels[i].read_work, hsi_read_work); INIT_WORK(&hsi_channels[i].write_work, hsi_write_work); #if defined (HSI_LL_ENABLE_RX_BUF_RETRY_WQ) INIT_WORK(&hsi_channels[i].buf_retry_work, hsi_buf_retry_work); #endif #else /* HSI patch for MST test */ PREPARE_WORK(&hsi_channels[i].read_work, hsi_read_work); PREPARE_WORK(&hsi_channels[i].write_work, hsi_write_work); #if defined (HSI_LL_ENABLE_RX_BUF_RETRY_WQ) PREPARE_WORK(&hsi_channels[i].buf_retry_work, hsi_buf_retry_work); #endif #endif /* */ return i; } } #if MCM_DBG_ERR_LOG printk("\nmcm: Channel name not proper \n"); #endif return -EINVAL; }