[PATCH v3 3/4] staging/rtl8188eu : Remove duplicated BIT() definitions
Anish Bhatt
anish7 at gmail.com
Sat Sep 12 09:04:43 UTC 2015
On Fri, Sep 11, 2015 at 7:42 PM, Greg KH <gregkh at linuxfoundation.org> wrote:
> On Wed, Sep 09, 2015 at 03:57:09PM -0700, Anish Bhatt wrote:
>> The BIT() macro is already defined in bitops.h, remove duplicate
>> definitions. Users of BIT() macro are expecting unsigned int/u32, so
>> add typecasts where this creates a build warning.
>>
>> Signed-off-by: Anish Bhatt <anish at chelsio.com>
>> ---
>> drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | 7 +++++--
>> drivers/staging/rtl8188eu/core/rtw_wlan_util.c | 6 ++++--
>> drivers/staging/rtl8188eu/include/rtl8188e_spec.h | 4 ----
>> drivers/staging/rtl8188eu/include/wifi.h | 7 -------
>> 4 files changed, 9 insertions(+), 15 deletions(-)
>>
>> diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
>> index 5dae7de..dd82018 100644
>> --- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
>> +++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
>> @@ -4177,10 +4177,13 @@ void mgt_dispatcher(struct adapter *padapter, struct recv_frame *precv_frame)
>>
>> RT_TRACE(_module_rtl871x_mlme_c_, _drv_info_,
>> ("+mgt_dispatcher: type(0x%x) subtype(0x%x)\n",
>> - GetFrameType(pframe), GetFrameSubType(pframe)));
>> + (unsigned int)GetFrameType(pframe),
>> + (unsigned int)GetFrameSubType(pframe)));
>
> I don't understand why you are adding these typecasts, you aren't
> changing anything that requires this, right?
BIT() is defined in bitops as (1UL << x). This causes compiler warnings with
the %x format specifier used in the RT_TRACE messages, where previously
rtl8188eu simply had (1 << x), hence the typecasts.
>
>>
>> if (GetFrameType(pframe) != WIFI_MGT_TYPE) {
>> - RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_, ("mgt_dispatcher: type(0x%x) error!\n", GetFrameType(pframe)));
>> + RT_TRACE(_module_rtl871x_mlme_c_, _drv_err_,
>> + ("mgt_dispatcher: type(0x%x) error!\n",
>> + (unsigned int)GetFrameType(pframe)));
>> return;
>> }
>>
>> diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
>> index 077b39a..3bb40a7fe 100644
>> --- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
>> +++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c
>> @@ -1414,13 +1414,15 @@ void update_IOT_info(struct adapter *padapter)
>> pmlmeinfo->turboMode_cts2self = 0;
>> pmlmeinfo->turboMode_rtsen = 1;
>> /* disable high power */
>> - Switch_DM_Func(padapter, (~DYNAMIC_BB_DYNAMIC_TXPWR), false);
>> + Switch_DM_Func(padapter, (u32)(~DYNAMIC_BB_DYNAMIC_TXPWR),
>> + false);
>> break;
>> case HT_IOT_PEER_REALTEK:
>> /* rtw_write16(padapter, 0x4cc, 0xffff); */
>> /* rtw_write16(padapter, 0x546, 0x01c0); */
>> /* disable high power */
>> - Switch_DM_Func(padapter, (~DYNAMIC_BB_DYNAMIC_TXPWR), false);
>> + Switch_DM_Func(padapter, (u32)(~DYNAMIC_BB_DYNAMIC_TXPWR),
>> + false);
>> break;
>> default:
>> pmlmeinfo->turboMode_cts2self = 0;
>> diff --git a/drivers/staging/rtl8188eu/include/rtl8188e_spec.h b/drivers/staging/rtl8188eu/include/rtl8188e_spec.h
>> index 2c33eb3..e99179a 100644
>> --- a/drivers/staging/rtl8188eu/include/rtl8188e_spec.h
>> +++ b/drivers/staging/rtl8188eu/include/rtl8188e_spec.h
>> @@ -19,10 +19,6 @@
>> #ifndef __RTL8188E_SPEC_H__
>> #define __RTL8188E_SPEC_H__
>>
>> -#ifndef BIT
>> -#define BIT(x) (1 << (x))
>> -#endif
>> -
>> #define BIT0 0x00000001
>> #define BIT1 0x00000002
>> #define BIT2 0x00000004
>
> What about these BIT0 and other #defines, they should be removed too,
> right?
Yes, I am covering that in a different patch because I was trying to avoid
changing BIT(N) and #define BITN in the same patch.
>
> thanks,
>
> greg k-h
More information about the devel
mailing list