From: Alan Ott <alan@signal11.us>
To: Alexander Smirnov <alex.bluesman.smirnov@gmail.com>,
Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
david@hauweele.net
Cc: linux-zigbee-devel@lists.sourceforge.net, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, Alan Ott <alan@signal11.us>
Subject: [PATCH v1 1/3] mrf24j40: Move INIT_COMPLETION() to before packet transmission
Date: Sat, 5 Oct 2013 23:52:22 -0400 [thread overview]
Message-ID: <1381031544-2960-2-git-send-email-alan@signal11.us> (raw)
In-Reply-To: <1381031544-2960-1-git-send-email-alan@signal11.us>
This avoids a race condition where complete(tx_complete) could be called
before tx_complete is initialized.
Signed-off-by: Alan Ott <alan@signal11.us>
---
drivers/net/ieee802154/mrf24j40.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ieee802154/mrf24j40.c b/drivers/net/ieee802154/mrf24j40.c
index 42e6dee..66bb4ce 100644
--- a/drivers/net/ieee802154/mrf24j40.c
+++ b/drivers/net/ieee802154/mrf24j40.c
@@ -344,6 +344,8 @@ static int mrf24j40_tx(struct ieee802154_dev *dev, struct sk_buff *skb)
if (ret)
goto err;
+ INIT_COMPLETION(devrec->tx_complete);
+
/* Set TXNTRIG bit of TXNCON to send packet */
ret = read_short_reg(devrec, REG_TXNCON, &val);
if (ret)
@@ -354,8 +356,6 @@ static int mrf24j40_tx(struct ieee802154_dev *dev, struct sk_buff *skb)
val |= 0x4;
write_short_reg(devrec, REG_TXNCON, val);
- INIT_COMPLETION(devrec->tx_complete);
-
/* Wait for the device to send the TX complete interrupt. */
ret = wait_for_completion_interruptible_timeout(
&devrec->tx_complete,
--
1.8.1.2
next prev parent reply other threads:[~2013-10-06 3:52 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CAO+c-UVJQJbmmmCS4hxAEYHKa8gEU1Bs=y+Rv_A75UHeBZxc+w@mail.gmail.com>
2013-05-20 0:05 ` [PATCH testing] mrf24j40: Move INIT_COMPLETION to before the packet is sent Alan Ott
2013-05-22 2:01 ` [PATCH beta 1] 0/3] Fix race conditions in mrf24j40 interrupts Alan Ott
2013-05-22 2:01 ` [PATCH beta 1] 1/3] mrf24j40: Move INIT_COMPLETION() to before packet transmission Alan Ott
2013-05-22 2:01 ` [PATCH beta 1] 2/3] mrf24j40: Use threaded IRQ handler Alan Ott
2013-05-22 2:01 ` [PATCH beta 1] 3/3] mrf24j40: Use level-triggered interrupts Alan Ott
2013-05-22 2:03 ` [PATCH beta 1] 0/3] Fix race conditions in mrf24j40 interrupts Alan Ott
2013-05-22 20:32 ` David Hauweele
2013-05-23 6:36 ` Alan Ott
2013-05-23 17:54 ` David Hauweele
2013-05-23 19:33 ` Alan Ott
2013-10-06 3:52 ` [PATCH v1 " Alan Ott
2013-10-06 3:52 ` Alan Ott [this message]
2013-10-06 3:52 ` [PATCH v1 2/3] mrf24j40: Use threaded IRQ handler Alan Ott
2013-10-06 3:52 ` [PATCH v1 3/3] mrf24j40: Use level-triggered interrupts Alan Ott
2013-10-08 19:32 ` [PATCH v1 0/3] Fix race conditions in mrf24j40 interrupts David Miller
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=1381031544-2960-2-git-send-email-alan@signal11.us \
--to=alan@signal11.us \
--cc=alex.bluesman.smirnov@gmail.com \
--cc=davem@davemloft.net \
--cc=david@hauweele.net \
--cc=dbaryshkov@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-zigbee-devel@lists.sourceforge.net \
--cc=netdev@vger.kernel.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
all inboxes | Powered by JetHome®