From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933145AbcGGJkx (ORCPT ); Thu, 7 Jul 2016 05:40:53 -0400 Received: from smtp02.citrix.com ([66.165.176.63]:9947 "EHLO SMTP02.CITRIX.COM" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756809AbcGGJkv (ORCPT ); Thu, 7 Jul 2016 05:40:51 -0400 X-IronPort-AV: E=Sophos;i="5.28,324,1464652800"; d="scan'208";a="371739450" Date: Thu, 7 Jul 2016 11:40:39 +0200 From: Roger Pau Monne To: Jan Beulich CC: Konrad Rzeszutek Wilk , , Subject: Re: [PATCH] xen-blkfront: prefer xenbus_scanf() over xenbus_gather() Message-ID: <20160707094038.c3d5ebbvyj4vm73n@mac> References: <577E297A02000078000FBF20@prv-mh.provo.novell.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <577E297A02000078000FBF20@prv-mh.provo.novell.com> User-Agent: Mutt/1.6.0-neo (2016-04-07) X-DLP: MIA1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 07, 2016 at 02:05:46AM -0600, Jan Beulich wrote: > ... 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 Acked-by: Roger Pau Monné > --- > drivers/block/xen-blkfront.c | 43 +++++++++++++++++++------------------------ > 1 file changed, 19 insertions(+), 24 deletions(-) > > --- 4.7-rc6-prefer-xenbus_scanf.orig/drivers/block/xen-blkfront.c > +++ 4.7-rc6-prefer-xenbus_scanf/drivers/block/xen-blkfront.c > @@ -2208,10 +2208,9 @@ static void blkfront_setup_discard(struc > info->discard_granularity = discard_granularity; > info->discard_alignment = discard_alignment; > } > - err = xenbus_gather(XBT_NIL, info->xbdev->otherend, > - "discard-secure", "%d", &discard_secure, > - NULL); > - if (!err) > + err = xenbus_scanf(XBT_NIL, info->xbdev->otherend, > + "discard-secure", "%u", &discard_secure); > + if (err > 0) I would prefer an explicit err == 1 check (here and elsewhere), but I'm not going to block this patch because of that. Roger.