ieee802154: Changes mac locking/unlocking to aid in debugging

This commit is contained in:
Anthony Merlino
2017-07-07 23:31:13 -04:00
parent 77b99c9a32
commit 4cf2d0a6a8
8 changed files with 96 additions and 72 deletions
+28 -28
View File
@@ -184,7 +184,7 @@ int mac802154_txdesc_alloc(FAR struct ieee802154_privmac_s *priv,
{ {
/* Unlock MAC so that other work can be done to free a notification */ /* Unlock MAC so that other work can be done to free a notification */
mac802154_givesem(&priv->exclsem); mac802154_unlock(priv)
/* Take a count from the tx desc semaphore, waiting if necessary. We /* Take a count from the tx desc semaphore, waiting if necessary. We
* only return from here with an error if we are allowing interruptions * only return from here with an error if we are allowing interruptions
@@ -204,7 +204,7 @@ int mac802154_txdesc_alloc(FAR struct ieee802154_privmac_s *priv,
* MAC in order to ensure this happens correctly. * MAC in order to ensure this happens correctly.
*/ */
ret = mac802154_takesem(&priv->exclsem, allow_interrupt); ret = mac802154_lock(priv, allow_interrupt);
if (ret < 0) if (ret < 0)
{ {
wlwarn("WARNING: mac802154_takesem failed: %d\n", ret); wlwarn("WARNING: mac802154_takesem failed: %d\n", ret);
@@ -609,7 +609,7 @@ static void mac802154_purge_worker(FAR void *arg)
* signals so don't allow interruptions * signals so don't allow interruptions
*/ */
mac802154_takesem(&priv->exclsem, false); mac802154_lock(priv, false);
while (1) while (1)
{ {
@@ -679,7 +679,7 @@ static int mac802154_radiopoll(FAR const struct ieee802154_radiocb_s *radiocb,
/* Get exclusive access to the driver structure. Ignore any EINTR signals */ /* Get exclusive access to the driver structure. Ignore any EINTR signals */
mac802154_takesem(&priv->exclsem, false); mac802154_lock(priv, false);
if (gts) if (gts)
{ {
@@ -694,7 +694,7 @@ static int mac802154_radiopoll(FAR const struct ieee802154_radiocb_s *radiocb,
*txdesc = (FAR struct ieee802154_txdesc_s *)sq_remfirst(&priv->csma_queue); *txdesc = (FAR struct ieee802154_txdesc_s *)sq_remfirst(&priv->csma_queue);
} }
mac802154_givesem(&priv->exclsem); mac802154_unlock(priv)
if (*txdesc != NULL) if (*txdesc != NULL)
{ {
@@ -731,11 +731,11 @@ static void mac802154_txdone(FAR const struct ieee802154_radiocb_s *radiocb,
* signals so don't allow interruptions * signals so don't allow interruptions
*/ */
mac802154_takesem(&priv->exclsem, false); mac802154_lock(priv, false);
sq_addlast((FAR sq_entry_t *)txdesc, &priv->txdone_queue); sq_addlast((FAR sq_entry_t *)txdesc, &priv->txdone_queue);
mac802154_givesem(&priv->exclsem); mac802154_unlock(priv)
/* Schedule work with the work queue to process the completion further */ /* Schedule work with the work queue to process the completion further */
@@ -767,7 +767,7 @@ static void mac802154_txdone_worker(FAR void *arg)
* signals so don't allow interruptions * signals so don't allow interruptions
*/ */
mac802154_takesem(&priv->exclsem, false); mac802154_lock(priv, false);
while (1) while (1)
{ {
@@ -794,9 +794,9 @@ static void mac802154_txdone_worker(FAR void *arg)
/* Release the MAC, call the callback, get exclusive access again */ /* Release the MAC, call the callback, get exclusive access again */
mac802154_givesem(&priv->exclsem); mac802154_unlock(priv)
mac802154_notify(priv, notif); mac802154_notify(priv, notif);
mac802154_takesem(&priv->exclsem, false); mac802154_lock(priv, false);
} }
break; break;
@@ -878,7 +878,7 @@ static void mac802154_txdone_worker(FAR void *arg)
mac802154_txdesc_free(priv, txdesc); mac802154_txdesc_free(priv, txdesc);
} }
mac802154_givesem(&priv->exclsem); mac802154_unlock(priv)
} }
/**************************************************************************** /****************************************************************************
@@ -909,7 +909,7 @@ static void mac802154_rxframe(FAR const struct ieee802154_radiocb_s *radiocb,
* signals so if we see one, just go back to trying to get access again. * signals so if we see one, just go back to trying to get access again.
*/ */
mac802154_takesem(&priv->exclsem, false); mac802154_lock(priv, false);
/* Push the iob onto the tail of the frame list for processing */ /* Push the iob onto the tail of the frame list for processing */
@@ -917,7 +917,7 @@ static void mac802154_rxframe(FAR const struct ieee802154_radiocb_s *radiocb,
wlinfo("Frame received\n"); wlinfo("Frame received\n");
mac802154_givesem(&priv->exclsem); mac802154_unlock(priv)
/* Schedule work with the work queue to process the completion further */ /* Schedule work with the work queue to process the completion further */
@@ -955,7 +955,7 @@ static void mac802154_rxframe_worker(FAR void *arg)
* signals so if we see one, just go back to trying to get access again. * signals so if we see one, just go back to trying to get access again.
*/ */
mac802154_takesem(&priv->exclsem, false); mac802154_lock(priv, false);
/* Pop the iob from the head of the frame list for processing */ /* Pop the iob from the head of the frame list for processing */
@@ -963,7 +963,7 @@ static void mac802154_rxframe_worker(FAR void *arg)
/* Once we pop off the indication, we don't need to keep the mac locked */ /* Once we pop off the indication, we don't need to keep the mac locked */
mac802154_givesem(&priv->exclsem); mac802154_unlock(priv)
if (ind == NULL) if (ind == NULL)
{ {
@@ -1147,7 +1147,7 @@ static void mac802154_rxdataframe(FAR struct ieee802154_privmac_s *priv,
/* Get exclusive access to the MAC */ /* Get exclusive access to the MAC */
mac802154_takesem(&priv->exclsem, false); mac802154_lock(priv, false);
/* If we are currently performing a POLL operation and we've /* If we are currently performing a POLL operation and we've
* received a data response, use the addressing information * received a data response, use the addressing information
@@ -1266,7 +1266,7 @@ static void mac802154_rxdataframe(FAR struct ieee802154_privmac_s *priv,
/* Release the MAC */ /* Release the MAC */
mac802154_givesem(&priv->exclsem); mac802154_unlock(priv)
mac802154_notify(priv, notif); mac802154_notify(priv, notif);
/* If there was data, pass it along */ /* If there was data, pass it along */
@@ -1282,7 +1282,7 @@ static void mac802154_rxdataframe(FAR struct ieee802154_privmac_s *priv,
notify_with_lock: notify_with_lock:
mac802154_givesem(&priv->exclsem); mac802154_unlock(priv)
notify_without_lock: notify_without_lock:
@@ -1341,7 +1341,7 @@ static void mac802154_rxdatareq(FAR struct ieee802154_privmac_s *priv,
/* Get exclusive access to the MAC */ /* Get exclusive access to the MAC */
mac802154_takesem(&priv->exclsem, false); mac802154_lock(priv, false);
/* Search the list of indirect transactions to see if there are any waiting /* Search the list of indirect transactions to see if there are any waiting
* for the requesting device. * for the requesting device.
@@ -1371,7 +1371,7 @@ static void mac802154_rxdatareq(FAR struct ieee802154_privmac_s *priv,
priv->radio->txdelayed(priv->radio, txdesc, 0); priv->radio->txdelayed(priv->radio, txdesc, 0);
priv->beaconupdate = true; priv->beaconupdate = true;
mac802154_givesem(&priv->exclsem); mac802154_unlock(priv)
return; return;
} }
} }
@@ -1388,7 +1388,7 @@ static void mac802154_rxdatareq(FAR struct ieee802154_privmac_s *priv,
priv->radio->txdelayed(priv->radio, txdesc, 0); priv->radio->txdelayed(priv->radio, txdesc, 0);
priv->beaconupdate = true; priv->beaconupdate = true;
mac802154_givesem(&priv->exclsem); mac802154_unlock(priv)
return; return;
} }
} }
@@ -1494,7 +1494,7 @@ static void mac802154_rxdatareq(FAR struct ieee802154_privmac_s *priv,
txdesc->frame = iob; txdesc->frame = iob;
txdesc->frametype = IEEE802154_FRAME_DATA; txdesc->frametype = IEEE802154_FRAME_DATA;
mac802154_givesem(&priv->exclsem); mac802154_unlock(priv)
priv->radio->txdelayed(priv->radio, txdesc, 0); priv->radio->txdelayed(priv->radio, txdesc, 0);
} }
@@ -1513,7 +1513,7 @@ static void mac802154_sfevent(FAR const struct ieee802154_radiocb_s *radiocb,
* signals so if we see one, just go back to trying to get access again. * signals so if we see one, just go back to trying to get access again.
*/ */
mac802154_takesem(&priv->exclsem, false); mac802154_lock(priv, false);
switch (sfevent) switch (sfevent)
{ {
@@ -1536,7 +1536,7 @@ static void mac802154_sfevent(FAR const struct ieee802154_radiocb_s *radiocb,
} }
mac802154_givesem(&priv->exclsem); mac802154_unlock(priv)
} }
/**************************************************************************** /****************************************************************************
@@ -1823,9 +1823,9 @@ static void mac802154_rxbeaconframe(FAR struct ieee802154_privmac_s *priv,
{ {
/* Unlock the MAC, notify, then lock again */ /* Unlock the MAC, notify, then lock again */
mac802154_givesem(&priv->exclsem); mac802154_unlock(priv)
mac802154_notify(priv, notif); mac802154_notify(priv, notif);
mac802154_takesem(&priv->exclsem, false); mac802154_lock(priv, false);
} }
/* If we have data pending for us, attempt to extract it. If for some /* If we have data pending for us, attempt to extract it. If for some
@@ -1887,9 +1887,9 @@ static void mac802154_rxbeaconframe(FAR struct ieee802154_privmac_s *priv,
/* Unlock the MAC, notify, then lock again */ /* Unlock the MAC, notify, then lock again */
mac802154_givesem(&priv->exclsem); mac802154_unlock(priv)
mac802154_notify(priv, notif); mac802154_notify(priv, notif);
mac802154_takesem(&priv->exclsem, false); mac802154_lock(priv, false);
return; /* Return so that we don't free the notificaiton */ return; /* Return so that we don't free the notificaiton */
} }
} }
+17 -17
View File
@@ -111,7 +111,7 @@ int mac802154_req_associate(MACHANDLE mac,
/* Get exclusive access to the MAC */ /* Get exclusive access to the MAC */
ret = mac802154_takesem(&priv->exclsem, true); ret = mac802154_lock(priv, true);
if (ret < 0) if (ret < 0)
{ {
mac802154_givesem(&priv->opsem); mac802154_givesem(&priv->opsem);
@@ -154,7 +154,7 @@ int mac802154_req_associate(MACHANDLE mac,
if (ret < 0) if (ret < 0)
{ {
iob_free(iob); iob_free(iob);
mac802154_givesem(&priv->exclsem); mac802154_unlock(priv)
mac802154_givesem(&priv->opsem); mac802154_givesem(&priv->opsem);
return ret; return ret;
} }
@@ -299,7 +299,7 @@ int mac802154_req_associate(MACHANDLE mac,
/* We no longer need to have the MAC layer locked. */ /* We no longer need to have the MAC layer locked. */
mac802154_givesem(&priv->exclsem); mac802154_unlock(priv)
return OK; return OK;
} }
@@ -394,7 +394,7 @@ int mac802154_resp_associate(MACHANDLE mac,
/* Get exclusive access to the MAC */ /* Get exclusive access to the MAC */
ret = mac802154_takesem(&priv->exclsem, true); ret = mac802154_lock(priv, true);
if (ret < 0) if (ret < 0)
{ {
iob_free(iob); iob_free(iob);
@@ -407,7 +407,7 @@ int mac802154_resp_associate(MACHANDLE mac,
if (ret < 0) if (ret < 0)
{ {
iob_free(iob); iob_free(iob);
mac802154_givesem(&priv->exclsem); mac802154_unlock(priv)
return ret; return ret;
} }
@@ -420,7 +420,7 @@ int mac802154_resp_associate(MACHANDLE mac,
mac802154_setupindirect(priv, txdesc); mac802154_setupindirect(priv, txdesc);
mac802154_givesem(&priv->exclsem); mac802154_unlock(priv)
return OK; return OK;
} }
@@ -484,9 +484,9 @@ void mac802154_txdone_assocreq(FAR struct ieee802154_privmac_s *priv,
/* Release the MAC, call the callback, get exclusive access again */ /* Release the MAC, call the callback, get exclusive access again */
mac802154_givesem(&priv->exclsem); mac802154_unlock(priv)
mac802154_notify(priv, notif); mac802154_notify(priv, notif);
mac802154_takesem(&priv->exclsem, false); mac802154_lock(priv, false);
} }
else else
{ {
@@ -627,9 +627,9 @@ void mac802154_txdone_datareq_assoc(FAR struct ieee802154_privmac_s *priv,
/* Release the MAC, call the callback, get exclusive access again */ /* Release the MAC, call the callback, get exclusive access again */
mac802154_givesem(&priv->exclsem); mac802154_unlock(priv)
mac802154_notify(priv, notif); mac802154_notify(priv, notif);
mac802154_takesem(&priv->exclsem, false); mac802154_lock(priv, false);
} }
else else
{ {
@@ -689,7 +689,7 @@ void mac802154_rx_assocreq(FAR struct ieee802154_privmac_s *priv,
/* Get exclusive access to the MAC */ /* Get exclusive access to the MAC */
mac802154_takesem(&priv->exclsem, false); mac802154_lock(priv, false);
/* Allocate a notification to pass to the next highest layer */ /* Allocate a notification to pass to the next highest layer */
@@ -730,7 +730,7 @@ void mac802154_rx_assocreq(FAR struct ieee802154_privmac_s *priv,
/* Unlock the MAC */ /* Unlock the MAC */
mac802154_givesem(&priv->exclsem); mac802154_unlock(priv)
/* Notify the next highest layer of the association status */ /* Notify the next highest layer of the association status */
@@ -738,7 +738,7 @@ void mac802154_rx_assocreq(FAR struct ieee802154_privmac_s *priv,
return; return;
errout_with_sem: errout_with_sem:
mac802154_givesem(&priv->exclsem); mac802154_unlock(priv)
return; return;
} }
@@ -785,7 +785,7 @@ void mac802154_rx_assocresp(FAR struct ieee802154_privmac_s *priv,
/* Get exclusive access to the MAC */ /* Get exclusive access to the MAC */
mac802154_takesem(&priv->exclsem, false); mac802154_lock(priv, false);
/* Allocate a notification to pass to the next highest layer */ /* Allocate a notification to pass to the next highest layer */
@@ -838,7 +838,7 @@ void mac802154_rx_assocresp(FAR struct ieee802154_privmac_s *priv,
/* Unlock the MAC */ /* Unlock the MAC */
mac802154_givesem(&priv->exclsem); mac802154_unlock(priv)
/* Notify the next highest layer of the association status */ /* Notify the next highest layer of the association status */
@@ -875,7 +875,7 @@ static void mac802154_assoctimeout(FAR struct ieee802154_privmac_s *priv)
* Don't allow EINTR to interrupt. * Don't allow EINTR to interrupt.
*/ */
mac802154_takesem(&priv->exclsem, false); mac802154_lock(priv, false);
mac802154_notif_alloc(priv, &notif, false); mac802154_notif_alloc(priv, &notif, false);
/* We are no longer performing the association operation */ /* We are no longer performing the association operation */
@@ -887,7 +887,7 @@ static void mac802154_assoctimeout(FAR struct ieee802154_privmac_s *priv)
/* Release the MAC */ /* Release the MAC */
mac802154_givesem(&priv->exclsem); mac802154_unlock(priv)
notif->notiftype = IEEE802154_NOTIFY_CONF_ASSOC; notif->notiftype = IEEE802154_NOTIFY_CONF_ASSOC;
notif->u.assocconf.status = IEEE802154_STATUS_NO_DATA; notif->u.assocconf.status = IEEE802154_STATUS_NO_DATA;
+4 -4
View File
@@ -147,7 +147,7 @@ int mac802154_req_data(MACHANDLE mac,
/* From this point on, we need exclusive access to the privmac struct */ /* From this point on, we need exclusive access to the privmac struct */
ret = mac802154_takesem(&priv->exclsem, true); ret = mac802154_lock(priv, true);
if (ret < 0) if (ret < 0)
{ {
/* Should only fail if interrupted by a signal */ /* Should only fail if interrupted by a signal */
@@ -313,7 +313,7 @@ int mac802154_req_data(MACHANDLE mac,
memcpy(&txdesc->destaddr, &meta->destaddr, memcpy(&txdesc->destaddr, &meta->destaddr,
sizeof(struct ieee802154_addr_s)); sizeof(struct ieee802154_addr_s));
mac802154_setupindirect(priv, txdesc); mac802154_setupindirect(priv, txdesc);
mac802154_givesem(&priv->exclsem); mac802154_unlock(priv)
} }
else else
{ {
@@ -329,7 +329,7 @@ int mac802154_req_data(MACHANDLE mac,
/* We no longer need to have the MAC layer locked. */ /* We no longer need to have the MAC layer locked. */
mac802154_givesem(&priv->exclsem); mac802154_unlock(priv)
/* Notify the radio driver that there is data available */ /* Notify the radio driver that there is data available */
@@ -346,7 +346,7 @@ errout_with_txdesc:
mac802154_txdesc_free(priv, txdesc); mac802154_txdesc_free(priv, txdesc);
errout_with_sem: errout_with_sem:
mac802154_givesem(&priv->exclsem); mac802154_unlock(priv)
return ret; return ret;
} }
+28 -4
View File
@@ -388,8 +388,6 @@ void mac802154_createdatareq(FAR struct ieee802154_privmac_s *priv,
void mac802154_updatebeacon(FAR struct ieee802154_privmac_s *priv); void mac802154_updatebeacon(FAR struct ieee802154_privmac_s *priv);
/**************************************************************************** /****************************************************************************
* Helper Macros/Inline Functions * Helper Macros/Inline Functions
****************************************************************************/ ****************************************************************************/
@@ -564,9 +562,9 @@ void mac802154_updatebeacon(FAR struct ieee802154_privmac_s *priv);
((GETHOST16(ptr, index) & IEEE802154_PENDADDR_NEADDR) >> \ ((GETHOST16(ptr, index) & IEEE802154_PENDADDR_NEADDR) >> \
IEEE802154_PENDADDR_SHIFT_NEADDR) IEEE802154_PENDADDR_SHIFT_NEADDR)
/* General helper macros ****************************************************/ /* General helpers ****************************************************/
#define mac802154_givesem(s) sem_post(s); #define mac802154_givesem(s) sem_post(s)
static inline int mac802154_takesem(sem_t *sem, bool allowinterrupt) static inline int mac802154_takesem(sem_t *sem, bool allowinterrupt)
{ {
@@ -593,6 +591,32 @@ static inline int mac802154_takesem(sem_t *sem, bool allowinterrupt)
return OK; return OK;
} }
#define mac802154_unlock(dev) \
mac802154_givesem(&dev->exclsem); \
wlinfo("MAC unlocked\n");
#define mac802154_lock(dev, allowinterrupt) \
mac802154_lockpriv(dev, allowinterrupt, __FUNCTION__)
static inline int mac802154_lockpriv(FAR struct ieee802154_privmac_s *dev,
bool allowinterrupt, FAR const char *funcname)
{
int ret;
wlinfo("Locking MAC: %s\n", funcname);
ret = mac802154_takesem(&dev->exclsem, allowinterrupt);
if (ret < 0)
{
wlinfo("Failed to lock MAC\n");
}
else
{
wlinfo("MAC locked\n");
}
return ret;
}
static inline void mac802154_txdesc_free(FAR struct ieee802154_privmac_s *priv, static inline void mac802154_txdesc_free(FAR struct ieee802154_privmac_s *priv,
FAR struct ieee802154_txdesc_s *txdesc) FAR struct ieee802154_txdesc_s *txdesc)
{ {
+4 -4
View File
@@ -76,7 +76,7 @@ void mac802154_notif_free(MACHANDLE mac, FAR struct ieee802154_notif_s *notif)
/* Lock the MAC */ /* Lock the MAC */
mac802154_takesem(&priv->exclsem, false); mac802154_lock(priv, false);
/* Call the internal helper function to free the notification */ /* Call the internal helper function to free the notification */
@@ -84,7 +84,7 @@ void mac802154_notif_free(MACHANDLE mac, FAR struct ieee802154_notif_s *notif)
/* Unlock the MAC */ /* Unlock the MAC */
mac802154_givesem(&priv->exclsem); mac802154_unlock(priv)
} }
/**************************************************************************** /****************************************************************************
@@ -170,7 +170,7 @@ int mac802154_notif_alloc(FAR struct ieee802154_privmac_s *priv,
{ {
/* Unlock MAC so that other work can be done to free a notification */ /* Unlock MAC so that other work can be done to free a notification */
mac802154_givesem(&priv->exclsem); mac802154_unlock(priv)
/* Take a count from the notification semaphore, waiting if necessary. We /* Take a count from the notification semaphore, waiting if necessary. We
* only return from here with an error if we are allowing interruptions * only return from here with an error if we are allowing interruptions
@@ -189,7 +189,7 @@ int mac802154_notif_alloc(FAR struct ieee802154_privmac_s *priv,
* MAC in order to ensure this happens correctly. * MAC in order to ensure this happens correctly.
*/ */
ret = mac802154_takesem(&priv->exclsem, allow_interrupt); ret = mac802154_lock(priv, allow_interrupt);
if (ret < 0) if (ret < 0)
{ {
mac802154_givesem(&priv->notif_sem); mac802154_givesem(&priv->notif_sem);
+7 -7
View File
@@ -106,7 +106,7 @@ int mac802154_req_poll(MACHANDLE mac, FAR struct ieee802154_poll_req_s *req)
/* Get exclusive access to the MAC */ /* Get exclusive access to the MAC */
ret = mac802154_takesem(&priv->exclsem, true); ret = mac802154_lock(priv, true);
if (ret < 0) if (ret < 0)
{ {
mac802154_givesem(&priv->opsem); mac802154_givesem(&priv->opsem);
@@ -121,7 +121,7 @@ int mac802154_req_poll(MACHANDLE mac, FAR struct ieee802154_poll_req_s *req)
ret = mac802154_txdesc_alloc(priv, &txdesc, true); ret = mac802154_txdesc_alloc(priv, &txdesc, true);
if (ret < 0) if (ret < 0)
{ {
mac802154_givesem(&priv->exclsem); mac802154_unlock(priv)
mac802154_givesem(&priv->opsem); mac802154_givesem(&priv->opsem);
return ret; return ret;
} }
@@ -158,7 +158,7 @@ int mac802154_req_poll(MACHANDLE mac, FAR struct ieee802154_poll_req_s *req)
/* We no longer need to have the MAC layer locked. */ /* We no longer need to have the MAC layer locked. */
mac802154_givesem(&priv->exclsem); mac802154_unlock(priv)
/* Notify the radio driver that there is data available */ /* Notify the radio driver that there is data available */
@@ -222,9 +222,9 @@ void mac802154_txdone_datareq_poll(FAR struct ieee802154_privmac_s *priv,
/* Release the MAC, call the callback, get exclusive access again */ /* Release the MAC, call the callback, get exclusive access again */
mac802154_givesem(&priv->exclsem); mac802154_unlock(priv)
mac802154_notify(priv, notif); mac802154_notify(priv, notif);
mac802154_takesem(&priv->exclsem, false); mac802154_lock(priv, false);
} }
else else
{ {
@@ -269,7 +269,7 @@ void mac802154_polltimeout(FAR struct ieee802154_privmac_s *priv)
* Don't allow EINTR to interrupt. * Don't allow EINTR to interrupt.
*/ */
mac802154_takesem(&priv->exclsem, false); mac802154_lock(priv, false);
mac802154_notif_alloc(priv, &notif, false); mac802154_notif_alloc(priv, &notif, false);
/* We are no longer performing the association operation */ /* We are no longer performing the association operation */
@@ -279,7 +279,7 @@ void mac802154_polltimeout(FAR struct ieee802154_privmac_s *priv)
/* Release the MAC */ /* Release the MAC */
mac802154_givesem(&priv->exclsem); mac802154_unlock(priv)
notif->notiftype = IEEE802154_NOTIFY_CONF_POLL; notif->notiftype = IEEE802154_NOTIFY_CONF_POLL;
notif->u.pollconf.status = IEEE802154_STATUS_NO_DATA; notif->u.pollconf.status = IEEE802154_STATUS_NO_DATA;
+5 -5
View File
@@ -110,7 +110,7 @@ int mac802154_req_scan(MACHANDLE mac, FAR struct ieee802154_scan_req_s *req)
/* Get exclusive access to the MAC */ /* Get exclusive access to the MAC */
ret = mac802154_takesem(&priv->exclsem, true); ret = mac802154_lock(priv, true);
if (ret < 0) if (ret < 0)
{ {
mac802154_givesem(&priv->opsem); mac802154_givesem(&priv->opsem);
@@ -186,11 +186,11 @@ int mac802154_req_scan(MACHANDLE mac, FAR struct ieee802154_scan_req_s *req)
break; break;
} }
mac802154_givesem(&priv->exclsem); mac802154_unlock(priv)
return OK; return OK;
errout_with_sem: errout_with_sem:
mac802154_givesem(&priv->exclsem); mac802154_unlock(priv)
mac802154_givesem(&priv->opsem); mac802154_givesem(&priv->opsem);
errout: errout:
return ret; return ret;
@@ -205,7 +205,7 @@ void mac802154_scanfinish(FAR struct ieee802154_privmac_s *priv,
{ {
FAR struct ieee802154_notif_s * notif; FAR struct ieee802154_notif_s * notif;
mac802154_takesem(&priv->exclsem, false); mac802154_lock(priv, false);
mac802154_notif_alloc(priv, &notif, false); mac802154_notif_alloc(priv, &notif, false);
priv->curr_op = MAC802154_OP_NONE; priv->curr_op = MAC802154_OP_NONE;
@@ -233,7 +233,7 @@ void mac802154_scanfinish(FAR struct ieee802154_privmac_s *priv,
mac802154_setpanid(priv, priv->panidbeforescan); mac802154_setpanid(priv, priv->panidbeforescan);
mac802154_givesem(&priv->exclsem); mac802154_unlock(priv)
mac802154_notify(priv, notif); mac802154_notify(priv, notif);
} }
+3 -3
View File
@@ -72,7 +72,7 @@ int mac802154_req_start(MACHANDLE mac, FAR struct ieee802154_start_req_s *req)
/* Get exclusive access to the MAC */ /* Get exclusive access to the MAC */
ret = mac802154_takesem(&priv->exclsem, true); ret = mac802154_lock(priv, true);
if (ret < 0) if (ret < 0)
{ {
return ret; return ret;
@@ -194,11 +194,11 @@ int mac802154_req_start(MACHANDLE mac, FAR struct ieee802154_start_req_s *req)
} }
} }
mac802154_givesem(&priv->exclsem); mac802154_unlock(priv)
return OK; return OK;
errout: errout:
mac802154_givesem(&priv->exclsem); mac802154_unlock(priv)
return ret; return ret;
} }