Skip to contentSkip to conversation

staging: rtl8723bs: replace rtw_netdev_priv define with inline function

PATCH New Ivan Safonov 1 participant 1 message Aug 2, 2020 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: rtl8723bs: replace rtw_netdev_priv define with inline function

The function guarantees type checking of arguments and return value.

Result of rtw_netdev_priv macro can be assigned to pointer with incompatible type without warning. The function allow compiler to perform this check.

---
 drivers/staging/rtl8723bs/include/osdep_service_linux.h | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/staging/rtl8723bs/include/osdep_service_linux.h +6 -2
index 1710fa3eeb71..4a5bdb93e75d 100644
@@ -129,8 +129,6 @@ static inline void rtw_netif_stop_queue(struct net_device *pnetdev)
 
 #define rtw_signal_process(pid, sig) kill_pid(find_vpid((pid)), (sig), 1)
 
-#define rtw_netdev_priv(netdev) (((struct rtw_netdev_priv_indicator *)netdev_priv(netdev))->priv)
-
 #define NDEV_FMT "%s"
 #define NDEV_ARG(ndev) ndev->name
 #define ADPT_FMT "%s"
@@ -144,6 +142,12 @@ struct rtw_netdev_priv_indicator {
 	void *priv;
 	u32 sizeof_priv;
 };
+
+static inline struct adapter *rtw_netdev_priv(struct net_device *netdev)
+{
+	return ((struct rtw_netdev_priv_indicator *)netdev_priv(netdev))->priv;
+}
+
 struct net_device *rtw_alloc_etherdev_with_old_priv(int sizeof_priv, void *old_priv);
 extern struct net_device * rtw_alloc_etherdev(int sizeof_priv);
 
Signature · 1 line
2.26.2