channel->state = EVTCHNL_STATE_DISCONNECTED; if (channel->type == EVTCHNL_TYPE_REQ) { /* Release all who still waits for response if any. */
channel->u.req.resp_status = -EIO;
complete_all(&channel->u.req.completion);
}
if (channel->irq)
unbind_from_irqhandler(channel->irq, channel);
if (channel->port)
xenbus_free_evtchn(front_info->xb_dev, channel->port);
/* End access and free the page. */
xenbus_teardown_ring(&page, 1, &channel->gref);
memset(channel, 0, sizeof(*channel));
}
void xen_snd_front_evtchnl_free_all(struct xen_snd_front_info *front_info)
{ int i;
if (!front_info->evt_pairs) return;
for (i = 0; i < front_info->num_evt_pairs; i++) {
evtchnl_free(front_info, &front_info->evt_pairs[i].req);
evtchnl_free(front_info, &front_info->evt_pairs[i].evt);
}
ret = xenbus_alloc_evtchn(xb_dev, &channel->port); if (ret < 0) goto fail;
ret = bind_evtchn_to_irq(channel->port); if (ret < 0) {
dev_err(&xb_dev->dev, "Failed to bind IRQ for domid %d port %d: %d\n",
front_info->xb_dev->otherend_id, channel->port, ret); goto fail;
}
channel->irq = ret;
ret = request_threaded_irq(channel->irq, NULL, handler,
IRQF_ONESHOT, handler_name, channel); if (ret < 0) {
dev_err(&xb_dev->dev, "Failed to request IRQ %d: %d\n",
channel->irq, ret); goto fail;
}
int xen_snd_front_evtchnl_create_all(struct xen_snd_front_info *front_info, int num_streams)
{ struct xen_front_cfg_card *cfg = &front_info->cfg; struct device *dev = &front_info->xb_dev->dev; int d, ret = 0;
front_info->evt_pairs =
kcalloc(num_streams, sizeof(struct xen_snd_front_evtchnl_pair),
GFP_KERNEL); if (!front_info->evt_pairs) return -ENOMEM;
/* Iterate over devices and their streams and create event channels. */ for (d = 0; d < cfg->num_pcm_instances; d++) { struct xen_front_cfg_pcm_instance *pcm_instance; int s, index;
pcm_instance = &cfg->pcm_instances[d];
for (s = 0; s < pcm_instance->num_streams_pb; s++) {
index = pcm_instance->streams_pb[s].index;
ret = evtchnl_alloc(front_info, index,
&front_info->evt_pairs[index].req,
EVTCHNL_TYPE_REQ); if (ret < 0) {
dev_err(dev, "Error allocating control channel\n"); goto fail;
}
ret = evtchnl_alloc(front_info, index,
&front_info->evt_pairs[index].evt,
EVTCHNL_TYPE_EVT); if (ret < 0) {
dev_err(dev, "Error allocating in-event channel\n"); goto fail;
}
}
for (s = 0; s < pcm_instance->num_streams_cap; s++) {
index = pcm_instance->streams_cap[s].index;
ret = evtchnl_alloc(front_info, index,
&front_info->evt_pairs[index].req,
EVTCHNL_TYPE_REQ); if (ret < 0) {
dev_err(dev, "Error allocating control channel\n"); goto fail;
}
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.