From patchwork Thu Apr 14 14:34:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Joe Perches X-Patchwork-Id: 8837771 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id CC17CC0553 for ; Thu, 14 Apr 2016 14:34:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C686D202DD for ; Thu, 14 Apr 2016 14:34:19 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id B096720166 for ; Thu, 14 Apr 2016 14:34:17 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 007E26EA3D; Thu, 14 Apr 2016 14:34:17 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from smtprelay.hostedemail.com (smtprelay0228.hostedemail.com [216.40.44.228]) by gabe.freedesktop.org (Postfix) with ESMTPS id 37F076EA3D for ; Thu, 14 Apr 2016 14:34:15 +0000 (UTC) Received: from filter.hostedemail.com (unknown [216.40.38.60]) by smtprelay08.hostedemail.com (Postfix) with ESMTP id 924D029DDA0; Thu, 14 Apr 2016 14:34:13 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2, 0, 0, , d41d8cd98f00b204, joe@perches.com, :::::::, RULES_HIT:41:69:355:379:541:599:800:960:966:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1542:1593:1594:1711:1730:1747:1777:1792:2196:2199:2393:2559:2562:2828:2914:3138:3139:3140:3141:3142:3353:3622:3865:3866:3867:3868:3870:3872:3874:4250:4321:4385:5007:6119:9592:10004:10400:10848:11026:11232:11473:11657:11658:11783:11889:11914:12043:12438:12517:12519:12555:12740:13439:13894:14181:14659:14721:21080:21094:21323:30046:30054:30091, 0, RBL:none, CacheIP:none, Bayesian:0.5, 0.5, 0.5, Netcheck:none, DomainCache:0, MSF:not bulk, SPF:fn, MSBL:0, DNSBL:none, Custom_rules:0:0:0, LFtime:1, LUA_SUMMARY:none X-HE-Tag: note85_41c1a4d747c07 X-Filterd-Recvd-Size: 3000 Received: from XPS-9350.home (unknown [71.118.176.190]) (Authenticated sender: joe@perches.com) by omf07.hostedemail.com (Postfix) with ESMTPA; Thu, 14 Apr 2016 14:34:11 +0000 (UTC) Message-ID: <1460644444.19090.17.camel@perches.com> Subject: Re: [PATCH] drm/vmwgfx: use *_32_bits() macros From: Joe Perches To: Paul Bolle , David Airlie Date: Thu, 14 Apr 2016 07:34:04 -0700 In-Reply-To: <1460633540.2728.6.camel@tiscali.nl> References: <1457000770-2317-1-git-send-email-pebolle@tiscali.nl> <1460633540.2728.6.camel@tiscali.nl> X-Mailer: Evolution 3.18.5.2-0ubuntu1 Mime-Version: 1.0 Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-5.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Thu, 2016-04-14 at 13:32 +0200, Paul Bolle wrote: > On do, 2016-03-03 at 11:26 +0100, Paul Bolle wrote: > > > > Use the upper_32_bits() macro instead of the four line equivalent that > > triggers a GCC warning on 32 bits x86: > >     drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c: In function > > 'vmw_cmdbuf_header_submit': > >     drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c:297:25: warning: right > > shift count >= width of type [-Wshift-count-overflow] > >        val = (header->handle >> 32); > >                              ^ > > > > And use the lower_32_bits() macro instead of and-ing with a 32 bits > > mask. > > > > Signed-off-by: Paul Bolle > > --- > > Note: compile tested only (I don't use any of vmware's products). > The warning can still be seen on v4.6-rc3 for 32 bits x86. This patch > applies cleanly to that rc. > > Has anyone had a chance to look at this patch, and perhaps even test it? Test?  Nope.  Seems obviously correct. It might be clearer removing the temporary though: Maybe: Reviewed-by: Thomas Hellstrom ---  drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c | 15 +++++----------  1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c b/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c index 67cebb2..330794f 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c @@ -291,17 +291,12 @@ void vmw_cmdbuf_header_free(struct vmw_cmdbuf_header *header)  static int vmw_cmdbuf_header_submit(struct vmw_cmdbuf_header *header)  {   struct vmw_cmdbuf_man *man = header->man; - u32 val;   - if (sizeof(header->handle) > 4) - val = (header->handle >> 32); - else - val = 0; - vmw_write(man->dev_priv, SVGA_REG_COMMAND_HIGH, val); - - val = (header->handle & 0xFFFFFFFFULL); - val |= header->cb_context & SVGA_CB_CONTEXT_MASK; - vmw_write(man->dev_priv, SVGA_REG_COMMAND_LOW, val); + vmw_write(man->dev_priv, SVGA_REG_COMMAND_HIGH, +   upper_32_bits(header->handle)); + vmw_write(man->dev_priv, SVGA_REG_COMMAND_LOW, +   lower_32_bits(header->handle) | +   (header->cb_context & SVGA_CB_CONTEXT_MASK));     return header->cb_header->status;  }