Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp4292976pxk; Tue, 22 Sep 2020 15:56:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwx9XbY04k5uImpr1m4z9MweVmZEMBb9OQSQsSO+4qAxmH5bGOSAg2bRzQMz3AydVDftJhb X-Received: by 2002:a50:fc83:: with SMTP id f3mr6302382edq.256.1600815368191; Tue, 22 Sep 2020 15:56:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600815368; cv=none; d=google.com; s=arc-20160816; b=vWkRLkFs5bDhJl+B6/DU8M2f57OXEVOuBFVBSJHmnnDxWoK+Skxy2vXqhXntPedtih SMBIqSKhfPn9Ki+B7EFPeyuCmxt4ga31iP+8FyUdkx/vFEUvhNnA5dChqiIqOjXBW4kZ qCiY+x2j3zdq3s7LRLIJ5lhotXMuWzMLMa9DcHnaM+CROh93KYQ0TN5/dZTHf/e4S7mI 0Y/krJBkyt6O5uvPIU865166px7fKr/fU1hkpeX4EyjOK9YB8f3mWV846aeS8UVCs/B/ fYid6ohrtrC4pHyFwL5QWB/1kx3OCbWQHMy4diu31CGmSeqHEYI3BWsX9ysKqC26RB7z l9dA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=VJxaJS9zxYhaymHHDoqlujoEmK5Ye8suFy8gG2bHHhY=; b=WN4SbJCRigk5xOVYaFn1cawZKNKX2/gUA+7vDZ5REm/I6QkvdNPRJfxIIkK9zxIe+w h/Je/Sr6BuZnS5IrYxI5uyKtRlHFTW60rMI281Oa691kUQAIV+UgFmRJttJkDAg9LZud gUAkydxWPLfTKyQ/4GzHh1rIMRhhkOXSiGNJye+OAaFE2xBBquKS1Ko5OVz7Be7iS+vs Qm3RKQsELeg7JZh8qkOo3cFRr5gqGj+hQxusSP/NjcrDc5Z2GvgumnS6detoxlNQdJxv NNv2utKm1IJd2LJGbuionKnKuNzRTOhqpFInb+26dB+funuLvc0ua19xlmheAMb/jM0K PwoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=oTb66uNN; 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 q20si11516593ejx.248.2020.09.22.15.55.44; Tue, 22 Sep 2020 15:56:08 -0700 (PDT) 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=oTb66uNN; 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 S1727201AbgIVWyC (ORCPT + 99 others); Tue, 22 Sep 2020 18:54:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726993AbgIVWws (ORCPT ); Tue, 22 Sep 2020 18:52:48 -0400 Received: from mail-lf1-x144.google.com (mail-lf1-x144.google.com [IPv6:2a00:1450:4864:20::144]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 447D8C0613D0; Tue, 22 Sep 2020 15:52:48 -0700 (PDT) Received: by mail-lf1-x144.google.com with SMTP id z19so19880301lfr.4; Tue, 22 Sep 2020 15:52:48 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=VJxaJS9zxYhaymHHDoqlujoEmK5Ye8suFy8gG2bHHhY=; b=oTb66uNN2Fl6H8jtcuwPxCs6CcY22NLQKdYWEdRnOFAG8da8P+Lq59AQXvfZNArepV 6dMlWtvPKhSPOvrH6pbUIE20uVn12WBVoWj7ZWl38meB7gk89fsA+wxXahrYt1aEWHnx OaEABJUb0KoLrqCmSEiBmK39ayZQ9kOwRW+tn0eOhKIZl+IPizhu3ip6cjRXadXN395T v5Pk09/dSnaF21cv0d4oizmfL8UUcG7EwKQ2+gdxtQU1sYn9Nm4JWSYskc4MR6ofrmFz MJFh9iLXZQUIWTd+KL/jRy+pckqiV9wW1DRe6ao9XOk7YaI0v63L4CAX0C1eWFoLYv09 YqZg== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=VJxaJS9zxYhaymHHDoqlujoEmK5Ye8suFy8gG2bHHhY=; b=XJQEMyUU4ol98wKdHBEVZcJvS0PoSLTav/jEf/6AH5eISzsbXEEMi/FDGxfv6IAjMg 9QuG8A9hftmJDj+e1tWDLER80X9dTKNwk6sy29dl+KBjgYGhT0Of2OZ8amrx8XxfCjqS UqL+l98Ll586bR8oyG7Oo813J7ctqSao41tHltkm+rud+QjNcXAAJml77p/XA2Vmy8T+ z1jXFUzmw5l4FcUV59CDr1rAE7A6K9bJqKJn2zm5vgyoqYqgzL2MKkTf6ADYqsK1qkd9 6Bfm049tsYBHSGM4uWhOpDjxo6I7ZC7q2veqcc/C6yqRtdEZTHrko+NgiHDjsPy1YpOn z6zQ== X-Gm-Message-State: AOAM533nPZg/Lv3vMSqDsb3EFaTJ5NqJgT02rLB5ZlYumRc2VF1nf1vU 6148i24rjz2NvEOIPqOkTJU= X-Received: by 2002:a05:6512:4c1:: with SMTP id w1mr2559216lfq.202.1600815166695; Tue, 22 Sep 2020 15:52:46 -0700 (PDT) Received: from localhost.localdomain (109-252-170-211.dynamic.spd-mgts.ru. [109.252.170.211]) by smtp.gmail.com with ESMTPSA id l15sm3977588lfk.71.2020.09.22.15.52.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Sep 2020 15:52:46 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Laxman Dewangan , Wolfram Sang , =?UTF-8?q?Micha=C5=82=20Miros=C5=82aw?= , Andy Shevchenko Cc: linux-i2c@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v8 17/32] i2c: tegra: Remove outdated barrier() Date: Wed, 23 Sep 2020 01:51:40 +0300 Message-Id: <20200922225155.10798-18-digetx@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200922225155.10798-1-digetx@gmail.com> References: <20200922225155.10798-1-digetx@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The barrier() was intended to reduce possibility of racing with the interrupt handler, but driver's code evolved significantly and today's driver enables interrupt only when it waits for completion notification. Hence barrier() has no good use anymore, let's remove it. Reviewed-by: Michał Mirosław Acked-by: Thierry Reding Tested-by: Thierry Reding Signed-off-by: Dmitry Osipenko --- drivers/i2c/busses/i2c-tegra.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c index a56c0873f4a3..347651401cd6 100644 --- a/drivers/i2c/busses/i2c-tegra.c +++ b/drivers/i2c/busses/i2c-tegra.c @@ -795,18 +795,17 @@ static int tegra_i2c_fill_tx_fifo(struct tegra_i2c_dev *i2c_dev) words_to_transfer = tx_fifo_avail; /* - * Update state before writing to FIFO. If this casues us - * to finish writing all bytes (AKA buf_remaining goes to 0) we - * have a potential for an interrupt (PACKET_XFER_COMPLETE is - * not maskable). We need to make sure that the isr sees - * buf_remaining as 0 and doesn't call us back re-entrantly. + * Update state before writing to FIFO. Note that this may + * cause us to finish writing all bytes (AKA buf_remaining + * goes to 0), hence we have a potential for an interrupt + * (PACKET_XFER_COMPLETE is not maskable), but GIC interrupt + * is disabled at this point. */ buf_remaining -= words_to_transfer * BYTES_PER_FIFO_WORD; tx_fifo_avail -= words_to_transfer; i2c_dev->msg_buf_remaining = buf_remaining; i2c_dev->msg_buf = buf + words_to_transfer * BYTES_PER_FIFO_WORD; - barrier(); i2c_writesl(i2c_dev, buf, I2C_TX_FIFO, words_to_transfer); @@ -827,10 +826,8 @@ static int tegra_i2c_fill_tx_fifo(struct tegra_i2c_dev *i2c_dev) memcpy(&val, buf, buf_remaining); val = le32_to_cpu(val); - /* Again update before writing to FIFO to make sure isr sees. */ i2c_dev->msg_buf_remaining = 0; i2c_dev->msg_buf = NULL; - barrier(); i2c_writel(i2c_dev, val, I2C_TX_FIFO); } -- 2.27.0