diskio: remove locally coded ilog2()
authorH. Peter Anvin <hpa@linux.intel.com>
Fri, 16 Jul 2010 23:35:41 +0000 (16:35 -0700)
committerH. Peter Anvin <hpa@linux.intel.com>
Fri, 16 Jul 2010 23:35:41 +0000 (16:35 -0700)
Use the centrally coded ilog2() function.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
core/fs/diskio.c

index 55a9df4..b6722e7 100644 (file)
@@ -6,6 +6,7 @@
 #include <core.h>
 #include <fs.h>
 #include <disk.h>
+#include <ilog2.h>
 
 #define RETRY_COUNT 6
 
@@ -291,19 +292,6 @@ static inline bool is_power_of_2(uint32_t x)
     return !(x & (x-1));
 }
 
-static int ilog2(uint32_t num)
-{
-    int i = 0;
-
-    if (!is_power_of_2(num)) {
-        printf("ERROR: the num must be power of 2 when conveting to log2\n");
-        return 0;
-    }
-    while (num >>= 1)
-        i++;
-    return i;
-}
-
 void getoneblk(struct disk *disk, char *buf, block_t block, int block_size)
 {
     int sec_per_block = block_size / disk->sector_size;