From patchwork Thu Nov 25 12:41:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tudor Ambarus X-Patchwork-Id: 12693648 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9F9A3C433F5 for ; Thu, 25 Nov 2021 12:43:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=GyL5A0fu5sbfEXldIxouZJCbobS8cf6WGYeY0fzzyUE=; b=B8ZNEOY1Z4s4U5 8FVBVU04nL9l/ptzgIlHNA871rI8IRJI7UlcvsaQVmv81ctosJUuiaBi5jmEqwYvEpJdJZt6NRcF5 CnhwjMfp+f0YkH5kRnImGoPEfDh4BUaqoXcuIGbDRxqPVTbrlVjDrTqcBZdvhX+SOUz2u07T54g/R QxUGI5lt0eJ5LSoQxyW2SPcUt/7bWSzpiu7LP54ZukK8UqbvHhzNnmgDhdKSIVwCzHM7c1TE12oZD YFsUqaZjive260h+mx4J8dH0xLLxz5joxOOWcYL9pZyOeuxoaX03GqFedBo9G0DkfucR5FCO9nAVZ SRoIJ9mDKcfgugblCWHg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mqE4J-007R5I-AR; Thu, 25 Nov 2021 12:41:39 +0000 Received: from esa.microchip.iphmx.com ([68.232.153.233]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mqE41-007R0g-Pv for linux-arm-kernel@lists.infradead.org; Thu, 25 Nov 2021 12:41:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1637844083; x=1669380083; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Twni1p76FodKjv3xPWrmvD2cFE0XBN5XBjkX4FZSD1U=; b=jE7KG+5BF3P484I3mu/P88kgSaXkepu9q903zMke8VmdzlxI10ApC07F 1RtZftuB+xoed78nZ+u3ZLF99DDhH6BQKTxXQ2qnk7p/xhiAqJXqabWRh SnrK7rz/InLNY/uClsdUFbzVJGD89lPSEvRvg6G/3h3j6XJ/F3vZpaZoG V3egs+OCktqEs7n5A0bOKR1H8VHHXfmkbaJgehH06EjLMYe59dh44kKPY jGiRAJ40YwrgrHIRIPlXrEjAqobK7uB+qEzhpaFJ8yufbKYT9Y71jKsI5 bnUSwGwu45nLOz9JQCSLRcKShxzB3Hx+rk+fsRMcuqtvTp5Few8eLER3h Q==; IronPort-SDR: kPC96V2z2oiETc3pap99SL43DJNlfOPFpfks2mZw/cOXVpeASiS466SPTT9cZMaBTyDFfu9+aK pAD7vIOxc6boCdRc1xkUml+NV9p2fUC6ewL57cRY/0+bsJw7Cdca1PKLrXb/zvuStVQS5tgILY ZFa1QUM45RDRcVjR5U8Vzf7hAaAlVHXy5q0s+TgTlWe6othSPxBw4lpEAv+qStvJ6iGse5u32U J9GfhGypj+/AOl36hJBLaPgahILPqZpJjQyBFaiYdbTL074QvMmGDP6eAEF32ulmDnoUS1we4k aAJxRD+oLMBLyOcWo8XOHcXV X-IronPort-AV: E=Sophos;i="5.87,263,1631602800"; d="scan'208";a="144550448" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa5.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 25 Nov 2021 05:41:22 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Thu, 25 Nov 2021 05:41:21 -0700 Received: from ROB-ULT-M18064N.mchp-main.com (10.10.115.15) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server id 15.1.2176.14 via Frontend Transport; Thu, 25 Nov 2021 05:41:19 -0700 From: Tudor Ambarus To: Subject: [PATCH 1/2] spi: atmel: Drop slave_config argument in atmel_spi_dma_slave_config() Date: Thu, 25 Nov 2021 14:41:09 +0200 Message-ID: <20211125124110.838037-2-tudor.ambarus@microchip.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211125124110.838037-1-tudor.ambarus@microchip.com> References: <20211125124110.838037-1-tudor.ambarus@microchip.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211125_044121_876145_99499E5E X-CRM114-Status: GOOD ( 13.46 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alexandre.belloni@bootlin.com, Tudor Ambarus , linux-kernel@vger.kernel.org, ludovic.desroches@microchip.com, linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The callers passed a pointer to slave_config as an argument of atmel_spi_dma_slave_config(), but they did not use it afterwards. Use instead a local variable in atmel_spi_dma_slave_config(), and stop passing arguments that are not needed in the callers. Signed-off-by: Tudor Ambarus --- drivers/spi/spi-atmel.c | 38 +++++++++++++++++--------------------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c index f872cf196c2f..22c7239aff75 100644 --- a/drivers/spi/spi-atmel.c +++ b/drivers/spi/spi-atmel.c @@ -433,26 +433,25 @@ static bool atmel_spi_can_dma(struct spi_master *master, } -static int atmel_spi_dma_slave_config(struct atmel_spi *as, - struct dma_slave_config *slave_config, - u8 bits_per_word) +static int atmel_spi_dma_slave_config(struct atmel_spi *as, u8 bits_per_word) { struct spi_master *master = platform_get_drvdata(as->pdev); + struct dma_slave_config slave_config; int err = 0; if (bits_per_word > 8) { - slave_config->dst_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES; - slave_config->src_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES; + slave_config.dst_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES; + slave_config.src_addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES; } else { - slave_config->dst_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE; - slave_config->src_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE; + slave_config.dst_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE; + slave_config.src_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE; } - slave_config->dst_addr = (dma_addr_t)as->phybase + SPI_TDR; - slave_config->src_addr = (dma_addr_t)as->phybase + SPI_RDR; - slave_config->src_maxburst = 1; - slave_config->dst_maxburst = 1; - slave_config->device_fc = false; + slave_config.dst_addr = (dma_addr_t)as->phybase + SPI_TDR; + slave_config.src_addr = (dma_addr_t)as->phybase + SPI_RDR; + slave_config.src_maxburst = 1; + slave_config.dst_maxburst = 1; + slave_config.device_fc = false; /* * This driver uses fixed peripheral select mode (PS bit set to '0' in @@ -468,8 +467,8 @@ static int atmel_spi_dma_slave_config(struct atmel_spi *as, * So we'd rather write only one data at the time. Hence the transmit * path works the same whether FIFOs are available (and enabled) or not. */ - slave_config->direction = DMA_MEM_TO_DEV; - if (dmaengine_slave_config(master->dma_tx, slave_config)) { + slave_config.direction = DMA_MEM_TO_DEV; + if (dmaengine_slave_config(master->dma_tx, &slave_config)) { dev_err(&as->pdev->dev, "failed to configure tx dma channel\n"); err = -EINVAL; @@ -483,8 +482,8 @@ static int atmel_spi_dma_slave_config(struct atmel_spi *as, * So the receive path works the same whether FIFOs are available (and * enabled) or not. */ - slave_config->direction = DMA_DEV_TO_MEM; - if (dmaengine_slave_config(master->dma_rx, slave_config)) { + slave_config.direction = DMA_DEV_TO_MEM; + if (dmaengine_slave_config(master->dma_rx, &slave_config)) { dev_err(&as->pdev->dev, "failed to configure rx dma channel\n"); err = -EINVAL; @@ -496,7 +495,6 @@ static int atmel_spi_dma_slave_config(struct atmel_spi *as, static int atmel_spi_configure_dma(struct spi_master *master, struct atmel_spi *as) { - struct dma_slave_config slave_config; struct device *dev = &as->pdev->dev; int err; @@ -518,7 +516,7 @@ static int atmel_spi_configure_dma(struct spi_master *master, goto error; } - err = atmel_spi_dma_slave_config(as, &slave_config, 8); + err = atmel_spi_dma_slave_config(as, 8); if (err) goto error; @@ -700,7 +698,6 @@ static int atmel_spi_next_xfer_dma_submit(struct spi_master *master, struct dma_chan *txchan = master->dma_tx; struct dma_async_tx_descriptor *rxdesc; struct dma_async_tx_descriptor *txdesc; - struct dma_slave_config slave_config; dma_cookie_t cookie; dev_vdbg(master->dev.parent, "atmel_spi_next_xfer_dma_submit\n"); @@ -712,8 +709,7 @@ static int atmel_spi_next_xfer_dma_submit(struct spi_master *master, *plen = xfer->len; - if (atmel_spi_dma_slave_config(as, &slave_config, - xfer->bits_per_word)) + if (atmel_spi_dma_slave_config(as, xfer->bits_per_word)) goto err_exit; /* Send both scatterlists */