* [PATCH net-next] amd-xgbe: Mark expected switch fall-throughs
@ 2019-04-24 16:08 Gustavo A. R. Silva
2019-04-25 13:12 ` Lendacky, Thomas
2019-04-26 15:29 ` David Miller
0 siblings, 2 replies; 5+ messages in thread
From: Gustavo A. R. Silva @ 2019-04-24 16:08 UTC (permalink / raw)
To: Tom Lendacky, David S. Miller
Cc: netdev, linux-kernel, Gustavo A. R. Silva, Kees Cook
In preparation to enabling -Wimplicit-fallthrough, mark switch
cases where we are expecting to fall through.
This patch fixes the following warnings:
In file included from drivers/net/ethernet/amd/xgbe/xgbe-drv.c:129:
drivers/net/ethernet/amd/xgbe/xgbe-drv.c: In function ‘xgbe_set_hwtstamp_settings’:
drivers/net/ethernet/amd/xgbe/xgbe-common.h:1392:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
(_var) |= (((_val) & ((0x1 << (_width)) - 1)) << (_index)); \
~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/amd/xgbe/xgbe-common.h:1419:2: note: in expansion of macro ‘SET_BITS’
SET_BITS((_var), \
^~~~~~~~
drivers/net/ethernet/amd/xgbe/xgbe-drv.c:1614:3: note: in expansion of macro ‘XGMAC_SET_BITS’
XGMAC_SET_BITS(mac_tscr, MAC_TSCR, TSVER2ENA, 1);
^~~~~~~~~~~~~~
drivers/net/ethernet/amd/xgbe/xgbe-drv.c:1616:2: note: here
case HWTSTAMP_FILTER_PTP_V1_L4_EVENT:
^~~~
In file included from drivers/net/ethernet/amd/xgbe/xgbe-drv.c:129:
drivers/net/ethernet/amd/xgbe/xgbe-common.h:1392:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
(_var) |= (((_val) & ((0x1 << (_width)) - 1)) << (_index)); \
~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/amd/xgbe/xgbe-common.h:1419:2: note: in expansion of macro ‘SET_BITS’
SET_BITS((_var), \
^~~~~~~~
drivers/net/ethernet/amd/xgbe/xgbe-drv.c:1625:3: note: in expansion of macro ‘XGMAC_SET_BITS’
XGMAC_SET_BITS(mac_tscr, MAC_TSCR, TSVER2ENA, 1);
^~~~~~~~~~~~~~
drivers/net/ethernet/amd/xgbe/xgbe-drv.c:1627:2: note: here
case HWTSTAMP_FILTER_PTP_V1_L4_SYNC:
^~~~
In file included from drivers/net/ethernet/amd/xgbe/xgbe-drv.c:129:
drivers/net/ethernet/amd/xgbe/xgbe-common.h:1392:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
(_var) |= (((_val) & ((0x1 << (_width)) - 1)) << (_index)); \
~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/amd/xgbe/xgbe-common.h:1419:2: note: in expansion of macro ‘SET_BITS’
SET_BITS((_var), \
^~~~~~~~
drivers/net/ethernet/amd/xgbe/xgbe-drv.c:1636:3: note: in expansion of macro ‘XGMAC_SET_BITS’
XGMAC_SET_BITS(mac_tscr, MAC_TSCR, TSVER2ENA, 1);
^~~~~~~~~~~~~~
drivers/net/ethernet/amd/xgbe/xgbe-drv.c:1638:2: note: here
case HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ:
^~~~
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 */
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);
--
2.21.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] amd-xgbe: Mark expected switch fall-throughs
2019-04-24 16:08 [PATCH net-next] amd-xgbe: Mark expected switch fall-throughs Gustavo A. R. Silva
@ 2019-04-25 13:12 ` Lendacky, Thomas
2019-04-25 14:54 ` Gustavo A. R. Silva
2019-04-26 15:29 ` David Miller
1 sibling, 1 reply; 5+ messages in thread
From: Lendacky, Thomas @ 2019-04-25 13:12 UTC (permalink / raw)
To: Gustavo A. R. Silva, David S. Miller; +Cc: netdev, linux-kernel, Kees Cook
On 4/24/19 11:08 AM, Gustavo A. R. Silva wrote:
> In preparation to enabling -Wimplicit-fallthrough, mark switch
> cases where we are expecting to fall through.
>
> This patch fixes the following warnings:
>
> In file included from drivers/net/ethernet/amd/xgbe/xgbe-drv.c:129:
> drivers/net/ethernet/amd/xgbe/xgbe-drv.c: In function ‘xgbe_set_hwtstamp_settings’:
> drivers/net/ethernet/amd/xgbe/xgbe-common.h:1392:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
> (_var) |= (((_val) & ((0x1 << (_width)) - 1)) << (_index)); \
> ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/net/ethernet/amd/xgbe/xgbe-common.h:1419:2: note: in expansion of macro ‘SET_BITS’
> SET_BITS((_var), \
> ^~~~~~~~
> drivers/net/ethernet/amd/xgbe/xgbe-drv.c:1614:3: note: in expansion of macro ‘XGMAC_SET_BITS’
> XGMAC_SET_BITS(mac_tscr, MAC_TSCR, TSVER2ENA, 1);
> ^~~~~~~~~~~~~~
> drivers/net/ethernet/amd/xgbe/xgbe-drv.c:1616:2: note: here
> case HWTSTAMP_FILTER_PTP_V1_L4_EVENT:
> ^~~~
> In file included from drivers/net/ethernet/amd/xgbe/xgbe-drv.c:129:
> drivers/net/ethernet/amd/xgbe/xgbe-common.h:1392:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
> (_var) |= (((_val) & ((0x1 << (_width)) - 1)) << (_index)); \
> ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/net/ethernet/amd/xgbe/xgbe-common.h:1419:2: note: in expansion of macro ‘SET_BITS’
> SET_BITS((_var), \
> ^~~~~~~~
> drivers/net/ethernet/amd/xgbe/xgbe-drv.c:1625:3: note: in expansion of macro ‘XGMAC_SET_BITS’
> XGMAC_SET_BITS(mac_tscr, MAC_TSCR, TSVER2ENA, 1);
> ^~~~~~~~~~~~~~
> drivers/net/ethernet/amd/xgbe/xgbe-drv.c:1627:2: note: here
> case HWTSTAMP_FILTER_PTP_V1_L4_SYNC:
> ^~~~
> In file included from drivers/net/ethernet/amd/xgbe/xgbe-drv.c:129:
> drivers/net/ethernet/amd/xgbe/xgbe-common.h:1392:9: warning: this statement may fall through [-Wimplicit-fallthrough=]
> (_var) |= (((_val) & ((0x1 << (_width)) - 1)) << (_index)); \
> ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> drivers/net/ethernet/amd/xgbe/xgbe-common.h:1419:2: note: in expansion of macro ‘SET_BITS’
> SET_BITS((_var), \
> ^~~~~~~~
> drivers/net/ethernet/amd/xgbe/xgbe-drv.c:1636:3: note: in expansion of macro ‘XGMAC_SET_BITS’
> XGMAC_SET_BITS(mac_tscr, MAC_TSCR, TSVER2ENA, 1);
> ^~~~~~~~~~~~~~
> drivers/net/ethernet/amd/xgbe/xgbe-drv.c:1638:2: note: here
> case HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ:
> ^~~~
>
> 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.
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);
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] amd-xgbe: Mark expected switch fall-throughs
2019-04-25 13:12 ` Lendacky, Thomas
@ 2019-04-25 14:54 ` Gustavo A. R. Silva
2019-04-25 15:01 ` Lendacky, Thomas
0 siblings, 1 reply; 5+ messages in thread
From: Gustavo A. R. Silva @ 2019-04-25 14:54 UTC (permalink / raw)
To: Lendacky, Thomas, David S. Miller; +Cc: netdev, linux-kernel, Kees Cook
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.
Which do you prefer?
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);
>>
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] amd-xgbe: Mark expected switch fall-throughs
2019-04-25 14:54 ` Gustavo A. R. Silva
@ 2019-04-25 15:01 ` Lendacky, Thomas
0 siblings, 0 replies; 5+ messages in thread
From: Lendacky, Thomas @ 2019-04-25 15:01 UTC (permalink / raw)
To: Gustavo A. R. Silva, David S. Miller; +Cc: netdev, linux-kernel, Kees Cook
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);
>>>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] amd-xgbe: Mark expected switch fall-throughs
2019-04-24 16:08 [PATCH net-next] amd-xgbe: Mark expected switch fall-throughs Gustavo A. R. Silva
2019-04-25 13:12 ` Lendacky, Thomas
@ 2019-04-26 15:29 ` David Miller
1 sibling, 0 replies; 5+ messages in thread
From: David Miller @ 2019-04-26 15:29 UTC (permalink / raw)
To: gustavo; +Cc: thomas.lendacky, netdev, linux-kernel, keescook
From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
Date: Wed, 24 Apr 2019 11:08:24 -0500
> In preparation to enabling -Wimplicit-fallthrough, mark switch
> cases where we are expecting to fall through.
>
> This patch fixes the following warnings:
...
> 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>
Applied.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-04-26 15:29 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-24 16:08 [PATCH net-next] amd-xgbe: Mark expected switch fall-throughs 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
2019-04-26 15:29 ` David Miller
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).