/** * comp_open - implements the syscall to open the device * @inode: inode pointer * @filp: file pointer * * This stores the channel pointer in the private data field of * the file structure and activates the channel within the core.
*/ staticint comp_open(struct inode *inode, struct file *filp)
{ struct comp_channel *c; int ret;
c = to_channel(inode->i_cdev);
filp->private_data = c;
/** * comp_disconnect_channel - disconnect a channel * @iface: pointer to interface instance * @channel_id: channel index * * This frees allocated memory and removes the cdev that represents this * channel in user space.
*/ staticint comp_disconnect_channel(struct most_interface *iface, int channel_id)
{ struct comp_channel *c;
c = get_channel(iface, channel_id); if (!c) return -EINVAL;
/** * comp_rx_completion - completion handler for rx channels * @mbo: pointer to buffer object that has completed * * This searches for the channel linked to this MBO and stores it in the local * fifo buffer.
*/ staticint comp_rx_completion(struct mbo *mbo)
{ struct comp_channel *c;
if (!mbo) return -EINVAL;
c = get_channel(mbo->ifp, mbo->hdm_channel_id); if (!c) return -EINVAL;
spin_lock(&c->unlink); if (!c->access_ref || !c->dev) {
spin_unlock(&c->unlink); return -ENODEV;
}
kfifo_in(&c->fifo, &mbo, 1);
spin_unlock(&c->unlink); #ifdef DEBUG_MESG if (kfifo_is_full(&c->fifo))
dev_warn(c->dev, "Fifo is full\n"); #endif
wake_up_interruptible(&c->wq); return 0;
}
/** * comp_tx_completion - completion handler for tx channels * @iface: pointer to interface instance * @channel_id: channel index/ID * * This wakes sleeping processes in the wait-queue.
*/ staticint comp_tx_completion(struct most_interface *iface, int channel_id)
{ struct comp_channel *c;
c = get_channel(iface, channel_id); if (!c) return -EINVAL;
if ((channel_id < 0) || (channel_id >= iface->num_channels)) {
dev_warn(c->dev, "Channel ID out of range\n"); return -EINVAL;
}
wake_up_interruptible(&c->wq); return 0;
}
/** * comp_probe - probe function of the driver module * @iface: pointer to interface instance * @channel_id: channel index/ID * @cfg: pointer to actual channel configuration * @name: name of the device to be created * @args: pointer to array of component parameters (from configfs) * * This allocates a channel object and creates the device node in /dev * * Returns 0 on success or error code otherwise.
*/ staticint comp_probe(struct most_interface *iface, int channel_id, struct most_channel_config *cfg, char *name, char *args)
{ struct comp_channel *c; unsignedlong cl_flags; int retval; int current_minor;
if (!cfg || !name) return -EINVAL;
c = get_channel(iface, channel_id); if (c) return -EEXIST;
current_minor = ida_alloc(&comp.minor_id, GFP_KERNEL); if (current_minor < 0) return current_minor;
c = kzalloc(sizeof(*c), GFP_KERNEL); if (!c) {
retval = -ENOMEM; goto err_remove_ida;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.