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 <insafonov@gmail.com>
Link: https://lore.kernel.org/r/20200801180235.34116-1-insafonov@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Ivan Safonov 2020-08-01 21:02:35 +03:00 коммит произвёл Greg Kroah-Hartman
Родитель d47cecef71
Коммит 5df9de5a40
1 изменённых файлов: 5 добавлений и 2 удалений

Просмотреть файл

@ -71,8 +71,11 @@ struct rtw_netdev_priv_indicator {
};
struct net_device *rtw_alloc_etherdev_with_old_priv(void *old_priv);
#define rtw_netdev_priv(netdev) \
(((struct rtw_netdev_priv_indicator *)netdev_priv(netdev))->priv)
static inline struct adapter *rtw_netdev_priv(struct net_device *netdev)
{
return ((struct rtw_netdev_priv_indicator *)netdev_priv(netdev))->priv;
}
void rtw_free_netdev(struct net_device *netdev);
#define FUNC_NDEV_FMT "%s(%s)"