* [PATCH 00/12] xen: add common function for reading optional value @ 2016-10-31 16:48 Juergen Gross 2016-10-31 16:48 ` [PATCH 05/12] xen: make use of xenbus_read_unsigned() in xen-kbdfront Juergen Gross ` (2 more replies) 0 siblings, 3 replies; 7+ messages in thread From: Juergen Gross @ 2016-10-31 16:48 UTC (permalink / raw) To: linux-kernel, xen-devel Cc: david.vrabel, boris.ostrovsky, Juergen Gross, konrad.wilk, roger.pau, peterhuewe, tpmdd, jarkko.sakkinen, jgunthorpe, tpmdd-devel, dmitry.torokhov, linux-input, wei.liu2, paul.durrant, netdev, bhelgaas, linux-pci, tomi.valkeinen, linux-fbdev There are multiple instances of code reading an optional unsigned parameter from Xenstore via xenbus_scanf(). Instead of repeating the same code over and over add a service function doing the job and replace the call of xenbus_scanf() with the call of the new function where appropriate. Juergen Gross (12): xen: introduce xenbus_read_unsigned() xen: make use of xenbus_read_unsigned() in xen-blkback xen: make use of xenbus_read_unsigned() in xen-blkfront xen: make use of xenbus_read_unsigned() in xen-tpmfront xen: make use of xenbus_read_unsigned() in xen-kbdfront xen: make use of xenbus_read_unsigned() in xen-netback xen: make use of xenbus_read_unsigned() in xen-netfront xen: make use of xenbus_read_unsigned() in xen-pcifront xen: make use of xenbus_read_unsigned() in xen-scsifront xen: make use of xenbus_read_unsigned() in xen-fbfront xen: make use of xenbus_read_unsigned() in xen-pciback xen: make use of xenbus_read_unsigned() in xenbus drivers/block/xen-blkback/xenbus.c | 36 ++++++-------- drivers/block/xen-blkfront.c | 81 ++++++++++--------------------- drivers/char/tpm/xen-tpmfront.c | 8 +-- drivers/input/misc/xen-kbdfront.c | 13 ++--- drivers/net/xen-netback/xenbus.c | 50 ++++++------------- drivers/net/xen-netfront.c | 67 +++++++------------------ drivers/pci/xen-pcifront.c | 6 +-- drivers/scsi/xen-scsifront.c | 6 +-- drivers/video/fbdev/xen-fbfront.c | 13 ++--- drivers/xen/xen-pciback/xenbus.c | 8 ++- drivers/xen/xenbus/xenbus_probe_backend.c | 8 +-- drivers/xen/xenbus/xenbus_xs.c | 22 +++++++-- include/xen/xenbus.h | 4 ++ 13 files changed, 112 insertions(+), 210 deletions(-) Cc: konrad.wilk@oracle.com Cc: roger.pau@citrix.com Cc: peterhuewe@gmx.de Cc: tpmdd@selhorst.net Cc: jarkko.sakkinen@linux.intel.com Cc: jgunthorpe@obsidianresearch.com Cc: tpmdd-devel@lists.sourceforge.net Cc: dmitry.torokhov@gmail.com Cc: linux-input@vger.kernel.org Cc: wei.liu2@citrix.com Cc: paul.durrant@citrix.com Cc: netdev@vger.kernel.org Cc: bhelgaas@google.com Cc: linux-pci@vger.kernel.org Cc: tomi.valkeinen@ti.com Cc: linux-fbdev@vger.kernel.org -- 2.6.6 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 05/12] xen: make use of xenbus_read_unsigned() in xen-kbdfront 2016-10-31 16:48 [PATCH 00/12] xen: add common function for reading optional value Juergen Gross @ 2016-10-31 16:48 ` Juergen Gross 2016-11-09 0:29 ` Dmitry Torokhov 2016-10-31 17:08 ` [PATCH 00/12] xen: add common function for reading optional value David Miller 2016-11-07 11:08 ` David Vrabel 2 siblings, 1 reply; 7+ messages in thread From: Juergen Gross @ 2016-10-31 16:48 UTC (permalink / raw) To: linux-kernel, xen-devel Cc: david.vrabel, boris.ostrovsky, Juergen Gross, dmitry.torokhov, linux-input 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 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 05/12] xen: make use of xenbus_read_unsigned() in xen-kbdfront 2016-10-31 16:48 ` [PATCH 05/12] xen: make use of xenbus_read_unsigned() in xen-kbdfront Juergen Gross @ 2016-11-09 0:29 ` Dmitry Torokhov 0 siblings, 0 replies; 7+ messages in thread From: Dmitry Torokhov @ 2016-11-09 0:29 UTC (permalink / raw) To: Juergen Gross Cc: linux-kernel, xen-devel, david.vrabel, boris.ostrovsky, linux-input On Mon, Oct 31, 2016 at 05:48:23PM +0100, Juergen Gross wrote: > 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> Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.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 > -- Dmitry ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 00/12] xen: add common function for reading optional value 2016-10-31 16:48 [PATCH 00/12] xen: add common function for reading optional value Juergen Gross 2016-10-31 16:48 ` [PATCH 05/12] xen: make use of xenbus_read_unsigned() in xen-kbdfront Juergen Gross @ 2016-10-31 17:08 ` David Miller 2016-11-01 4:33 ` Juergen Gross 2016-11-07 11:08 ` David Vrabel 2 siblings, 1 reply; 7+ messages in thread From: David Miller @ 2016-10-31 17:08 UTC (permalink / raw) To: jgross Cc: linux-fbdev, wei.liu2, linux-pci, netdev, tomi.valkeinen, dmitry.torokhov, tpmdd, linux-kernel, jarkko.sakkinen, xen-devel, jgunthorpe, tpmdd-devel, david.vrabel, linux-input, bhelgaas, boris.ostrovsky, peterhuewe, paul.durrant, roger.pau From: Juergen Gross <jgross@suse.com> Date: Mon, 31 Oct 2016 17:48:18 +0100 > There are multiple instances of code reading an optional unsigned > parameter from Xenstore via xenbus_scanf(). Instead of repeating the > same code over and over add a service function doing the job and > replace the call of xenbus_scanf() with the call of the new function > where appropriate. As this seems to be a series that will go through some tree other than mine, I assume the networking bits will be taken care of that way. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 00/12] xen: add common function for reading optional value 2016-10-31 17:08 ` [PATCH 00/12] xen: add common function for reading optional value David Miller @ 2016-11-01 4:33 ` Juergen Gross 0 siblings, 0 replies; 7+ messages in thread From: Juergen Gross @ 2016-11-01 4:33 UTC (permalink / raw) To: David Miller Cc: linux-kernel, xen-devel, david.vrabel, boris.ostrovsky, konrad.wilk, roger.pau, peterhuewe, tpmdd, jarkko.sakkinen, jgunthorpe, tpmdd-devel, dmitry.torokhov, linux-input, wei.liu2, paul.durrant, netdev, bhelgaas, linux-pci, tomi.valkeinen, linux-fbdev On 31/10/16 18:08, David Miller wrote: > From: Juergen Gross <jgross@suse.com> > Date: Mon, 31 Oct 2016 17:48:18 +0100 > >> There are multiple instances of code reading an optional unsigned >> parameter from Xenstore via xenbus_scanf(). Instead of repeating the >> same code over and over add a service function doing the job and >> replace the call of xenbus_scanf() with the call of the new function >> where appropriate. > > As this seems to be a series that will go through some tree other > than mine, I assume the networking bits will be taken care of that > way. > If accepted I expect this series to go through the Xen tree. Juergen ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 00/12] xen: add common function for reading optional value 2016-10-31 16:48 [PATCH 00/12] xen: add common function for reading optional value Juergen Gross 2016-10-31 16:48 ` [PATCH 05/12] xen: make use of xenbus_read_unsigned() in xen-kbdfront Juergen Gross 2016-10-31 17:08 ` [PATCH 00/12] xen: add common function for reading optional value David Miller @ 2016-11-07 11:08 ` David Vrabel [not found] ` <8d314b86-4a28-5628-2a79-842a2fafc4c1-Sxgqhf6Nn4DQT0dZR+AlfA@public.gmane.org> 2 siblings, 1 reply; 7+ messages in thread From: David Vrabel @ 2016-11-07 11:08 UTC (permalink / raw) To: Juergen Gross, linux-kernel, xen-devel Cc: boris.ostrovsky, konrad.wilk, roger.pau, peterhuewe, tpmdd, jarkko.sakkinen, jgunthorpe, tpmdd-devel, dmitry.torokhov, linux-input, wei.liu2, paul.durrant, netdev, bhelgaas, linux-pci, tomi.valkeinen, linux-fbdev On 31/10/16 16:48, Juergen Gross wrote: > There are multiple instances of code reading an optional unsigned > parameter from Xenstore via xenbus_scanf(). Instead of repeating the > same code over and over add a service function doing the job and > replace the call of xenbus_scanf() with the call of the new function > where appropriate. Acked-by: David Vrabel <david.vrabel@citrix.com> Please queue for the next release. David ^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <8d314b86-4a28-5628-2a79-842a2fafc4c1-Sxgqhf6Nn4DQT0dZR+AlfA@public.gmane.org>]
* Re: [PATCH 00/12] xen: add common function for reading optional value [not found] ` <8d314b86-4a28-5628-2a79-842a2fafc4c1-Sxgqhf6Nn4DQT0dZR+AlfA@public.gmane.org> @ 2016-11-07 16:20 ` Jarkko Sakkinen 0 siblings, 0 replies; 7+ messages in thread From: Jarkko Sakkinen @ 2016-11-07 16:20 UTC (permalink / raw) To: David Vrabel Cc: Juergen Gross, linux-fbdev-u79uwXL29TY76Z2rM5mHXA, wei.liu2-Sxgqhf6Nn4DQT0dZR+AlfA, konrad.wilk-QHcLZuEGTsvQT0dZR+AlfA, linux-pci-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA, tomi.valkeinen-l0cyMroinI0, dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w, linux-kernel-u79uwXL29TY76Z2rM5mHXA, xen-devel-GuqFBffKawuEi8DpZVb4nw, tpmdd-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, linux-input-u79uwXL29TY76Z2rM5mHXA, bhelgaas-hpIqsD4AKlfQT0dZR+AlfA, boris.ostrovsky-QHcLZuEGTsvQT0dZR+AlfA, paul.durrant-Sxgqhf6Nn4DQT0dZR+AlfA, roger.pau-Sxgqhf6Nn4DQT0dZR+AlfA On Mon, Nov 07, 2016 at 11:08:09AM +0000, David Vrabel wrote: > On 31/10/16 16:48, Juergen Gross wrote: > > There are multiple instances of code reading an optional unsigned > > parameter from Xenstore via xenbus_scanf(). Instead of repeating the > > same code over and over add a service function doing the job and > > replace the call of xenbus_scanf() with the call of the new function > > where appropriate. > > Acked-by: David Vrabel <david.vrabel-Sxgqhf6Nn4DQT0dZR+AlfA@public.gmane.org> > > Please queue for the next release. If you want this change to tpmdd, please resend it to tpmdd mailing list and CC it to linux-security-module. Thanks. > David /Jarkko ------------------------------------------------------------------------------ Developer Access Program for Intel Xeon Phi Processors Access to Intel Xeon Phi processor-based developer platforms. With one year of Intel Parallel Studio XE. Training and support from Colfax. Order your platform today. http://sdm.link/xeonphi ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2016-11-09 0:29 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-10-31 16:48 [PATCH 00/12] xen: add common function for reading optional value Juergen Gross 2016-10-31 16:48 ` [PATCH 05/12] xen: make use of xenbus_read_unsigned() in xen-kbdfront Juergen Gross 2016-11-09 0:29 ` Dmitry Torokhov 2016-10-31 17:08 ` [PATCH 00/12] xen: add common function for reading optional value David Miller 2016-11-01 4:33 ` Juergen Gross 2016-11-07 11:08 ` David Vrabel [not found] ` <8d314b86-4a28-5628-2a79-842a2fafc4c1-Sxgqhf6Nn4DQT0dZR+AlfA@public.gmane.org> 2016-11-07 16:20 ` Jarkko Sakkinen
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).