Re: [PATCH] staging: r8188eu: replace custom macros with is_broadcast_ether_addr

From: Greg KH
Date: Fri Aug 06 2021 - 00:40:22 EST


On Thu, Aug 05, 2021 at 06:47:26PM -0500, Larry Finger wrote:
> On 8/5/21 3:50 PM, Michael Straube wrote:
> > Replace usage of custom macros with is_broadcast_ether_addr. All buffers
> > are properly aligned. Remove the now unsued macros MacAddr_isBcst and
> > IS_MAC_ADDRESS_BROADCAST.
> >
> > Signed-off-by: Michael Straube <straube.linux@xxxxxxxxx>
> > ---
> > drivers/staging/r8188eu/core/rtw_ioctl_set.c | 13 +++----------
> > drivers/staging/r8188eu/core/rtw_recv.c | 2 +-
> > drivers/staging/r8188eu/include/wifi.h | 7 -------
> > 3 files changed, 4 insertions(+), 18 deletions(-)
> >
> > diff --git a/drivers/staging/r8188eu/core/rtw_ioctl_set.c b/drivers/staging/r8188eu/core/rtw_ioctl_set.c
> > index 3e2add5409cc..c354f720310c 100644
> > --- a/drivers/staging/r8188eu/core/rtw_ioctl_set.c
> > +++ b/drivers/staging/r8188eu/core/rtw_ioctl_set.c
> > @@ -13,13 +13,6 @@
> > extern void indicate_wx_scan_complete_event(struct adapter *padapter);
> > -#define IS_MAC_ADDRESS_BROADCAST(addr) \
> > -(\
> > - ((addr[0] == 0xff) && (addr[1] == 0xff) && \
> > - (addr[2] == 0xff) && (addr[3] == 0xff) && \
> > - (addr[4] == 0xff) && (addr[5] == 0xff)) ? true : false \
> > -)
> > -
> > u8 rtw_validate_ssid(struct ndis_802_11_ssid *ssid)
> > {
> > u8 i;
> > @@ -656,8 +649,8 @@ u8 rtw_set_802_11_add_key(struct adapter *padapter, struct ndis_802_11_key *key)
> > }
> > /* check BSSID */
> > - if (IS_MAC_ADDRESS_BROADCAST(key->BSSID) == true) {
> > - RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, ("MacAddr_isBcst(key->BSSID)\n"));
> > + if (is_broadcast_ether_addr(key->BSSID)) {
> > + RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_, ("is_broadcast_ether_addr(key->BSSID)\n"));
> > ret = false;
> > goto exit;
> > }
> > @@ -744,7 +737,7 @@ u8 rtw_set_802_11_add_key(struct adapter *padapter, struct ndis_802_11_key *key)
> > padapter->securitypriv.dot118021XGrpPrivacy, key->KeyLength));
> > }
> > - if ((check_fwstate(&padapter->mlmepriv, WIFI_ADHOC_STATE) == true) && (IS_MAC_ADDRESS_BROADCAST(key->BSSID) == false)) {
> > + if (check_fwstate(&padapter->mlmepriv, WIFI_ADHOC_STATE) && !is_broadcast_ether_addr(key->BSSID)) {
> > RT_TRACE(_module_rtl871x_ioctl_set_c_, _drv_err_,
> > (" IBSS but BSSID is not Broadcast Address.\n"));
> > ret = _FAIL;
> > diff --git a/drivers/staging/r8188eu/core/rtw_recv.c b/drivers/staging/r8188eu/core/rtw_recv.c
> > index aef32f029537..afab951d87fd 100644
> > --- a/drivers/staging/r8188eu/core/rtw_recv.c
> > +++ b/drivers/staging/r8188eu/core/rtw_recv.c
> > @@ -694,7 +694,7 @@ static void count_rx_stats(struct adapter *padapter, struct recv_frame *prframe,
> > padapter->mlmepriv.LinkDetectInfo.NumRxOkInPeriod++;
> > - if ((!MacAddr_isBcst(pattrib->dst)) && (!IS_MCAST(pattrib->dst)))
> > + if (!is_broadcast_ether_addr(pattrib->dst) && !IS_MCAST(pattrib->dst))
> > padapter->mlmepriv.LinkDetectInfo.NumRxUnicastOkInPeriod++;
> > if (sta)
> > diff --git a/drivers/staging/r8188eu/include/wifi.h b/drivers/staging/r8188eu/include/wifi.h
> > index 2c56d1d70d03..65fc677bf4eb 100644
> > --- a/drivers/staging/r8188eu/include/wifi.h
> > +++ b/drivers/staging/r8188eu/include/wifi.h
> > @@ -368,13 +368,6 @@ enum WIFI_REG_DOMAIN {
> > #define GetAddr4Ptr(pbuf) ((unsigned char *)((size_t)(pbuf) + 24))
> > -#define MacAddr_isBcst(addr) \
> > - ( \
> > - ((addr[0] == 0xff) && (addr[1] == 0xff) && \
> > - (addr[2] == 0xff) && (addr[3] == 0xff) && \
> > - (addr[4] == 0xff) && (addr[5] == 0xff)) ? true : false \
> > -)
> > -
> > static inline int IS_MCAST(unsigned char *da)
> > {
> > if ((*da) & 0x01)
>
> Acked-by: Larry Finger <Larry.Finger@lwfinger,net>

Odd ',' use here :)