From patchwork Thu Jul 7 07:57:49 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 9218097 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 314F46048B for ; Thu, 7 Jul 2016 08:00:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 26B0228799 for ; Thu, 7 Jul 2016 08:00:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 199B72879D; Thu, 7 Jul 2016 08:00:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E83EB28799 for ; Thu, 7 Jul 2016 08:00:56 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bL4C1-0001Fh-Nu; Thu, 07 Jul 2016 07:57:53 +0000 Received: from mail6.bemta6.messagelabs.com ([85.158.143.247]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bL4C1-0001FR-45 for xen-devel@lists.xenproject.org; Thu, 07 Jul 2016 07:57:53 +0000 Received: from [85.158.143.35] by server-2.bemta-6.messagelabs.com id CD/8A-11548-08B0E775; Thu, 07 Jul 2016 07:57:52 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFuphkeJIrShJLcpLzFFi42LpdPzhpVvPXRd u8PqbpcX3LZOZHBg9Dn+4whLAGMWamZeUX5HAmvGnbQZzwTquiq63vWwNjGc5uhg5OYQE8iT6 N7Uyg9i8AnYSPxbPZAWxJQQMJfbNX8UGYrMIqEosef2YCcRmE1CXaHu2HaxGREBZ4u73GSwgN rOArcSci2/B4sICnhLbJz1h72LkAJopKPF3hzBEiZbEw1+3oMq1JZYtfM0MUsIsIC2x/B/HBE aeWQgNs5A0zELSMAuhYQEjyypG9eLUorLUIl0jvaSizPSMktzEzBxdQwMzvdzU4uLE9NScxKR iveT83E2MwFBiAIIdjMv+Oh1ilORgUhLl3XO3NlyILyk/pTIjsTgjvqg0J7X4EKMMB4eSBO9f rrpwIcGi1PTUirTMHGBQw6QlOHiURHi/gaR5iwsSc4sz0yFSpxgVpcR5uYCxICQAksgozYNrg 0XSJUZZKWFeRqBDhHgKUotyM0tQ5V8xinMwKgnz7gYZz5OZVwI3/RXQYiagxT9dqkEWlyQipK QaGCVmhyZuEpQ6UJN+4MjzlvXtE1jdLZ80p1c3y15/YGMYoK+Y+Jw3vuYjy58n/qEPSo8cP70 ooOuc1z+nq8JcZ9RjZ7+f41e5I0T1tiYvQ39v37KDX2SUJvStvq+g/nHL1Y7nzx5/2fu8uW5v YYndGv3YSceCGA4mTiu31r0aduPgo1sfGZzuMCuxFGckGmoxFxUnAgDk//3tnwIAAA== X-Env-Sender: JBeulich@suse.com X-Msg-Ref: server-6.tower-21.messagelabs.com!1467878270!213263!1 X-Originating-IP: [137.65.248.74] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.77; banners=-,-,- X-VirusChecked: Checked Received: (qmail 14417 invoked from network); 7 Jul 2016 07:57:51 -0000 Received: from prv-mh.provo.novell.com (HELO prv-mh.provo.novell.com) (137.65.248.74) by server-6.tower-21.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 7 Jul 2016 07:57:51 -0000 Received: from INET-PRV-MTA by prv-mh.provo.novell.com with Novell_GroupWise; Thu, 07 Jul 2016 01:57:49 -0600 Message-Id: <577E279D02000078000FBEBF@prv-mh.provo.novell.com> X-Mailer: Novell GroupWise Internet Agent 14.2.0 Date: Thu, 07 Jul 2016 01:57:49 -0600 From: "Jan Beulich" To: "Wei Liu" Mime-Version: 1.0 Content-Disposition: inline Cc: xen-devel@lists.xenproject.org, netdev@vger.kernel.org Subject: [Xen-devel] [PATCH] xen-netback: prefer xenbus_scanf() over xenbus_gather() X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP ... for single items being collected: It is more typesafe (as the compiler can check format string and to-be-written-to variable match) and requires one less parameter to be passed. Signed-off-by: Jan Beulich --- drivers/net/xen-netback/xenbus.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) --- 4.7-rc6-prefer-xenbus_scanf.orig/drivers/net/xen-netback/xenbus.c +++ 4.7-rc6-prefer-xenbus_scanf/drivers/net/xen-netback/xenbus.c @@ -842,16 +842,16 @@ static int connect_ctrl_ring(struct back unsigned int evtchn; int err; - err = xenbus_gather(XBT_NIL, dev->otherend, - "ctrl-ring-ref", "%u", &val, NULL); - if (err) + err = xenbus_scanf(XBT_NIL, dev->otherend, + "ctrl-ring-ref", "%u", &val); + if (err <= 0) goto done; /* The frontend does not have a control ring */ ring_ref = val; - err = xenbus_gather(XBT_NIL, dev->otherend, - "event-channel-ctrl", "%u", &val, NULL); - if (err) { + err = xenbus_scanf(XBT_NIL, dev->otherend, + "event-channel-ctrl", "%u", &val); + if (err <= 0) { xenbus_dev_fatal(dev, err, "reading %s/event-channel-ctrl", dev->otherend); @@ -872,7 +872,7 @@ done: return 0; fail: - return err; + return err ?: -ENODATA; } static void connect(struct backend_info *be)