Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 46847
b: refs/heads/master
c: 63c2f78
h: refs/heads/master
i:
  46845: 813ed05
  46843: 76badce
  46839: 1aa0740
  46831: 991cd4d
  46815: cd38564
  46783: eeba1f8
  46719: 292f175
  46591: 94c827b
v: v3
  • Loading branch information
Robert P. J. Day authored and Paul Mackerras committed Feb 7, 2007
1 parent e77ccb7 commit 8e3d81e
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7df2457db83bc922fcc8b462526b77f1ffe8c84b
refs/heads/master: 63c2f782e8f6aafbc11b14b2cb291b3dc9fc217d
5 changes: 1 addition & 4 deletions trunk/arch/powerpc/mm/pgtable_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -294,11 +294,8 @@ void __init mapin_ram(void)
}
}

/* is x a power of 2? */
#define is_power_of_2(x) ((x) != 0 && (((x) & ((x) - 1)) == 0))

/* is x a power of 4? */
#define is_power_of_4(x) ((x) != 0 && (((x) & (x-1)) == 0) && (ffs(x) & 1))
#define is_power_of_4(x) is_power_of_2(x) && (ffs(x) & 1))

/*
* Set up a mapping for a block of I/O.
Expand Down
5 changes: 1 addition & 4 deletions trunk/arch/ppc/mm/pgtable.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,11 +313,8 @@ void __init mapin_ram(void)
}
}

/* is x a power of 2? */
#define is_power_of_2(x) ((x) != 0 && (((x) & ((x) - 1)) == 0))

/* is x a power of 4? */
#define is_power_of_4(x) ((x) != 0 && (((x) & (x-1)) == 0) && (ffs(x) & 1))
#define is_power_of_4(x) is_power_of_2(x) && (ffs(x) & 1))

/*
* Set up a mapping for a block of I/O.
Expand Down
2 changes: 0 additions & 2 deletions trunk/arch/ppc/syslib/ppc85xx_rio.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@
#define DBELL_TID(x) (*(u8 *)(x + DOORBELL_TID_OFFSET))
#define DBELL_INF(x) (*(u16 *)(x + DOORBELL_INFO_OFFSET))

#define is_power_of_2(x) (((x) & ((x) - 1)) == 0)

struct rio_atmu_regs {
u32 rowtar;
u32 pad1;
Expand Down
2 changes: 0 additions & 2 deletions trunk/drivers/net/gianfar_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@

#include "gianfar.h"

#define is_power_of_2(x) ((x) != 0 && (((x) & ((x) - 1)) == 0))

extern void gfar_start(struct net_device *dev);
extern int gfar_clean_rx_ring(struct net_device *dev, int rx_work_limit);

Expand Down
11 changes: 11 additions & 0 deletions trunk/include/linux/log2.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,17 @@ int __ilog2_u64(u64 n)
}
#endif

/*
* Determine whether some value is a power of two, where zero is
* *not* considered a power of two.
*/

static inline __attribute__((const))
bool is_power_of_2(unsigned long n)
{
return (n != 0 && ((n & (n - 1)) == 0));
}

/*
* round up to nearest power of two
*/
Expand Down

0 comments on commit 8e3d81e

Please sign in to comment.