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: 15472 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 78E4823E3E for ; Thu, 21 Mar 2013 13:49:58 +0000 (UTC) Received: from mail-ve0-f173.google.com (mail-ve0-f173.google.com [209.85.128.173]) by fiordland.canonical.com (Postfix) with ESMTP id 1FF06A18434 for ; Thu, 21 Mar 2013 13:49:58 +0000 (UTC) Received: by mail-ve0-f173.google.com with SMTP id oz10so2425878veb.18 for ; Thu, 21 Mar 2013 06:49:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :x-gm-message-state; bh=41n/xs05yT9l8ujBiLbO4xVslce5DBokon5YIDnaK7g=; b=fLjfH10xkyWNROGQCN1NLhe9nv4VZC7WN4/dVuEtvyWQna3zrYuE2VGwIvJHrFZaxW ahnMHW+2u7uEhPrBRTIe60UlTc1OOdxgbxagR4aVMRhA8V40bg+G5/NiMmVbkAaJUU5W xImn7SI5QiSd6smH3wBfc+s8uTp7eDxrNrc8JunmqBZn8g0zsVE+X6NqJWTRjUjpa5i8 tR4BV1uHfu6PB3izacGwPf6I4NtEnMqLYAY9KOa2mg5RFEqKNWg1ic/oRs0zuvA0+XVI 1XXmKXf37ba4wLSkU8sLaUHH9F4UgGLishG13UJpzirtltWAaco7it91xamtB9PgSJWa Jqbw== X-Received: by 10.52.93.20 with SMTP id cq20mr11507832vdb.38.1363873797651; Thu, 21 Mar 2013 06:49:57 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.58.233.198 with SMTP id ty6csp61215vec; Thu, 21 Mar 2013 06:49:57 -0700 (PDT) X-Received: by 10.180.183.197 with SMTP id eo5mr4848608wic.28.1363873796383; Thu, 21 Mar 2013 06:49:56 -0700 (PDT) Received: from mail-wi0-x236.google.com ([2a00:1450:400c:c05::236]) by mx.google.com with ESMTPS id s19si1263907wiv.63.2013.03.21.06.49.55 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 21 Mar 2013 06:49:56 -0700 (PDT) Received-SPF: neutral (google.com: 2a00:1450:400c:c05::236 is neither permitted nor denied by best guess record for domain of fabio.baltieri@linaro.org) client-ip=2a00:1450:400c:c05::236; Authentication-Results: mx.google.com; spf=neutral (google.com: 2a00:1450:400c:c05::236 is neither permitted nor denied by best guess record for domain of fabio.baltieri@linaro.org) smtp.mail=fabio.baltieri@linaro.org Received: by mail-wi0-f182.google.com with SMTP id hi18so3089992wib.9 for ; Thu, 21 Mar 2013 06:49:55 -0700 (PDT) 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 Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Linus Walleij , Lee Jones , Fabio Baltieri 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: ALoCoQnF22WXakZ6fE+7pcW1xMYAFm2+S0qsHPYconMlJKXjG4nhHDx+9CkEONmduTaEhRXaxIKi 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; }