From patchwork Fri Aug 4 00:00:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Packham X-Patchwork-Id: 9880125 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 A834260311 for ; Fri, 4 Aug 2017 00:01:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9976F28935 for ; Fri, 4 Aug 2017 00:01:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8E2A028936; Fri, 4 Aug 2017 00:01:28 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 3ABDF28932 for ; Fri, 4 Aug 2017 00:01:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751916AbdHDAB0 (ORCPT ); Thu, 3 Aug 2017 20:01:26 -0400 Received: from gate2.alliedtelesis.co.nz ([202.36.163.20]:33747 "EHLO gate2.alliedtelesis.co.nz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752086AbdHDAAi (ORCPT ); Thu, 3 Aug 2017 20:00:38 -0400 Received: from mmarshal3.atlnz.lc (mmarshal3.atlnz.lc [10.32.18.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by gate2.alliedtelesis.co.nz (Postfix) with ESMTPS id 87C338448A; Fri, 4 Aug 2017 12:00:34 +1200 (NZST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alliedtelesis.co.nz; s=mail; t=1501804834; bh=IcU9rSR3DwXq8wszKpDUr9t3rzs8RXzcwPtjtbTklt8=; h=From:To:Subject:Date:In-Reply-To:References; b=iD0XdvSjA8LjvwmqbqOOD6KCzobP2oSv6bG1oUuxZhIRjevOH4BNMRHt3tUZkotcY Htb6eRSuEHOtWzJp9b5FFHgSHPm3uhSpMNUKHJaZDuCYfNiEeMYbXZdBSwx1yGveaR ChxEuDfx75X1WpCNvfxMmXTnOFnF4yXUTomzG93s= Received: from smtp (Not Verified[10.32.16.33]) by mmarshal3.atlnz.lc with Trustwave SEG (v7, 5, 8, 10121) id ; Fri, 04 Aug 2017 12:00:33 +1200 Received: from chrisp-dl.ws.atlnz.lc (chrisp-dl.ws.atlnz.lc [10.33.22.30]) by smtp (Postfix) with ESMTP id 2401B13EEEB; Fri, 4 Aug 2017 12:00:42 +1200 (NZST) Received: by chrisp-dl.ws.atlnz.lc (Postfix, from userid 1030) id 73DBB1E1D0C; Fri, 4 Aug 2017 12:00:34 +1200 (NZST) From: Chris Packham To: broonie@kernel.org, linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, andy.shevchenko@gmail.com, hsweeten@visionengravers.com Subject: [PATCH v2 6/7] spi: spi-ep93xx: remove private data 'current_msg' Date: Fri, 4 Aug 2017 12:00:22 +1200 Message-Id: <20170804000023.15624-7-chris.packham@alliedtelesis.co.nz> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170804000023.15624-1-chris.packham@alliedtelesis.co.nz> References: <20170804000023.15624-1-chris.packham@alliedtelesis.co.nz> 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 From: H Hartley Sweeten The currently in-flight message can be found from the spi master. Use that instead and remove the private data pointer. Signed-off-by: H Hartley Sweeten Reviewed-by: Andy Shevchenko --- drivers/spi/spi-ep93xx.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/drivers/spi/spi-ep93xx.c b/drivers/spi/spi-ep93xx.c index 2d80e36f5015..cf7d8175bf79 100644 --- a/drivers/spi/spi-ep93xx.c +++ b/drivers/spi/spi-ep93xx.c @@ -74,7 +74,6 @@ * @mmio: pointer to ioremap()'d registers * @sspdr_phys: physical address of the SSPDR register * @wait: wait here until given transfer is completed - * @current_msg: message that is currently processed (or %NULL if none) * @tx: current byte in transfer to transmit * @rx: current byte in transfer to receive * @fifo_level: how full is FIFO (%0..%SPI_FIFO_SIZE - %1). Receiving one @@ -93,7 +92,6 @@ struct ep93xx_spi { void __iomem *mmio; unsigned long sspdr_phys; struct completion wait; - struct spi_message *current_msg; size_t tx; size_t rx; size_t fifo_level; @@ -236,8 +234,7 @@ static void ep93xx_do_read(struct ep93xx_spi *espi, struct spi_transfer *t) static int ep93xx_spi_read_write(struct spi_master *master) { struct ep93xx_spi *espi = spi_master_get_devdata(master); - struct spi_message *msg = espi->current_msg; - struct spi_transfer *t = msg->state; + struct spi_transfer *t = master->cur_msg->state; /* read as long as RX FIFO has frames in it */ while ((readl(espi->mmio + SSPSR) & SSPSR_RNE)) { @@ -290,7 +287,7 @@ ep93xx_spi_dma_prepare(struct spi_master *master, enum dma_transfer_direction dir) { struct ep93xx_spi *espi = spi_master_get_devdata(master); - struct spi_transfer *t = espi->current_msg->state; + struct spi_transfer *t = master->cur_msg->state; struct dma_async_tx_descriptor *txd; enum dma_slave_buswidth buswidth; struct dma_slave_config conf; @@ -415,13 +412,12 @@ static void ep93xx_spi_dma_callback(void *callback_param) static void ep93xx_spi_dma_transfer(struct spi_master *master) { struct ep93xx_spi *espi = spi_master_get_devdata(master); - struct spi_message *msg = espi->current_msg; struct dma_async_tx_descriptor *rxd, *txd; rxd = ep93xx_spi_dma_prepare(master, DMA_DEV_TO_MEM); if (IS_ERR(rxd)) { dev_err(&master->dev, "DMA RX failed: %ld\n", PTR_ERR(rxd)); - msg->status = PTR_ERR(rxd); + master->cur_msg->status = PTR_ERR(rxd); return; } @@ -429,7 +425,7 @@ static void ep93xx_spi_dma_transfer(struct spi_master *master) if (IS_ERR(txd)) { ep93xx_spi_dma_finish(master, DMA_DEV_TO_MEM); dev_err(&master->dev, "DMA TX failed: %ld\n", PTR_ERR(txd)); - msg->status = PTR_ERR(txd); + master->cur_msg->status = PTR_ERR(txd); return; } @@ -587,9 +583,7 @@ static int ep93xx_spi_transfer_one_message(struct spi_master *master, msg->status = 0; msg->actual_length = 0; - espi->current_msg = msg; ep93xx_spi_process_message(master, msg); - espi->current_msg = NULL; spi_finalize_current_message(master); @@ -611,7 +605,7 @@ static irqreturn_t ep93xx_spi_interrupt(int irq, void *dev_id) writel(0, espi->mmio + SSPICR); dev_warn(&master->dev, "receive overrun, aborting the message\n"); - espi->current_msg->status = -EIO; + master->cur_msg->status = -EIO; } else { /* * Interrupt is either RX (RIS) or TX (TIS). For both cases we