Skip to content

Commit 666fe7e

Browse files
author
Josuah Demangeon
committed
event: use bitmask semantics (supported variant of API)
Signed-off-by: Josuah Demangeon <[email protected]>
1 parent 8346e45 commit 666fe7e

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

drivers/usb/uhc/uhc_dwc2.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,7 +1013,7 @@ static void uhc_dwc2_handle_chan_intr(const struct device *dev, struct uhc_dwc2_
10131013
break;
10141014
}
10151015
chan->last_event = chan_event;
1016-
k_event_post(&priv->event, BIT(UHC_DWC2_EVENT_CHAN0));
1016+
k_event_set(&priv->event, BIT(UHC_DWC2_EVENT_CHAN0));
10171017
break;
10181018
case DWC2_CHAN_EVENT_ERROR:
10191019
LOG_ERR("Channel error handling not implemented yet");
@@ -1110,7 +1110,7 @@ static void uhc_dwc2_isr_handler(const struct device *dev)
11101110
port_event = uhc_dwc2_decode_hprt(dev, core_event);
11111111
if (port_event != UHC_PORT_EVENT_NONE) {
11121112
priv->last_event = port_event;
1113-
k_event_post(&priv->event, BIT(UHC_DWC2_EVENT_PORT));
1113+
k_event_set(&priv->event, BIT(UHC_DWC2_EVENT_PORT));
11141114
}
11151115
} else {
11161116
/* No core event, nothing to do. Should never occur */
@@ -1594,21 +1594,19 @@ static void uhc_dwc2_thread(void *arg1, void *arg2, void *arg3)
15941594
{
15951595
const struct device *dev = (const struct device *)arg1;
15961596
struct uhc_dwc2_data *const priv = uhc_get_private(dev);
1597-
uint32_t evt;
1597+
uint32_t events;
15981598

15991599
while (true) {
1600-
evt = k_event_wait(&priv->event, UINT32_MAX, false, K_FOREVER);
1600+
events = k_event_wait_safe(&priv->event, UINT32_MAX, false, K_FOREVER);
16011601

16021602
uhc_lock_internal(dev, K_FOREVER);
16031603

1604-
if (evt & BIT(UHC_DWC2_EVENT_PORT)) {
1605-
k_event_clear(&priv->event, BIT(UHC_DWC2_EVENT_PORT));
1604+
if (events & BIT(UHC_DWC2_EVENT_PORT)) {
16061605
uhc_dwc2_handle_port_events(dev);
16071606
}
16081607

16091608
for (uint32_t i = 0; i < 32; i++) {
1610-
if (evt & BIT(UHC_DWC2_EVENT_CHAN0 + i)) {
1611-
k_event_clear(&priv->event, BIT(UHC_DWC2_EVENT_CHAN0 + i));
1609+
if (events & BIT(UHC_DWC2_EVENT_CHAN0 + i)) {
16121610
uhc_dwc2_handle_chan_events(dev, &priv->chan[i]);
16131611
}
16141612
}

0 commit comments

Comments
 (0)