diff options
author | Fengguang Wu <fengguang.wu@gmail.com> | 2007-10-17 02:26:25 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-17 11:42:48 -0400 |
commit | e57aa839cea13852e07ecb495692b602b11136c9 (patch) | |
tree | 5296984f012e1483519f87af55c617fcbf186073 /drivers/char/agp/i460-agp.c | |
parent | bf020cb7b3918e186309db21d75cb91ebafc9d6f (diff) |
convert ill defined log2() to ilog2()
It's *wrong* to have
#define log2(n) ffz(~(n))
It should be *reversed*:
#define log2(n) flz(~(n))
or
#define log2(n) fls(n)
or just use
ilog2(n) defined in linux/log2.h.
This patch follows the last solution, recommended by Andrew Morton.
Cc: <linux-ext4@vger.kernel.org>
Cc: Mingming Cao <cmm@us.ibm.com>
Cc: Bjorn Helgaas <bjorn.helgaas@hp.com>
Cc: Chris Ahna <christopher.j.ahna@intel.com>
Cc: David Mosberger-Tang <davidm@hpl.hp.com>
Cc: Kyle McMartin <kyle@parisc-linux.org>
Cc: Dave Airlie <airlied@linux.ie>
Cc: Dave Jones <davej@codemonkey.org.uk>
Signed-off-by: Fengguang Wu <wfg@mail.ustc.edu.cn>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char/agp/i460-agp.c')
-rw-r--r-- | drivers/char/agp/i460-agp.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/char/agp/i460-agp.c b/drivers/char/agp/i460-agp.c index 70117df4d067..e72a83e2bad5 100644 --- a/drivers/char/agp/i460-agp.c +++ b/drivers/char/agp/i460-agp.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/string.h> | 13 | #include <linux/string.h> |
14 | #include <linux/slab.h> | 14 | #include <linux/slab.h> |
15 | #include <linux/agp_backend.h> | 15 | #include <linux/agp_backend.h> |
16 | #include <linux/log2.h> | ||
16 | 17 | ||
17 | #include "agp.h" | 18 | #include "agp.h" |
18 | 19 | ||
@@ -59,8 +60,6 @@ | |||
59 | */ | 60 | */ |
60 | #define WR_FLUSH_GATT(index) RD_GATT(index) | 61 | #define WR_FLUSH_GATT(index) RD_GATT(index) |
61 | 62 | ||
62 | #define log2(x) ffz(~(x)) | ||
63 | |||
64 | static struct { | 63 | static struct { |
65 | void *gatt; /* ioremap'd GATT area */ | 64 | void *gatt; /* ioremap'd GATT area */ |
66 | 65 | ||
@@ -148,7 +147,7 @@ static int i460_fetch_size (void) | |||
148 | * values[i].size. | 147 | * values[i].size. |
149 | */ | 148 | */ |
150 | values[i].num_entries = (values[i].size << 8) >> (I460_IO_PAGE_SHIFT - 12); | 149 | values[i].num_entries = (values[i].size << 8) >> (I460_IO_PAGE_SHIFT - 12); |
151 | values[i].page_order = log2((sizeof(u32)*values[i].num_entries) >> PAGE_SHIFT); | 150 | values[i].page_order = ilog2((sizeof(u32)*values[i].num_entries) >> PAGE_SHIFT); |
152 | } | 151 | } |
153 | 152 | ||
154 | for (i = 0; i < agp_bridge->driver->num_aperture_sizes; i++) { | 153 | for (i = 0; i < agp_bridge->driver->num_aperture_sizes; i++) { |