From e1f81f02fd09a5b02de4698b153cbf6b7881f23b Mon Sep 17 00:00:00 2001 From: Martine Lenders Date: Mon, 2 Dec 2019 08:14:25 +0100 Subject: [PATCH] gnrc_gomac: don't use constant as argument for RTT callback The RTT callback for a super-frame cycle uses the `arg` pointer to set the message value that then is handed to the GoMacH thread. However, in both instances the timer is scheduled the constant `GNRC_GOMACH_EVENT_RTT_NEW_CYCLE` is provided. This means the argument is not really necessary. --- sys/net/gnrc/link_layer/gomach/gomach.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sys/net/gnrc/link_layer/gomach/gomach.c b/sys/net/gnrc/link_layer/gomach/gomach.c index 57649d590b..8eedc17e72 100644 --- a/sys/net/gnrc/link_layer/gomach/gomach.c +++ b/sys/net/gnrc/link_layer/gomach/gomach.c @@ -162,7 +162,8 @@ static void _gomach_rtt_cb(void *arg) { msg_t msg; - msg.content.value = ((uint32_t) arg) & 0xffff; + (void)arg; + msg.content.value = GNRC_GOMACH_EVENT_RTT_NEW_CYCLE; msg.type = GNRC_GOMACH_EVENT_RTT_TYPE; msg_send(&msg, gomach_pid); @@ -194,7 +195,7 @@ static void _gomach_rtt_handler(uint32_t event, gnrc_netif_t *netif) /* Set next cycle's starting time. */ uint32_t alarm = netif->mac.prot.gomach.last_wakeup + RTT_US_TO_TICKS(GNRC_GOMACH_SUPERFRAME_DURATION_US); - rtt_set_alarm(alarm, _gomach_rtt_cb, (void *) GNRC_GOMACH_EVENT_RTT_NEW_CYCLE); + rtt_set_alarm(alarm, _gomach_rtt_cb, NULL); /* Update neighbors' public channel phases. */ gnrc_gomach_update_neighbor_pubchan(netif); @@ -1451,7 +1452,7 @@ static void _gomach_phase_backoff(gnrc_netif_t *netif) uint32_t alarm = netif->mac.prot.gomach.last_wakeup + RTT_US_TO_TICKS(GNRC_GOMACH_SUPERFRAME_DURATION_US); - rtt_set_alarm(alarm, _gomach_rtt_cb, (void *) GNRC_GOMACH_EVENT_RTT_NEW_CYCLE); + rtt_set_alarm(alarm, _gomach_rtt_cb, NULL); gnrc_gomach_update_neighbor_phase(netif);