in most_cdev.c [116:148]
static int comp_open(struct inode *inode, struct file *filp)
{
struct comp_channel *c;
int ret;
c = to_channel(inode->i_cdev);
filp->private_data = c;
if (((c->cfg->direction == MOST_CH_RX) &&
((filp->f_flags & O_ACCMODE) != O_RDONLY)) ||
((c->cfg->direction == MOST_CH_TX) &&
((filp->f_flags & O_ACCMODE) != O_WRONLY))) {
return -EACCES;
}
mutex_lock(&c->io_mutex);
if (!c->dev) {
mutex_unlock(&c->io_mutex);
return -ENODEV;
}
if (c->access_ref) {
mutex_unlock(&c->io_mutex);
return -EBUSY;
}
c->mbo_offs = 0;
ret = most_start_channel(c->iface, c->channel_id, &comp.cc);
if (!ret)
c->access_ref = 1;
mutex_unlock(&c->io_mutex);
return ret;
}