Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2765365imj; Mon, 11 Feb 2019 08:08:44 -0800 (PST) X-Google-Smtp-Source: AHgI3IbofpYUlxrWCCd5DSlBsNhCmWt5aVqI5Rn3t50OIOfLRtP35DiJBovi6p0RlZG79tapdwsp X-Received: by 2002:a17:902:ab84:: with SMTP id f4mr37487538plr.207.1549901324857; Mon, 11 Feb 2019 08:08:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549901324; cv=none; d=google.com; s=arc-20160816; b=hRQyU2fJlmOZO2T/bP5k8R0h7GWZ08dep2DdSKWDKTXh6GKBmtvsApdtVGT9FytUu7 hsfN0GJy4X/65fEBnQRfgvVgPw+u+QgsFI1Xe9WwCA/hBzPAvxNXs/6Jk6BtbomAQDQG Qehjwoixq70fylwZva7W7eMubq70ZJPttyxvTDH9SXKtc0CfKwVH3XHFU7uLHQ/NUe5K J9Jzkkx9AswDGjw/o2nkNILqUvChN4RYr3UxY7xGawJqMh1WG0fH692hA403HEsG4WG+ 0mq3ybgfwpC1j+i+lnRgri2X0Y/v8w6HXBPU9MYth0etsGMjg17CeJPmOEZMxCv3mi28 sEdg== 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=G8tAcT/apF6DPLLmFySVdcDsEcqNwhs0WLE6X7Q3J0c=; b=aBHWXEK3jXuEMQ2TJ+WbUuMB69JBHd864cEE+rChNNAS3nIodByPHJDCtanNsVu2Up 3nOSMaEH20t2DFU7Hite5+YOOO3BtWHlRN0miB+P377NG/QxAyhInWWS2xQjGXe41v1G lAQz4+drxO3as301dv7fm+/ba+dw10qXVdTw2y26X4EQOIF+Y6M8fQWIetotfK59wXjc ZThrewfpPADugaBIDHyqxZDppoNTzhve6Qp8npQfqMqWbCdTuyX2U8uL55zcHaNxSvt5 44VYTOZn+4wwfN8z2cxjhCHVQttD9lgQeDPmN2FRkwTuSzzKpGbYTXL/avDBOEVNLM7Y t4HA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cern.onmicrosoft.com header.s=selector1-cern-ch header.b=oU4x4xhx; 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 p65si319164pfp.140.2019.02.11.08.08.27; Mon, 11 Feb 2019 08:08:44 -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=oU4x4xhx; 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 S1730839AbfBKQFu (ORCPT + 99 others); Mon, 11 Feb 2019 11:05:50 -0500 Received: from mail-eopbgr20043.outbound.protection.outlook.com ([40.107.2.43]:42002 "EHLO EUR02-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728015AbfBKQFt (ORCPT ); Mon, 11 Feb 2019 11:05:49 -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=G8tAcT/apF6DPLLmFySVdcDsEcqNwhs0WLE6X7Q3J0c=; b=oU4x4xhx5G2So46+5fwXj6XjKr1aDV3EFF0AwoPHmwB9IJSSh045bGnoWtOSAuX753TkYhDNVstUz7DmM7/rRY9ibgY/n7LZjoKaP+YGQ5eAHDaJRynecbCWUjf0/DJpmw2ly2zBCIVxMLK+1+/pqWec0LOccLaKql+6ms0agUc= Received: from DB6PR06CA0013.eurprd06.prod.outlook.com (2603:10a6:6:1::26) by AM6PR0602MB3526.eurprd06.prod.outlook.com (2603:10a6:209:e::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1601.19; Mon, 11 Feb 2019 16:05:46 +0000 Received: from AM5EUR02FT063.eop-EUR02.prod.protection.outlook.com (2a01:111:f400:7e1e::204) by DB6PR06CA0013.outlook.office365.com (2603:10a6:6:1::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1601.17 via Frontend Transport; Mon, 11 Feb 2019 16:05:45 +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 AM5EUR02FT063.mail.protection.outlook.com (10.152.9.234) 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 16:05: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 17:05:41 +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 17:05:40 +0100 From: Federico Vaga To: Peter Korsgaard , Andrew Lunn CC: , , Federico Vaga Subject: [PATCH v5 2/5] i2c:ocores: do not handle IRQ if IF is not set Date: Mon, 11 Feb 2019 17:05:26 +0100 Message-ID: <20190211160529.23858-3-federico.vaga@cern.ch> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20190211160529.23858-1-federico.vaga@cern.ch> References: <20190211160529.23858-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:AM6PR0602MB3526;H:cernmxgwlb4.cern.ch;FPR:;SPF:None;LANG:en; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c825e68a-b80c-45d2-348d-08d6903ac7df 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:AM6PR0602MB3526; X-MS-TrafficTypeDiagnostic: AM6PR0602MB3526: X-Microsoft-Exchange-Diagnostics: 1;AM6PR0602MB3526;20:p0/0Eie7baV98kHh3H5oVUBudIaXUINPKqYa+9VaU+9Gw9wMDCuNQ2wKOSrEDZy4vtORHUnNeC8rr3Vd47a7cHNDFRH+sJQmHuygiqqFiy289/Fx4yewMqI34yxP/PnhoyLSTxoEb8zYzT/K9N9y07GGg9p9I+ZS17bFnw674sPOH0MhHQvKWjXFc8az7Xsxz4DgDl4UiAOV9BvDK0VX6IGCFHG2dwUWi2qXc2OhRQ+oUMfQsmMPzl99iv/aEtq4CsozCG5vqsFdMDF963Wyw/QSQoB6bqMjIFXe78yDQnI8ufyMkGfcceWw+4rYQJXzJcyj7QoQxix54nOXP7X9L3MjS2IT5kELLRmZbNfegUq9be9mzv2+2dgY1QZNGY/P2zZPMS+lVuWK51cTT5gKl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jvu2Jbq8lUxHh2+x2I77/VID4yT3rWN1vtD0+801A== X-OriginatorOrg: cern.ch X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Feb 2019 16:05:45.2818 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c825e68a-b80c-45d2-348d-08d6903ac7df 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: AM6PR0602MB3526 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 --- 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