Skip to contentSkip to conversation

Remove the last use and definition of IS_PO2

PATCH New Aya Mahfouz 1 participant 3 messages Nov 17, 2015 Staging

lore
Share & tools
lore
#0 lore raw

cover Remove the last use and definition of IS_PO2

Concerned with the removal of IS_PO2 by replacing its use with is_power_of_2 and then removing the definition.

Aya Mahfouz (2):
staging: lustre: hash.c: Replace IS_PO2 by is_power_of_2
staging: lustre: libcfs.h: remove IS_PO2 and __is_po2

 drivers/staging/lustre/include/linux/libcfs/libcfs.h | 7 -------
 drivers/staging/lustre/lustre/libcfs/hash.c          | 3 ++-
 2 files changed, 2 insertions(+), 8 deletions(-)
Signature · 6 lines
2.4.3


-- 
Kind Regards,
Aya Saif El-yazal Mahfouz
#1 lore raw

PATCH 1/2 staging: lustre: hash.c: Replace IS_PO2 by is_power_of_2

Replaces IS_PO2 by is_power_of_2. It is more accurate to use is_power_of_2 since it returns 1 for numbers that are powers of 2 only whereas IS_PO2 returns 1 for 0 and numbers that are powers of 2.

---
 drivers/staging/lustre/lustre/libcfs/hash.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/lustre/lustre/libcfs/hash.c +2 -1
index d285117..4d50510 100644
@@ -107,6 +107,7 @@
  *   table. Also, user can break the iteration by return 1 in callback.
  */
 #include <linux/seq_file.h>
+#include <linux/log2.h>
 
 #include "../../include/linux/libcfs/libcfs.h"
 
@@ -1777,7 +1778,7 @@ cfs_hash_rehash_cancel_locked(struct cfs_hash *hs)
 	for (i = 2; cfs_hash_is_rehashing(hs); i++) {
 		cfs_hash_unlock(hs, 1);
 		/* raise console warning while waiting too long */
-		CDEBUG(IS_PO2(i >> 3) ? D_WARNING : D_INFO,
+		CDEBUG(is_power_of_2(i >> 3) ? D_WARNING : D_INFO,
 		       "hash %s is still rehashing, rescheded %d\n",
 		       hs->hs_name, i - 1);
 		cond_resched();
Signature · 6 lines
2.4.3


-- 
Kind Regards,
Aya Saif El-yazal Mahfouz
#2 lore raw

PATCH 2/2 staging: lustre: libcfs.h: remove IS_PO2 and __is_po2

In reply to Aya Mahfouz

Removes IS_PO2 and __is_po2 since the uses of IS_PO2 have been replaced by is_power_of_2

---
 drivers/staging/lustre/include/linux/libcfs/libcfs.h | 7 -------
 1 file changed, 7 deletions(-)
drivers/staging/lustre/include/linux/libcfs/libcfs.h +0 -7
index 4d74e8a..7f76b20 100644
@@ -42,13 +42,6 @@
 
 #include "curproc.h"
 
-static inline int __is_po2(unsigned long long val)
-{
-	return !(val & (val - 1));
-}
-
-#define IS_PO2(val) __is_po2((unsigned long long)(val))
-
 #define LOWEST_BIT_SET(x)       ((x) & ~((x) - 1))
 
 /*
Signature · 6 lines
2.4.3


-- 
Kind Regards,
Aya Saif El-yazal Mahfouz