From: cl349@firebug.cl.cam.ac.uk Date: Fri, 19 Aug 2005 13:05:31 +0000 (+0000) Subject: Fix suspend/resume for domains with devices which are in xenstore but have no xenbus... X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~16891^2~2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=605d86e2cbcca784d39568d3ece2036107c6206c;p=xen.git Fix suspend/resume for domains with devices which are in xenstore but have no xenbus aware driver. Information about network devices is stored in xenstore. Xenbus creates device objects for these devices but the network driver doesn't support finding devices over xenbus yet and thus these devices have no driver. Signed-off-by: Christian Limpach --- diff --git a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c index b346b9dddc..d5fe6cc2f3 100644 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c @@ -531,10 +531,13 @@ static struct xenbus_watch be_watch = { static int suspend_dev(struct device *dev, void *data) { int err = 0; - struct xenbus_driver *drv = to_xenbus_driver(dev->driver); - struct xenbus_device *xdev - = container_of(dev, struct xenbus_device, dev); + struct xenbus_driver *drv; + struct xenbus_device *xdev; + if (dev->driver == NULL) + return 0; + drv = to_xenbus_driver(dev->driver); + xdev = container_of(dev, struct xenbus_device, dev); if (drv->suspend) err = drv->suspend(xdev); if (err) @@ -545,10 +548,13 @@ static int suspend_dev(struct device *dev, void *data) static int resume_dev(struct device *dev, void *data) { int err = 0; - struct xenbus_driver *drv = to_xenbus_driver(dev->driver); - struct xenbus_device *xdev - = container_of(dev, struct xenbus_device, dev); + struct xenbus_driver *drv; + struct xenbus_device *xdev; + if (dev->driver == NULL) + return 0; + drv = to_xenbus_driver(dev->driver); + xdev = container_of(dev, struct xenbus_device, dev); if (drv->resume) err = drv->resume(xdev); if (err)