[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [linux-2.6.18-xen] drivers: prefer xenbus_write() over xenbus_printf() where possible


  • To: xen-changelog@xxxxxxxxxxxxxxxxxxx
  • From: Xen patchbot-linux-2.6.18-xen <patchbot@xxxxxxx>
  • Date: Mon, 20 Jan 2014 09:11:03 +0000
  • Delivery-date: Mon, 20 Jan 2014 09:11:12 +0000
  • List-id: "Change log for Mercurial \(receive only\)" <xen-changelog.lists.xen.org>

# HG changeset patch
# User Jan Beulich <jbeulich@xxxxxxxx>
# Date 1390208636 -3600
# Node ID 9aa376723f25b5f022bc01bb36ae2197ee75d334
# Parent  ca683fddd28a1878b1bea536eb99f3d2ddee7020
drivers: prefer xenbus_write() over xenbus_printf() where possible

... as being the simpler variant.

This includes an inversion of netfront's HAVE_CSUM_OFFLOAD, in order to
be able to directly use __stringify() on it.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---


diff -r ca683fddd28a -r 9aa376723f25 drivers/xen/blkfront/blkfront.c
--- a/drivers/xen/blkfront/blkfront.c   Mon Jan 20 10:01:11 2014 +0100
+++ b/drivers/xen/blkfront/blkfront.c   Mon Jan 20 10:03:56 2014 +0100
@@ -187,8 +187,8 @@ again:
                message = "writing event-channel";
                goto abort_transaction;
        }
-       err = xenbus_printf(xbt, dev->nodename, "protocol", "%s",
-                           XEN_IO_PROTO_ABI_NATIVE);
+       err = xenbus_write(xbt, dev->nodename, "protocol",
+                          XEN_IO_PROTO_ABI_NATIVE);
        if (err) {
                message = "writing protocol";
                goto abort_transaction;
diff -r ca683fddd28a -r 9aa376723f25 drivers/xen/fbfront/xenfb.c
--- a/drivers/xen/fbfront/xenfb.c       Mon Jan 20 10:01:11 2014 +0100
+++ b/drivers/xen/fbfront/xenfb.c       Mon Jan 20 10:03:56 2014 +0100
@@ -760,11 +760,11 @@ static int xenfb_connect_backend(struct 
                            irq_to_evtchn_port(irq));
        if (ret)
                goto error_xenbus;
-       ret = xenbus_printf(xbt, dev->nodename, "protocol", "%s",
-                           XEN_IO_PROTO_ABI_NATIVE);
+       ret = xenbus_write(xbt, dev->nodename, "protocol",
+                          XEN_IO_PROTO_ABI_NATIVE);
        if (ret)
                goto error_xenbus;
-       ret = xenbus_printf(xbt, dev->nodename, "feature-update", "1");
+       ret = xenbus_write(xbt, dev->nodename, "feature-update", "1");
        if (ret)
                goto error_xenbus;
        ret = xenbus_transaction_end(xbt, 0);
diff -r ca683fddd28a -r 9aa376723f25 drivers/xen/fbfront/xenkbd.c
--- a/drivers/xen/fbfront/xenkbd.c      Mon Jan 20 10:01:11 2014 +0100
+++ b/drivers/xen/fbfront/xenkbd.c      Mon Jan 20 10:03:56 2014 +0100
@@ -126,7 +126,7 @@ int __devinit xenkbd_probe(struct xenbus
        if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-abs-pointer", "%d", 
&abs) < 0)
                abs = 0;
        if (abs)
-               xenbus_printf(XBT_NIL, dev->nodename, "request-abs-pointer", 
"1");
+               xenbus_write(XBT_NIL, dev->nodename, "request-abs-pointer", 
"1");
 
        /* keyboard */
        kbd = input_allocate_device();
