From patchwork Tue May 12 10:32:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Sperl X-Patchwork-Id: 6387201 Return-Path: X-Original-To: patchwork-linux-spi@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 DC8E3BEEE1 for ; Tue, 12 May 2015 10:32:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1F251203EC for ; Tue, 12 May 2015 10:32:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 35162203F7 for ; Tue, 12 May 2015 10:32:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752673AbbELKcf (ORCPT ); Tue, 12 May 2015 06:32:35 -0400 Received: from 212-186-180-163.dynamic.surfer.at ([212.186.180.163]:50893 "EHLO cgate.sperl.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752997AbbELKcf (ORCPT ); Tue, 12 May 2015 06:32:35 -0400 Received: from raspb.intern.sperl.org (account martin@sperl.org [10.10.10.32] verified) by sperl.org (CommuniGate Pro SMTP 6.1.2) with ESMTPSA id 6321720; Tue, 12 May 2015 10:32:32 +0000 From: kernel@martin.sperl.org To: Mark Brown , Stephen Warren , Lee Jones , linux-spi@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, Stephen Rothwell Cc: Martin Sperl Subject: [PATCH] spi: bcm2835: fix kbuild compile warnings/errors and a typo Date: Tue, 12 May 2015 10:32:08 +0000 Message-Id: <1431426729-2154-1-git-send-email-kernel@martin.sperl.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <55516950.5070105@wwwdotorg.org> References: <55516950.5070105@wwwdotorg.org> Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_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 From: Martin Sperl fixes several warnings/error emmitted by the kbuild system: * warn: cast from pointer to integer of different size using size_t instead of u32 * error: 'SZ_4K' undeclared moved to PAGE_SIZE and PAGE_MASK instead Review showed also a typo in the same code where tx_buff was checked twice instead of checking both rx and tx_buff. Reported by: Stephen Rothwell Signed-off-by: Martin Sperl --- drivers/spi/spi-bcm2835.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/spi/spi-bcm2835.c b/drivers/spi/spi-bcm2835.c index 6ab43c8..ac1760e 100644 --- a/drivers/spi/spi-bcm2835.c +++ b/drivers/spi/spi-bcm2835.c @@ -20,6 +20,7 @@ * GNU General Public License for more details. */ +#include #include #include #include @@ -378,18 +379,19 @@ static bool bcm2835_spi_can_dma(struct spi_master *master, } /* if we run rx/tx_buf with word aligned addresses then we are OK */ - if (((u32)tfr->tx_buf % 4 == 0) && ((u32)tfr->tx_buf % 4 == 0)) + if ((((size_t)tfr->rx_buf & 3) == 0) && + (((size_t)tfr->tx_buf & 3) == 0)) return true; /* otherwise we only allow transfers within the same page * to avoid wasting time on dma_mapping when it is not practical */ - if (((u32)tfr->tx_buf % SZ_4K) + tfr->len > SZ_4K) { + if (((size_t)tfr->tx_buf & PAGE_MASK) + tfr->len > PAGE_SIZE) { dev_warn_once(&spi->dev, "Unaligned spi tx-transfer bridging page\n"); return false; } - if (((u32)tfr->rx_buf % SZ_4K) + tfr->len > SZ_4K) { + if (((size_t)tfr->rx_buf & PAGE_MASK) + tfr->len > PAGE_SIZE) { dev_warn_once(&spi->dev, "Unaligned spi tx-transfer bridging page\n"); return false;