From patchwork Thu Feb 16 23:48:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: H Hartley Sweeten X-Patchwork-Id: 9578537 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 B898960209 for ; Thu, 16 Feb 2017 23:50:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A85EE286A0 for ; Thu, 16 Feb 2017 23:50:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9D8D82869F; Thu, 16 Feb 2017 23:50:07 +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=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 4AB1E286A1 for ; Thu, 16 Feb 2017 23:50:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933755AbdBPXuG (ORCPT ); Thu, 16 Feb 2017 18:50:06 -0500 Received: from dukecmmtar03.coxmail.com ([68.99.120.44]:63138 "EHLO dukecmmtar03.coxmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933761AbdBPXuF (ORCPT ); Thu, 16 Feb 2017 18:50:05 -0500 Received: from dukecmimpo02.coxmail.com ([68.99.120.135]) by dukecmmtar03.coxmail.com (InterMail vM.8.01.05.28 201-2260-151-171-20160122) with ESMTP id <20170216235003.ZSSJ14855.dukecmmtar03.coxmail.com@dukecmimpo02.coxmail.com>; Thu, 16 Feb 2017 18:50:03 -0500 Received: from wheezy.visionengravers.com ([184.183.19.121]) by dukecmimpo02.coxmail.com with bizsmtp id lbp21u00N2ckKpC01bp243; Thu, 16 Feb 2017 18:49:03 -0500 Received: from bigguiness by wheezy.visionengravers.com with local (Exim 4.80) (envelope-from ) id 1ceVnB-000PUl-Uw; Thu, 16 Feb 2017 16:48:53 -0700 From: H Hartley Sweeten To: linux-spi@vger.kernel.org Cc: H Hartley Sweeten Subject: [PATCH 4/7] spi: spi-ep93xx: absorb the interrupt enable/disable helpers Date: Thu, 16 Feb 2017 16:48:48 -0700 Message-Id: <20170216234851.97938-5-hsweeten@visionengravers.com> X-Mailer: git-send-email 2.10.0 In-Reply-To: <20170216234851.97938-1-hsweeten@visionengravers.com> References: <20170216234851.97938-1-hsweeten@visionengravers.com> 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 These are each only called once. Just absorb them into the callers. Signed-off-by: H Hartley Sweeten --- drivers/spi/spi-ep93xx.c | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/drivers/spi/spi-ep93xx.c b/drivers/spi/spi-ep93xx.c index dd179f3..e8f454b 100644 --- a/drivers/spi/spi-ep93xx.c +++ b/drivers/spi/spi-ep93xx.c @@ -111,24 +111,6 @@ struct ep93xx_spi { /* converts bits per word to CR0.DSS value */ #define bits_per_word_to_dss(bpw) ((bpw) - 1) -static void ep93xx_spi_enable_interrupts(const struct ep93xx_spi *espi) -{ - unsigned int val; - - val = readl(espi->mmio + SSPCR1); - val |= (SSPCR1_RORIE | SSPCR1_TIE | SSPCR1_RIE); - writel(val, espi->mmio + SSPCR1); -} - -static void ep93xx_spi_disable_interrupts(const struct ep93xx_spi *espi) -{ - unsigned int val; - - val = readl(espi->mmio + SSPCR1); - val &= ~(SSPCR1_RORIE | SSPCR1_TIE | SSPCR1_RIE); - writel(val, espi->mmio + SSPCR1); -} - /** * ep93xx_spi_calc_divisors() - calculates SPI clock divisors * @espi: ep93xx SPI controller struct @@ -282,7 +264,12 @@ static void ep93xx_spi_pio_transfer(struct ep93xx_spi *espi) * FIFO, enable interrupts, and wait for the transfer to complete. */ if (ep93xx_spi_read_write(espi)) { - ep93xx_spi_enable_interrupts(espi); + unsigned int val; + + val = readl(espi->mmio + SSPCR1); + val |= (SSPCR1_RORIE | SSPCR1_TIE | SSPCR1_RIE); + writel(val, espi->mmio + SSPCR1); + wait_for_completion(&espi->wait); } } @@ -604,6 +591,7 @@ static int ep93xx_spi_transfer_one_message(struct spi_master *master, static irqreturn_t ep93xx_spi_interrupt(int irq, void *dev_id) { struct ep93xx_spi *espi = dev_id; + unsigned int val; /* * If we got ROR (receive overrun) interrupt we know that something is @@ -635,8 +623,12 @@ static irqreturn_t ep93xx_spi_interrupt(int irq, void *dev_id) * any case we disable interrupts and notify the worker to handle * any post-processing of the message. */ - ep93xx_spi_disable_interrupts(espi); + val = readl(espi->mmio + SSPCR1); + val &= ~(SSPCR1_RORIE | SSPCR1_TIE | SSPCR1_RIE); + writel(val, espi->mmio + SSPCR1); + complete(&espi->wait); + return IRQ_HANDLED; }