From patchwork Thu Mar 21 13:49:44 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Baltieri X-Patchwork-Id: 2313601 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 474A0400E6 for ; Thu, 21 Mar 2013 13:54:22 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UIfsf-0007Vf-Cr; Thu, 21 Mar 2013 13:50:09 +0000 Received: from mail-wi0-x22c.google.com ([2a00:1450:400c:c05::22c]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UIfsT-0007S1-OS for linux-arm-kernel@lists.infradead.org; Thu, 21 Mar 2013 13:49:58 +0000 Received: by mail-wi0-f172.google.com with SMTP id hj13so431196wib.17 for ; Thu, 21 Mar 2013 06:49:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer :x-gm-message-state; bh=41n/xs05yT9l8ujBiLbO4xVslce5DBokon5YIDnaK7g=; b=CZrzJCHcIBjT7UhQ/Vq87atnHlojHs3trJMfEwF0JRFis2bYtlcamua2Z5f/toT5ht N2vxU0JgdDGhCQwqe6IeMcY90JCyqlb8QLWrfrOMGxdRTHvoK3mOfTpXTHc1JmK0WmLN QoxsVyN9DXVlhl4zZCje2XFOmnp2cKm32erT7D4at8DdjDoVacx2vzQEIZZX+gr1BAYW WHMiUp00VIMBch2A+52L6g2aYn6FQ8XtOMR09BBgdRjbq+kVOjcOMbhR+Lnd6pYL48Td otKPHgVATKN4WgfGNPLaAVy8VXIq1PTWVsLymoVysmkyn7ipLJ55KmD7QCojtNq3N7IK fElg== X-Received: by 10.180.185.197 with SMTP id fe5mr5213152wic.3.1363873795874; Thu, 21 Mar 2013 06:49:55 -0700 (PDT) Received: from localhost ([2a01:2003:1:1e91:8e70:5aff:feac:ad8]) by mx.google.com with ESMTPS id dp5sm4868864wib.1.2013.03.21.06.49.48 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 21 Mar 2013 06:49:55 -0700 (PDT) From: Fabio Baltieri To: Samuel Ortiz , Anton Vorontsov Subject: [PATCH] mfd: ab8500-core: Ignore masked out interrupts Date: Thu, 21 Mar 2013 14:49:44 +0100 Message-Id: <1363873784-27378-1-git-send-email-fabio.baltieri@linaro.org> X-Mailer: git-send-email 1.8.1.3 X-Gm-Message-State: ALoCoQkuFMm88XnOrkcbYpl8qscvr/YxuBtA4wEQJHFoNBa9+tuKBatPn46KuGviUJPRNtPruOn1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130321_094957_924469_3A761149 X-CRM114-Status: GOOD ( 13.59 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Fabio Baltieri , Linus Walleij , Lee Jones , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org AB8500 asserts LATCH bits for masked out interrupts. This patch explicitly masks those out using the cached mask value to prevent handle_nested_irq() being called for masked IRQ on the same register as unmasked ones. Acked-by: Linus Walleij Signed-off-by: Fabio Baltieri --- Hello Samuel, Anton, this is a small fix for the AB8500 irq generation code. As this depends on Lee's patches already merged in the battery tree, this patch is based on Anton's repository, and should apply cleanly on it and on next. Samuel, does it make sense to get your ack for this patch and have it merged with the others in the battery tree? Thanks, Fabio drivers/mfd/ab8500-core.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/drivers/mfd/ab8500-core.c b/drivers/mfd/ab8500-core.c index f276352..36751f3 100644 --- a/drivers/mfd/ab8500-core.c +++ b/drivers/mfd/ab8500-core.c @@ -458,22 +458,23 @@ static void update_latch_offset(u8 *offset, int i) static int ab8500_handle_hierarchical_line(struct ab8500 *ab8500, int latch_offset, u8 latch_val) { - int int_bit = __ffs(latch_val); - int line, i; + int int_bit, line, i; - do { - int_bit = __ffs(latch_val); + for (i = 0; i < ab8500->mask_size; i++) + if (ab8500->irq_reg_offset[i] == latch_offset) + break; - for (i = 0; i < ab8500->mask_size; i++) - if (ab8500->irq_reg_offset[i] == latch_offset) - break; + if (i >= ab8500->mask_size) { + dev_err(ab8500->dev, "Register offset 0x%2x not declared\n", + latch_offset); + return -ENXIO; + } - if (i >= ab8500->mask_size) { - dev_err(ab8500->dev, "Register offset 0x%2x not declared\n", - latch_offset); - return -ENXIO; - } + /* ignore masked out interrupts */ + latch_val &= ~ab8500->mask[i]; + while (latch_val) { + int_bit = __ffs(latch_val); line = (i << 3) + int_bit; latch_val &= ~(1 << int_bit); @@ -491,7 +492,7 @@ static int ab8500_handle_hierarchical_line(struct ab8500 *ab8500, line += 1; handle_nested_irq(ab8500->irq_base + line); - } while (latch_val); + } return 0; }