netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: mscc: simplify retrieving the tag type from the frame header
@ 2018-07-13 14:57 Antoine Tenart
  2018-07-16 14:17 ` Alexandre Belloni
  2018-07-16 20:44 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Antoine Tenart @ 2018-07-13 14:57 UTC (permalink / raw)
  To: davem
  Cc: Antoine Tenart, f.fainelli, andrew, netdev, linux-kernel,
	thomas.petazzoni, alexandre.belloni, quentin.schulz,
	allan.nielsen

The tag type in the frame extraction header is only a bit wide. There's
no need to use GENMASK when retrieving the information. This patch
simplify the code by dropping GENMASK and using BIT instead.

Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
---
 drivers/net/ethernet/mscc/ocelot_board.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mscc/ocelot_board.c b/drivers/net/ethernet/mscc/ocelot_board.c
index 18df7d934e81..26bb3b18f3be 100644
--- a/drivers/net/ethernet/mscc/ocelot_board.c
+++ b/drivers/net/ethernet/mscc/ocelot_board.c
@@ -29,7 +29,7 @@ static int ocelot_parse_ifh(u32 *ifh, struct frame_info *info)
 	info->port = (ifh[2] & GENMASK(14, 11)) >> 11;
 
 	info->cpuq = (ifh[3] & GENMASK(27, 20)) >> 20;
-	info->tag_type = (ifh[3] & GENMASK(16, 16)) >> 16;
+	info->tag_type = (ifh[3] & BIT(16)) >> 16;
 	info->vid = ifh[3] & GENMASK(11, 0);
 
 	return 0;
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: mscc: simplify retrieving the tag type from the frame header
  2018-07-13 14:57 [PATCH net-next] net: mscc: simplify retrieving the tag type from the frame header Antoine Tenart
@ 2018-07-16 14:17 ` Alexandre Belloni
  2018-07-16 20:44 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Alexandre Belloni @ 2018-07-16 14:17 UTC (permalink / raw)
  To: Antoine Tenart
  Cc: davem, f.fainelli, andrew, netdev, linux-kernel, thomas.petazzoni,
	quentin.schulz, allan.nielsen

On 13/07/2018 16:57:57+0200, Antoine Ténart wrote:
> The tag type in the frame extraction header is only a bit wide. There's
> no need to use GENMASK when retrieving the information. This patch
> simplify the code by dropping GENMASK and using BIT instead.
> 
> Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
Reviewed-by: Alexandre Belloni <alexandre.belloni@bootlin.com>

> ---
>  drivers/net/ethernet/mscc/ocelot_board.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/mscc/ocelot_board.c b/drivers/net/ethernet/mscc/ocelot_board.c
> index 18df7d934e81..26bb3b18f3be 100644
> --- a/drivers/net/ethernet/mscc/ocelot_board.c
> +++ b/drivers/net/ethernet/mscc/ocelot_board.c
> @@ -29,7 +29,7 @@ static int ocelot_parse_ifh(u32 *ifh, struct frame_info *info)
>  	info->port = (ifh[2] & GENMASK(14, 11)) >> 11;
>  
>  	info->cpuq = (ifh[3] & GENMASK(27, 20)) >> 20;
> -	info->tag_type = (ifh[3] & GENMASK(16, 16)) >> 16;
> +	info->tag_type = (ifh[3] & BIT(16)) >> 16;
>  	info->vid = ifh[3] & GENMASK(11, 0);
>  
>  	return 0;
> -- 
> 2.17.1
> 

-- 
Alexandre Belloni, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: mscc: simplify retrieving the tag type from the frame header
  2018-07-13 14:57 [PATCH net-next] net: mscc: simplify retrieving the tag type from the frame header Antoine Tenart
  2018-07-16 14:17 ` Alexandre Belloni
@ 2018-07-16 20:44 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2018-07-16 20:44 UTC (permalink / raw)
  To: antoine.tenart
  Cc: f.fainelli, andrew, netdev, linux-kernel, thomas.petazzoni,
	alexandre.belloni, quentin.schulz, allan.nielsen

From: Antoine Tenart <antoine.tenart@bootlin.com>
Date: Fri, 13 Jul 2018 16:57:57 +0200

> The tag type in the frame extraction header is only a bit wide. There's
> no need to use GENMASK when retrieving the information. This patch
> simplify the code by dropping GENMASK and using BIT instead.
> 
> Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>

Applied.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-07-16 20:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-13 14:57 [PATCH net-next] net: mscc: simplify retrieving the tag type from the frame header Antoine Tenart
2018-07-16 14:17 ` Alexandre Belloni
2018-07-16 20:44 ` 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).