Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp4128011pxk; Tue, 29 Sep 2020 15:25:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyMlLzK0uFCnMxO+bD/SqaiYr40ebbSzCHaBpv46c0kyZgM3zBF6iKjvLHxo13tzMLfK1xB X-Received: by 2002:a17:906:fccb:: with SMTP id qx11mr6195304ejb.429.1601418317558; Tue, 29 Sep 2020 15:25:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601418317; cv=none; d=google.com; s=arc-20160816; b=vSWkGJ7iVRQauBvqdB67uCoapprzNXipvenQcpQ9Tqvt/W6Dw7RrEFFZ1WI9hHEjhV tDfVeTb7jWhKmtpCsHqRxQPh+xjvnBXa2Es/WZ6rAGq3CYydW/Od4viCqeH9cOOyaFNH z0CLwJBBBcPT9MLgWiIQXEoV3ZqOhyql5XWqkNFKd04UJ4INCfj2L/MxeKDEE1HqWUD0 Prc0ar5QB3S3LqPT+go5W+6Ry9cYqmEyg3Cxyl9BEt5pQmmZLBBC1B9CQNBFSNccs1CI wBvV6FcXuYjGPCtSXzuL+Nq8gXL3+D13s1/pDBv8oWcRBCQ75fEAvSCpIkXYbkX9792q AjOw== 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=pHAwf3Bd6yoReSveFkgnKtaMRN4YjhPD1mjTlCUGqUo=; b=yrTHqaOJPwVH4WXWDQvXwSj1V+gDFMSWxK2xM2n8k1a7vcFmV2Uo9WXIlNdciOg+M9 7KxS/rIuKnl8gueHLRJ9zDG8SV7ooFlbHhM72mHM1KyZQUtJLyXHT4nylOdJx+lmHK+f 5NgTozkf186STSbCgUIh0HuJkbSrEftmiMmi9uX7CeFIGp8ackQgqXA17Dxkw5hjRn+F hqmWaZKbDhvehqMufr9B2+bqcj5lPFs3CJ7wgwH2lGBBe6yZxtbsqJoZpfkT2s2KIIuE PllwvskRMxLMTIP2PcU/miibfWHafH+d3gi0Xhuz5VlHTJENbs/e5uq3oSjNs0YZ5VAa BRPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=MWTHIBAl; 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 bi17si3895060edb.582.2020.09.29.15.24.54; Tue, 29 Sep 2020 15:25:17 -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=MWTHIBAl; 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 S1729785AbgI2WW2 (ORCPT + 99 others); Tue, 29 Sep 2020 18:22:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53662 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729080AbgI2WUz (ORCPT ); Tue, 29 Sep 2020 18:20:55 -0400 Received: from mail-lf1-x142.google.com (mail-lf1-x142.google.com [IPv6:2a00:1450:4864:20::142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 110E9C0613D7; Tue, 29 Sep 2020 15:20:54 -0700 (PDT) Received: by mail-lf1-x142.google.com with SMTP id y2so7394344lfy.10; Tue, 29 Sep 2020 15:20:53 -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=pHAwf3Bd6yoReSveFkgnKtaMRN4YjhPD1mjTlCUGqUo=; b=MWTHIBAll+rNvndiQt03bMVIl4QYKhBNxv9NlqPYj3IRcPXpB41acsBR3xXQEwLg/m Qx2lrSbdiO06KRRliH+mhS7fmafOHPNbOnZR7sKJv9fvP1kXUwHpsw+pRFhwIrylDIXg dEbwe3HYVqvkZt02ZqD7fOP1kn3KlxGbb7XSWpW9Cv13X5DOp0/5Soy1GDHV91kCYzwb FOPA24YqoOIpd7YqzZYakNZ2ph3ZBijAY92ZN/C09iu5Y7BP9cMpfQo2UTMVerBcZOcV hHXBRUC5/9maB2PO8GZZwRM5PMpSJGaq44SWIeZKfPkyNR9+bRWQviPbgJxFrfiHViAK l2eg== 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=pHAwf3Bd6yoReSveFkgnKtaMRN4YjhPD1mjTlCUGqUo=; b=aVrq9Cwqsg6M9YS+cMqR7XjPU14UCMnhp4QMVTsG1cz9+MWQtYF6wInDJrY8nrDe+C PZQiLPv3xlzzmi80qLmRYaYlq3Px+bdXiDgNdGUCJHR8hG1HOaVjLA3C5cu5BvyLJZQc mofj+TyhtiUVHVMsPN795hzjld+lSho1z12lYHInwfiqUPh+Fvy5owVTVP3KFhdv157G nryPZHP92WV4I+fZ09FEaq/Ij7WS8OJUNEXoPqg8f4xbNkVdHaY9fkDNKK8BpykvCCwY Q6qYIMnpAwpX/mhdnAQSkrno+R5te3wJZVeP6UAKIPXHETiYZsk7n5sLWVdteSJkK7uu 55HA== X-Gm-Message-State: AOAM533Fij+MRVAdqB1eKSWfsYGZ1CXMnX0t/Dp7SZvD0T0W+qbGvPdC MvAsy0CdC86o5Wbgqrb2Z1KCGuagzWQ= X-Received: by 2002:a19:8316:: with SMTP id f22mr2163836lfd.239.1601418052431; Tue, 29 Sep 2020 15:20:52 -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 q18sm3379750lfr.138.2020.09.29.15.20.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Sep 2020 15:20:51 -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 v9 17/32] i2c: tegra: Remove outdated barrier() Date: Wed, 30 Sep 2020 01:19:00 +0300 Message-Id: <20200929221915.10979-18-digetx@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200929221915.10979-1-digetx@gmail.com> References: <20200929221915.10979-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 Reviewed-by: Andy Shevchenko 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