mirror of
https://github.com/apache/nuttx.git
synced 2026-06-04 23:03:27 +08:00
sched/wdog: Don't dynamically allocate wdog_s
to save the preserved space(1KB) and also avoid the heap overhead Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com> Change-Id: I694073f68e1bd63960cedeea1ddec441437be025
This commit is contained in:
@@ -123,7 +123,7 @@ struct lo_driver_s
|
||||
bool lo_bifup; /* true:ifup false:ifdown */
|
||||
bool lo_pending; /* True: TX poll pending */
|
||||
uint8_t lo_panid[2]; /* Fake PAN ID for testing */
|
||||
WDOG_ID lo_polldog; /* TX poll timer */
|
||||
struct wdog_s lo_polldog; /* TX poll timer */
|
||||
struct work_s lo_work; /* For deferring poll work to the work queue */
|
||||
FAR struct iob_s *lo_head; /* Head of IOBs queued for loopback */
|
||||
FAR struct iob_s *lo_tail; /* Tail of IOBs queued for loopback */
|
||||
@@ -491,7 +491,7 @@ static void lo_poll_work(FAR void *arg)
|
||||
|
||||
/* Setup the watchdog poll timer again */
|
||||
|
||||
wd_start(priv->lo_polldog, LO_WDDELAY, lo_poll_expiry, 1, (wdparm_t)priv);
|
||||
wd_start(&priv->lo_polldog, LO_WDDELAY, lo_poll_expiry, 1, (wdparm_t)priv);
|
||||
net_unlock();
|
||||
}
|
||||
|
||||
@@ -594,7 +594,7 @@ static int lo_ifup(FAR struct net_driver_s *dev)
|
||||
|
||||
/* Set and activate a timer process */
|
||||
|
||||
wd_start(priv->lo_polldog, LO_WDDELAY,
|
||||
wd_start(&priv->lo_polldog, LO_WDDELAY,
|
||||
lo_poll_expiry, 1, (wdparm_t)priv);
|
||||
|
||||
priv->lo_bifup = true;
|
||||
@@ -625,7 +625,7 @@ static int lo_ifdown(FAR struct net_driver_s *dev)
|
||||
|
||||
/* Cancel the TX poll timer and TX timeout timers */
|
||||
|
||||
wd_cancel(priv->lo_polldog);
|
||||
wd_cancel(&priv->lo_polldog);
|
||||
|
||||
/* Mark the device "down" */
|
||||
|
||||
@@ -1102,7 +1102,7 @@ int ieee8021514_loopback(void)
|
||||
#ifdef CONFIG_NETDEV_IOCTL
|
||||
dev->d_ioctl = lo_ioctl; /* Handle network IOCTL commands */
|
||||
#endif
|
||||
dev->d_private = (FAR void *)priv; /* Used to recover private state from dev */
|
||||
dev->d_private = priv; /* Used to recover private state from dev */
|
||||
|
||||
/* Set the network mask and advertise our MAC-based IP address */
|
||||
|
||||
@@ -1115,10 +1115,6 @@ int ieee8021514_loopback(void)
|
||||
radio->r_req_data = lo_req_data; /* Enqueue frame for transmission */
|
||||
radio->r_properties = lo_properties; /* Returns radio properties */
|
||||
|
||||
/* Create a watchdog for timing polling for and timing of transmissions */
|
||||
|
||||
priv->lo_polldog = wd_create(); /* Create periodic poll timer */
|
||||
|
||||
#ifdef CONFIG_NET_6LOWPAN
|
||||
/* Make sure the our single packet buffer is attached.
|
||||
* We must do this before registering the device since, once the device
|
||||
|
||||
@@ -156,7 +156,7 @@ struct macnet_driver_s
|
||||
struct macnet_callback_s md_cb; /* Callback information */
|
||||
MACHANDLE md_mac; /* Contained MAC interface */
|
||||
bool md_bifup; /* true:ifup false:ifdown */
|
||||
WDOG_ID md_txpoll; /* TX poll timer */
|
||||
struct wdog_s md_txpoll; /* TX poll timer */
|
||||
struct work_s md_pollwork; /* Defer poll work to the work queue */
|
||||
|
||||
/* Hold a list of events */
|
||||
@@ -590,7 +590,7 @@ static void macnet_txpoll_work(FAR void *arg)
|
||||
|
||||
/* Setup the watchdog poll timer again */
|
||||
|
||||
wd_start(priv->md_txpoll, TXPOLL_WDDELAY,
|
||||
wd_start(&priv->md_txpoll, TXPOLL_WDDELAY,
|
||||
macnet_txpoll_expiry, 1, (wdparm_t)priv);
|
||||
net_unlock();
|
||||
}
|
||||
@@ -778,7 +778,7 @@ static int macnet_ifup(FAR struct net_driver_s *dev)
|
||||
|
||||
/* Set and activate a timer process */
|
||||
|
||||
wd_start(priv->md_txpoll, TXPOLL_WDDELAY,
|
||||
wd_start(&priv->md_txpoll, TXPOLL_WDDELAY,
|
||||
macnet_txpoll_expiry, 1, (wdparm_t)priv);
|
||||
|
||||
ret = OK;
|
||||
@@ -818,7 +818,7 @@ static int macnet_ifdown(FAR struct net_driver_s *dev)
|
||||
|
||||
/* Cancel the TX poll timer and TX timeout timers */
|
||||
|
||||
wd_cancel(priv->md_txpoll);
|
||||
wd_cancel(&priv->md_txpoll);
|
||||
|
||||
/* Put the EMAC in its reset, non-operational state. This should be
|
||||
* a known configuration that will guarantee the macnet_ifup() always
|
||||
@@ -1370,12 +1370,8 @@ int mac802154netdev_register(MACHANDLE mac)
|
||||
#ifdef CONFIG_NETDEV_IOCTL
|
||||
dev->d_ioctl = macnet_ioctl; /* Handle network IOCTL commands */
|
||||
#endif
|
||||
dev->d_private = (FAR void *)priv; /* Used to recover private state from dev */
|
||||
|
||||
/* Create a watchdog for timing polling for and timing of transmissions */
|
||||
|
||||
dev->d_private = priv; /* Used to recover private state from dev */
|
||||
priv->md_mac = mac; /* Save the MAC interface instance */
|
||||
priv->md_txpoll = wd_create(); /* Create periodic poll timer */
|
||||
|
||||
/* Setup a locking semaphore for exclusive device driver access */
|
||||
|
||||
@@ -1452,10 +1448,6 @@ int mac802154netdev_register(MACHANDLE mac)
|
||||
|
||||
errout:
|
||||
|
||||
/* Release wdog timers */
|
||||
|
||||
wd_delete(priv->md_txpoll);
|
||||
|
||||
/* Free memory and return the error */
|
||||
|
||||
kmm_free(priv);
|
||||
|
||||
Reference in New Issue
Block a user