From patchwork Thu Dec 18 05:07:26 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Golle X-Patchwork-Id: 422476 X-Patchwork-Delegate: blogic@openwrt.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from arrakis.dune.hu (arrakis.dune.hu [78.24.191.176]) (using TLSv1.1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 1D0BA1400EA for ; Thu, 18 Dec 2014 16:07:15 +1100 (AEDT) Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 9EA2F284E91; Thu, 18 Dec 2014 06:05:01 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on arrakis.dune.hu X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00, T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.2 Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 966E228A680 for ; Thu, 18 Dec 2014 06:04:39 +0100 (CET) X-policyd-weight: using cached result; rate:hard: -7.6 Received: from fudo.makrotopia.org (fudo.makrotopia.org [5.135.190.93]) by arrakis.dune.hu (Postfix) with ESMTPS for ; Thu, 18 Dec 2014 06:04:39 +0100 (CET) Received: from local by fudo.makrotopia.org with esmtpsa (TLSv1.2:AES128-GCM-SHA256:128) (Exim 4.84) (envelope-from ) id 1Y1TID-0007fF-TH; Thu, 18 Dec 2014 06:06:30 +0100 Date: Thu, 18 Dec 2014 06:07:26 +0100 From: Daniel Golle To: openwrt-devel@lists.openwrt.org Message-ID: <20141218050718.GA20578@makrotopia.org> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) Subject: [OpenWrt-Devel] [PATCH 4/4] oxnas: sata_oxnas: make irq handler more readable X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: openwrt-devel-bounces@lists.openwrt.org Sender: "openwrt-devel" safed one level of indention by using 'continue' instead of a lengthy if-clause. Signed-off-by: Daniel Golle --- target/linux/oxnas/files/drivers/ata/sata_oxnas.c | 26 ++++++++++++----------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/target/linux/oxnas/files/drivers/ata/sata_oxnas.c b/target/linux/oxnas/files/drivers/ata/sata_oxnas.c index 30bcb23..b63cd60 100644 --- a/target/linux/oxnas/files/drivers/ata/sata_oxnas.c +++ b/target/linux/oxnas/files/drivers/ata/sata_oxnas.c @@ -2041,7 +2041,7 @@ int sata_oxnas_init_controller(struct ata_host *host) * * @param port SATA port to check and if necessary, correct. */ -static int sata_oxnas_bug_6320_workaround(struct ata_port *ap) +static int sata_oxnas_bug_6320_detect(struct ata_port *ap) { struct sata_oxnas_port_priv *pd = ap->private_data; void __iomem *core_base = pd->core_base; @@ -2175,17 +2175,19 @@ static irqreturn_t sata_oxnas_interrupt(int irq, void *dev_instance) /* check the raw end of command interrupt to see if the * port is done */ mask = (COREINT_END << port_no); - if (int_status & mask) { - /* this port had an interrupt, clear it */ - iowrite32(mask, core_base + CORE_INT_CLEAR); - bug_present = - (hd->current_ucode == UNKNOWN_MODE) ? - sata_oxnas_bug_6320_workaround( - ah->ports[port_no]):0; - sata_oxnas_port_irq(ah->ports[port_no], - bug_present); - ret = IRQ_HANDLED; - } + if (!(int_status & mask)) + continue; + + /* this port had an interrupt, clear it */ + iowrite32(mask, core_base + CORE_INT_CLEAR); + /* check for bug 6320 only if no microcode was loaded */ + bug_present = (hd->current_ucode == UNKNOWN_MODE) ? + sata_oxnas_bug_6320_detect(ah->ports[port_no]) : + 0; + + sata_oxnas_port_irq(ah->ports[port_no], + bug_present); + ret = IRQ_HANDLED; } }