On Wed, 2018-04-04 at 02:43 +0000, Larry Finger wrote:
> On 03/28/2018 02:27 AM, [email protected] wrote:
> > From: Ping-Ke Shih <[email protected]>
> >
> > This file supports 8822be WiFi module with two physical antenna that
> > means one antenna will share with BT.
> >
> > Signed-off-by: Ping-Ke Shih <[email protected]>
> > ---
> > .../realtek/rtlwifi/btcoexist/halbtc8822b1ant.c | 5303
> >++++++++++++++++++++
> > .../realtek/rtlwifi/btcoexist/halbtc8822b1ant.h | 413 ++
> > 2 files changed, 5716 insertions(+)
> > create mode 100644
> >drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8822b1ant.c
> > create mode 100644
> >drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8822b1ant.h
>
> --snip--
>
> > +/*anttenna control by bb mac bt antdiv pta to write 0x4c 0xcb4,0xcbd*/
> > +
> > +static
> > +void hallbtc882b1ant_set_ant_switch(struct btc_coexist *btcoexist,
> > + bool force_exec, u8 ctrl_type,
> > + u8 pos_type)
> > +{
> > + struct rtl_priv *rtlpriv = btcoexist->adapter;
> > + bool switch_polatiry_inverse = false;
> > + u8 regval_0xcbd = 0, regval_0x64;
> > + u32 u32tmp1 = 0, u32tmp2 = 0, u32tmp3 = 0;
> > +
> > + /* Ext switch buffer mux */
> > + btcoexist->btc_write_1byte(btcoexist, 0x974, 0xff);
> > + btcoexist->btc_write_1byte_bitmask(btcoexist, 0x1991, 0x3, 0x0);
> > + btcoexist->btc_write_1byte_bitmask(btcoexist, 0xcbe, 0x8, 0x0);
> > +
> > + if (!rfe_type->ext_ant_switch_exist)
> > + return;
> > +
> > + coex_dm->cur_ext_ant_switch_status = (ctrl_type << 8) + pos_type;
> > +
> > + if (!force_exec) {
> > + if (coex_dm->pre_ext_ant_switch_status ==
> > + coex_dm->cur_ext_ant_switch_status)
> > + return;
> > + }
> > +
> > + coex_dm->pre_ext_ant_switch_status = coex_dm->cur_ext_ant_switch_status;
> > +
> > + /* swap control polarity if use different switch control polarity*/
> > + /* Normal switch polarity for SPDT,
> > + * 0xcbd[1:0] = 2b'01 => Ant to BTG, WLA
> > + * 0xcbd[1:0] = 2b'10 => Ant to WLG
> > + */
> > + switch_polatiry_inverse = (rfe_type->ext_ant_switch_ctrl_polarity == 1 ?
> > + ~switch_polatiry_inverse :
> > + switch_polatiry_inverse);
>
> gcc 7.3.1 reports the following:
>
> CC [M] drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8822b1ant.o
> drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8822b1ant.c: In function
> ‘hallbtc882b1ant_set_ant_switch’:
> drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8822b1ant.c:2193:9:
> warning: ‘~’ on a boolean expression [-Wbool-operation]
> ~switch_polatiry_inverse :
> ^
> drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8822b1ant.c:2193:9:
> note:
> did you mean to use logical not?
> ~switch_polatiry_inverse :
> ^
>
> For a boolean, you should use !bool, not -bool. In addition, it would be
> better
> to use switch_polarity_inverse, not switch_polatiry_inverse. The same "typo"
> happens in other places in this file. I suggest
>
> sed -i 's/polatiry_inverse/polarity_inverse/g' \
> drivers/net/wireless/realtek/rtlwifi/btcoexist/halbtc8822b1ant.c.
>
I'll fix the typo, and declare the variable switch_polarity_inverse without
initial value, then assign value true or false in the line mentioned in above
warning. It looks like:
bool switch_polatiry_inverse;
...
switch_polarity_inverse = (rfe_type->ext_ant_switch_ctrl_polarity == 1 ?
true : false);
PK