From patchwork Tue Sep 13 21:15:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 9329967 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 CE4876077F for ; Tue, 13 Sep 2016 21:16:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BE8D029785 for ; Tue, 13 Sep 2016 21:16:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B3604297AC; Tue, 13 Sep 2016 21:16:54 +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_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, 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 5641029785 for ; Tue, 13 Sep 2016 21:16:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752651AbcIMVQx (ORCPT ); Tue, 13 Sep 2016 17:16:53 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:33163 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750940AbcIMVQx (ORCPT ); Tue, 13 Sep 2016 17:16:53 -0400 Received: by mail-wm0-f68.google.com with SMTP id b187so305150wme.0 for ; Tue, 13 Sep 2016 14:16:52 -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=lpz9xuhbilMyXvH3S+rdy7z39ReH94PT/Zfjasf5008=; b=HxXCUC1P7JaQaMUchgZLCNv5AYuWvZKMXa6ebnOFRKGTE2T9uCl/9ZGCQHXyj6w+Q5 fTgifwyoURbBJF/Hb0gxdT4R+qBcrsIZyouKur2Z4HmKNhK5KKLgu3vFFVPOcXSIJ+WT TWUc1AwqEDFyb2UNohQNVlvLM0mqrog+MyZCbDtSTIVpOf4d9yBze/PftgoOeuQglOlK 1th6Aifomk7R2GXyRpgpcJC1EU6BMj1WmyYkjLlPK92EjDnJyFGpHhwq8ohg5R4Y+4LW qmFpFv0ViatgJYq3nV7XDJN5lEHJvB7N1KmLz1t65dTeXLmeImAghklGYijodJt0rpYZ v6Jg== 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=lpz9xuhbilMyXvH3S+rdy7z39ReH94PT/Zfjasf5008=; b=Z6qfhFxFIA2WsmfVtEjKB5SO9cDtOzGu+7zajfQcnKjTCXmECfW0vic456SiWIUpvs M3hRC5kFZxYCoeOPaOdbkcxVoUmcHcWbH2y7OEEz9VMLmtfdQPrdeubu5W+0YwHezDsy zeHSlodt4O3N0sqqQayrxFFWMtXXSL4c6Qj+33kB/SnRpaGuA6rHgiNblzzq3zTbujHe MMzCa4c/aBu22ELi7YKVuHZYRG/7ivI8ioACWS/7WaKWLw/e+igBGmUWOXxq7tRow4o9 9MgyOp58WyqiIaGtnDoMgtmXnfsiPye2IEsJaTxO+RJn7qPqCeoUVQ8Tv6+66CzJzIIp kkxA== X-Gm-Message-State: AE9vXwMlQrMs+0jup6U0W0Kur4g+iUvs5bzA1zx8EZGTUUDBXhtZhlAPB8dp6nu5CCBgLQ== X-Received: by 10.194.17.6 with SMTP id k6mr2468597wjd.65.1473801411495; Tue, 13 Sep 2016 14:16:51 -0700 (PDT) Received: from ?IPv6:2003:62:5f43:9500:1103:9781:fa4d:e4fc? (p200300625F43950011039781FA4DE4FC.dip0.t-ipconnect.de. [2003:62:5f43:9500:1103:9781:fa4d:e4fc]) by smtp.googlemail.com with ESMTPSA id ml1sm622248wjb.46.2016.09.13.14.16.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Sep 2016 14:16:51 -0700 (PDT) From: Heiner Kallweit Subject: [PATCH 2/4] spi: fsl-espi: improve and simplify interrupt handler To: Mark Brown References: <848f06e1-3cb9-bef1-bb41-455fa72822b1@gmail.com> Cc: "linux-spi@vger.kernel.org" Message-ID: <5be7ab71-3401-0e9e-b374-d781afda98f1@gmail.com> Date: Tue, 13 Sep 2016 23:15:57 +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: <848f06e1-3cb9-bef1-bb41-455fa72822b1@gmail.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 Simplify the interrupt handler a little. In addition don't call fsl_espi_cpu_irq() if no event bit is set. Signed-off-by: Heiner Kallweit --- drivers/spi/spi-fsl-espi.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/spi/spi-fsl-espi.c b/drivers/spi/spi-fsl-espi.c index 060624f..032bf3a 100644 --- a/drivers/spi/spi-fsl-espi.c +++ b/drivers/spi/spi-fsl-espi.c @@ -443,17 +443,11 @@ static void fsl_espi_cpu_irq(struct mpc8xxx_spi *mspi, u32 events) ®_base->event)) & SPIE_NF), 1000, 0); if (!ret) { dev_err(mspi->dev, "tired waiting for SPIE_NF\n"); - - /* Clear the SPIE bits */ - mpc8xxx_spi_write_reg(®_base->event, events); complete(&mspi->done); return; } } - /* Clear the events */ - mpc8xxx_spi_write_reg(®_base->event, events); - mspi->count -= 1; if (mspi->count) { u32 word = mspi->get_tx(mspi); @@ -468,19 +462,21 @@ static irqreturn_t fsl_espi_irq(s32 irq, void *context_data) { struct mpc8xxx_spi *mspi = context_data; struct fsl_espi_reg *reg_base = mspi->reg_base; - irqreturn_t ret = IRQ_NONE; u32 events; /* Get interrupt events(tx/rx) */ events = mpc8xxx_spi_read_reg(®_base->event); - if (events) - ret = IRQ_HANDLED; + if (!events) + return IRQ_NONE; dev_vdbg(mspi->dev, "%s: events %x\n", __func__, events); fsl_espi_cpu_irq(mspi, events); - return ret; + /* Clear the events */ + mpc8xxx_spi_write_reg(®_base->event, events); + + return IRQ_HANDLED; } #ifdef CONFIG_PM