From patchwork Fri Sep 2 21:22:27 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 9311691 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 71B5060772 for ; Fri, 2 Sep 2016 21:23:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 61B9A2985C for ; Fri, 2 Sep 2016 21:23:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 521B429843; Fri, 2 Sep 2016 21:23:06 +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=-5.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, 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 E2EC529843 for ; Fri, 2 Sep 2016 21:23:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752014AbcIBVXE (ORCPT ); Fri, 2 Sep 2016 17:23:04 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:35452 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751917AbcIBVXD (ORCPT ); Fri, 2 Sep 2016 17:23:03 -0400 Received: by mail-wm0-f68.google.com with SMTP id c133so4383275wmd.2 for ; Fri, 02 Sep 2016 14:23:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:subject:to:references:cc:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=m6aWCzyRYdYPItqNK0KdKp6BkzB1nBydObmfPqAvw50=; b=CTIj6eRiLquwM/WWQCQbH1EKBdzfKSXhtJM7Vc4lg2D3iZBvOJjEbV+xegnas253nP 40oHvKbisnvcTrvJb0NSvHrkEVVrnnaQhbMjJvu4ADtzG8QUTJrveT3ligYHhbzZjywl 8Oq3eXudCiy9kPO4KfSvWgmfXRMe+FyKVQRb1wkdSQ5aGdAoigAh77QKLnRGiV+GROYQ fJZBb3M5RP7aSStg70/LWsksMtpdJzUPf7CxQ1rGO1jzehKNT129CAKUJosMhnNotLN1 M665eLGDO6yxhM3AQlVAGfOiIzbxAd9+L2x6vePBH0QAbPNeZhUHY9tShLqGFcQ+ne8/ ueuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:subject:to:references:cc:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=m6aWCzyRYdYPItqNK0KdKp6BkzB1nBydObmfPqAvw50=; b=Uvc7mACMFkpTFn1hJBmrc3QSuZl3z6mfhMmY1Ht3bmHmSRW6AEZmsqbqk3kZCJnGvp OQKiwaEsX7/yziJQDWza6xrdxrjE8BA1dpNQXOPKU2XULrh8aUpHFp6yP/iQ6SJR1vPl EesGWP7zQtPq/UFrL6q7LtTGwXgr4xJHWsI5fvvwRRYzIxXkYhutC6DcJjhpt1ZfE+jz jjgxS6p1A/ZKW553VC5IYmi9g0u7PyJVpdUNaQ0GSivWrzGB7Dv3KhJLjrGSGesfQtGl 5v17hrvOr5t8ljv+BbJjWaCaQziubLYZQ/aQNhidAw7uUntXy2znuAvGcN6H/UBHntWq gyrg== X-Gm-Message-State: AE9vXwOTI1nnPhn3GQ6iHdjkvNtMHW4Q/llp5yuQ9kpXzHSiD6iSj0Naf1RpedYBq2f90w== X-Received: by 10.28.175.16 with SMTP id y16mr5252474wme.64.1472851381988; Fri, 02 Sep 2016 14:23:01 -0700 (PDT) Received: from ?IPv6:2003:62:5f43:9500:39ed:a1fb:9a43:e02d? (p200300625F43950039EDA1FB9A43E02D.dip0.t-ipconnect.de. [2003:62:5f43:9500:39ed:a1fb:9a43:e02d]) by smtp.googlemail.com with ESMTPSA id pf5sm12220460wjb.42.2016.09.02.14.23.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 02 Sep 2016 14:23:01 -0700 (PDT) From: Heiner Kallweit Subject: [PATCH v2 17/23] spi: fsl-espi: merge fsl_espi_bufs and fsl_espi_cpu_bufs To: Mark Brown References: Cc: "linux-spi@vger.kernel.org" Message-ID: <5e1072a3-58ef-e733-7f49-8cc97a319c47@gmail.com> Date: Fri, 2 Sep 2016 23:22:27 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: 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 fsl_espi_bufs and fsl_espi_cpu_bufs are very small that we can merge them. Signed-off-by: Heiner Kallweit --- v2: - rebased --- drivers/spi/spi-fsl-espi.c | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/drivers/spi/spi-fsl-espi.c b/drivers/spi/spi-fsl-espi.c index 8d6a570..190ca5c 100644 --- a/drivers/spi/spi-fsl-espi.c +++ b/drivers/spi/spi-fsl-espi.c @@ -206,31 +206,15 @@ static void fsl_espi_setup_transfer(struct spi_device *spi, fsl_espi_change_mode(spi); } -static void fsl_espi_cpu_bufs(struct mpc8xxx_spi *mspi, struct spi_transfer *t, - unsigned int len) -{ - u32 word; - struct fsl_espi_reg *reg_base = mspi->reg_base; - - mspi->count = len; - - /* enable rx ints */ - mpc8xxx_spi_write_reg(®_base->mask, SPIM_NE); - - /* transmit word */ - word = mspi->get_tx(mspi); - mpc8xxx_spi_write_reg(®_base->transmit, word); -} - static int fsl_espi_bufs(struct spi_device *spi, struct spi_transfer *t) { struct mpc8xxx_spi *mpc8xxx_spi = spi_master_get_devdata(spi->master); struct fsl_espi_reg *reg_base = mpc8xxx_spi->reg_base; - unsigned int len = t->len; + u32 word; int ret; mpc8xxx_spi->len = t->len; - len = roundup(len, 4) / 4; + mpc8xxx_spi->count = roundup(t->len, 4) / 4; mpc8xxx_spi->tx = t->tx_buf; mpc8xxx_spi->rx = t->rx_buf; @@ -246,7 +230,12 @@ static int fsl_espi_bufs(struct spi_device *spi, struct spi_transfer *t) mpc8xxx_spi_write_reg(®_base->command, (SPCOM_CS(spi->chip_select) | SPCOM_TRANLEN(t->len - 1))); - fsl_espi_cpu_bufs(mpc8xxx_spi, t, len); + /* enable rx ints */ + mpc8xxx_spi_write_reg(®_base->mask, SPIM_NE); + + /* transmit word */ + word = mpc8xxx_spi->get_tx(mpc8xxx_spi); + mpc8xxx_spi_write_reg(®_base->transmit, word); /* Won't hang up forever, SPI bus sometimes got lost interrupts... */ ret = wait_for_completion_timeout(&mpc8xxx_spi->done, 2 * HZ);