Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp4072405imm; Mon, 25 Jun 2018 09:14:55 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJj09QVYIPMVGT8vkgq6MDfoyMoqIas3X2xNKwhqOq1GWd59AUflchZxXom8YuQff+nuvNt X-Received: by 2002:a17:902:6acc:: with SMTP id i12-v6mr13136503plt.278.1529943295435; Mon, 25 Jun 2018 09:14:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529943295; cv=none; d=google.com; s=arc-20160816; b=BmwbyTHui5Ys92xoWGgJK89rEFKIGuXuGrEyGzo80fnYv7ssxoYWp3INRkl5YiTETp LP8I0UpwtTAjOJFhg47iLqqAsFuqQRUwHFJDIEEBDKYckYErupkvW3QVdGfoB//Ixq8f Tyc3prGdmEsbrYNoLn1jJMCYYalglwUeO7GWQsspXVtS6y6bZEGAHBwLr0LdhGBNmVsv VbIEfqEL37/0dN9dW/5obENbKJKs4NalWg/oS3k9HysuaXaVtpLL31vSxVT2Txs1O5GU sxQx/gXB9d4lkT0eatX73+Th0DoQrVdOTj2jPeyokRD82HzsGP0yvJS2fTe9LS4YQDAT pu8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature:arc-authentication-results; bh=nGBDCiIjInfGhbS5po3Rutny60IIm02U58n0e61kZgM=; b=a8s/gO2KZT3OVgrDqP+Psc+vc8LxM4xPNAukLVOisWt3odBYS8h/vGTtvNE4Bigrhr EFgLji7THiRYpN9RZDHRLi2XORoVdOHHqysLGWO2j4SrJiSG7mcDqskeqS8g9TXlng9v Y7OASH3Tsl/a/1rhatkb/jMklCGPamV3YYLaua5k9Vvlur+oHUZ0yqckifabGJEZ9ANV cafz2FjsQrYHaWSgJD5ywgY3QsCnqXL60e9w++KFizdClXyLKEYhraqikUZSn/VDitGd nCRkFsmnL8iTk4zuLVgame7a4Llm/eHeNb+8kq/a63SUNttLa/RBz3pQbS/y1zfADd7v +TXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cern.onmicrosoft.com header.s=selector1-cern-ch header.b=mesjOoXk; 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 y190-v6si6434601pgy.22.2018.06.25.09.14.40; Mon, 25 Jun 2018 09:14:55 -0700 (PDT) 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=mesjOoXk; 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 S1754943AbeFYQNg (ORCPT + 99 others); Mon, 25 Jun 2018 12:13:36 -0400 Received: from mail-db5eur01on0082.outbound.protection.outlook.com ([104.47.2.82]:26496 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754017AbeFYQNb (ORCPT ); Mon, 25 Jun 2018 12:13:31 -0400 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=nGBDCiIjInfGhbS5po3Rutny60IIm02U58n0e61kZgM=; b=mesjOoXk/Ekz0RkCuk5sSGkIsytCPMN9hzHNA5N9MNATh9IHbTaNkqYxwXbE8AYx5UvxT/BXmIW04ig3Luw9Ws1GvOSckKrw/Tk8Gtp1XgJ33k729zIvb7a1waTizkEYsroDw8oKWcOIU5b4jRfrgS575wM+07rk52pndFD8kwQ= Received: from AM6PR06CA0016.eurprd06.prod.outlook.com (2603:10a6:20b:14::29) by AM3PR06MB1140.eurprd06.prod.outlook.com (2a01:111:e400:5872::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.884.22; Mon, 25 Jun 2018 16:13:28 +0000 Received: from VE1EUR02FT013.eop-EUR02.prod.protection.outlook.com (2a01:111:f400:7e06::205) by AM6PR06CA0016.outlook.office365.com (2603:10a6:20b:14::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.884.21 via Frontend Transport; Mon, 25 Jun 2018 16:13:28 +0000 Authentication-Results: spf=pass (sender IP is 188.184.36.48) smtp.mailfrom=cern.ch; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=bestguesspass action=none header.from=cern.ch; Received-SPF: Pass (protection.outlook.com: domain of cern.ch designates 188.184.36.48 as permitted sender) receiver=protection.outlook.com; client-ip=188.184.36.48; helo=cernmxgwlb4.cern.ch; Received: from cernmxgwlb4.cern.ch (188.184.36.48) by VE1EUR02FT013.mail.protection.outlook.com (10.152.12.142) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.20.906.15 via Frontend Transport; Mon, 25 Jun 2018 16:13:27 +0000 Received: from cernfe05.cern.ch (188.184.36.45) by cernmxgwlb4.cern.ch (188.184.36.48) with Microsoft SMTP Server (TLS) id 14.3.399.0; Mon, 25 Jun 2018 18:13:22 +0200 Received: from pcbe13614.cern.ch (2001:1458:202:121::100:40) by smtp.cern.ch (2001:1458:201:66::100:14) with Microsoft SMTP Server (TLS) id 14.3.399.0; Mon, 25 Jun 2018 18:13:22 +0200 From: Federico Vaga To: , , "Peter Korsgaard" CC: Subject: [PATCH 2/3] i2c:ocores: do not handle IRQ if IF is not set Date: Mon, 25 Jun 2018 18:13:02 +0200 Message-ID: <20180625161303.7991-3-federico.vaga@cern.ch> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180625161303.7991-1-federico.vaga@cern.ch> References: <20180625161303.7991-1-federico.vaga@cern.ch> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [2001:1458:202:121::100:40] X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:188.184.36.48;IPV:NLI;CTRY:CH;EFV:NLI;SFV:NSPM;SFS:(10009020)(396003)(376002)(346002)(39860400002)(39380400002)(2980300002)(438002)(189003)(199004)(6666003)(786003)(76176011)(575784001)(478600001)(86362001)(1076002)(16526019)(106002)(51416003)(186003)(26005)(7696005)(6116002)(336012)(107886003)(53416004)(4326008)(14444005)(106466001)(2906002)(5660300001)(426003)(110136005)(8936002)(2616005)(446003)(356003)(11346002)(48376002)(47776003)(74482002)(16586007)(36756003)(246002)(44832011)(7736002)(7636002)(8676002)(305945005)(50226002)(316002)(476003)(486006)(126002)(50466002);DIR:OUT;SFP:1101;SCL:1;SRVR:AM3PR06MB1140;H:cernmxgwlb4.cern.ch;FPR:;SPF:Pass;LANG:en;PTR:cernmx12.cern.ch;MX:1;A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 22cf6d13-3529-414c-f4a0-08d5dab69639 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600026)(711020)(4608076)(2017052603328)(7153060)(7193020);SRVR:AM3PR06MB1140; X-MS-TrafficTypeDiagnostic: AM3PR06MB1140: X-Microsoft-Exchange-Diagnostics: 1;AM3PR06MB1140;20:YyOO4xFWz29+XT/lNp0iPXzJaEub6leriTL4c4M3WIOXQ/AmkdPIncYQhQShnyH7QiTU2PVphuP7PBPqXAb8mKxk1/WO6GrPSoYc6ZfEicSss9H5ZlWp4DARVOMWem72UYfpgSbg5ddfXL5kGzWYj4tNfnMCPRQRxJY86DNwL4bwgTz0R8/2mIzqfaYOk7xy4fMd7kP4QAhzGgOAncNp93RfZ+jznRVqrTvfrqN+TBkrZ02ohYyaDc0CbCiJLK0lSgqeXpeTCkCvgMSS4KOD9mrAp3b8C1XmZZH6famb9FzL7GSv7f/gBCshryavfI63C6nojWPOJm36c287O6RLKJyEJmnZ6HWcye7QsrPQbj41cMwgaqmwn5ZPNCD86iw0piWiDv7FEvuNwRbHT2mkUOuqp4RHnxjtizF3MDJP+YiNQrcz0zUq333ub8JeDnSfq4j3s/2Nerrw6ak+ABpnRQvzDWUtrjGm+ZmsoH+rvUno4v5+1DZlxgpvPboBkByC;4:Lj4taYtz+J2LEEYMm4vAvaLwhLuRvLmk7C2cUB7V+RWKt2sDvyj3j6h9VVhgDubFW0SFawiyWbTeoOexzxbYmKUESh7VJb1y0H4s4W7/MgWtScWRs2Rb8VQZ2a2PuB6EmgBntAwI/VpBeX7JSvsN7PuoFy+MZ+zYIoMGsDtODg6nHQQF3L+2RSIzMATMtGG02BXAhQPhTNZm+f2um84ze4odu2qXXrZd2qbhBSZVaickPej1fYB2EoHZYTQpHI1LZf07b+7b/COfm76WAd77yA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(3231254)(944501410)(52105095)(93006095)(93004095)(10201501046)(149027)(150027)(6041310)(20161123558120)(20161123560045)(20161123562045)(201703131423095)(201702281529075)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(6072148)(201708071742011)(7699016);SRVR:AM3PR06MB1140;BCL:0;PCL:0;RULEID:;SRVR:AM3PR06MB1140; X-Forefront-PRVS: 0714841678 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;AM3P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6HoYAztikELylLhrTcIXI+P1x96wyKP0bUx+zDuNppbLBbUULk7xO/XrX44R9nX1FxX0kD7E0nD8TZh1TfRWQ1tsUcky2wKss023K8hM+z6KjSjmYljZ0LoKwiXRA9r81/QFVhFVNZnxiX3YF9fPBo/DcfpRhqrMmLM42Gxrg2sPGyHrz+g0PoyOn/updak/o5sHcDwUEmPuxWc+JxpoTj/Yc1TcjZEfW8keCmnRj62FiQ9/B1hvyg==;5:p+W5aQf426Cg8epGZojJcA0iNnc4gi6+2mPnu0JDXRcywrGdNNx+GUS1d0vaABEaLTHW9SoJT4Lqseo6gfB1dOVkecmZUevkTrrJy/ZCE6DTWZsXFKpIWGiZA8gTShFiSngQh3h76qR2TrorlGTkgigOR1kmIW5c9VTG9gh12Wc=;24:HpHOQJY9rGaQnuwLUZB0y+UmqFQLOQGse71H0n4v1k+t+B6PvHIgkvTa0EufKpMC27KkqltArWxgjE2L6PxLsxKoXaZFwaUXFgEZUN0avIM= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;AM3PR06MB1140;7:mwoSv6lNdgd0mDzltmnKyP22/MdVCBnyJWwXmSizwTDzOzPXSAyDT7puyAayfWyOwDUQPcBOpZzeNB7C9L8WWzjpZhfEwp1lGbyV9p882LyCr5f6AqSmIVk6j1G1o7YH/150jqmq6gmCCQrTtG5ZjfCvsWkeIodKK/yFA3DU+39zF57ITycwTempSKNcEu0FHAIp+bYGE8E7nBuv3r1vaKhyJvKnuCnE8ML0nzgFOrt76gV7QbgDX5TxkR9zCShr X-OriginatorOrg: cern.ch X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jun 2018 16:13:27.9420 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 22cf6d13-3529-414c-f4a0-08d5dab69639 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.48];Helo=[cernmxgwlb4.cern.ch] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM3PR06MB1140 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 --- 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 98c0ef74882b..274d6eb22a2c 100644 --- a/drivers/i2c/busses/i2c-ocores.c +++ b/drivers/i2c/busses/i2c-ocores.c @@ -139,10 +139,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); if ((i2c->state == STATE_DONE) || (i2c->state == STATE_ERROR)) { /* stop has been sent */ @@ -209,9 +208,13 @@ static void ocores_process(struct ocores_i2c *i2c) static irqreturn_t ocores_isr(int irq, void *dev_id) { struct ocores_i2c *i2c = dev_id; + u8 stat = oc_getreg(i2c, OCI2C_STATUS); unsigned long flags; int ret; + if (!(stat & OCI2C_STAT_IF)) + return IRQ_NONE; + /* * We need to protect i2c against a timeout event (see ocores_xfer()) * If we cannot take this lock, it means that we are already in @@ -222,7 +225,7 @@ static irqreturn_t ocores_isr(int irq, void *dev_id) if (!ret) return IRQ_HANDLED; - ocores_process(i2c); + ocores_process(i2c, stat); spin_unlock_irqrestore(&i2c->xfer_lock, flags); -- 2.15.0