]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
xen: make use of xenbus_read_unsigned() in xen-fbfront
authorJuergen Gross <jgross@suse.com>
Mon, 31 Oct 2016 13:58:41 +0000 (14:58 +0100)
committerBoris Ostrovsky <boris.ostrovsky@oracle.com>
Fri, 3 Feb 2017 20:55:28 +0000 (15:55 -0500)
Use xenbus_read_unsigned() instead of xenbus_scanf() when possible.
This requires to change the type of the reads from int to unsigned,
but these cases have been wrong before: negative values are not allowed
for the modified cases.

Cc: tomi.valkeinen@ti.com
Cc: linux-fbdev@vger.kernel.org
Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: David Vrabel <david.vrabel@citrix.com>
OraBug: 25497392

(cherry picked from commit eaf46e181ec3cc3b6eafdbe8e30fb5a03ebbde68)
Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
drivers/video/fbdev/xen-fbfront.c

index afe774a5edbed0e8c4343ee47c3a14badc883bed..b0592520fe122c2522486d2077ffa92864c2538e 100644 (file)
@@ -633,7 +633,6 @@ static void xenfb_backend_changed(struct xenbus_device *dev,
                                  enum xenbus_state backend_state)
 {
        struct xenfb_info *info = dev_get_drvdata(&dev->dev);
-       int val;
 
        switch (backend_state) {
        case XenbusStateInitialising:
@@ -657,16 +656,12 @@ InitWait:
                if (dev->state != XenbusStateConnected)
                        goto InitWait; /* no InitWait seen yet, fudge it */
 
-               if (xenbus_scanf(XBT_NIL, info->xbdev->otherend,
-                                "request-update", "%d", &val) < 0)
-                       val = 0;
-               if (val)
+               if (xenbus_read_unsigned(info->xbdev->otherend,
+                                        "request-update", 0))
                        info->update_wanted = 1;
 
-               if (xenbus_scanf(XBT_NIL, dev->otherend,
-                                "feature-resize", "%d", &val) < 0)
-                       val = 0;
-               info->feature_resize = val;
+               info->feature_resize = xenbus_read_unsigned(dev->otherend,
+                                                       "feature-resize", 0);
                break;
 
        case XenbusStateClosed: