Esempio n. 1
0
static void omx_xenfront_backend_changed(struct xenbus_device *dev,
					 enum xenbus_state backend_state)
{
	struct omx_xenfront_info *fe = dev_get_drvdata(&dev->dev);
	int ret = 0;

	dprintk_in();

	dprintk_deb("backend state %s\n", xenbus_strstate(backend_state));

	switch (backend_state) {
	case XenbusStateInitialising:
	case XenbusStateInitWait:
		break;
	case XenbusStateInitialised:
		ret = talk_to_backend(dev, fe);
		if (ret) {
			printk_err("Error trying to talk to backend"
				   ", ret=%d\n", ret);
			//kfree(info);
		}
		break;
	case XenbusStateReconfiguring:
	case XenbusStateReconfigured:
	case XenbusStateUnknown:
	case XenbusStateClosed:
		break;
	case XenbusStateConnected:
		if (dev->state == XenbusStateConnected)
			break;
		omx_xenfront_connect(fe);
		break;
	case XenbusStateClosing:
		dprintk_deb("Closing Xenbus\n");
		xenbus_frontend_closed(dev);
		break;
	}
	dprintk_out();

	return;
}
Esempio n. 2
0
static int connect(struct xenbus_device *dev)
{
	struct usbfront_info *info = dev->dev.driver_data;

	usbif_conn_request_t *req;
	int i, idx, err;
	int notify;
	char name[TASK_COMM_LEN];
	struct usb_hcd *hcd;

	hcd = info_to_hcd(info);
	snprintf(name, TASK_COMM_LEN, "xenhcd.%d", hcd->self.busnum);

	err = talk_to_backend(dev, info);
	if (err)
		return err;

	info->kthread = kthread_run(xenhcd_schedule, info, name);
	if (IS_ERR(info->kthread)) {
		err = PTR_ERR(info->kthread);
		info->kthread = NULL;
		xenbus_dev_fatal(dev, err, "Error creating thread");
		return err;
	}
	/* prepare ring for hotplug notification */
	for (idx = 0, i = 0; i < USB_CONN_RING_SIZE; i++) {
		req = RING_GET_REQUEST(&info->conn_ring, idx);
		req->id = idx;
		idx++;
	}
	info->conn_ring.req_prod_pvt = idx;

	RING_PUSH_REQUESTS_AND_CHECK_NOTIFY(&info->conn_ring, notify);
	if (notify)
		notify_remote_via_irq(info->irq);

	return 0;
}