xen: make use of xenbus_read_unsigned() in xenbus

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.

Signed-off-by: Juergen Gross <jgross@suse.com>
Acked-by: David Vrabel <david.vrabel@citrix.com>
This commit is contained in:
Juergen Gross
2016-10-31 14:58:42 +01:00
parent 4e81f1caa7
commit 999c9af9e3
2 changed files with 4 additions and 11 deletions

View File

@@ -224,13 +224,7 @@ static int read_frontend_details(struct xenbus_device *xendev)
int xenbus_dev_is_online(struct xenbus_device *dev)
{
int rc, val;
rc = xenbus_scanf(XBT_NIL, dev->nodename, "online", "%d", &val);
if (rc != 1)
val = 0; /* no online node present */
return val;
return !!xenbus_read_unsigned(dev->nodename, "online", 0);
}
EXPORT_SYMBOL_GPL(xenbus_dev_is_online);