linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/12] xen: add common function for reading optional value
@ 2016-10-31 16:48 Juergen Gross
  2016-10-31 16:48 ` [PATCH 08/12] xen: make use of xenbus_read_unsigned() in xen-pcifront 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 08/12] xen: make use of xenbus_read_unsigned() in xen-pcifront
  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-10-31 18:18   ` Bjorn Helgaas
  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, bhelgaas, linux-pci

Use xenbus_read_unsigned() instead of xenbus_scanf() when possible.
This requires to change the type of the read from int to unsigned,
but this case has been wrong before: negative values are not allowed
for the modified case.

Cc: bhelgaas@google.com
Cc: linux-pci@vger.kernel.org

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 drivers/pci/xen-pcifront.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c
index d6ff5e8..8fc2e95 100644
--- a/drivers/pci/xen-pcifront.c
+++ b/drivers/pci/xen-pcifront.c
@@ -1038,10 +1038,8 @@ static int pcifront_detach_devices(struct pcifront_device *pdev)
 			err = -ENOMEM;
 			goto out;
 		}
-		err = xenbus_scanf(XBT_NIL, pdev->xdev->otherend, str, "%d",
-				   &state);
-		if (err != 1)
-			state = XenbusStateUnknown;
+		state = xenbus_read_unsigned(pdev->xdev->otherend, str,
+					     XenbusStateUnknown);
 
 		if (state != XenbusStateClosing)
 			continue;
-- 
2.6.6

^ permalink raw reply related	[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 08/12] xen: make use of xenbus_read_unsigned() in xen-pcifront 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-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

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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 08/12] xen: make use of xenbus_read_unsigned() in xen-pcifront
  2016-10-31 16:48 ` [PATCH 08/12] xen: make use of xenbus_read_unsigned() in xen-pcifront Juergen Gross
@ 2016-10-31 18:18   ` Bjorn Helgaas
  0 siblings, 0 replies; 7+ messages in thread
From: Bjorn Helgaas @ 2016-10-31 18:18 UTC (permalink / raw)
  To: Juergen Gross
  Cc: linux-kernel, xen-devel, david.vrabel, boris.ostrovsky, bhelgaas,
	linux-pci

On Mon, Oct 31, 2016 at 05:48:26PM +0100, Juergen Gross wrote:
> Use xenbus_read_unsigned() instead of xenbus_scanf() when possible.
> This requires to change the type of the read from int to unsigned,
> but this case has been wrong before: negative values are not allowed
> for the modified case.
> 
> Cc: bhelgaas@google.com
> Cc: linux-pci@vger.kernel.org
> 
> Signed-off-by: Juergen Gross <jgross@suse.com>

Acked-by: Bjorn Helgaas <bhelgaas@google.com>

I assume this will be merged with the rest of the series via some tree
other than mine.

> ---
>  drivers/pci/xen-pcifront.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/pci/xen-pcifront.c b/drivers/pci/xen-pcifront.c
> index d6ff5e8..8fc2e95 100644
> --- a/drivers/pci/xen-pcifront.c
> +++ b/drivers/pci/xen-pcifront.c
> @@ -1038,10 +1038,8 @@ static int pcifront_detach_devices(struct pcifront_device *pdev)
>  			err = -ENOMEM;
>  			goto out;
>  		}
> -		err = xenbus_scanf(XBT_NIL, pdev->xdev->otherend, str, "%d",
> -				   &state);
> -		if (err != 1)
> -			state = XenbusStateUnknown;
> +		state = xenbus_read_unsigned(pdev->xdev->otherend, str,
> +					     XenbusStateUnknown);
>  
>  		if (state != XenbusStateClosing)
>  			continue;
> -- 
> 2.6.6
> 

^ 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 08/12] xen: make use of xenbus_read_unsigned() in xen-pcifront 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
  2016-11-07 16:20   ` Jarkko Sakkinen
  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

* Re: [PATCH 00/12] xen: add common function for reading optional value
  2016-11-07 11:08 ` David Vrabel
@ 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-kernel, xen-devel, boris.ostrovsky,
	konrad.wilk, roger.pau, peterhuewe, tpmdd, jgunthorpe,
	tpmdd-devel, dmitry.torokhov, linux-input, wei.liu2, paul.durrant,
	netdev, bhelgaas, linux-pci, tomi.valkeinen, linux-fbdev

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@citrix.com>
> 
> 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-11-07 16:20 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 08/12] xen: make use of xenbus_read_unsigned() in xen-pcifront Juergen Gross
2016-10-31 18:18   ` Bjorn Helgaas
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
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).