lkml.org 
[lkml]   [2020]   [Aug]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] staging: r8188eu: replace rtw_netdev_priv define with inline function
On Sat, Aug 01, 2020 at 12:47:07PM +0300, Ivan Safonov wrote:
> The function guarantees type checking of arguments and return value.
>
> Signed-off-by: Ivan Safonov <insafonov@gmail.com>
> ---
> drivers/staging/rtl8188eu/include/osdep_service.h | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/rtl8188eu/include/osdep_service.h b/drivers/staging/rtl8188eu/include/osdep_service.h
> index 31d897f1d21f..e0ccafdea9cd 100644
> --- a/drivers/staging/rtl8188eu/include/osdep_service.h
> +++ b/drivers/staging/rtl8188eu/include/osdep_service.h
> @@ -71,8 +71,10 @@ 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 *dev)
> +{
> + return (((struct rtw_netdev_priv_indicator *)netdev_priv(dev))->priv);
> +}
> void rtw_free_netdev(struct net_device *netdev);

Is the cast really needed?

And no blank line before the next function prototype?

And is this really needed? Type checking is already happening as this
is a "simple" macro, right?

thanks,

greg k-h

\
 
 \ /
  Last update: 2020-08-01 11:51    [W:0.049 / U:11.436 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site