From patchwork Fri Jan 16 14:39:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 5649021 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 366EC9F3A0 for ; Fri, 16 Jan 2015 14:42:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 66BB720259 for ; Fri, 16 Jan 2015 14:42:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 899E320254 for ; Fri, 16 Jan 2015 14:42:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752491AbbAPOkT (ORCPT ); Fri, 16 Jan 2015 09:40:19 -0500 Received: from mail-lb0-f170.google.com ([209.85.217.170]:34121 "EHLO mail-lb0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752480AbbAPOkR (ORCPT ); Fri, 16 Jan 2015 09:40:17 -0500 Received: by mail-lb0-f170.google.com with SMTP id 10so18791159lbg.1 for ; Fri, 16 Jan 2015 06:40:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=gLXMk1AqpcagaDYO/31hhtT2OjIx2T681ebr/AAxx+E=; b=ih4A09Uo3CRZ+Rs0RjmTT8gKB5+1o6rQkq1Zpelzbe0HgLbcwCHiMcIVin6NHnLQzE Xg2pvsDxKVQS7pP4Rg4wTSakaUsJZt0QXqr07CSX/VFOavXcWIzGUUNlyDUs+zAyflVU GG+rXCtoC0aymza/bgTWj3UER0cV3W5VG2S0g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=gLXMk1AqpcagaDYO/31hhtT2OjIx2T681ebr/AAxx+E=; b=f30Cy1SwYYNp2ORiFxTu12euSypCDFc24QDUah7SFkzldBPfUKn+ZdCibVk/StfS4R jZit7lRjFU13RSCAx6x/wFPfs+sOwwTCDnC80OSgx7KHNWFhthDPFHCZOCizDawtiZC/ Pu5RF9YiWz84TiRM68JUEvAdGrvXVehELVL6WoPB1vKruwJHrXXgbo5Qin83khW11SvR DzgZgtk2mBJaNitBEaEfqIUmaQhmjQ5k9bZmTVb7Qb96u7y3wYKpJ/jKFEuU8wTKWuAO igbk+Jib58Hd7BUKO5Iym7qnXd+0JHi4KRzsr4OO6K8KAf1aU0aGHU1sj0Esu1urdZs3 2ciQ== X-Gm-Message-State: ALoCoQlWNX+07ewSGSiCVrIMOyvjTNjDQbthuT2FDQQ3YBQsxyWWqcKW+el9mOZmNgRqNl2jfGxq X-Received: by 10.112.57.226 with SMTP id l2mr9480921lbq.27.1421419215719; Fri, 16 Jan 2015 06:40:15 -0800 (PST) Received: from spencer.imf.au.dk ([130.225.20.51]) by mx.google.com with ESMTPSA id d8sm88573lbk.25.2015.01.16.06.40.14 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Jan 2015 06:40:15 -0800 (PST) From: Rasmus Villemoes To: Roland Dreier , Sean Hefty , Hal Rosenstock Cc: Rasmus Villemoes , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] infiniband: Use unsigned for bit index Date: Fri, 16 Jan 2015 15:39:56 +0100 Message-Id: <1421419196-4659-2-git-send-email-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 2.1.3 In-Reply-To: <1421419196-4659-1-git-send-email-linux@rasmusvillemoes.dk> References: <1421419196-4659-1-git-send-email-linux@rasmusvillemoes.dk> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham 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 In the expressions idx/32 and idx%32, both idx and 32 have signed type, and unfortunately the C standard prescribes rounding to 0, so unless gcc can prove that idx is non-negative, these cannot be implemented as simple shift respectively mask operations. Help gcc by changing the type of idx to unsigned - this cuts another few instructions from the generated code. Signed-off-by: Rasmus Villemoes Acked-by: Selvin Xavier --- drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c index eff11e6c6183..61c3047f5170 100644 --- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c +++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c @@ -1479,10 +1479,10 @@ mbx_err: return status; } -static void ocrdma_srq_toggle_bit(struct ocrdma_srq *srq, int idx) +static void ocrdma_srq_toggle_bit(struct ocrdma_srq *srq, unsigned int idx) { - int i = idx / 32; - unsigned int mask = (1 << (idx % 32)); + unsigned int i = idx / 32; + u32 mask = (1U << (idx % 32)); srq->idx_bit_fields[i] ^= mask; }