@@ -294,8 +294,8 @@ static void xenkbd_backend_changed(struc
                if (ret < 0)
                        val = 0;
                if (val) {
-                       ret = xenbus_printf(XBT_NIL, info->xbdev->nodename,
-                                           "request-abs-pointer", "1");
+                       ret = xenbus_write(XBT_NIL, info->xbdev->nodename,
+                                          "request-abs-pointer", "1");
                        if (ret)
                                ; /* FIXME */
                }
diff -r ca683fddd28a -r 9aa376723f25 drivers/xen/netback/xenbus.c
--- a/drivers/xen/netback/xenbus.c      Mon Jan 20 10:01:11 2014 +0100
+++ b/drivers/xen/netback/xenbus.c      Mon Jan 20 10:03:56 2014 +0100
@@ -107,8 +107,7 @@ static int netback_probe(struct xenbus_d
                }
 
                /* We support rx-copy path. */
-               err = xenbus_printf(xbt, dev->nodename,
-                                   "feature-rx-copy", "%d", 1);
+               err = xenbus_write(xbt, dev->nodename, "feature-rx-copy", "1");
                if (err) {
                        message = "writing feature-rx-copy";
                        goto abort_transaction;
@@ -118,8 +117,7 @@ static int netback_probe(struct xenbus_d
                 * We don't support rx-flip path (except old guests who don't
                 * grok this feature flag).
                 */
-               err = xenbus_printf(xbt, dev->nodename,
-                                   "feature-rx-flip", "%d", 0);
+               err = xenbus_write(xbt, dev->nodename, "feature-rx-flip", "0");
                if (err) {
                        message = "writing feature-rx-flip";
                        goto abort_transaction;
diff -r ca683fddd28a -r 9aa376723f25 drivers/xen/netfront/netfront.c
--- a/drivers/xen/netfront/netfront.c   Mon Jan 20 10:01:11 2014 +0100
+++ b/drivers/xen/netfront/netfront.c   Mon Jan 20 10:03:56 2014 +0100
@@ -37,6 +37,7 @@
 #include <linux/sched.h>
 #include <linux/slab.h>
 #include <linux/string.h>
+#include <linux/stringify.h>
 #include <linux/errno.h>
 #include <linux/netdevice.h>
 #include <linux/inetdevice.h>
@@ -100,7 +101,7 @@ static const int MODPARM_rx_flip = 0;
 #if defined(NETIF_F_GSO)
 #define HAVE_GSO                       1
 #define HAVE_TSO                       1 /* TSO is a subset of GSO */
-#define HAVE_CSUM_OFFLOAD              1
+#define NO_CSUM_OFFLOAD                        0
 static inline void dev_disable_gso_features(struct net_device *dev)
 {
        /* Turn off all GSO bits except ROBUST. */
@@ -116,7 +117,7 @@ static inline void dev_disable_gso_featu
  * with the presence of NETIF_F_TSO but it appears to be a good first
  * approximiation.
  */
-#define HAVE_CSUM_OFFLOAD              0
+#define NO_CSUM_OFFLOAD                        1
 
 #define gso_size tso_size
 #define gso_segs tso_segs
@@ -143,7 +144,7 @@ static inline int netif_needs_gso(struct
 #else
 #define HAVE_GSO                       0
 #define HAVE_TSO                       0
-#define HAVE_CSUM_OFFLOAD              0
+#define NO_CSUM_OFFLOAD                        1
 #define netif_needs_gso(dev, skb)      0
 #define dev_disable_gso_features(dev)  ((void)0)
 #define ethtool_op_set_tso(dev, data)  (-ENOSYS)
@@ -420,27 +421,27 @@ again:
                goto abort_transaction;
        }
 
-       err = xenbus_printf(xbt, dev->nodename, "feature-rx-notify", "%d", 1);
+       err = xenbus_write(xbt, dev->nodename, "feature-rx-notify", "1");
        if (err) {
                message = "writing feature-rx-notify";
                goto abort_transaction;
        }
 
-       err = xenbus_printf(xbt, dev->nodename, "feature-no-csum-offload",
-                           "%d", !HAVE_CSUM_OFFLOAD);
+       err = xenbus_write(xbt, dev->nodename, "feature-no-csum-offload",
+                          __stringify(NO_CSUM_OFFLOAD));
        if (err) {
                message = "writing feature-no-csum-offload";
                goto abort_transaction;
        }
 
-       err = xenbus_printf(xbt, dev->nodename, "feature-sg", "%d", 1);
+       err = xenbus_write(xbt, dev->nodename, "feature-sg", "1");
        if (err) {
                message = "writing feature-sg";
                goto abort_transaction;
        }
 
-       err = xenbus_printf(xbt, dev->nodename, "feature-gso-tcpv4", "%d",
-                           HAVE_TSO);
+       err = xenbus_write(xbt, dev->nodename, "feature-gso-tcpv4",
+                          __stringify(HAVE_TSO));
        if (err) {
                message = "writing feature-gso-tcpv4";
                goto abort_transaction;
diff -r ca683fddd28a -r 9aa376723f25 drivers/xen/pcifront/xenbus.c
--- a/drivers/xen/pcifront/xenbus.c     Mon Jan 20 10:01:11 2014 +0100
+++ b/drivers/xen/pcifront/xenbus.c     Mon Jan 20 10:03:56 2014 +0100
@@ -124,8 +124,8 @@ static int pcifront_publish_info(struct 
                err = xenbus_printf(trans, pdev->xdev->nodename,
                                    "event-channel", "%u", pdev->evtchn);
        if (!err)
-               err = xenbus_printf(trans, pdev->xdev->nodename,
-                                   "magic", XEN_PCI_MAGIC);
+               err = xenbus_write(trans, pdev->xdev->nodename, "magic",
+                                  XEN_PCI_MAGIC);
 
        if (err) {
                xenbus_transaction_end(trans, 1);
diff -r ca683fddd28a -r 9aa376723f25 drivers/xen/tpmback/xenbus.c
--- a/drivers/xen/tpmback/xenbus.c      Mon Jan 20 10:01:11 2014 +0100
+++ b/drivers/xen/tpmback/xenbus.c      Mon Jan 20 10:03:56 2014 +0100
@@ -176,7 +176,6 @@ static void connect(struct backend_info 
        struct xenbus_transaction xbt;
        int err;
        struct xenbus_device *dev = be->dev;
-       unsigned long ready = 1;
 
 again:
        err = xenbus_transaction_start(&xbt);
@@ -185,8 +184,7 @@ again:
                return;
        }
 
-       err = xenbus_printf(xbt, be->dev->nodename,
-                           "ready", "%lu", ready);
+       err = xenbus_write(xbt, be->dev->nodename, "ready", "1");
        if (err) {
                xenbus_dev_fatal(be->dev, err, "writing 'ready'");
                goto abort;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.