From: Arnaud Bonnet <abo@medichon.fr>
To: marcel@holtmann.org, luiz.dentz@gmail.com,
matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com
Cc: linux-bluetooth@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org, jkoolstra@xs4all.nl,
skhan@linuxfoundation.org, Arnaud Bonnet <abo@medichon.fr>
Subject: [PATCH] Bluetooth: btmtk: remove redundant memory barrier with helper
Date: Wed, 21 Oct 2026 16:51:12 +0200 [thread overview]
Message-ID: <20261021145112.64213-1-abo@medichon.fr> (raw)
The test_and_clear_bit() call works as a full memory barrier, thus it is
not required to emit a barrier using smp_mb__after_atomic() before
wake_up_bit().
Replace the whole sequence with test_and_clear_wake_up_bit(), which was
introduced later in commit 52d633def56c ("sched: Add
test_and_clear_wake_up_bit() and atomic_dec_and_wake_up()") as a wrapper
for the correct sequence.
Signed-off-by: Arnaud Bonnet <abo@medichon.fr>
---
Tested by building and manually checking generated assembly on x86, arm64
and riscv64.
drivers/bluetooth/btmtk.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/drivers/bluetooth/btmtk.c b/drivers/bluetooth/btmtk.c
index 75483d8230e1..a620e24b6c17 100644
--- a/drivers/bluetooth/btmtk.c
+++ b/drivers/bluetooth/btmtk.c
@@ -607,13 +607,7 @@ static void btmtk_usb_wmt_recv(struct urb *urb)
return;
}
- if (test_and_clear_bit(BTMTK_TX_WAIT_VND_EVT,
- &data->flags)) {
- /* Barrier to sync with other CPUs */
- smp_mb__after_atomic();
- wake_up_bit(&data->flags,
- BTMTK_TX_WAIT_VND_EVT);
- }
+ test_and_clear_wake_up_bit(BTMTK_TX_WAIT_VND_EVT, &data->flags);
kfree(urb->setup_packet);
return;
} else if (urb->status == -ENOENT) {
--
2.53.0
reply other threads:[~2026-10-21 14:52 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261021145112.64213-1-abo@medichon.fr \
--to=abo@medichon.fr \
--cc=angelogioacchino.delregno@collabora.com \
--cc=jkoolstra@xs4all.nl \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-bluetooth@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=luiz.dentz@gmail.com \
--cc=marcel@holtmann.org \
--cc=matthias.bgg@gmail.com \
--cc=skhan@linuxfoundation.org \
/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