Fix suspend/resume for domains with devices which are in xenstore but have no xenbus...
authorcl349@firebug.cl.cam.ac.uk <cl349@firebug.cl.cam.ac.uk>
Fri, 19 Aug 2005 13:05:31 +0000 (13:05 +0000)
committercl349@firebug.cl.cam.ac.uk <cl349@firebug.cl.cam.ac.uk>
Fri, 19 Aug 2005 13:05:31 +0000 (13:05 +0000)
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 <Christian.Limpach@cl.cam.ac.uk>
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_probe.c

index b346b9dddc4b1f3572ec6c271cec39a3f6acdeb9..d5fe6cc2f3f1213b50903eb400992adea004c597 100644 (file)
@@ -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)