Re: [PATCH] staging: r8188eu: remove local BIT macro

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi David,

thanks for digging into this mess.

Thus wrote David Laight (David.Laight@xxxxxxxxxx):

> From: Martin Kaiser <martin@xxxxxxxxx>
> > Sent: 19 March 2022 18:04

> > The r8188eu driver defines a local BIT(x) macro. Remove this local macro
> > and use the one from include/linux/bits.h.

> > The global BIT macro returns an unsigned long value, the removed local
> > BIT macro used a signed int.

> > DYNAMIC_BB_DYNAMIC_TXPWR is defined as BIT(2), ~DYNAMIC_BB_DYNAMIC_TXPWR
> > is passed to Switch_DM_Func as a u32 parameter. We need a cast in this
> > case as ~DYNAMIC_BB_DYNAMIC_TXPWR is a 64-bit value on x86_64 systems.

> Hmmm....
> Why not fix the called function so that the caller doesn't
> need to do the invert.

When I look into this driver, it's challenging to fix one thing at a time
and not be caught up in all the other problems I discover along the way.

Would you be ok with removing the local BIT macro first?

It seems to me that this whole DYNAMIC_BB_DYNAMIC_TXPWR handling can go.
DYNAMIC_BB_DYNAMIC_TXPWR isn't checked anywhere. I'll submit this as a
separate patch.

With DYNAMIC_BB_DYNAMIC_TXPWR gone, ony three calls remain

  16   6723  drivers/staging/r8188eu/core/rtw_mlme_ext.c <<mlmeext_joinbss_event_callback>>
             Switch_DM_Func(padapter, DYNAMIC_ALL_FUNC_ENABLE, true);
  17   7124  drivers/staging/r8188eu/core/rtw_mlme_ext.c <<createbss_hdl>>
             Switch_DM_Func(padapter, DYNAMIC_FUNC_DISABLE, false);
  18   7393  drivers/staging/r8188eu/core/rtw_mlme_ext.c <<sitesurvey_cmd_hdl>>
             Switch_DM_Func(padapter, DYNAMIC_FUNC_DISABLE, false);

DYNAMIC_FUNC_DISABLE is indeed 0 and sets podmpriv->SupportAbility = 0,
DYNAMIC_ALL_FUNC_ENABLE sets podmpriv->SupportAbility = pdmpriv->InitODMFlag.

We can do this without dubious casts and intermediate functions...

Best regards,
Martin




[Index of Archives]     [Linux Driver Development]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux