From 060fda032bc446e8deb1322ff78ec1fedee19a45 Mon Sep 17 00:00:00 2001 From: zhangyuan29 Date: Wed, 4 Dec 2024 21:11:12 +0800 Subject: [PATCH] drivers/net: change netdev_lower_quota_load to macro. Signed-off-by: zhangyuan29 --- drivers/net/netdev_upperhalf.c | 18 ------------------ include/nuttx/net/netdev_lowerhalf.h | 3 +-- wireless/bluetooth/bt_conn.c | 6 ++++-- 3 files changed, 5 insertions(+), 22 deletions(-) diff --git a/drivers/net/netdev_upperhalf.c b/drivers/net/netdev_upperhalf.c index 4a3132efeb..98d8f0bf88 100644 --- a/drivers/net/netdev_upperhalf.c +++ b/drivers/net/netdev_upperhalf.c @@ -1365,24 +1365,6 @@ void netdev_lower_txdone(FAR struct netdev_lowerhalf_s *dev) #endif } -/**************************************************************************** - * Name: netdev_lower_quota_load - * - * Description: - * Fetch the quota, works like atomic_read. - * - * Input Parameters: - * dev - The lower half device driver structure - * type - Whether get quota for TX or RX - * - ****************************************************************************/ - -int netdev_lower_quota_load(FAR struct netdev_lowerhalf_s *dev, - enum netpkt_type_e type) -{ - return atomic_read(&dev->quota[type]); -} - /**************************************************************************** * Name: netpkt_alloc * diff --git a/include/nuttx/net/netdev_lowerhalf.h b/include/nuttx/net/netdev_lowerhalf.h index ee61e49108..29a55f3b32 100644 --- a/include/nuttx/net/netdev_lowerhalf.h +++ b/include/nuttx/net/netdev_lowerhalf.h @@ -320,8 +320,7 @@ void netdev_lower_txdone(FAR struct netdev_lowerhalf_s *dev); * ****************************************************************************/ -int netdev_lower_quota_load(FAR struct netdev_lowerhalf_s *dev, - enum netpkt_type_e type); +#define netdev_lower_quota_load(dev, type) atomic_read(&dev->quota[type]) /**************************************************************************** * Name: netpkt_alloc diff --git a/wireless/bluetooth/bt_conn.c b/wireless/bluetooth/bt_conn.c index f682df6687..264b1c6fee 100644 --- a/wireless/bluetooth/bt_conn.c +++ b/wireless/bluetooth/bt_conn.c @@ -762,7 +762,8 @@ FAR struct bt_conn_s *bt_conn_addref(FAR struct bt_conn_s *conn) { bt_atomic_incr(&conn->ref); - wlinfo("handle %u ref %u\n", conn->handle, bt_atomic_get(&conn->ref)); + wlinfo("handle %u ref %" PRId32 "\n", conn->handle, + bt_atomic_get(&conn->ref)); return conn; } @@ -787,7 +788,8 @@ void bt_conn_release(FAR struct bt_conn_s *conn) old_ref = bt_atomic_decr(&conn->ref); - wlinfo("handle %u ref %u\n", conn->handle, bt_atomic_get(&conn->ref)); + wlinfo("handle %u ref %" PRId32 "\n", conn->handle, + bt_atomic_get(&conn->ref)); if (old_ref > 1) {