From patchwork Thu Jul 27 22:03:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Packham X-Patchwork-Id: 9867559 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 962356038F for ; Thu, 27 Jul 2017 22:03:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8A4FD2887B for ; Thu, 27 Jul 2017 22:03:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7F52D28897; Thu, 27 Jul 2017 22:03:36 +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=ham 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 0C33C2889C for ; Thu, 27 Jul 2017 22:03:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751623AbdG0WDf (ORCPT ); Thu, 27 Jul 2017 18:03:35 -0400 Received: from gate2.alliedtelesis.co.nz ([202.36.163.20]:48284 "EHLO gate2.alliedtelesis.co.nz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751633AbdG0WDe (ORCPT ); Thu, 27 Jul 2017 18:03:34 -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 CEE8A86CE8; Fri, 28 Jul 2017 10:03:24 +1200 (NZST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alliedtelesis.co.nz; s=mail; t=1501193004; bh=p4MzDxx1tr2TcpddSapG5DjJiOSMCn0ifG8MNc0IEE4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=g6zm3myP95FH/QoOMKOtXNQkEE307SfTUbyM5bSosARys770JxDhItbh92QWWzzx6 FzrmBuk4/LrQhlQ8T726PUSiHSzsDy8vNqspmYR9I/qA94Voaw4mqTs0fnn/TEYzsf xBTvK1S4MgscOsTHN6SNnxyDxPQx5GtwhDgQwowg= Received: from smtp (Not Verified[10.32.16.33]) by mmarshal3.atlnz.lc with Trustwave SEG (v7, 5, 8, 10121) id ; Fri, 28 Jul 2017 10:03:23 +1200 Received: from chrisp-dl.ws.atlnz.lc (chrisp-dl.ws.atlnz.lc [10.33.22.30]) by smtp (Postfix) with ESMTP id D5B0C13EEF7; Fri, 28 Jul 2017 10:03:29 +1200 (NZST) Received: by chrisp-dl.ws.atlnz.lc (Postfix, from userid 1030) id B49961E04D9; Fri, 28 Jul 2017 10:03:22 +1200 (NZST) From: Chris Packham To: andy.shevchenko@gmail.com Cc: linux-spi@vger.kernel.org Subject: [RFC PATCH v2 05/12] spi: spi-ep93xx: remove private data 'current_msg' Date: Fri, 28 Jul 2017 10:03:15 +1200 Message-Id: <20170727220322.26654-6-chris.packham@alliedtelesis.co.nz> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170727220322.26654-1-chris.packham@alliedtelesis.co.nz> References: <20170727220322.26654-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 --- 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 f276ddee5a2e..dd376266d77e 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