Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp2706293ybh; Mon, 5 Aug 2019 05:34:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqys86YlEtbEYgfcVauZTBbo0oW7gIU2wTKI3qHaxFjhItc12O36OIKre/wZ7M4+sFOqrXgg X-Received: by 2002:a17:902:6a2:: with SMTP id 31mr136799640plh.296.1565008463433; Mon, 05 Aug 2019 05:34:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565008463; cv=none; d=google.com; s=arc-20160816; b=JhuGBWB+wvq1Mg6pW0JAbGv7cUt1CKeYayVNjhvj73QunVqxx8HiMtP3FN5h9JgSXl ZT0OR57tKHvdcgB438wbIgqNP38ka0Fp6qbI9aU8f9mJnj+bO148P33B/8qVKvUEfZiH 2wiJkg/69oA7YnDlJfmy2C4xB8brVTV8Ua85FpoLy9q80e4YY/O3ole18KF9eubDc3Ir h0FZag0W6716epPpxem0r/0eKZMDnwYl8SK3Eym/lBixeZjTQUsbAcE/Xt/quHZTLmgt NIPIjGFi9j4pwui34U5MBD4OS9qMx7/7OuRxhOKCcRsz4Jnu6sT2OgV+RtQnjkLluNHC jWxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:message-id:date:subject:cc:from :dkim-signature; bh=sqV3s1K4ns9GNRz+g3OmEaOqbEW74Ump8unGoU9qEjg=; b=RYK68l2alHNAi8rhu90DEsUk9X6N4+eOmddYZa+hqetZtaJHaHCEDkkpEi60IoLy3c GS/D5uE19PNAM8U3vZWYNEuVImWEm3AJ1SiDF2xuNip9UOz3cDkERW4NWPSUaE8jSMjq DHzLUMK7+JFuSNiONq6ANDT5A39ZKeuRw/hKEtDt2zthAH6iYH0S7hk2fcdotpt8gvam 0tG5qWRBV3Q1rtnmnLIqgfq72VcFnQ9jYZ8nladiR2t0c9Cz7NQj0WgqWivE/0UjDVLI KMYqU81PXFo94YldaxF6um7+3/pb3yIVKSXh6hH3GLZwpyKMnCDzLvkoAP9SEPni2i46 3SgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=f6z1Pbls; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f8si46295487pgi.191.2019.08.05.05.34.07; Mon, 05 Aug 2019 05:34:23 -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=fail header.i=@gmail.com header.s=20161025 header.b=f6z1Pbls; 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; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728734AbfHEMbw (ORCPT + 99 others); Mon, 5 Aug 2019 08:31:52 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:45801 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728144AbfHEMbw (ORCPT ); Mon, 5 Aug 2019 08:31:52 -0400 Received: by mail-pl1-f194.google.com with SMTP id y8so36439474plr.12; Mon, 05 Aug 2019 05:31:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=sqV3s1K4ns9GNRz+g3OmEaOqbEW74Ump8unGoU9qEjg=; b=f6z1Pblsnub+mS8CYJfFLKu4rUlG4HLRKLG+TwMtUylc6+JoSJuziEDRFVwjAwiQh4 2ZAvhgAmyYdrkzKEOSyG+aT/rl3meCnWQztBVsX9b8kwrdutRO/d/qqQFoI2oSra2JW/ 04hfJ9nF12lsZ0MqFLh6AWLHYNnN/Sf8A/sg+JOjhkg7Gdhc4veFr7txdwB2ztjdbSQZ /rM4Ely7QK6C6a2d4h1rPmtpj1cax3Ql+7nVt1fZfmUNmoUiW/0F5uYO7Xd7RAks+Ni1 RKMHxYjbja0tMgbSwsD4dQ5lCJyKwet0F4aS2XKORfa+JerJo506DQhe2aIizLGs9BTu +XKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=sqV3s1K4ns9GNRz+g3OmEaOqbEW74Ump8unGoU9qEjg=; b=S0cNFVgr+Z8uWKQ/ldAJe3iaGibrGu8TPwYwGaHzPgCi9bDhi0hvIzdNF63IkQsXTG 0nHz70mr8hXf0tQAErfROrEnMGv8fW8UfXn9LE2Ekzon+KkUxoetcP9FdjJ/L01HyQ+P r1L8e5ndO9Db5A+AfDh22lou8BsvS3E1vXDJV3HopVMvN3Z1h016kMQxxxuAT45V22MU sPGZg9sA9W85eOWyQXz1S8ked64r3afCkCwzi5QSIknlLC595WFLnrq1b5/QTfCTIjjj Jg9naTP6DwFgbl+zvTQTNvG0lecKuyF5Id6+ibMpN+PSx+wGTWpePJfqRYrhH1VP3ELF fMjw== X-Gm-Message-State: APjAAAWbBOcW/jyTxsv9NsP4n7CiwjFunWjrZkWMmH+XMIudj8iHTnWg vFM8tUS8eMIWgXy8FlzTA992S2FJNtM= X-Received: by 2002:a17:902:8a94:: with SMTP id p20mr143610300plo.312.1565008311500; Mon, 05 Aug 2019 05:31:51 -0700 (PDT) Received: from hfq-skylake.ipads-lab.se.sjtu.edu.cn ([202.120.40.82]) by smtp.googlemail.com with ESMTPSA id u3sm18958550pjn.5.2019.08.05.05.31.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Aug 2019 05:31:50 -0700 (PDT) From: Fuqian Huang Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Fuqian Huang Subject: [PATCH] i2c: avoid sleep in IRQ context Date: Mon, 5 Aug 2019 20:31:34 +0800 Message-Id: <20190805123134.23199-1-huangfq.daxian@gmail.com> X-Mailer: git-send-email 2.11.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org i2c_pxa_handler -> i2c_pxa_irq_txempty -> i2c_pxa_reset -> i2c_pxa_set_slave -> i2c_pxa_wait_slave As i2c_pxa_handler is an interrupt handler, it will finally calls i2c_pxa_wait_slave which calls msleep. Add in_interrupt check before msleep to avoid sleep in IRQ context. Signed-off-by: Fuqian Huang --- drivers/i2c/busses/i2c-pxa.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c index 2c3c3d6935c0..b35a0e8efcb2 100644 --- a/drivers/i2c/busses/i2c-pxa.c +++ b/drivers/i2c/busses/i2c-pxa.c @@ -443,6 +443,8 @@ static int i2c_pxa_wait_slave(struct pxa_i2c *i2c) show_state(i2c); + if (in_interrupt()) + return 0; while (time_before(jiffies, timeout)) { if (i2c_debug > 1) dev_dbg(&i2c->adap.dev, "%s: %ld: ISR=%08x, ICR=%08x, IBMR=%02x\n", -- 2.11.0