From patchwork Fri Jun 7 18:46:05 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grygorii Strashko X-Patchwork-Id: 2689231 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 04FEFDFB78 for ; Fri, 7 Jun 2013 18:52:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932114Ab3FGSwN (ORCPT ); Fri, 7 Jun 2013 14:52:13 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:50057 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757209Ab3FGSuA (ORCPT ); Fri, 7 Jun 2013 14:50:00 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id r57InvDs016690; Fri, 7 Jun 2013 13:49:57 -0500 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id r57Inv1P026331; Fri, 7 Jun 2013 13:49:57 -0500 Received: from dlelxv22.itg.ti.com (172.17.1.197) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.2.342.3; Fri, 7 Jun 2013 13:49:56 -0500 Received: from localhost (uglx0174654.ucm2.emeaucm.ext.ti.com [10.167.145.172]) by dlelxv22.itg.ti.com (8.13.8/8.13.8) with ESMTP id r57InulM028286; Fri, 7 Jun 2013 13:49:56 -0500 From: Grygorii Strashko To: Wolfram Sang , Tony Lindgren CC: , , , Grygorii Strashko , Kevin Hilman Subject: [PATCH 2/5] i2c: omap: add runtime check in isr to be sure that i2c is enabled Date: Fri, 7 Jun 2013 21:46:05 +0300 Message-ID: <1370630768-4077-3-git-send-email-grygorii.strashko@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1370630768-4077-1-git-send-email-grygorii.strashko@ti.com> References: <1370630768-4077-1-git-send-email-grygorii.strashko@ti.com> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Add runtime check at the beginning of omap_i2c_isr/omap_i2c_isr_thread to be sure that i2c is enabled, before performing IRQ handling and accessing I2C IP registers: if (pm_runtime_suspended(dev->dev)) { WARN_ONCE(true, "We should never be here!\n"); return IRQ_NONE; } Produce warning in case if ISR called when i2c is disabled CC: Kevin Hilman Signed-off-by: Grygorii Strashko --- drivers/i2c/busses/i2c-omap.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c index 97844ff..2dac598 100644 --- a/drivers/i2c/busses/i2c-omap.c +++ b/drivers/i2c/busses/i2c-omap.c @@ -885,6 +885,11 @@ omap_i2c_isr(int irq, void *dev_id) u16 stat; spin_lock(&dev->lock); + if (pm_runtime_suspended(dev->dev)) { + WARN_ONCE(true, "We should never be here!\n"); + return IRQ_NONE; + } + mask = omap_i2c_read_reg(dev, OMAP_I2C_IE_REG); stat = omap_i2c_read_reg(dev, OMAP_I2C_STAT_REG); @@ -905,6 +910,11 @@ omap_i2c_isr_thread(int this_irq, void *dev_id) u16 stat; int err = 0, count = 0; + if (pm_runtime_suspended(dev->dev)) { + WARN_ONCE(true, "We should never be here!\n"); + return IRQ_NONE; + } + spin_lock_irqsave(&dev->lock, flags); do { bits = omap_i2c_read_reg(dev, OMAP_I2C_IE_REG);