Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1512708
| From | Juergen Gross <jgross@suse.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 05/12] xen: make use of xenbus_read_unsigned() in xen-kbdfront |
| Date | 2016-10-31 17:50 +0100 |
| Message-ID | <synWy-4Wn-43@gated-at.bofh.it> (permalink) |
| References | <synWy-4Wn-19@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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: Juergen Gross <jgross@suse.com>
---
drivers/input/misc/xen-kbdfront.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/drivers/input/misc/xen-kbdfront.c b/drivers/input/misc/xen-kbdfront.c
index 227fbd2..3900875 100644
--- a/drivers/input/misc/xen-kbdfront.c
+++ b/drivers/input/misc/xen-kbdfront.c
@@ -108,7 +108,8 @@ static irqreturn_t input_handler(int rq, void *dev_id)
static int xenkbd_probe(struct xenbus_device *dev,
const struct xenbus_device_id *id)
{
- int ret, i, abs;
+ int ret, i;
+ unsigned int abs;
struct xenkbd_info *info;
struct input_dev *kbd, *ptr;
@@ -127,8 +128,7 @@ static int xenkbd_probe(struct xenbus_device *dev,
if (!info->page)
goto error_nomem;
- if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-abs-pointer", "%d", &abs) < 0)
- abs = 0;
+ abs = xenbus_read_unsigned(dev->otherend, "feature-abs-pointer", 0);
if (abs) {
ret = xenbus_write(XBT_NIL, dev->nodename,
"request-abs-pointer", "1");
@@ -322,11 +322,8 @@ static void xenkbd_backend_changed(struct xenbus_device *dev,
case XenbusStateInitWait:
InitWait:
- ret = xenbus_scanf(XBT_NIL, info->xbdev->otherend,
- "feature-abs-pointer", "%d", &val);
- if (ret < 0)
- val = 0;
- if (val) {
+ if (xenbus_read_unsigned(info->xbdev->otherend,
+ "feature-abs-pointer", 0)) {
ret = xenbus_write(XBT_NIL, info->xbdev->nodename,
"request-abs-pointer", "1");
if (ret)
--
2.6.6
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 00/12] xen: add common function for reading optional value Juergen Gross <jgross@suse.com> - 2016-10-31 17:50 +0100
[PATCH 05/12] xen: make use of xenbus_read_unsigned() in xen-kbdfront Juergen Gross <jgross@suse.com> - 2016-10-31 17:50 +0100
Re: [PATCH 05/12] xen: make use of xenbus_read_unsigned() in xen-kbdfront Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2016-11-09 01:30 +0100
[PATCH 09/12] xen: make use of xenbus_read_unsigned() in xen-scsifront Juergen Gross <jgross@suse.com> - 2016-10-31 18:00 +0100
[PATCH 01/12] xen: introduce xenbus_read_unsigned() Juergen Gross <jgross@suse.com> - 2016-10-31 18:00 +0100
Re: [Xen-devel] [PATCH 01/12] xen: introduce xenbus_read_unsigned() David Vrabel <david.vrabel@citrix.com> - 2016-11-07 12:10 +0100
[PATCH 03/12] xen: make use of xenbus_read_unsigned() in xen-blkfront Juergen Gross <jgross@suse.com> - 2016-10-31 18:00 +0100
[PATCH 04/12] xen: make use of xenbus_read_unsigned() in xen-tpmfront Juergen Gross <jgross@suse.com> - 2016-10-31 18:00 +0100
Re: [PATCH 04/12] xen: make use of xenbus_read_unsigned() in xen-tpmfront Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2016-11-02 11:40 +0100
Re: [PATCH 04/12] xen: make use of xenbus_read_unsigned() in xen-tpmfront Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2016-11-04 05:30 +0100
[PATCH 10/12] xen: make use of xenbus_read_unsigned() in xen-fbfront Juergen Gross <jgross@suse.com> - 2016-10-31 18:00 +0100
[PATCH 12/12] xen: make use of xenbus_read_unsigned() in xenbus Juergen Gross <jgross@suse.com> - 2016-10-31 18:00 +0100
[PATCH 11/12] xen: make use of xenbus_read_unsigned() in xen-pciback Juergen Gross <jgross@suse.com> - 2016-10-31 18:00 +0100
Re: [PATCH 00/12] xen: add common function for reading optional value David Miller <davem@davemloft.net> - 2016-10-31 18:10 +0100
Re: [PATCH 00/12] xen: add common function for reading optional value Juergen Gross <jgross@suse.com> - 2016-11-01 05:40 +0100
Re: [PATCH 00/12] xen: add common function for reading optional value David Vrabel <david.vrabel@citrix.com> - 2016-11-07 12:10 +0100
Re: [PATCH 00/12] xen: add common function for reading optional value Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2016-11-07 17:30 +0100
csiph-web