From patchwork Mon Oct 31 16:48:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?SsO8cmdlbiBHcm/Dnw==?= X-Patchwork-Id: 9406013 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 89BD560588 for ; Mon, 31 Oct 2016 16:50:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7B62329341 for ; Mon, 31 Oct 2016 16:50:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6FFDB2935B; Mon, 31 Oct 2016 16:50:55 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1F35F29341 for ; Mon, 31 Oct 2016 16:50:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S944533AbcJaQuI (ORCPT ); Mon, 31 Oct 2016 12:50:08 -0400 Received: from mx2.suse.de ([195.135.220.15]:52544 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S944371AbcJaQsy (ORCPT ); Mon, 31 Oct 2016 12:48:54 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 12A1AAD25; Mon, 31 Oct 2016 16:48:53 +0000 (UTC) From: Juergen Gross To: linux-kernel@vger.kernel.org, xen-devel@lists.xen.org Cc: david.vrabel@citrix.com, boris.ostrovsky@oracle.com, Juergen Gross , tomi.valkeinen@ti.com, linux-fbdev@vger.kernel.org Subject: [PATCH 10/12] xen: make use of xenbus_read_unsigned() in xen-fbfront Date: Mon, 31 Oct 2016 17:48:28 +0100 Message-Id: <1477932510-28594-11-git-send-email-jgross@suse.com> X-Mailer: git-send-email 2.6.6 In-Reply-To: <1477932510-28594-1-git-send-email-jgross@suse.com> References: <1477932510-28594-1-git-send-email-jgross@suse.com> Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use xenbus_read_unsigned() instead of xenbus_scanf() when possible. This requires to change the type of the reads from int to unsigned, but these cases have been wrong before: negative values are not allowed for the modified cases. Cc: tomi.valkeinen@ti.com Cc: linux-fbdev@vger.kernel.org Signed-off-by: Juergen Gross --- drivers/video/fbdev/xen-fbfront.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/video/fbdev/xen-fbfront.c b/drivers/video/fbdev/xen-fbfront.c index 0567d51..d0115a7 100644 --- a/drivers/video/fbdev/xen-fbfront.c +++ b/drivers/video/fbdev/xen-fbfront.c @@ -633,7 +633,6 @@ static void xenfb_backend_changed(struct xenbus_device *dev, enum xenbus_state backend_state) { struct xenfb_info *info = dev_get_drvdata(&dev->dev); - int val; switch (backend_state) { case XenbusStateInitialising: @@ -657,16 +656,12 @@ static void xenfb_backend_changed(struct xenbus_device *dev, if (dev->state != XenbusStateConnected) goto InitWait; /* no InitWait seen yet, fudge it */ - if (xenbus_scanf(XBT_NIL, info->xbdev->otherend, - "request-update", "%d", &val) < 0) - val = 0; - if (val) + if (xenbus_read_unsigned(info->xbdev->otherend, + "request-update", 0)) info->update_wanted = 1; - if (xenbus_scanf(XBT_NIL, dev->otherend, - "feature-resize", "%d", &val) < 0) - val = 0; - info->feature_resize = val; + info->feature_resize = xenbus_read_unsigned(dev->otherend, + "feature-resize", 0); break; case XenbusStateClosed: