Skip to content

Commit 5df9de5

Browse files
insafonovgregkh
authored andcommitted
staging: r8188eu: 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: Ivan Safonov <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent d47cece commit 5df9de5

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

drivers/staging/rtl8188eu/include/osdep_service.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,11 @@ struct rtw_netdev_priv_indicator {
7171
};
7272
struct net_device *rtw_alloc_etherdev_with_old_priv(void *old_priv);
7373

74-
#define rtw_netdev_priv(netdev) \
75-
(((struct rtw_netdev_priv_indicator *)netdev_priv(netdev))->priv)
74+
static inline struct adapter *rtw_netdev_priv(struct net_device *netdev)
75+
{
76+
return ((struct rtw_netdev_priv_indicator *)netdev_priv(netdev))->priv;
77+
}
78+
7679
void rtw_free_netdev(struct net_device *netdev);
7780

7881
#define FUNC_NDEV_FMT "%s(%s)"

0 commit comments

Comments
 (0)