int if_hsi_openchannel(struct if_hsi_channel *channel) { int ret = 0; dev_dbg(&channel->dev->device, "%s, ch = %d\n", __func__, channel->channel_id); spin_lock(&channel->lock); if (channel->state == HSI_CHANNEL_STATE_UNAVAIL) { ret = -ENODEV; goto leave; } if (channel->opened) { ret = -EBUSY; goto leave; } if (!channel->dev) { pr_err("Channel %d is not ready??\n", channel->channel_id); ret = -ENODEV; goto leave; } spin_unlock(&channel->lock); ret = hsi_open(channel->dev); spin_lock(&channel->lock); if (ret < 0) { pr_err("Could not open channel %d\n", channel->channel_id); goto leave; } channel->opened = 1; channel->tx_state = HSI_LL_TX_STATE_IDLE; channel->rx_state = HSI_LL_RX_STATE_TO_CONN_READY; printk(KERN_INFO "setting channel->opened=1 for channel %d\n", channel->dev->n_ch); leave: spin_unlock(&channel->lock); return ret; }
static int if_hsi_open_channel(struct if_hsi_channel *channel) { int ret; if (channel->opened) { pr_debug("[MIPI-HSI] channel %d is already opened\n", channel->channel_id); return 0; } ret = hsi_open(channel->dev); if (ret) { pr_err("[MIPI-HSI] hsi_open fail : %d\n", ret); if (ret == -EBUSY) pr_err("[MIPI-HSI] ch %d already opened\n", channel->channel_id); else return ret; } channel->opened = 1; pr_debug("[MIPI-HSI] hsi_open Done : %d\n", channel->channel_id); return 0; }