Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging: lustre: Remove typedef and update cfs_hash_lock union

Remove typedef keyword and rename the cfs_hash_lock_t
union to cfs_hash_lock in libcfs_hash.h. These changes
resolve the "Do not add new typedefs" warning
generated by checkpatch.pl and meet kernel coding style.

The union variables in hash.c are updated to reflect this
change as well.

Signed-off-by: Lisa Nguyen <lisa@xenapiadmin.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Lisa Nguyen and committed by
Greg Kroah-Hartman
29323b3e bcc3b704

+14 -14
+8 -8
drivers/staging/lustre/include/linux/libcfs/libcfs_hash.h
··· 81 81 struct cfs_hash_lock_ops; 82 82 struct cfs_hash_hlist_ops; 83 83 84 - typedef union { 84 + union cfs_hash_lock { 85 85 rwlock_t rw; /**< rwlock */ 86 86 spinlock_t spin; /**< spinlock */ 87 - } cfs_hash_lock_t; 87 + }; 88 88 89 89 /** 90 90 * cfs_hash_bucket is a container of: ··· 98 98 * - some extra bytes (caller can require it while creating hash) 99 99 */ 100 100 typedef struct cfs_hash_bucket { 101 - cfs_hash_lock_t hsb_lock; /**< bucket lock */ 101 + union cfs_hash_lock hsb_lock; /**< bucket lock */ 102 102 __u32 hsb_count; /**< current entries */ 103 103 __u32 hsb_version; /**< change version */ 104 104 unsigned int hsb_index; /**< index of bucket */ ··· 213 213 typedef struct cfs_hash { 214 214 /** serialize with rehash, or serialize all operations if 215 215 * the hash-table has CFS_HASH_NO_BKTLOCK */ 216 - cfs_hash_lock_t hs_lock; 216 + union cfs_hash_lock hs_lock; 217 217 /** hash operations */ 218 218 struct cfs_hash_ops *hs_ops; 219 219 /** hash lock operations */ ··· 276 276 277 277 typedef struct cfs_hash_lock_ops { 278 278 /** lock the hash table */ 279 - void (*hs_lock)(cfs_hash_lock_t *lock, int exclusive); 279 + void (*hs_lock)(union cfs_hash_lock *lock, int exclusive); 280 280 /** unlock the hash table */ 281 - void (*hs_unlock)(cfs_hash_lock_t *lock, int exclusive); 281 + void (*hs_unlock)(union cfs_hash_lock *lock, int exclusive); 282 282 /** lock the hash bucket */ 283 - void (*hs_bkt_lock)(cfs_hash_lock_t *lock, int exclusive); 283 + void (*hs_bkt_lock)(union cfs_hash_lock *lock, int exclusive); 284 284 /** unlock the hash bucket */ 285 - void (*hs_bkt_unlock)(cfs_hash_lock_t *lock, int exclusive); 285 + void (*hs_bkt_unlock)(union cfs_hash_lock *lock, int exclusive); 286 286 } cfs_hash_lock_ops_t; 287 287 288 288 typedef struct cfs_hash_hlist_ops {
+6 -6
drivers/staging/lustre/lustre/libcfs/hash.c
··· 119 119 struct cfs_wi_sched *cfs_sched_rehash; 120 120 121 121 static inline void 122 - cfs_hash_nl_lock(cfs_hash_lock_t *lock, int exclusive) {} 122 + cfs_hash_nl_lock(union cfs_hash_lock *lock, int exclusive) {} 123 123 124 124 static inline void 125 - cfs_hash_nl_unlock(cfs_hash_lock_t *lock, int exclusive) {} 125 + cfs_hash_nl_unlock(union cfs_hash_lock *lock, int exclusive) {} 126 126 127 127 static inline void 128 - cfs_hash_spin_lock(cfs_hash_lock_t *lock, int exclusive) 128 + cfs_hash_spin_lock(union cfs_hash_lock *lock, int exclusive) 129 129 { 130 130 spin_lock(&lock->spin); 131 131 } 132 132 133 133 static inline void 134 - cfs_hash_spin_unlock(cfs_hash_lock_t *lock, int exclusive) 134 + cfs_hash_spin_unlock(union cfs_hash_lock *lock, int exclusive) 135 135 { 136 136 spin_unlock(&lock->spin); 137 137 } 138 138 139 139 static inline void 140 - cfs_hash_rw_lock(cfs_hash_lock_t *lock, int exclusive) 140 + cfs_hash_rw_lock(union cfs_hash_lock *lock, int exclusive) 141 141 { 142 142 if (!exclusive) 143 143 read_lock(&lock->rw); ··· 146 146 } 147 147 148 148 static inline void 149 - cfs_hash_rw_unlock(cfs_hash_lock_t *lock, int exclusive) 149 + cfs_hash_rw_unlock(union cfs_hash_lock *lock, int exclusive) 150 150 { 151 151 if (!exclusive) 152 152 read_unlock(&lock->rw);