From patchwork Wed Jan 24 14:10:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Chevallier X-Patchwork-Id: 10182611 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 8FC1060233 for ; Wed, 24 Jan 2018 14:10:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7F8AF28526 for ; Wed, 24 Jan 2018 14:10:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 72EA6287E8; Wed, 24 Jan 2018 14:10:27 +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=unavailable 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 2215B28526 for ; Wed, 24 Jan 2018 14:10:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933829AbeAXOKA (ORCPT ); Wed, 24 Jan 2018 09:10:00 -0500 Received: from idris.smile.fr ([91.216.209.19]:51578 "EHLO idris.smile.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933845AbeAXOJ6 (ORCPT ); Wed, 24 Jan 2018 09:09:58 -0500 Received: from localhost (localhost [127.0.0.1]) by idris.smile.fr (Postfix) with ESMTP id 33E161EE229D; Wed, 24 Jan 2018 15:09:57 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at smile.fr Received: from idris.smile.fr ([127.0.0.1]) by localhost (bluemind-mta.prod.vitry.intranet [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IeZW4iif9S9U; Wed, 24 Jan 2018 15:09:57 +0100 (CET) Received: from smile-e5570.sigfox.io (unknown [217.114.201.133]) by idris.smile.fr (Postfix) with ESMTPSA id E2E551EE228F; Wed, 24 Jan 2018 15:09:56 +0100 (CET) From: Maxime Chevallier To: broonie@kernel.org Cc: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, gregory.clement@free-electrons.com, Maxime Chevallier Subject: [PATCH 2/2] spi: a3700: Remove endianness swapping for full-duplex transfers Date: Wed, 24 Jan 2018 15:10:48 +0100 Message-Id: <1516803048-26942-3-git-send-email-maxime.chevallier@smile.fr> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1516803048-26942-1-git-send-email-maxime.chevallier@smile.fr> References: <1516803048-26942-1-git-send-email-maxime.chevallier@smile.fr> Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Fixes the following sparse warnings : line 767: warning: incorrect type in assignment (different base types) line 767: expected unsigned int [unsigned] [assigned] [usertype] val_out line 767: got restricted __le32 [usertype] line 776: warning: cast to restricted __le32 This takes advantage of readl/writel to do the endianness reordering, and removes an extra variable in the function. Fixes: f68a7dcb91b7 ("spi: a3700: Add full-duplex support") Signed-off-by: Maxime Chevallier Reviewed-by: Gregory CLEMENT --- drivers/spi/spi-armada-3700.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/spi/spi-armada-3700.c b/drivers/spi/spi-armada-3700.c index 43ee0b56fe1c..7dcb14d303eb 100644 --- a/drivers/spi/spi-armada-3700.c +++ b/drivers/spi/spi-armada-3700.c @@ -747,7 +747,7 @@ static int a3700_spi_transfer_one_full_duplex(struct spi_master *master, struct spi_transfer *xfer) { struct a3700_spi *a3700_spi = spi_master_get_devdata(master); - u32 val_in, val_out; + u32 val; /* Disable FIFO mode */ a3700_spi_fifo_mode_set(a3700_spi, false); @@ -761,21 +761,20 @@ static int a3700_spi_transfer_one_full_duplex(struct spi_master *master, a3700_spi_bytelen_set(a3700_spi, 1); if (a3700_spi->byte_len == 1) - val_out = *a3700_spi->tx_buf; + val = *a3700_spi->tx_buf; else - val_out = cpu_to_le32(*(u32 *)a3700_spi->tx_buf); + val = *(u32 *)a3700_spi->tx_buf; - spireg_write(a3700_spi, A3700_SPI_DATA_OUT_REG, val_out); + spireg_write(a3700_spi, A3700_SPI_DATA_OUT_REG, val); /* Wait for all the data to be shifted in / out */ while (!(spireg_read(a3700_spi, A3700_SPI_IF_CTRL_REG) & A3700_SPI_XFER_DONE)) cpu_relax(); - val_in = le32_to_cpu(spireg_read(a3700_spi, - A3700_SPI_DATA_IN_REG)); + val = spireg_read(a3700_spi, A3700_SPI_DATA_IN_REG); - memcpy(a3700_spi->rx_buf, &val_in, a3700_spi->byte_len); + memcpy(a3700_spi->rx_buf, &val, a3700_spi->byte_len); a3700_spi->buf_len -= a3700_spi->byte_len; a3700_spi->tx_buf += a3700_spi->byte_len;