[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [linux-2.6.18-xen] xenbus: don't invoke ->is_ready() for most device states


  • To: xen-changelog@xxxxxxxxxxxxxxxxxxx
  • From: Xen patchbot-linux-2.6.18-xen <patchbot@xxxxxxx>
  • Date: Fri, 07 Oct 2016 10:11:01 +0000
  • Delivery-date: Fri, 07 Oct 2016 10:11:11 +0000
  • List-id: "Change log for Mercurial \(receive only\)" <xen-changelog.lists.xen.org>

# HG changeset patch
# User Jan Beulich <jbeulich@xxxxxxxx>
# Date 1475834593 -7200
#      Fri Oct 07 12:03:13 2016 +0200
# Node ID d8a0a20fdf208e98c3e41464cf8bdd4eee0ac25b
# Parent  7ba8deb4c1be7d9353a88f2af0f23bf789d3f5d9
xenbus: don't invoke ->is_ready() for most device states

Along the lines of is_device_connecting(), print_device_status() should
avoid invoking ->is_ready() when the device is in other than connected
state. Convert the log message issuing logic to an if-else-if sequence
to at once make sure
- at most one warning will be issued,
- there will be a warning for any unexpected state.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---


diff -r 7ba8deb4c1be -r d8a0a20fdf20 drivers/xen/xenbus/xenbus_probe.c
--- a/drivers/xen/xenbus/xenbus_probe.c Mon Aug 22 08:24:03 2016 +0200
+++ b/drivers/xen/xenbus/xenbus_probe.c Fri Oct 07 12:03:13 2016 +0200
@@ -1280,7 +1280,6 @@ static int print_device_status(struct de
 {
        struct xenbus_device *xendev = to_xenbus_device(dev);
        struct device_driver *drv = data;
-       struct xenbus_driver *xendrv;
 
        /* Is this operation limited to a particular driver? */
        if (drv && (dev->driver != drv))
@@ -1290,22 +1289,22 @@ static int print_device_status(struct de
                /* Information only: is this too noisy? */
                printk(KERN_INFO "XENBUS: Device with no driver: %s\n",
                       xendev->nodename);
-               return 0;
-       }
-
-       if (xendev->state < XenbusStateConnected) {
+       } else if (xendev->state < XenbusStateConnected) {
                enum xenbus_state rstate = XenbusStateUnknown;
                if (xendev->otherend)
                        rstate = xenbus_read_driver_state(xendev->otherend);
                printk(KERN_WARNING "XENBUS: Timeout connecting "
                       "to device: %s (local state %d, remote state %d)\n",
                       xendev->nodename, xendev->state, rstate);
-       }
+       } else if (xendev->state == XenbusStateConnected) {
+               struct xenbus_driver *xendrv = to_xenbus_driver(dev->driver);
 
-       xendrv = to_xenbus_driver(dev->driver);
-       if (xendrv->is_ready && !xendrv->is_ready(xendev))
-               printk(KERN_WARNING "XENBUS: Device not ready: %s\n",
-                      xendev->nodename);
+               if (xendrv->is_ready && !xendrv->is_ready(xendev))
+                       printk(KERN_WARNING "XENBUS: Device not ready: %s\n",
+                              xendev->nodename);
+       } else
+               printk(KERN_WARNING "XENBUS: Unexpected state %d: %s\n",
+                      xendev->state, xendev->nodename);
 
        return 0;
 }

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.