static int snddev_ecodec_close(struct msm_snddev_info *dev_info) { int rc = 0; struct snddev_ecodec_state *ecodec; struct snddev_ecodec_drv_state *drv = &snddev_ecodec_drv; if (!dev_info) { rc = -EINVAL; goto error; } ecodec = dev_info->private_data; printk(KERN_INFO "snddev_icodec_open: device %s\n", dev_info->name); if (audio_ops->bt_sco_enable) audio_ops->bt_sco_enable(0); if (ecodec->data->capability & SNDDEV_CAP_RX) { mutex_lock(&drv->dev_lock); if (!drv->rx_active) { mutex_unlock(&drv->dev_lock); rc = -EPERM; goto error; } rc = snddev_ecodec_close_rx(ecodec); if (!IS_ERR_VALUE(rc)) drv->rx_active = 0; mutex_unlock(&drv->dev_lock); } else { mutex_lock(&drv->dev_lock); if (!drv->tx_active) { mutex_unlock(&drv->dev_lock); rc = -EPERM; goto error; } rc = snddev_ecodec_close_tx(ecodec); if (!IS_ERR_VALUE(rc)) drv->tx_active = 0; mutex_unlock(&drv->dev_lock); } error: return rc; }
static int snddev_ecodec_close(struct msm_snddev_info *dev_info) { int rc = 0; struct snddev_ecodec_state *ecodec; struct snddev_ecodec_drv_state *drv = &snddev_ecodec_drv; if (!dev_info) { rc = -EINVAL; goto error; } ecodec = dev_info->private_data; if (ecodec->data->capability & SNDDEV_CAP_RX) { mutex_lock(&drv->dev_lock); if (!drv->rx_active) { mutex_unlock(&drv->dev_lock); rc = -EPERM; goto error; } rc = snddev_ecodec_close_rx(ecodec); if (!IS_ERR_VALUE(rc)) drv->rx_active = 0; mutex_unlock(&drv->dev_lock); } else { mutex_lock(&drv->dev_lock); if (!drv->tx_active) { mutex_unlock(&drv->dev_lock); rc = -EPERM; goto error; } rc = snddev_ecodec_close_tx(ecodec); if (!IS_ERR_VALUE(rc)) drv->tx_active = 0; mutex_unlock(&drv->dev_lock); } error: return rc; }