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


Groups > linux.kernel > #1215829

[PATCH 4/8] staging: lustre: libcfs: put constant on the right of binary operator

From Julia Lawall <Julia.Lawall@lip6.fr>
Newsgroups linux.kernel
Subject [PATCH 4/8] staging: lustre: libcfs: put constant on the right of binary operator
Date 2015-08-29 19:50 +0200
Message-ID <q2Sqm-ob-29@gated-at.bofh.it> (permalink)
References <q2Sql-ob-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Move constants to the right of binary operators.

A simplified version of the semantic patch that makes this change is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
constant c;
expression e;
binary operator b = {==,!=,&,|};
@@

(
- c
+ e
b
- e
+ c
|
- c < e
+ e > c
)
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/staging/lustre/lustre/libcfs/hash.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/lustre/lustre/libcfs/hash.c b/drivers/staging/lustre/lustre/libcfs/hash.c
index 0ed0631..08f0b48 100644
--- a/drivers/staging/lustre/lustre/libcfs/hash.c
+++ b/drivers/staging/lustre/lustre/libcfs/hash.c
@@ -677,8 +677,8 @@ cfs_hash_bd_findadd_locked(struct cfs_hash *hs, struct cfs_hash_bd *bd,
 			   int noref)
 {
 	return cfs_hash_bd_lookup_intent(hs, bd, key, hnode,
-					 CFS_HS_LOOKUP_IT_ADD |
-					 (!noref * CFS_HS_LOOKUP_MASK_REF));
+					 (!noref * CFS_HS_LOOKUP_MASK_REF) |
+					 CFS_HS_LOOKUP_IT_ADD);
 }
 EXPORT_SYMBOL(cfs_hash_bd_findadd_locked);
 
@@ -756,7 +756,7 @@ cfs_hash_multi_bd_findadd_locked(struct cfs_hash *hs,
 	unsigned	   i;
 
 	LASSERT(hnode != NULL);
-	intent = CFS_HS_LOOKUP_IT_PEEK | (!noref * CFS_HS_LOOKUP_MASK_REF);
+	intent = (!noref * CFS_HS_LOOKUP_MASK_REF) | CFS_HS_LOOKUP_IT_PEEK;
 
 	cfs_hash_for_each_bd(bds, n, i) {
 		ehnode = cfs_hash_bd_lookup_intent(hs, &bds[i], key,

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH 0/8] put constant on the right of binary operator Julia Lawall <Julia.Lawall@lip6.fr> - 2015-08-29 19:50 +0200
  [PATCH 7/8] staging: lustre: osc: put constant on the right of binary operator Julia Lawall <Julia.Lawall@lip6.fr> - 2015-08-29 19:50 +0200
  [PATCH 1/8] staging: lustre: include: put constant on the right of binary operator Julia Lawall <Julia.Lawall@lip6.fr> - 2015-08-29 19:50 +0200
  [PATCH 8/8] staging: lustre: put constant on the right of binary operator Julia Lawall <Julia.Lawall@lip6.fr> - 2015-08-29 19:50 +0200
    Re: [PATCH 8/8] staging: lustre: put constant on the right of  binary operator Joe Perches <joe@perches.com> - 2015-08-30 02:00 +0200
      Re: [PATCH 8/8] staging: lustre: put constant on the right of binary  operator Julia Lawall <julia.lawall@lip6.fr> - 2015-08-30 10:50 +0200
      Re: [PATCH 8/8] staging: lustre: put constant on the right of binary  operator Julia Lawall <julia.lawall@lip6.fr> - 2015-08-30 19:20 +0200
  [PATCH 6/8] Staging: lustre: obd: put constant on the right of binary operator Julia Lawall <Julia.Lawall@lip6.fr> - 2015-08-29 19:50 +0200
  [PATCH 3/8] staging: lustre: ldlm: put constant on the right of binary operator Julia Lawall <Julia.Lawall@lip6.fr> - 2015-08-29 19:50 +0200
  [PATCH 2/8] staging: lustre: lnet: lib-ptl.c: put constant on the right of binary operator Julia Lawall <Julia.Lawall@lip6.fr> - 2015-08-29 19:50 +0200
  [PATCH 5/8] staging: lustre: llite: put constant on the right of binary operator Julia Lawall <Julia.Lawall@lip6.fr> - 2015-08-29 19:50 +0200
  [PATCH 4/8] staging: lustre: libcfs: put constant on the right of binary operator Julia Lawall <Julia.Lawall@lip6.fr> - 2015-08-29 19:50 +0200

csiph-web