Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp3055276pxb; Tue, 12 Jan 2021 05:22:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJwU7K7Y52Uj1eM/4PPlynRicO/q4oMjM5uq2HFk1gg09ZYUmnOgPkFImLcmnqq+tH9xbpoM X-Received: by 2002:a17:906:7118:: with SMTP id x24mr3222304ejj.333.1610457773874; Tue, 12 Jan 2021 05:22:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610457773; cv=none; d=google.com; s=arc-20160816; b=Zc8OoPNwO6rvVMA/9P9iu8F3nUfp3OzRbvMxh9shlkxWeS3Z1Gyn/X/XAFBtT0qwqP /aZxgOAiVehzqYGfg+5R/Y0PdCrB2uGvDhjY6FIvjg8k66Ge124wWr8Ob6MdeExaoiay BtVToUww07Z2CKtdDhDO5BNa8OqBBbZ0Rf35cPm7Im1VbeOzSB+5+kxJwzqQRGbgzEne BwyNP4dMAGxQK+aplzJYZwto96/z7ywDlSO7TBGytpiQMgli3mnKbdAQCM2TizqMCMD1 jl0p+yQxyjogqgnj525beu2O0INUTUC1DKLV29Ps1hz8aVi3IUhRim9P8WsnpYZG403J kmfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=dnN2tqffNW/ZGJScvjdPkfvZef1jhn/Tnr5Ec8h0oh0=; b=ZJ81K/PaLZCV1QJhC0htlT0Q+Tj4N3mcmcfrEROaaU+icSGmZ2HerQLgQ9urjO5p1q IatZYXxHpzw5uZnWwL/F4UesbSS70+27ESi/QSqV2DRg1xVMUvs9CZvrJhdtdwkBk5bo Y18kOj/oiJClXT5VYhlcatkjsaflQ5aaqHoVNgW0kAaRx5I1Lsb1X3MgOtfU3xPQmVg8 D+djd8nGoEhNQ0b6PcTRRL7wnon43nifo2cuYsEqFknr0dXecNDyu+YFW9MSamDG0Goq xdqYrlxMfznWXY/cLHLgip6IgGkNW/NysC3/8TgJy5fheRnPSFfXjdXflE5oOij/4nNo sceg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=lfbpCHc3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hj15si1168525ejb.734.2021.01.12.05.22.30; Tue, 12 Jan 2021 05:22:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=lfbpCHc3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729503AbhALNTK (ORCPT + 99 others); Tue, 12 Jan 2021 08:19:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726554AbhALNTI (ORCPT ); Tue, 12 Jan 2021 08:19:08 -0500 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B003CC061575; Tue, 12 Jan 2021 05:18:27 -0800 (PST) Received: by mail-lf1-x12f.google.com with SMTP id o13so3338131lfr.3; Tue, 12 Jan 2021 05:18:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=dnN2tqffNW/ZGJScvjdPkfvZef1jhn/Tnr5Ec8h0oh0=; b=lfbpCHc32dI/mtyN8tTDPI3iPN5eDGiGfC3Dj78llxLL1P5b8EMsEZ8lF+hJdBk16w 3zSNKO0fuGc14xwdxWY46TgG0AP8odFcgsSrGZTY4QlLZGQcGlyKOLI7cWwQyXfq877L cKU4KhCQWixhEQB/KZ+eFXyxXICpV3SHJ7YlaiT4ALazX8z6pZRu27/RSFU1sdh+15jy vukfl5vatsjc0+KvZ9wDoxV1yxUa65lWFsspw+SqKAdHPf2NBqnDd7A3Y9fkH3IKzYn+ gIUZY/euy9LvFcSZRz2AX6DOHpVSSkqW1y1Nl8FHtjEB3aXiQJSxTIy0eK4H9HVlrtmu MVOQ== 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:mime-version :content-transfer-encoding; bh=dnN2tqffNW/ZGJScvjdPkfvZef1jhn/Tnr5Ec8h0oh0=; b=uGjTn6RwzD0OqxpsLpZmqrVkUcQPG7BZN08OnVYRU5ZpPYQJRFHxn9F9Z3Z1MCOVjh mBDkwNt/iVI6iJvpVwYk0ZbKxNsM6QzIWLV8oIvLf0MhAFaBSsSEX/HfX9XIPWLEp2iI Jx8pmZwyCnNF46N5QDbKgiBXYirq8sL9Wv0aT5UeS/IHWXWgl7EzcknRnk9ppc4F/cWc k/y+ypBQ8x0yokndV8X/hmvAnHtu2ZOXTHm2asqydKXZ/iDIbdx8ZhKvcCf5DIfqJQyg 3DILiiOV5iiBLiAqISPWA0kQLYVo6+79Q7xvFL9PYoeHb9cIK9GPftnWLOQ+tAnHEXOw 0x2Q== X-Gm-Message-State: AOAM53124CaETgO+uOGxdXa1oWp+PKqi3vzLCNR4oHRUx9U0oQnlmxZc IKrupyH7MJ3m5biIMlZvyZQ= X-Received: by 2002:a19:6459:: with SMTP id b25mr2063344lfj.635.1610457506271; Tue, 12 Jan 2021 05:18:26 -0800 (PST) Received: from localhost.localdomain (109-252-192-57.dynamic.spd-mgts.ru. [109.252.192.57]) by smtp.gmail.com with ESMTPSA id a4sm341188ljp.14.2021.01.12.05.18.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jan 2021 05:18:25 -0800 (PST) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Laxman Dewangan , Wolfram Sang , Mikko Perttunen Cc: linux-i2c@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v1] i2c: tegra: Use threaded interrupt Date: Tue, 12 Jan 2021 16:17:09 +0300 Message-Id: <20210112131709.1711-1-digetx@gmail.com> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Switch to use threaded interrupt context in order to avoid checking of "are we in interrupt?" for the code that may sleep in the IRQ handler. I2C doesn't require a very low interrupt-handling latency, hence this change doesn't introduce any noticeable effects. Signed-off-by: Dmitry Osipenko --- drivers/i2c/busses/i2c-tegra.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c index 0727383f4940..c4262408bae7 100644 --- a/drivers/i2c/busses/i2c-tegra.c +++ b/drivers/i2c/busses/i2c-tegra.c @@ -533,7 +533,7 @@ static int tegra_i2c_poll_register(struct tegra_i2c_dev *i2c_dev, void __iomem *addr = i2c_dev->base + tegra_i2c_reg_addr(i2c_dev, reg); u32 val; - if (!i2c_dev->atomic_mode && !in_irq()) + if (!i2c_dev->atomic_mode) return readl_relaxed_poll_timeout(addr, val, !(val & mask), delay_us, timeout_us); @@ -1719,9 +1719,10 @@ static int tegra_i2c_probe(struct platform_device *pdev) /* interrupt will be enabled during of transfer time */ irq_set_status_flags(i2c_dev->irq, IRQ_NOAUTOEN); - err = devm_request_irq(i2c_dev->dev, i2c_dev->irq, tegra_i2c_isr, - IRQF_NO_SUSPEND, dev_name(i2c_dev->dev), - i2c_dev); + err = devm_request_threaded_irq(i2c_dev->dev, i2c_dev->irq, + NULL, tegra_i2c_isr, + IRQF_NO_SUSPEND | IRQF_ONESHOT, + dev_name(i2c_dev->dev), i2c_dev); if (err) return err; -- 2.29.2