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/hp-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/hp-agp.c')
-rw-r--r-- | drivers/char/agp/hp-agp.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/char/agp/hp-agp.c b/drivers/char/agp/hp-agp.c index 313a133a1172..cbb0444467ba 100644 --- a/drivers/char/agp/hp-agp.c +++ b/drivers/char/agp/hp-agp.c | |||
@@ -14,15 +14,12 @@ | |||
14 | #include <linux/pci.h> | 14 | #include <linux/pci.h> |
15 | #include <linux/init.h> | 15 | #include <linux/init.h> |
16 | #include <linux/agp_backend.h> | 16 | #include <linux/agp_backend.h> |
17 | #include <linux/log2.h> | ||
17 | 18 | ||
18 | #include <asm/acpi-ext.h> | 19 | #include <asm/acpi-ext.h> |
19 | 20 | ||
20 | #include "agp.h" | 21 | #include "agp.h" |
21 | 22 | ||
22 | #ifndef log2 | ||
23 | #define log2(x) ffz(~(x)) | ||
24 | #endif | ||
25 | |||
26 | #define HP_ZX1_IOC_OFFSET 0x1000 /* ACPI reports SBA, we want IOC */ | 23 | #define HP_ZX1_IOC_OFFSET 0x1000 /* ACPI reports SBA, we want IOC */ |
27 | 24 | ||
28 | /* HP ZX1 IOC registers */ | 25 | /* HP ZX1 IOC registers */ |
@@ -257,7 +254,7 @@ hp_zx1_configure (void) | |||
257 | readl(hp->ioc_regs+HP_ZX1_IMASK); | 254 | readl(hp->ioc_regs+HP_ZX1_IMASK); |
258 | writel(hp->iova_base|1, hp->ioc_regs+HP_ZX1_IBASE); | 255 | writel(hp->iova_base|1, hp->ioc_regs+HP_ZX1_IBASE); |
259 | readl(hp->ioc_regs+HP_ZX1_IBASE); | 256 | readl(hp->ioc_regs+HP_ZX1_IBASE); |
260 | writel(hp->iova_base|log2(HP_ZX1_IOVA_SIZE), hp->ioc_regs+HP_ZX1_PCOM); | 257 | writel(hp->iova_base|ilog2(HP_ZX1_IOVA_SIZE), hp->ioc_regs+HP_ZX1_PCOM); |
261 | readl(hp->ioc_regs+HP_ZX1_PCOM); | 258 | readl(hp->ioc_regs+HP_ZX1_PCOM); |
262 | } | 259 | } |
263 | 260 | ||
@@ -285,7 +282,7 @@ hp_zx1_tlbflush (struct agp_memory *mem) | |||
285 | { | 282 | { |
286 | struct _hp_private *hp = &hp_private; | 283 | struct _hp_private *hp = &hp_private; |
287 | 284 | ||
288 | writeq(hp->gart_base | log2(hp->gart_size), hp->ioc_regs+HP_ZX1_PCOM); | 285 | writeq(hp->gart_base | ilog2(hp->gart_size), hp->ioc_regs+HP_ZX1_PCOM); |
289 | readq(hp->ioc_regs+HP_ZX1_PCOM); | 286 | readq(hp->ioc_regs+HP_ZX1_PCOM); |
290 | } | 287 | } |
291 | 288 | ||