mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Lendacky, Thomas" <Thomas.Lendacky@amd.com>
To: "Gustavo A. R. Silva" <gustavo@embeddedor.com>,
	"David S. Miller" <davem@davemloft.net>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Kees Cook <keescook@chromium.org>
Subject: Re: [PATCH net-next] amd-xgbe: Mark expected switch fall-throughs
Date: Thu, 25 Apr 2019 15:01:31 +0000	[thread overview]
Message-ID: <b3e7066f-1338-7047-1d49-df7da472d039@amd.com> (raw)
In-Reply-To: <1cd135d4-df0f-ee31-d85f-5f47c8037f2d@embeddedor.com>

On 4/25/19 9:54 AM, Gustavo A. R. Silva wrote:
> Hi,
> 
> On 4/25/19 8:12 AM, Lendacky, Thomas wrote:
> [..]
>>>   ^~~~
>>>
>>> Warning level 3 was used: -Wimplicit-fallthrough=3
>>>
>>> Notice that, in this particular case, the code comments are modified
>>> in accordance with what GCC is expecting to find.
>>>
>>> This patch is part of the ongoing efforts to enable
>>> -Wimplicit-fallthrough.
>>>
>>> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
>>> ---
>>>  drivers/net/ethernet/amd/xgbe/xgbe-drv.c | 6 +++---
>>>  1 file changed, 3 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c
>>> index 0cc911f928b1..3dd0cecddba8 100644
>>> --- a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c
>>> +++ b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c
>>> @@ -1612,7 +1612,7 @@ static int xgbe_set_hwtstamp_settings(struct xgbe_prv_data *pdata,
>>>  	/* PTP v2, UDP, any kind of event packet */
>>>  	case HWTSTAMP_FILTER_PTP_V2_L4_EVENT:
>>>  		XGMAC_SET_BITS(mac_tscr, MAC_TSCR, TSVER2ENA, 1);
>>> -	/* PTP v1, UDP, any kind of event packet */
>>> +		/* Fall through - to PTP v1, UDP, any kind of event packet */
>>
>> If the compiler doesn't have a problem with adding just an indented
>> "Fall through" comment and leaving the original comment in place, I would
>> prefer that. It seems clearer to me.
>>
> 
> This is the other alternative:
> 
> diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c
> index 0cc911f928b1..f913bf404baa 100644
> --- a/drivers/net/ethernet/amd/xgbe/xgbe-drv.c
> +++ b/drivers/net/ethernet/amd/xgbe/xgbe-drv.c
> @@ -1613,6 +1613,7 @@ static int xgbe_set_hwtstamp_settings(struct xgbe_prv_data *pdata,
>         case HWTSTAMP_FILTER_PTP_V2_L4_EVENT:
>                 XGMAC_SET_BITS(mac_tscr, MAC_TSCR, TSVER2ENA, 1);
>         /* PTP v1, UDP, any kind of event packet */
> +               /* Fall through */
>         case HWTSTAMP_FILTER_PTP_V1_L4_EVENT:
>                 XGMAC_SET_BITS(mac_tscr, MAC_TSCR, TSIPV4ENA, 1);
>                 XGMAC_SET_BITS(mac_tscr, MAC_TSCR, TSIPV6ENA, 1);
> @@ -1624,6 +1625,7 @@ static int xgbe_set_hwtstamp_settings(struct xgbe_prv_data *pdata,
>         case HWTSTAMP_FILTER_PTP_V2_L4_SYNC:
>                 XGMAC_SET_BITS(mac_tscr, MAC_TSCR, TSVER2ENA, 1);
>         /* PTP v1, UDP, Sync packet */
> +               /* Fall through */
>         case HWTSTAMP_FILTER_PTP_V1_L4_SYNC:
>                 XGMAC_SET_BITS(mac_tscr, MAC_TSCR, TSIPV4ENA, 1);
>                 XGMAC_SET_BITS(mac_tscr, MAC_TSCR, TSIPV6ENA, 1);
> @@ -1635,6 +1637,7 @@ static int xgbe_set_hwtstamp_settings(struct xgbe_prv_data *pdata,
>         case HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ:
>                 XGMAC_SET_BITS(mac_tscr, MAC_TSCR, TSVER2ENA, 1);
>         /* PTP v1, UDP, Delay_req packet */
> +               /* Fall through */
>         case HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ:
>                 XGMAC_SET_BITS(mac_tscr, MAC_TSCR, TSIPV4ENA, 1);
>                 XGMAC_SET_BITS(mac_tscr, MAC_TSCR, TSIPV6ENA, 1);
> 
> 
> The thing is that the fall-through comments have to be placed at the
> very bottom of each case.

Ah, that's too bad.  I was hoping to be able to put the fall-through
comment prior to the case comment.

> 
> Which do you prefer?

I prefer your original patch over this one.

Thanks for checking into this!

Tom

> 
> Thanks
> --
> Gustavo
> 
>> Thanks,
>> Tom
>>
>>>  	case HWTSTAMP_FILTER_PTP_V1_L4_EVENT:
>>>  		XGMAC_SET_BITS(mac_tscr, MAC_TSCR, TSIPV4ENA, 1);
>>>  		XGMAC_SET_BITS(mac_tscr, MAC_TSCR, TSIPV6ENA, 1);
>>> @@ -1623,7 +1623,7 @@ static int xgbe_set_hwtstamp_settings(struct xgbe_prv_data *pdata,
>>>  	/* PTP v2, UDP, Sync packet */
>>>  	case HWTSTAMP_FILTER_PTP_V2_L4_SYNC:
>>>  		XGMAC_SET_BITS(mac_tscr, MAC_TSCR, TSVER2ENA, 1);
>>> -	/* PTP v1, UDP, Sync packet */
>>> +		/* Fall through - to PTP v1, UDP, Sync packet */
>>>  	case HWTSTAMP_FILTER_PTP_V1_L4_SYNC:
>>>  		XGMAC_SET_BITS(mac_tscr, MAC_TSCR, TSIPV4ENA, 1);
>>>  		XGMAC_SET_BITS(mac_tscr, MAC_TSCR, TSIPV6ENA, 1);
>>> @@ -1634,7 +1634,7 @@ static int xgbe_set_hwtstamp_settings(struct xgbe_prv_data *pdata,
>>>  	/* PTP v2, UDP, Delay_req packet */
>>>  	case HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ:
>>>  		XGMAC_SET_BITS(mac_tscr, MAC_TSCR, TSVER2ENA, 1);
>>> -	/* PTP v1, UDP, Delay_req packet */
>>> +		/* Fall through - to PTP v1, UDP, Delay_req packet */
>>>  	case HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ:
>>>  		XGMAC_SET_BITS(mac_tscr, MAC_TSCR, TSIPV4ENA, 1);
>>>  		XGMAC_SET_BITS(mac_tscr, MAC_TSCR, TSIPV6ENA, 1);
>>>

  reply	other threads:[~2019-04-25 15:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-24 16:08 Gustavo A. R. Silva
2019-04-25 13:12 ` Lendacky, Thomas
2019-04-25 14:54   ` Gustavo A. R. Silva
2019-04-25 15:01     ` Lendacky, Thomas [this message]
2019-04-26 15:29 ` David Miller

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=b3e7066f-1338-7047-1d49-df7da472d039@amd.com \
    --to=thomas.lendacky@amd.com \
    --cc=davem@davemloft.net \
    --cc=gustavo@embeddedor.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@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

all inboxes | Powered by JetHome®