From patchwork Thu Mar 7 08:00:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 159803 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp7142891jad; Thu, 7 Mar 2019 00:01:21 -0800 (PST) X-Google-Smtp-Source: APXvYqzogeSpwzaPx5TYY1U0luRhRMqNUOnPxT4Iwh7AtCYhuW4ZReOv2EXpS24EpXVcASOoN5yI X-Received: by 2002:a62:e802:: with SMTP id c2mr11354735pfi.249.1551945681431; Thu, 07 Mar 2019 00:01:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551945681; cv=none; d=google.com; s=arc-20160816; b=WVJ4jlStOX6FrFC+UbHwzmuceD9ifw7m3CxZwjDsV6/yzzHpJwFKVss9fYnns8/BN4 nz96KqXqgSSFiU8LmdFYMVNMva7z6W1+LFiEDv4wEKdhks8SDtDQjFJJgomQdJdnORRz N8nP4H5O7kGOuAd/n2wE8wx1+y8k7GD8bs3gTWW3/jXgae+feiGkN9SW954C6UrjZACl TRuhgV+k4tyqufvcAZfW8IfsyIZXY8Dwg7/7xmwggUFrEmKVAVTiTXiTSmVAaeAHg0fK 5hXqhunSRcEUt5RKMa6JzWtOf6g7Y8m45012XwpyzXh83xu5LwkscsEJA9GxDkAR5wy2 WBvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=hbTri4cmFCawGRhJvKsSZ7HSCdYZWjblbqfI2xz0iF4=; b=cR5UyPHDrh9T3zeorTv+sI4BtbRmg7mWS1QKvfsTPClTIA7MelwRpY5htRIB2D+Jwt cRbtZSzCQ+0R9Uj6/IBpoOzheFi4fYSpWKxrz2gD52uHTw1LvQgR3/znE0V4ZjXM3tYl 5BS5i3FqkwKJ52DqXq6qdt6rkqTlzZ9jRZMvnXBMFnjQ8I8jsjaD9BakF09aurmhOOZI ZhF2N+Rku/ROEMP+WMYIgD0KZPZZGiuPdLmxzFjRZbAnU0lNE+tvvOYyH8NEuS8P5ndy u8o9GRZnqA71Iznlp3Qfj3oSKAwGDhVN7eKmPmz76NIm8yDBUW2muwAGPCWd6vkYW9V+ ikBQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y14si3403876pgl.274.2019.03.07.00.01.20; Thu, 07 Mar 2019 00:01:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726194AbfCGIBT (ORCPT + 31 others); Thu, 7 Mar 2019 03:01:19 -0500 Received: from mout.kundenserver.de ([212.227.17.24]:54495 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725788AbfCGIBS (ORCPT ); Thu, 7 Mar 2019 03:01:18 -0500 Received: from wuerfel.lan ([109.192.41.194]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.145]) with ESMTPA (Nemesis) id 1MsZeX-1gn0pF0d0l-00txjM; Thu, 07 Mar 2019 09:00:42 +0100 From: Arnd Bergmann To: Christoph Hellwig , Marek Szyprowski Cc: Nick Desaulniers , Arnd Bergmann , Robin Murphy , Jesper Dangaard Brouer , Paul Burton , Geert Uytterhoeven , iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: [PATCH] dma-mapping: work around clang bug Date: Thu, 7 Mar 2019 09:00:25 +0100 Message-Id: <20190307080038.3727426-1-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 MIME-Version: 1.0 X-Provags-ID: V03:K1:SnRTwP7mB1YqM4Ju0tIDBNxdpmKOjjsaltQRQqdqOs6SJgdPNEG qML6XcUhF83mtJcarIloWoyYtOlTZRao8xWFZctzxcOcvIvMuMEC3T0WBd2LMr2C+hwp1Sh x7KZlWkdTHteysVNHEyw89nSiSqz5aOMWlbXYCdUA5npGURM0KWRJKTeoYYwyh2H7oaui9m qtpISyDN3FdrO/Th/ZuZg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:mvI6dVuhiUU=:/R7VamLGMWNcYf311jvRHq qg0QfAvZnVzoUfZKJaapNdto//AYugPjk5TYwiMvo3NpB7Zb/tZJ3fZm/F3scEAv24S463rgW YqiqJVnNprt4WuyRaDZ67D2SxgSGMNu8EuY9g0GsZB2pruo35JYQedX36NQptfcdLu6jokkRK FOUQ/nPAmKNhRCRzE9/6dRjgI6y0FQZfd3VmFShAbAZSz9I9tGWQ+VC9t/ux4KMo4HGEK9m+s 5uKDeBp+OTqmWSVc4ys6isJImPoCspCrO0FxtwuIbDSZJ5GRwdtptYmDy2lfnDoWO1i/dBrX5 b4m7XHuxEGWzy3QOZvfVnrmPftbolGx7NKPbA+znCw40zy89WXHeAuqt+hTNrfZ6dn4MzsBiZ EX9NNoBL88W6nD1ICcaQFWdihFdWCvfxFcTwPKiOIbFG18W2CSuk2oKJOW1kfowyzPOiav+8c /1BLIwPSaRdRKPslVqQb5yHOBF4pkDstbxm14tN5FNkeYIdJpqjmysPhhQ5r0dU6zEr2EmPqL ZvnQypB+1kOleJhFxwWc1VcDJYO7XzUDg+Ja9dfQttxlSQVMmGfb60W5zUA/kuR+/9jbW8dK9 wjzPe+CewWmcZu84AlZLkqj0ts7BOaLG4CustNA7jiheu3V90/CDJKIfgEll6KHOsRmix4mqv oU8JYMjr2tLLCVE0TsUuZeIVdpquitA5p2Fi8cPlQa/fnmtm1o2ttJk/Y9zHpm4kccZz4qqla H83h4kxVORszuMisF5pRZHqg5sHXCCo8ZqcKjA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Clang has a rather annoying behavior of checking for integer arithmetic problems in code paths that are discarded by gcc before that perfoms the same checks. For DMA_BIT_MASK(64), this leads to a warning despite the result of the macro being completely sensible: arch/arm/plat-iop/adma.c:146:24: error: shift count >= width of type [-Werror,-Wshift-count-overflow] .coherent_dma_mask = DMA_BIT_MASK(64), The best workaround I could come up with is to shift the value twice, which makes the macro way less readable but always has the same result. Link: https://bugs.llvm.org/show_bug.cgi?id=38789 Signed-off-by: Arnd Bergmann --- include/linux/dma-mapping.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.20.0 diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index 75e60be91e5f..380d3a95d02e 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h @@ -138,7 +138,8 @@ struct dma_map_ops { extern const struct dma_map_ops dma_virt_ops; extern const struct dma_map_ops dma_dummy_ops; -#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1)) +/* double shift to work around https://bugs.llvm.org/show_bug.cgi?id=38789 */ +#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : (((1ULL<<((n)-1))-1) << 1)) #define DMA_MASK_NONE 0x0ULL