mirror of
https://github.com/apache/nuttx.git
synced 2026-06-04 14:53:47 +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 btnet_driver_s
|
||||
|
||||
sem_t bd_exclsem; /* Exclusive access to struct */
|
||||
bool bd_bifup; /* true:ifup false:ifdown */
|
||||
WDOG_ID bd_txpoll; /* TX poll timer */
|
||||
struct wdog_s bd_txpoll; /* TX poll timer */
|
||||
struct work_s bd_pollwork; /* Defer poll work to the work queue */
|
||||
struct bt_conn_cb_s bd_hcicb; /* HCI connection status callbacks */
|
||||
struct bt_l2cap_chan_s bd_l2capcb; /* L2CAP status callbacks */
|
||||
@@ -549,7 +549,7 @@ static void btnet_txpoll_work(FAR void *arg)
|
||||
|
||||
/* Setup the watchdog poll timer again */
|
||||
|
||||
wd_start(priv->bd_txpoll, TXPOLL_WDDELAY,
|
||||
wd_start(&priv->bd_txpoll, TXPOLL_WDDELAY,
|
||||
btnet_txpoll_expiry, 1, (wdparm_t)priv);
|
||||
net_unlock();
|
||||
}
|
||||
@@ -629,7 +629,7 @@ static int btnet_ifup(FAR struct net_driver_s *netdev)
|
||||
|
||||
/* Set and activate a timer process */
|
||||
|
||||
wd_start(priv->bd_txpoll, TXPOLL_WDDELAY,
|
||||
wd_start(&priv->bd_txpoll, TXPOLL_WDDELAY,
|
||||
btnet_txpoll_expiry, 1, (wdparm_t)priv);
|
||||
|
||||
/* The interface is now up */
|
||||
@@ -669,7 +669,7 @@ static int btnet_ifdown(FAR struct net_driver_s *netdev)
|
||||
|
||||
/* Cancel the TX poll timer and TX timeout timers */
|
||||
|
||||
wd_cancel(priv->bd_txpoll);
|
||||
wd_cancel(&priv->bd_txpoll);
|
||||
|
||||
/* Put the EMAC in its reset, non-operational state. This should be
|
||||
* a known configuration that will guarantee the btnet_ifup() always
|
||||
@@ -1039,7 +1039,7 @@ int bt_netdev_register(FAR const struct bt_driver_s *btdev)
|
||||
#ifdef CONFIG_NETDEV_IOCTL
|
||||
netdev->d_ioctl = btnet_ioctl; /* Handle network IOCTL commands */
|
||||
#endif
|
||||
netdev->d_private = (FAR void *)priv; /* Used to recover private state from netdev */
|
||||
netdev->d_private = priv; /* Used to recover private state from netdev */
|
||||
|
||||
/* Connection status change callbacks */
|
||||
|
||||
@@ -1061,10 +1061,6 @@ int bt_netdev_register(FAR const struct bt_driver_s *btdev)
|
||||
|
||||
bt_l2cap_chan_default(l2capcb);
|
||||
|
||||
/* Create a watchdog for timing polling for and timing of transmissions */
|
||||
|
||||
priv->bd_txpoll = wd_create(); /* Create periodic poll timer */
|
||||
|
||||
/* Setup a locking semaphore for exclusive device driver access */
|
||||
|
||||
nxsem_init(&priv->bd_exclsem, 0, 1);
|
||||
@@ -1137,10 +1133,6 @@ int bt_netdev_register(FAR const struct bt_driver_s *btdev)
|
||||
|
||||
errout:
|
||||
|
||||
/* Release wdog timers */
|
||||
|
||||
wd_delete(priv->bd_txpoll);
|
||||
|
||||
/* Un-initialize semaphores */
|
||||
|
||||
nxsem_destroy(&priv->bd_exclsem);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -118,7 +118,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 */
|
||||
@@ -449,7 +449,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();
|
||||
}
|
||||
|
||||
@@ -533,7 +533,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;
|
||||
@@ -564,7 +564,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" */
|
||||
|
||||
@@ -1045,7 +1045,7 @@ int pktradio_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 */
|
||||
|
||||
@@ -1058,10 +1058,6 @@ int pktradio_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,
|
||||
|
||||
Reference in New Issue
Block a user