dev_dbg(&xb_dev->dev, "Backend state is %s, front is %s\n",
xenbus_strstate(backend_state),
xenbus_strstate(xb_dev->state));
switch (backend_state) { case XenbusStateReconfiguring: case XenbusStateReconfigured: case XenbusStateInitialised: break;
case XenbusStateInitialising: /* Recovering after backend unexpected closure. */
sndback_disconnect(front_info); break;
case XenbusStateInitWait: /* Recovering after backend unexpected closure. */
sndback_disconnect(front_info);
ret = sndback_initwait(front_info); if (ret < 0)
xenbus_dev_fatal(xb_dev, ret, "initializing frontend"); else
xenbus_switch_state(xb_dev, XenbusStateInitialised); break;
case XenbusStateConnected: if (xb_dev->state != XenbusStateInitialised) break;
ret = sndback_connect(front_info); if (ret < 0)
xenbus_dev_fatal(xb_dev, ret, "initializing frontend"); else
xenbus_switch_state(xb_dev, XenbusStateConnected); break;
case XenbusStateClosing: /* * In this state backend starts freeing resources, * so let it go into closed state first, so we can also * remove ours.
*/ break;
case XenbusStateUnknown: case XenbusStateClosed: if (xb_dev->state == XenbusStateClosed) break;
staticvoid xen_drv_remove(struct xenbus_device *dev)
{ struct xen_snd_front_info *front_info = dev_get_drvdata(&dev->dev); int to = 100;
xenbus_switch_state(dev, XenbusStateClosing);
/* * On driver removal it is disconnected from XenBus, * so no backend state change events come via .otherend_changed * callback. This prevents us from exiting gracefully, e.g. * signaling the backend to free event channels, waiting for its * state to change to XenbusStateClosed and cleaning at our end. * Normally when front driver removed backend will finally go into * XenbusStateInitWait state. * * Workaround: read backend's state manually and wait with time-out.
*/ while ((xenbus_read_unsigned(front_info->xb_dev->otherend, "state",
XenbusStateUnknown) != XenbusStateInitWait) &&
--to)
msleep(10);
if (!to) { unsignedint state;
state = xenbus_read_unsigned(front_info->xb_dev->otherend, "state", XenbusStateUnknown);
pr_err("Backend state is %s while removing driver\n",
xenbus_strstate(state));
}
staticint __init xen_drv_init(void)
{ if (!xen_domain()) return -ENODEV;
if (!xen_has_pv_devices()) return -ENODEV;
/* At the moment we only support case with XEN_PAGE_SIZE == PAGE_SIZE */ if (XEN_PAGE_SIZE != PAGE_SIZE) {
pr_err(XENSND_DRIVER_NAME ": different kernel and Xen page sizes are not supported: XEN_PAGE_SIZE (%lu) != PAGE_SIZE (%lu)\n",
XEN_PAGE_SIZE, PAGE_SIZE); return -ENODEV;
}
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.