From: Tom Rini <trini@konsulko.com>
To: u-boot@lists.denx.de
Subject: [PATCH 04/10] tegra: Convert from ACCESS_ONCE to READ/WRITE_ONCE
Date: Thu, 14 May 2020 08:30:03 -0400 [thread overview]
Message-ID: <20200514123009.5721-4-trini@konsulko.com> (raw)
In-Reply-To: <20200514123009.5721-1-trini@konsulko.com>
In order to update our <linux/compiler.h> to a newer version that no
longer provides ACCESS_ONCE() but only READ_ONCE()/WRITE_ONCE() we need
to convert arch/arm/mach-tegra/ivc.c to the other macros.
Cc: Tom Warren <twarren@nvidia.com>
Signed-off-by: Tom Rini <trini@konsulko.com>
---
arch/arm/mach-tegra/ivc.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/arch/arm/mach-tegra/ivc.c b/arch/arm/mach-tegra/ivc.c
index a448f2df3028..325d61f6d3a7 100644
--- a/arch/arm/mach-tegra/ivc.c
+++ b/arch/arm/mach-tegra/ivc.c
@@ -123,11 +123,11 @@ static inline int tegra_ivc_channel_empty(struct tegra_ivc *ivc,
{
/*
* This function performs multiple checks on the same values with
- * security implications, so create snapshots with ACCESS_ONCE() to
+ * security implications, so create snapshots with READ_ONCE() to
* ensure that these checks use the same values.
*/
- uint32_t w_count = ACCESS_ONCE(ch->w_count);
- uint32_t r_count = ACCESS_ONCE(ch->r_count);
+ uint32_t w_count = READ_ONCE(ch->w_count);
+ uint32_t r_count = READ_ONCE(ch->r_count);
/*
* Perform an over-full check to prevent denial of service attacks where
@@ -152,14 +152,14 @@ static inline int tegra_ivc_channel_full(struct tegra_ivc *ivc,
* Invalid cases where the counters indicate that the queue is over
* capacity also appear full.
*/
- return (ACCESS_ONCE(ch->w_count) - ACCESS_ONCE(ch->r_count)) >=
+ return (READ_ONCE(ch->w_count) - READ_ONCE(ch->r_count)) >=
ivc->nframes;
}
static inline void tegra_ivc_advance_rx(struct tegra_ivc *ivc)
{
- ACCESS_ONCE(ivc->rx_channel->r_count) =
- ACCESS_ONCE(ivc->rx_channel->r_count) + 1;
+ WRITE_ONCE(ivc->rx_channel->r_count,
+ READ_ONCE(ivc->rx_channel->r_count) + 1);
if (ivc->r_pos == ivc->nframes - 1)
ivc->r_pos = 0;
@@ -169,8 +169,8 @@ static inline void tegra_ivc_advance_rx(struct tegra_ivc *ivc)
static inline void tegra_ivc_advance_tx(struct tegra_ivc *ivc)
{
- ACCESS_ONCE(ivc->tx_channel->w_count) =
- ACCESS_ONCE(ivc->tx_channel->w_count) + 1;
+ WRITE_ONCE(ivc->tx_channel->w_count,
+ READ_ONCE(ivc->tx_channel->w_count) + 1);
if (ivc->w_pos == ivc->nframes - 1)
ivc->w_pos = 0;
@@ -231,7 +231,7 @@ static inline uint32_t tegra_ivc_channel_avail_count(struct tegra_ivc *ivc,
* comment in tegra_ivc_channel_empty() for an explanation about
* special over-full considerations.
*/
- return ACCESS_ONCE(ch->w_count) - ACCESS_ONCE(ch->r_count);
+ return READ_ONCE(ch->w_count) - READ_ONCE(ch->r_count);
}
int tegra_ivc_read_get_next_frame(struct tegra_ivc *ivc, void **frame)
@@ -357,7 +357,7 @@ int tegra_ivc_channel_notified(struct tegra_ivc *ivc)
/* Copy the receiver's state out of shared memory. */
offset = offsetof(struct tegra_ivc_channel_header, w_count);
tegra_ivc_invalidate_counter(ivc, ivc->rx_channel, offset);
- peer_state = ACCESS_ONCE(ivc->rx_channel->state);
+ peer_state = READ_ONCE(ivc->rx_channel->state);
if (peer_state == ivc_state_sync) {
/*
--
2.17.1
next prev parent reply other threads:[~2020-05-14 12:30 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-14 12:30 [PATCH 01/10] kconfiglib: Update to the 14.1.0 release Tom Rini
2020-05-14 12:30 ` [PATCH 02/10] kconfig: Add scripts/Kconfig.include from v4.19 Tom Rini
2020-05-18 2:55 ` Masahiro Yamada
2020-05-18 15:23 ` Tom Rini
2020-05-18 16:55 ` Tom Rini
2020-05-19 1:40 ` Masahiro Yamada
2020-05-19 14:18 ` Tom Rini
2020-07-05 22:08 ` Tom Rini
2020-05-14 12:30 ` [PATCH 03/10] Don't start ad-hoc games with -Wno-maybe-initialized Tom Rini
2020-07-05 22:08 ` Tom Rini
2020-05-14 12:30 ` Tom Rini [this message]
2020-07-05 22:08 ` [PATCH 04/10] tegra: Convert from ACCESS_ONCE to READ/WRITE_ONCE Tom Rini
2020-05-14 12:30 ` [PATCH 05/10] x86: " Tom Rini
2020-05-20 3:07 ` Simon Glass
2020-07-05 22:08 ` Tom Rini
2020-05-14 12:30 ` [PATCH 06/10] socfpga: Mark socfpga_fpga_add() as static inline in the non-FPGA case Tom Rini
2020-05-14 12:52 ` Marek Vasut
2020-07-05 22:08 ` Tom Rini
2020-05-14 12:30 ` [PATCH 07/10] compiler*.h: sync include/linux/compiler*.h with Linux 5.7-rc5 Tom Rini
2020-07-05 22:08 ` Tom Rini
2020-07-20 8:03 ` Jagan Teki
2020-07-20 12:53 ` Tom Rini
2020-05-14 12:30 ` [PATCH 08/10] compiler_types.h: Re-introduce CONFIG_OPTIMIZE_INLINING for U-Boot Tom Rini
2020-07-05 22:08 ` Tom Rini
2020-05-14 12:30 ` [PATCH 09/10] compilers: Introduce options for forcing inlining on SPL/TPL Tom Rini
2020-07-05 22:08 ` Tom Rini
2020-05-14 12:30 ` [PATCH 10/10] socfpga: Enable optimized inlining on stratix10 Tom Rini
2020-05-14 12:52 ` Marek Vasut
2020-07-05 22:09 ` Tom Rini
2020-07-05 22:08 ` [PATCH 01/10] kconfiglib: Update to the 14.1.0 release Tom Rini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200514123009.5721-4-trini@konsulko.com \
--to=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox