Commit 1808a4c7 authored by Ivan Safonov's avatar Ivan Safonov Committed by Greg Kroah-Hartman

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.
Signed-off-by: default avatarIvan Safonov <insafonov@gmail.com>
Link: https://lore.kernel.org/r/20200802124249.101341-1-insafonov@gmail.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 0f86cfff
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment