]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
xen-kbdfront: handle backend CLOSED without CLOSING
authorDavid Vrabel <david.vrabel@citrix.com>
Thu, 18 Oct 2012 10:03:38 +0000 (11:03 +0100)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Tue, 4 Dec 2012 17:44:45 +0000 (12:44 -0500)
Backend drivers shouldn't transistion to CLOSED unless the frontend is
CLOSED.  If a backend does transition to CLOSED too soon then the
frontend may not see the CLOSING state and will not properly shutdown.

So, treat an unexpected backend CLOSED state the same as CLOSING.

Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
(cherry picked from commit 2ebb939ab9c6a2484866c5eae4184c83c2b21af8)

drivers/input/misc/xen-kbdfront.c

index b620f0fe00e9304da4bf9a525e1c7402bb96028f..3be9889fd9b0c42617457975ea527300d9f3cda2 100644 (file)
@@ -311,7 +311,6 @@ static void xenkbd_backend_changed(struct xenbus_device *dev,
        case XenbusStateReconfiguring:
        case XenbusStateReconfigured:
        case XenbusStateUnknown:
-       case XenbusStateClosed:
                break;
 
        case XenbusStateInitWait:
@@ -350,6 +349,10 @@ InitWait:
 
                break;
 
+       case XenbusStateClosed:
+               if (dev->state == XenbusStateClosed)
+                       break;
+               /* Missed the backend's CLOSING state -- fallthrough */
        case XenbusStateClosing:
                xenbus_frontend_closed(dev);
                break;