staging: lustre: libcfs: remove zero comparisons in headers
authorJames Simmons <jsimmons@infradead.org>
Fri, 18 Nov 2016 16:48:43 +0000 (11:48 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 19 Nov 2016 13:13:45 +0000 (14:13 +0100)
Remove the zero comparisions in the libcfs headers.

Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/include/linux/libcfs/libcfs_crypto.h
drivers/staging/lustre/include/linux/libcfs/libcfs_fail.h
drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h

index a0865e517b65f74cad3ea110d3d4dd455e77a07b..8f34c5ddc63e0c8fc9f840a5c72cdd41c04d6664 100644 (file)
@@ -137,7 +137,7 @@ static inline unsigned char cfs_crypto_hash_alg(const char *algname)
        enum cfs_crypto_hash_alg hash_alg;
 
        for (hash_alg = 0; hash_alg < CFS_HASH_ALG_MAX; hash_alg++)
-               if (strcmp(hash_types[hash_alg].cht_name, algname) == 0)
+               if (!strcmp(hash_types[hash_alg].cht_name, algname))
                        return hash_alg;
 
        return CFS_HASH_ALG_UNKNOWN;
index 73cbb479751a43d348f89394d2aee56f4b30d246..129047e5cbc586c4c281f9db0e4fb685effc5253 100644 (file)
@@ -71,7 +71,7 @@ enum {
 
 static inline bool CFS_FAIL_PRECHECK(__u32 id)
 {
-       return cfs_fail_loc != 0 &&
+       return cfs_fail_loc &&
               ((cfs_fail_loc & CFS_FAIL_MASK_LOC) == (id & CFS_FAIL_MASK_LOC) ||
                (cfs_fail_loc & id & CFS_FAULT));
 }
@@ -175,7 +175,7 @@ static inline void cfs_race(__u32 id)
                        cfs_race_state = 0;
                        CERROR("cfs_race id %x sleeping\n", id);
                        rc = wait_event_interruptible(cfs_race_waitq,
-                                                     cfs_race_state != 0);
+                                                     !!cfs_race_state);
                        CERROR("cfs_fail_race id %x awake, rc=%d\n", id, rc);
                } else {
                        CERROR("cfs_fail_race id %x waking\n", id);
index d0ba3e0e113adc67851c6e100b0aec8a6b5a1514..6231f47bcb232e8e2791862a3a93b3cb05425270 100644 (file)
@@ -342,34 +342,34 @@ static inline int
 cfs_hash_with_no_lock(struct cfs_hash *hs)
 {
        /* caller will serialize all operations for this hash-table */
-       return (hs->hs_flags & CFS_HASH_NO_LOCK) != 0;
+       return hs->hs_flags & CFS_HASH_NO_LOCK;
 }
 
 static inline int
 cfs_hash_with_no_bktlock(struct cfs_hash *hs)
 {
        /* no bucket lock, one single lock to protect the hash-table */
-       return (hs->hs_flags & CFS_HASH_NO_BKTLOCK) != 0;
+       return hs->hs_flags & CFS_HASH_NO_BKTLOCK;
 }
 
 static inline int
 cfs_hash_with_rw_bktlock(struct cfs_hash *hs)
 {
        /* rwlock to protect hash bucket */
-       return (hs->hs_flags & CFS_HASH_RW_BKTLOCK) != 0;
+       return hs->hs_flags & CFS_HASH_RW_BKTLOCK;
 }
 
 static inline int
 cfs_hash_with_spin_bktlock(struct cfs_hash *hs)
 {
        /* spinlock to protect hash bucket */
-       return (hs->hs_flags & CFS_HASH_SPIN_BKTLOCK) != 0;
+       return hs->hs_flags & CFS_HASH_SPIN_BKTLOCK;
 }
 
 static inline int
 cfs_hash_with_add_tail(struct cfs_hash *hs)
 {
-       return (hs->hs_flags & CFS_HASH_ADD_TAIL) != 0;
+       return hs->hs_flags & CFS_HASH_ADD_TAIL;
 }
 
 static inline int
@@ -380,55 +380,55 @@ cfs_hash_with_no_itemref(struct cfs_hash *hs)
         * item can't be removed from hash unless it's
         * ZERO refcount
         */
-       return (hs->hs_flags & CFS_HASH_NO_ITEMREF) != 0;
+       return hs->hs_flags & CFS_HASH_NO_ITEMREF;
 }
 
 static inline int
 cfs_hash_with_bigname(struct cfs_hash *hs)
 {
-       return (hs->hs_flags & CFS_HASH_BIGNAME) != 0;
+       return hs->hs_flags & CFS_HASH_BIGNAME;
 }
 
 static inline int
 cfs_hash_with_counter(struct cfs_hash *hs)
 {
-       return (hs->hs_flags & CFS_HASH_COUNTER) != 0;
+       return hs->hs_flags & CFS_HASH_COUNTER;
 }
 
 static inline int
 cfs_hash_with_rehash(struct cfs_hash *hs)
 {
-       return (hs->hs_flags & CFS_HASH_REHASH) != 0;
+       return hs->hs_flags & CFS_HASH_REHASH;
 }
 
 static inline int
 cfs_hash_with_rehash_key(struct cfs_hash *hs)
 {
-       return (hs->hs_flags & CFS_HASH_REHASH_KEY) != 0;
+       return hs->hs_flags & CFS_HASH_REHASH_KEY;
 }
 
 static inline int
 cfs_hash_with_shrink(struct cfs_hash *hs)
 {
-       return (hs->hs_flags & CFS_HASH_SHRINK) != 0;
+       return hs->hs_flags & CFS_HASH_SHRINK;
 }
 
 static inline int
 cfs_hash_with_assert_empty(struct cfs_hash *hs)
 {
-       return (hs->hs_flags & CFS_HASH_ASSERT_EMPTY) != 0;
+       return hs->hs_flags & CFS_HASH_ASSERT_EMPTY;
 }
 
 static inline int
 cfs_hash_with_depth(struct cfs_hash *hs)
 {
-       return (hs->hs_flags & CFS_HASH_DEPTH) != 0;
+       return hs->hs_flags & CFS_HASH_DEPTH;
 }
 
 static inline int
 cfs_hash_with_nblk_change(struct cfs_hash *hs)
 {
-       return (hs->hs_flags & CFS_HASH_NBLK_CHANGE) != 0;
+       return hs->hs_flags & CFS_HASH_NBLK_CHANGE;
 }
 
 static inline int
@@ -442,14 +442,14 @@ static inline int
 cfs_hash_is_rehashing(struct cfs_hash *hs)
 {
        /* rehash is launched */
-       return hs->hs_rehash_bits != 0;
+       return !!hs->hs_rehash_bits;
 }
 
 static inline int
 cfs_hash_is_iterating(struct cfs_hash *hs)
 {
        /* someone is calling cfs_hash_for_each_* */
-       return hs->hs_iterating || hs->hs_iterators != 0;
+       return hs->hs_iterating || hs->hs_iterators;
 }
 
 static inline int