diff mbox series

[net-next] net: mscc: simplify retrieving the tag type from the frame header

Message ID 20180713145757.3574-1-antoine.tenart@bootlin.com
State Accepted, archived
Delegated to: David Miller
Headers show
Series [net-next] net: mscc: simplify retrieving the tag type from the frame header | expand

Commit Message

Antoine Tenart July 13, 2018, 2:57 p.m. UTC
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(-)

Comments

Alexandre Belloni July 16, 2018, 2:17 p.m. UTC | #1
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
>
David Miller July 16, 2018, 8:44 p.m. UTC | #2
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.
diff mbox series

Patch

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;