Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1606200 > unrolled thread

[PATCH] staging: media: Replace a bit shift by a use of BIT.

Started byArushi Singhal <arushisinghal19971997@gmail.com>
First post2017-03-22 05:30 +0100
Last post2017-03-22 13:20 +0100
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] staging: media: Replace a bit shift by a use of BIT. Arushi Singhal <arushisinghal19971997@gmail.com> - 2017-03-22 05:30 +0100
    Re: [Outreachy kernel] [PATCH] staging: media: Replace a bit shift  by a use of BIT. Julia Lawall <julia.lawall@lip6.fr> - 2017-03-22 11:30 +0100
    Re: [PATCH] staging: media: Replace a bit shift by a use of BIT. "Dilger, Andreas" <andreas.dilger@intel.com> - 2017-03-22 13:20 +0100

#1606200 — [PATCH] staging: media: Replace a bit shift by a use of BIT.

FromArushi Singhal <arushisinghal19971997@gmail.com>
Date2017-03-22 05:30 +0100
Subject[PATCH] staging: media: Replace a bit shift by a use of BIT.
Message-ID<tnG4h-5dV-3@gated-at.bofh.it>
This patch replaces bit shifting on 1 with the BIT(x) macro.
This was done with coccinelle:
@@
constant c;
@@

-1 << c
+BIT(c)

Signed-off-by: Arushi Singhal <arushisinghal19971997@gmail.com>
---
 drivers/staging/octeon/ethernet-tx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/octeon/ethernet-tx.c b/drivers/staging/octeon/ethernet-tx.c
index ff4119e8de42..f00186ac4e27 100644
--- a/drivers/staging/octeon/ethernet-tx.c
+++ b/drivers/staging/octeon/ethernet-tx.c
@@ -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

[toc] | [next] | [standalone]


#1606333 — Re: [Outreachy kernel] [PATCH] staging: media: Replace a bit shift by a use of BIT.

FromJulia Lawall <julia.lawall@lip6.fr>
Date2017-03-22 11:30 +0100
SubjectRe: [Outreachy kernel] [PATCH] staging: media: Replace a bit shift by a use of BIT.
Message-ID<tnLGG-Ta-29@gated-at.bofh.it>
In reply to#1606200

On Wed, 22 Mar 2017, Arushi Singhal wrote:

> This patch replaces bit shifting on 1 with the BIT(x) macro.
> This was done with coccinelle:
> @@
> constant c;
> @@
>
> -1 << c
> +BIT(c)
>
> Signed-off-by: Arushi Singhal <arushisinghal19971997@gmail.com>
> ---
>  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

>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/octeon/ethernet-tx.c b/drivers/staging/octeon/ethernet-tx.c
> index ff4119e8de42..f00186ac4e27 100644
> --- a/drivers/staging/octeon/ethernet-tx.c
> +++ b/drivers/staging/octeon/ethernet-tx.c
> @@ -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@googlegroups.com.
> To post to this group, send email to outreachy-kernel@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.
>

[toc] | [prev] | [next] | [standalone]


#1606409

From"Dilger, Andreas" <andreas.dilger@intel.com>
Date2017-03-22 13:20 +0100
Message-ID<tnNp7-2fJ-1@gated-at.bofh.it>
In reply to#1606200
On Mar 22, 2017, at 00:20, Arushi Singhal <arushisinghal19971997@gmail.com> wrote:
> 
> 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 <ddaney@caviumnetworks.com> (original author)
- Luuk Paulussen <luuk.paulussen@alliedtelesis.co.nz> (recent non-trivial patcher)
- Kyeong Yoo <kyeong.yoo@alliedtelesis.co.nz> (recent non-trivial reviewer)
- Richard Laing <richard.laing@alliedtelesis.co.nz>  " "
- Chris Packham <chris.packham@alliedtelesis.co.nz>
- Tim Beale <tim.beale@alliedtelesis.co.nz>
- Hamish Martin <hamish.martin@alliedtelesis.co.nz>


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.


> Signed-off-by: Arushi Singhal <arushisinghal19971997@gmail.com>
> ---
> drivers/staging/octeon/ethernet-tx.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/octeon/ethernet-tx.c b/drivers/staging/octeon/ethernet-tx.c
> index ff4119e8de42..f00186ac4e27 100644
> --- a/drivers/staging/octeon/ethernet-tx.c
> +++ b/drivers/staging/octeon/ethernet-tx.c
> @@ -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.

> 	    ((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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web