staging: media: Replace a bit shift by a use of BIT.
PATCH 1/1 staging: media: Replace a bit shift by a use of BIT.
This patch replaces bit shifting on 1 with the BIT(x) macro. This was done with coccinelle:
@@
constant c;
@@
-1 << c
+BIT(c)
--- drivers/staging/octeon/ethernet-tx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/octeon/ethernet-tx.c +2 -2
@@ -381,7 +381,7 @@ int cvm_oct_xmit(struct sk_buff *skb, struct net_device *dev) (ip_hdr (skb)->version ==4 ) && (ip_hdr (skb)->ihl ==5 ) && ((ip_hdr (skb)->frag_off ==0 ) || - (ip_hdr (skb)->frag_off ==htons (1 <<14 ))) && + (ip_hdr (skb)->frag_off ==htons (BIT (14 )))) && ((ip_hdr (skb)->protocol ==IPPROTO_TCP ) || (ip_hdr(skb)->protocol == IPPROTO_UDP))) {/* Use hardware checksum calc */
@@ -613,7 +613,7 @@ int cvm_oct_xmit_pow(struct sk_buff *skb, struct net_device *dev)#endif work->word2.s.is_frag = !((ip_hdr (skb)->frag_off ==0 ) || (ip_hdr (skb)->frag_off == -1 <<14 )); +BIT (14 )));#if 0 /* Assume Linux is sending a good packet */ work->word2.s.IP_exc =0 ;
Signature · 1 line
2.11.0
Quoted 6 lines · Arushi Singhal
This patch replaces bit shifting on 1 with the BIT(x) macro. This was done with coccinelle:
@@
constant c;
@@
Quoted 6 lines
-1 << c
+BIT(c)Signed-off-by Arushi Singhal <[email protected]>--- drivers/staging/octeon/ethernet-tx.c | 4 ++--
What is the connection to media? You also seem to have picked up the Lustre maintainers, who are not relevant.
julia
Quoted 34 lines
1 file changed, 2 insertions(+), 2 deletions(-)drivers/staging/octeon/ethernet-tx.c +2
-3@@ -381,7 +381,7 @@ int cvm_oct_xmit(struct sk_buff *skb, struct net_device *dev) (ip_hdr (skb)->version ==4 ) && (ip_hdr (skb)->ihl ==5 ) && ((ip_hdr (skb)->frag_off ==0 ) || - (ip_hdr (skb)->frag_off ==htons (1 <<14 ))) && + (ip_hdr (skb)->frag_off ==htons (BIT (14 )))) && ((ip_hdr (skb)->protocol ==IPPROTO_TCP ) || (ip_hdr(skb)->protocol == IPPROTO_UDP))) {/* Use hardware checksum calc */ @@ -613,7 +613,7 @@ int cvm_oct_xmit_pow(struct sk_buff *skb, struct net_device *dev)#endif work->word2.s.is_frag = !((ip_hdr (skb)->frag_off ==0 ) || (ip_hdr (skb)->frag_off == -1 <<14 )); +BIT (14 )));#if 0 /* Assume Linux is sending a good packet */ work->word2.s.IP_exc =0 ; --2.11.0
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe at googlegroups.com. To post to this group, send email to outreachy-kernel at googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20170322042028.GA22848%40arushi-HP-Pavilion-Notebook.
For more options, visit https://groups.google.com/d/optout.
Quoted 9 lines · Arushi Singhal
This patch replaces bit shifting on 1 with the BIT(x) macro. This was done with coccinelle:
@@
constant c;
@@-1 << c
+BIT(c)
Hi Arushi,
thanks for taking time to contribute to the kernel. There are a few problems with this patch.
Firstly, I'm not sure why you sent this patch to lustre-devel, Oleg, James, and me, since it has nothing to do with Lustre. Conversely, the actual maintainer(s) of this code would normally be better suited to review the patch. This isn't totally clear in this case since get_maintainer.pl lists another person submitting minor cleanups, but "git log" does return some more likely candidates:
- David Daney <[email protected]> (original author)
- Luuk Paulussen <[email protected]> (recent non-trivial patcher)
- Kyeong Yoo <[email protected]> (recent non-trivial reviewer)
- Richard Laing <[email protected]> " "
- Chris Packham <[email protected]>
- Tim Beale <[email protected]>
- Hamish Martin <[email protected]>
Secondly, as mentioned with the other patch you submitted, you need to stop and look at whether your changes actually make sense. In this case, I don't think they do make sense, and this patch should probably just be abandoned.
Quoted 10 lines
Signed-off-by Arushi Singhal <[email protected]>---
drivers/staging/octeon/ethernet-tx.c| 4 ++--1 file changed, 2 insertions(+), 2 deletions(-)drivers/staging/octeon/ethernet-tx.c +0
-0
drivers/staging/octeon/ethernet-tx.c int cvm_oct_xmit(struct sk_buff *skb, struct net_device *dev) · line 384
Quoted 5 lines
drivers/staging/octeon/ethernet-tx.c +1
-1@@ -381,7 +381,7 @@ int cvm_oct_xmit(struct sk_buff *skb, struct net_device *dev) (ip_hdr (skb)->version ==4 ) && (ip_hdr (skb)->ihl ==5 ) && ((ip_hdr (skb)->frag_off ==0 ) || - (ip_hdr(skb)->frag_off == htons(1 << 14))) && + (ip_hdr(skb)->frag_off == htons(BIT(14)))) &&
In this case, it is checking if the fragment offset in bytes is 16384, rather than doing a bit comparison, so I don't think the use of BIT() is appropriate here.
drivers/staging/octeon/ethernet-tx.c int cvm_oct_xmit_pow(struct sk_buff *skb, struct net_device *dev) · line 616
Quoted 9 lines
drivers/staging/octeon/ethernet-tx.c +1
-1((ip_hdr(skb)->protocol == IPPROTO_TCP) || (ip_hdr(skb)->protocol == IPPROTO_UDP))) {/* Use hardware checksum calc */ @@ -613,7 +613,7 @@ int cvm_oct_xmit_pow(struct sk_buff *skb, struct net_device *dev)#endif work->word2.s.is_frag = !((ip_hdr (skb)->frag_off ==0 ) || (ip_hdr (skb)->frag_off == -1 <<14 )); +BIT (14 )));
Same.
Cheers, Andreas
--
Andreas Dilger
Lustre Principal Architect
Intel Corporation
Quoted 71 lines · Andreas
Quoted 9 lines · Arushi Singhal
This patch replaces bit shifting on 1 with the BIT(x) macro. This was done with coccinelle:
@@
constant c;
@@-1 << c
+BIT(c)Hi Arushi,
thanks for taking time to contribute to the kernel. There are a few problems with
this patch.Firstly, I'm not sure why you sent this patch to lustre-devel, Oleg, James, and me,
since it has nothing to do with Lustre. Conversely, the actual maintainer(s) of this
code would normally be better suited to review the patch. This isn't totally clear
in this case since get_maintainer.pl lists another person submitting minor cleanups,
but "git log" does return some more likely candidates:
- David Daney <[email protected]> (original author)
- Luuk Paulussen <[email protected]> (recent non-trivial patcher)
- Kyeong Yoo <[email protected]> (recent non-trivial reviewer)
- Richard Laing <[email protected]> " "
- Chris Packham <[email protected]>
- Tim Beale <[email protected]>
- Hamish Martin <[email protected]>Secondly, as mentioned with the other patch you submitted, you need to stop and look
at whether your changes actually make sense. In this case, I don't think they do
make sense, and this patch should probably just be abandoned.Review
Quoted 6 lines
Signed-off-by Arushi Singhal <[email protected]>---
drivers/staging/octeon/ethernet-tx.c| 4 ++--1 file changed, 2 insertions(+), 2 deletions(-)(quoted diff) +0
-0
b/drivers/staging/octeon/ethernet-tx.cdrivers/staging/octeon/ethernet-tx.c int cvm_oct_xmit(struct sk_buff *skb, struct
Quoted 4 lines
index
ff4119e8de42..f00186ac4e27100644drivers/staging/octeon/ethernet-tx.c +0
-0@@ -381,7 +381,7 @@ int cvm_oct_xmit(struct sk_buff *skb, struct
net_device*dev)drivers/staging/octeon/ethernet-tx.c int cvm_oct_xmit(struct sk_buff *skb, struct net_device *dev) · line 384
Quoted 5 lines
drivers/staging/octeon/ethernet-tx.c +1
-1(ip_hdr (skb)->version ==4 ) && (ip_hdr (skb)->ihl ==5 ) && ((ip_hdr (skb)->frag_off ==0 ) || - (ip_hdr(skb)->frag_off == htons(1 << 14))) && + (ip_hdr(skb)->frag_off == htons(BIT(14)))) &&In this case, it is checking if the fragment offset in bytes is 16384, rather than doing
a bit comparison, so I don't think the use ofBIT()is appropriate here.drivers/staging/octeon/ethernet-tx.c int cvm_oct_xmit_pow(struct sk_buff *skb, struct
Quoted 4 lines
drivers/staging/octeon/ethernet-tx.c +0
-0((ip_hdr(skb)->protocol == IPPROTO_TCP) || (ip_hdr(skb)->protocol == IPPROTO_UDP))) {/* Use hardware checksum calc */ @@ -613,7 +613,7 @@ int cvm_oct_xmit_pow(struct sk_buff *skb, struct
net_device*dev)
Quoted 8 lines
drivers/staging/octeon/ethernet-tx.c int cvm_oct_xmit_pow(struct sk_buff *skb, struct net_device *dev) · line 616
Quoted 5 lines
drivers/staging/octeon/ethernet-tx.c +1
-1#endif work->word2.s.is_frag = !((ip_hdr (skb)->frag_off ==0 ) || (ip_hdr (skb)->frag_off == -1 <<14 )); +BIT (14 )));Same.
Hi Andreas
Your suggestions are really fruitful.
I will keep in mind to do sensible changes.
Thanks
Arushi Singhal
Quoted 14 lines
Cheers, Andreas
--
Andreas Dilger
Lustre Principal Architect
Intel Corporation