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 --- a/drivers/xen/blkfront/blkfront.c +++ b/drivers/xen/blkfront/blkfront.c @@ -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; --- a/drivers/xen/fbfront/xenfb.c +++ b/drivers/xen/fbfront/xenfb.c @@ -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); --- a/drivers/xen/fbfront/xenkbd.c +++ b/drivers/xen/fbfront/xenkbd.c @@ -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 */ } --- a/drivers/xen/netback/xenbus.c +++ b/drivers/xen/netback/xenbus.c @@ -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; --- a/drivers/xen/netfront/netfront.c +++ b/drivers/xen/netfront/netfront.c @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include @@ -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; --- a/drivers/xen/pcifront/xenbus.c +++ b/drivers/xen/pcifront/xenbus.c @@ -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); --- a/drivers/xen/tpmback/xenbus.c +++ b/drivers/xen/tpmback/xenbus.c @@ -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;