Commit 81362c6f authored by Juergen Gross's avatar Juergen Gross

xen: make use of xenbus_read_unsigned() in xen-kbdfront

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: dmitry.torokhov@gmail.com
Cc: linux-input@vger.kernel.org
Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
Acked-by: default avatarDavid Vrabel <david.vrabel@citrix.com>
parent 02409334
...@@ -108,7 +108,8 @@ static irqreturn_t input_handler(int rq, void *dev_id) ...@@ -108,7 +108,8 @@ static irqreturn_t input_handler(int rq, void *dev_id)
static int xenkbd_probe(struct xenbus_device *dev, static int xenkbd_probe(struct xenbus_device *dev,
const struct xenbus_device_id *id) const struct xenbus_device_id *id)
{ {
int ret, i, abs; int ret, i;
unsigned int abs;
struct xenkbd_info *info; struct xenkbd_info *info;
struct input_dev *kbd, *ptr; struct input_dev *kbd, *ptr;
...@@ -127,8 +128,7 @@ static int xenkbd_probe(struct xenbus_device *dev, ...@@ -127,8 +128,7 @@ static int xenkbd_probe(struct xenbus_device *dev,
if (!info->page) if (!info->page)
goto error_nomem; goto error_nomem;
if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-abs-pointer", "%d", &abs) < 0) abs = xenbus_read_unsigned(dev->otherend, "feature-abs-pointer", 0);
abs = 0;
if (abs) { if (abs) {
ret = xenbus_write(XBT_NIL, dev->nodename, ret = xenbus_write(XBT_NIL, dev->nodename,
"request-abs-pointer", "1"); "request-abs-pointer", "1");
...@@ -322,11 +322,8 @@ static void xenkbd_backend_changed(struct xenbus_device *dev, ...@@ -322,11 +322,8 @@ static void xenkbd_backend_changed(struct xenbus_device *dev,
case XenbusStateInitWait: case XenbusStateInitWait:
InitWait: InitWait:
ret = xenbus_scanf(XBT_NIL, info->xbdev->otherend, if (xenbus_read_unsigned(info->xbdev->otherend,
"feature-abs-pointer", "%d", &val); "feature-abs-pointer", 0)) {
if (ret < 0)
val = 0;
if (val) {
ret = xenbus_write(XBT_NIL, info->xbdev->nodename, ret = xenbus_write(XBT_NIL, info->xbdev->nodename,
"request-abs-pointer", "1"); "request-abs-pointer", "1");
if (ret) if (ret)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment