Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2328059imj; Mon, 11 Feb 2019 00:32:24 -0800 (PST) X-Google-Smtp-Source: AHgI3IZCXf73uoi/7CRMydXa15tU2v/XxAd3VDvavVYCwzBEWaNUtToZ7vplzftZbDoInqasguqk X-Received: by 2002:a17:902:7882:: with SMTP id q2mr37244103pll.305.1549873944425; Mon, 11 Feb 2019 00:32:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549873944; cv=none; d=google.com; s=arc-20160816; b=CUjs8zW7XRXDh1ldY9cs0cfVl9TSg/VrvT8yaFZbzpLCciPlwND+qPvM+zx+rVgLuk hjkAtV0m011hORdQ63XQ1vdTR5llvIa/DF740BuMVBHTkg9AQNZdmCnmOLx0j2k8acGm FLykFuYndIFC81p3CKCSi/cxHKirCy9Objv6EPVND5zshNfxlpTOdbwMpVe1IbgtcM02 K38elbZkmtVNLoJW5zFGhZMPdDaGwphnCxmIe8Hj4WQ/Ih7IrJ1W7aGbGTc+tuvdTb+R CNbgVe3GBf8zNkd/vmCNw4ITS9tl2RPlUjGYVUACziFJ4gNW1COLgj432xBEEgotLIMn misw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=CLwsofVkTI5AVlJfqOgmCA10KEihOww2hNo+PbYbw38=; b=f6QUtojPSTjg4gOahHAQR5FsnX/fyC1STffcxX9qeaWZ4UBstqczqNclaY/T/RYhJz Jl9FE5/FQhkTjiCTQphvxpLsFrrjgN6EUqHbWMqC5B1+fm9DH86d9mtfAWzeCKr/lC4O +XnXqAu66pPms5c7fdVcileNTTghXp8bl1iJ36f0MGrjYnMW0nfVetIVxVvOhh5+CR63 r1rkRAQq6ZPH99hBP1N8apL5Pa9oFv8H659+VYfv8q7WpQwexdajZdROUcm2itsmskFb ymDu/PTHGK70FNBzswOfWizoYNw6xyL5/mlJWbfgN7uYlawzrO2Arm6P4cPhXJHVPbTZ 0Q5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cern.onmicrosoft.com header.s=selector1-cern-ch header.b=kWThdFXI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f23si7982195plr.151.2019.02.11.00.32.08; Mon, 11 Feb 2019 00:32:24 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@cern.onmicrosoft.com header.s=selector1-cern-ch header.b=kWThdFXI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727118AbfBKIbx (ORCPT + 99 others); Mon, 11 Feb 2019 03:31:53 -0500 Received: from mail-eopbgr30058.outbound.protection.outlook.com ([40.107.3.58]:8224 "EHLO EUR03-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726025AbfBKIbv (ORCPT ); Mon, 11 Feb 2019 03:31:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cern.onmicrosoft.com; s=selector1-cern-ch; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CLwsofVkTI5AVlJfqOgmCA10KEihOww2hNo+PbYbw38=; b=kWThdFXIQggGfeIBs7FLMXeA5CQNJlI0BjVsP6NkNlIE/esdylWLxB2B1VI/7xNEQ1LrUXrheJgxklrcY9OsnsBf6F4/nlI/m/GsW+OO4hGstqvaJgpYQT75TByonNk+tt4wdgfTmeSC99gOz7h6FVU/AB8TBmzqBPDzgXFCFOg= Received: from HE1PR06CA0150.eurprd06.prod.outlook.com (2603:10a6:7:16::37) by AM4PR0601MB2145.eurprd06.prod.outlook.com (2603:10a6:200:47::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1601.21; Mon, 11 Feb 2019 08:31:46 +0000 Received: from HE1EUR02FT064.eop-EUR02.prod.protection.outlook.com (2a01:111:f400:7e05::209) by HE1PR06CA0150.outlook.office365.com (2603:10a6:7:16::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1601.19 via Frontend Transport; Mon, 11 Feb 2019 08:31:46 +0000 Authentication-Results: spf=pass (sender IP is 188.184.36.46) smtp.mailfrom=cern.ch; korsgaard.com; dkim=none (message not signed) header.d=none;korsgaard.com; dmarc=bestguesspass action=none header.from=cern.ch; Received-SPF: Pass (protection.outlook.com: domain of cern.ch designates 188.184.36.46 as permitted sender) receiver=protection.outlook.com; client-ip=188.184.36.46; helo=cernmxgwlb4.cern.ch; Received: from cernmxgwlb4.cern.ch (188.184.36.46) by HE1EUR02FT064.mail.protection.outlook.com (10.152.11.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1580.10 via Frontend Transport; Mon, 11 Feb 2019 08:31:45 +0000 Received: from cernfe03.cern.ch (188.184.36.39) by cernmxgwlb4.cern.ch (188.184.36.46) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 11 Feb 2019 09:31:36 +0100 Received: from cwe-513-vol689.cern.ch (188.185.69.206) by smtp.cern.ch (188.184.36.52) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 11 Feb 2019 09:31:34 +0100 From: Federico Vaga To: Peter Korsgaard , Andrew Lunn CC: , , Federico Vaga Subject: [PATCH v4 2/5] i2c:ocores: do not handle IRQ if IF is not set Date: Mon, 11 Feb 2019 09:31:19 +0100 Message-ID: <20190211083122.32485-3-federico.vaga@cern.ch> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20190211083122.32485-1-federico.vaga@cern.ch> References: <20190211083122.32485-1-federico.vaga@cern.ch> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [188.185.69.206] X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:188.184.36.46;IPV:NLI;CTRY:CH;EFV:NLI;SFV:NSPM;SFS:(10001)(10009020)(459900002);DIR:OUT;SFP:1101;SCL:1;SRVR:AM4PR0601MB2145;H:cernmxgwlb4.cern.ch;FPR:;SPF:None;LANG:en; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9ca4095c-e107-4072-ea57-08d68ffb5be8 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(4608076)(4709027)(5565046)(2017052603328)(7153060)(7193020);SRVR:AM4PR0601MB2145; X-MS-TrafficTypeDiagnostic: AM4PR0601MB2145: X-Microsoft-Exchange-Diagnostics: 1;AM4PR0601MB2145;20:4XIk0fIKKMaXjGfGQsgozpbaRhHrMgpb+2lUmIbMkqZ6dPfct0XPBAsG+kRKV78Q8Y1NzXRGPgStsnRjYAPJBvUmq31qZFYr4oa69YZjFOR/KWkt0PP+f6U532kaD2PR5PQlkcHXG6dw3b8AKNuOdTjyRjVqr5fYlSGPAHebcaibJYBiijFa3ZdVCHkosa73kbbOFa6s6+Ucg8wWNxh1T/axx4DEFq7n9XhrIolbcVaA6hU51Ki9wBqAA8XD02UDJFqgoZSJ3RUBVH4aZ7LJv3VXylJTqizDL8EWXOs/kJNa1UZCsl5JjzuHUiB+p9Sd9c81Bb65eLRsX7KiZ/FaCuL2hckESRKEOe0e19qHQaoh8gF8lL49yQhEFCDxElq22ms9LlSOw2KGKiG+pC1PIxDDqrFBJ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8o5H2ZT66lPqk3FSi6+8A== X-OriginatorOrg: cern.ch X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Feb 2019 08:31:45.8145 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9ca4095c-e107-4072-ea57-08d68ffb5be8 X-MS-Exchange-CrossTenant-Id: c80d3499-4a40-4a8c-986e-abce017d6b19 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=c80d3499-4a40-4a8c-986e-abce017d6b19;Ip=[188.184.36.46];Helo=[cernmxgwlb4.cern.ch] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR0601MB2145 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If the Interrupt Flag (IF) is not set, we should not handle the IRQ: - the line can be shared with other devices - it can be a spurious interrupt To avoid reading twice the status register, the ocores_process() function expects it to be read by the caller. Signed-off-by: Federico Vaga Acked-by: Peter Korsgaard Reviewed-by: Andrew Lunn --- drivers/i2c/busses/i2c-ocores.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/i2c/busses/i2c-ocores.c b/drivers/i2c/busses/i2c-ocores.c index aa85202..fcc2558 100644 --- a/drivers/i2c/busses/i2c-ocores.c +++ b/drivers/i2c/busses/i2c-ocores.c @@ -143,10 +143,9 @@ static inline u8 oc_getreg(struct ocores_i2c *i2c, int reg) return i2c->getreg(i2c, reg); } -static void ocores_process(struct ocores_i2c *i2c) +static void ocores_process(struct ocores_i2c *i2c, u8 stat) { struct i2c_msg *msg = i2c->msg; - u8 stat = oc_getreg(i2c, OCI2C_STATUS); unsigned long flags; /* @@ -223,8 +222,12 @@ out: static irqreturn_t ocores_isr(int irq, void *dev_id) { struct ocores_i2c *i2c = dev_id; + u8 stat = oc_getreg(i2c, OCI2C_STATUS); + + if (!(stat & OCI2C_STAT_IF)) + return IRQ_NONE; - ocores_process(i2c); + ocores_process(i2c, stat); return IRQ_HANDLED; } -- 2.15.0