linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: Andrew Lunn <andrew@lunn.ch>, Alex Shi <alex.shi@linux.alibaba.com>
Cc: Vivien Didelot <vivien.didelot@gmail.com>,
	Vladimir Oltean <olteanv@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net/dsa: remove unused macros to tame gcc warning
Date: Fri, 6 Nov 2020 08:39:34 -0800	[thread overview]
Message-ID: <24690741-cc10-eec1-33c6-7960c8b7fac6@gmail.com> (raw)
In-Reply-To: <20201106141820.GP933237@lunn.ch>



On 11/6/2020 6:18 AM, Andrew Lunn wrote:
> On Fri, Nov 06, 2020 at 01:37:30PM +0800, Alex Shi wrote:
>> There are some macros unused, they causes much gcc warnings. Let's
>> remove them to tame gcc.
>>
>> net/dsa/tag_brcm.c:51:0: warning: macro "BRCM_EG_RC_SWITCH" is not used
>> [-Wunused-macros]
>> net/dsa/tag_brcm.c:53:0: warning: macro "BRCM_EG_RC_MIRROR" is not used
>> [-Wunused-macros]
>> net/dsa/tag_brcm.c:55:0: warning: macro "BRCM_EG_TC_MASK" is not used
>> [-Wunused-macros]
>> net/dsa/tag_brcm.c:35:0: warning: macro "BRCM_IG_TS_SHIFT" is not used
>> [-Wunused-macros]
>> net/dsa/tag_brcm.c:46:0: warning: macro "BRCM_EG_RC_MASK" is not used
>> [-Wunused-macros]
>> net/dsa/tag_brcm.c:49:0: warning: macro "BRCM_EG_RC_PROT_SNOOP" is not
>> used [-Wunused-macros]
>> net/dsa/tag_brcm.c:34:0: warning: macro "BRCM_IG_TE_MASK" is not used
>> [-Wunused-macros]
>> net/dsa/tag_brcm.c:43:0: warning: macro "BRCM_EG_CID_MASK" is not used
>> [-Wunused-macros]
>> net/dsa/tag_brcm.c:50:0: warning: macro "BRCM_EG_RC_PROT_TERM" is not
>> used [-Wunused-macros]
>> net/dsa/tag_brcm.c:54:0: warning: macro "BRCM_EG_TC_SHIFT" is not used
>> [-Wunused-macros]
>> net/dsa/tag_brcm.c:52:0: warning: macro "BRCM_EG_RC_MAC_LEARN" is not
>> used [-Wunused-macros]
>> net/dsa/tag_brcm.c:48:0: warning: macro "BRCM_EG_RC_EXCEPTION" is not
>> used [-Wunused-macros]
>>
>> Signed-off-by: Alex Shi <alex.shi@linux.alibaba.com>
>> Cc: Andrew Lunn <andrew@lunn.ch> 
>> Cc: Vivien Didelot <vivien.didelot@gmail.com> 
>> Cc: Florian Fainelli <f.fainelli@gmail.com> 
>> Cc: Vladimir Oltean <olteanv@gmail.com> 
>> Cc: "David S. Miller" <davem@davemloft.net> 
>> Cc: Jakub Kicinski <kuba@kernel.org> 
>> Cc: netdev@vger.kernel.org 
>> Cc: linux-kernel@vger.kernel.org 
>> ---
>>  net/dsa/tag_brcm.c | 15 ---------------
>>  1 file changed, 15 deletions(-)
>>
>> diff --git a/net/dsa/tag_brcm.c b/net/dsa/tag_brcm.c
>> index e934dace3922..ce23b5d4c6b8 100644
>> --- a/net/dsa/tag_brcm.c
>> +++ b/net/dsa/tag_brcm.c
>> @@ -30,29 +30,14 @@
>>  /* 1st byte in the tag */
>>  #define BRCM_IG_TC_SHIFT	2
>>  #define BRCM_IG_TC_MASK		0x7
>> -/* 2nd byte in the tag */
>> -#define BRCM_IG_TE_MASK		0x3
>> -#define BRCM_IG_TS_SHIFT	7
>>  /* 3rd byte in the tag */
>>  #define BRCM_IG_DSTMAP2_MASK	1
>>  #define BRCM_IG_DSTMAP1_MASK	0xff
> 
> Hi Alex
> 
> It is good to remember that there are multiple readers of source
> files. There is the compiler which generates code from it, and there
> is the human trying to understand what is going on, what the hardware
> can do, how we could maybe extend the code in the future to make use
> of bits are currently don't, etc.
> 
> The compiler has no use of these macros, at the moment. But i as a
> human do. It is valuable documentation, given that there is no open
> datasheet for this hardware.
> 
> I would say these warnings are bogus, and the code should be left
> alone.

Agreed, these definitions are intended to document what the hardware
does. These warnings are getting too far.
-- 
Florian

  reply	other threads:[~2020-11-06 16:39 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-06  5:37 [PATCH] net/dsa: remove unused macros to tame gcc warning Alex Shi
2020-11-06  6:36 ` Joe Perches
2020-11-06  8:28   ` Alex Shi
2020-11-06  8:52     ` Joe Perches
2020-11-06  8:57       ` Alex Shi
2020-11-06  9:24   ` David Laight
2020-11-06 14:18 ` Andrew Lunn
2020-11-06 16:39   ` Florian Fainelli [this message]
2020-11-07 12:54     ` Alex Shi
2020-11-07 17:39       ` Joe Perches
2020-11-07 22:33         ` Andrew Lunn
2020-11-08 12:39           ` David Laight

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=24690741-cc10-eec1-33c6-7960c8b7fac6@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=alex.shi@linux.alibaba.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=vivien.didelot@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).