aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
authorvignesh babu <vignesh.babu@wipro.com>2007-08-13 08:53:14 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2007-10-12 18:03:15 -0400
commit229f5afded86bf3819b7b67e57c62813ca0648a7 (patch)
tree608b5b355cb36bc93da24772eedfdd4b0c19ac0e /drivers/pci
parent40730d1042c595b1e84b28e40021f2c1377b4f8b (diff)
PCI: is_power_of_2 in drivers/pci/pci.c
Replacing n & (n - 1) for power of 2 check by is_power_of_2(n) Signed-off-by: vignesh babu <vignesh.babu@wipro.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/pci.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 37c00f6fd801..19a64a36ecab 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -17,6 +17,7 @@
17#include <linux/module.h> 17#include <linux/module.h>
18#include <linux/spinlock.h> 18#include <linux/spinlock.h>
19#include <linux/string.h> 19#include <linux/string.h>
20#include <linux/log2.h>
20#include <asm/dma.h> /* isa_dma_bridge_buggy */ 21#include <asm/dma.h> /* isa_dma_bridge_buggy */
21#include "pci.h" 22#include "pci.h"
22 23
@@ -1454,7 +1455,7 @@ int pcix_set_mmrbc(struct pci_dev *dev, int mmrbc)
1454 int cap, err = -EINVAL; 1455 int cap, err = -EINVAL;
1455 u32 stat, cmd, v, o; 1456 u32 stat, cmd, v, o;
1456 1457
1457 if (mmrbc < 512 || mmrbc > 4096 || (mmrbc & (mmrbc-1))) 1458 if (mmrbc < 512 || mmrbc > 4096 || !is_power_of_2(mmrbc))
1458 goto out; 1459 goto out;
1459 1460
1460 v = ffs(mmrbc) - 10; 1461 v = ffs(mmrbc) - 10;
@@ -1526,7 +1527,7 @@ int pcie_set_readrq(struct pci_dev *dev, int rq)
1526 int cap, err = -EINVAL; 1527 int cap, err = -EINVAL;
1527 u16 ctl, v; 1528 u16 ctl, v;
1528 1529
1529 if (rq < 128 || rq > 4096 || (rq & (rq-1))) 1530 if (rq < 128 || rq > 4096 || !is_power_of_2(rq))
1530 goto out; 1531 goto out;
1531 1532
1532 v = (ffs(rq) - 8) << 12; 1533 v = (ffs(rq) - 8) << 12;