public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: John Whitmore <johnfwhitmore@gmail.com>
To: Joe Perches <joe@perches.com>
Cc: linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org,
	gregkh@linuxfoundation.org
Subject: Re: [PATCH v2 01/15] staging:rtl8192u: Remove macro eqMacAddr - Style
Date: Thu, 9 Aug 2018 09:44:53 +0100	[thread overview]
Message-ID: <20180809084452.GA23526@xux707-tw> (raw)
In-Reply-To: <cb7de144fb0b6796dc5fc6013120fc95c8e564a9.camel@perches.com>

On Wed, Aug 08, 2018 at 03:14:19PM -0700, Joe Perches wrote:
> On Wed, 2018-08-08 at 22:00 +0100, John Whitmore wrote:
> > The macro eqMacAddr implements the same functionality as the
> > ether_addr_equal function defined in etherdevice.h, as a result the
> > macro has been removed from the code, and its use replaced with the
> > function call.
> []
> > diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c
> []
> > @@ -4460,15 +4460,15 @@ static void TranslateRxSignalStuff819xUsb(struct sk_buff *skb,
> >  
> >  	/* Check if the received packet is acceptable. */
> >  	bpacket_match_bssid = (type != IEEE80211_FTYPE_CTL) &&
> > -			       (eqMacAddr(priv->ieee80211->current_network.bssid,  (fc & IEEE80211_FCTL_TODS) ? hdr->addr1 : (fc & IEEE80211_FCTL_FROMDS) ? hdr->addr2 : hdr->addr3))
> > +			       (ether_addr_equal(priv->ieee80211->current_network.bssid,  (fc & IEEE80211_FCTL_TODS) ? hdr->addr1 : (fc & IEEE80211_FCTL_FROMDS) ? hdr->addr2 : hdr->addr3))
> >  			       && (!pstats->bHwError) && (!pstats->bCRC) && (!pstats->bICV);
> >  	bpacket_toself =  bpacket_match_bssid &
> > -			  (eqMacAddr(praddr, priv->ieee80211->dev->dev_addr));
> > +			  (ether_addr_equal(praddr, priv->ieee80211->dev->dev_addr));
> 
> Likely this should be
> 
> 	bpacket_match_bssid = bpacket_match_bss &&
> 
> as boolean use with a bitwise & is odd.
> 

Yes have to agree odd. Somebody famous in Computer Science said that
debugging was twice as difficult as writing code, so why would you
write the cleverest code you possibly could, or something like that.
That's what I thought when I now looked at that line of code.

I've been going through this driver cleaning up header files first.
Once those are sorted I was going to turn to the C and try get my
head around the logic. I'll have to look at the functionality of that
bpacket_toself variable but a bitwise operation does look odd.


  reply	other threads:[~2018-08-09  8:44 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-08 21:00 [PATCH v2 00/15] staging:rtl8192u: Coding style John Whitmore
2018-08-08 21:00 ` [PATCH v2 01/15] staging:rtl8192u: Remove macro eqMacAddr - Style John Whitmore
2018-08-08 22:14   ` Joe Perches
2018-08-09  8:44     ` John Whitmore [this message]
2018-08-08 21:00 ` [PATCH v2 02/15] staging:rtl8192u: Remove macro cpMacAddr " John Whitmore
2018-08-08 21:00 ` [PATCH v2 03/15] staging:rtl8192u: Replace magic number 6 with ETH_ALEN " John Whitmore
2018-08-08 21:00 ` [PATCH v2 04/15] staging:rtl8192u: Rename macro parameter __pIeeeDev " John Whitmore
2018-08-08 21:00 ` [PATCH v2 05/15] staging:rtl8192u: Rename __pTa " John Whitmore
2018-08-08 21:00 ` [PATCH v2 06/15] staging:rtl8192u: Lines should not end with a '(' " John Whitmore
2018-08-08 21:00 ` [PATCH v2 07/15] staging:rtl8192u: Rename Dot11d_Init " John Whitmore
2018-08-08 21:00 ` [PATCH v2 08/15] staging:rtl8192u: Rename Dot11d_Reset " John Whitmore
2018-08-08 21:00 ` [PATCH v2 09/15] staging:rtl8192u: Rename Dot11d_UpdateCountryIe " John Whitmore
2018-08-08 21:00 ` [PATCH v2 10/15] staging:rtl8192u: Rename dot11d_update_country_ie() parameters " John Whitmore
2018-08-08 21:00 ` [PATCH v2 11/15] staging:rtl8192u: Rename DOT11D_GetMaxTxPwrInDbm " John Whitmore
2018-08-08 21:00 ` [PATCH v2 12/15] staging:rtl8192u: Rename Channel " John Whitmore
2018-08-08 21:00 ` [PATCH v2 13/15] staging:rtl8192u: Rename DOT11D_ScanComplete " John Whitmore
2018-08-08 21:00 ` [PATCH v2 14/15] staging:rtl8192u: Rename IsLegalChannel " John Whitmore
2018-08-08 21:00 ` [PATCH v2 15/15] staging:rtl8192u: Rename ToLegalChannel " John Whitmore

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180809084452.GA23526@xux707-tw \
    --to=johnfwhitmore@gmail.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox