diff options
| author | Grant Likely <grant.likely@secretlab.ca> | 2010-06-25 14:16:52 -0400 |
|---|---|---|
| committer | Grant Likely <grant.likely@secretlab.ca> | 2010-07-15 01:55:23 -0400 |
| commit | f1d4c3a76981addcd7669f404f75041435a04e6a (patch) | |
| tree | f1200acbdc31312d650ea43a9e2004e6080182ea | |
| parent | 596c955c126608b51ac1ca56de9d670c1f6464cb (diff) | |
of/flattree: Use common ALIGN() macro instead of arch specific _ALIGN
There's no reason to use the powerpc-specific _ALIGN macro in the fdt
code. Replace it with ALIGN() from kernel.h
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Acked-By: Jeremy Kerr <jeremy.kerr@canonical.com>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
| -rw-r--r-- | arch/microblaze/include/asm/page.h | 7 | ||||
| -rw-r--r-- | drivers/of/fdt.c | 20 |
2 files changed, 10 insertions, 17 deletions
diff --git a/arch/microblaze/include/asm/page.h b/arch/microblaze/include/asm/page.h index 464ff32bee3d..2fd476126260 100644 --- a/arch/microblaze/include/asm/page.h +++ b/arch/microblaze/include/asm/page.h | |||
| @@ -39,13 +39,6 @@ | |||
| 39 | #define PAGE_UP(addr) (((addr)+((PAGE_SIZE)-1))&(~((PAGE_SIZE)-1))) | 39 | #define PAGE_UP(addr) (((addr)+((PAGE_SIZE)-1))&(~((PAGE_SIZE)-1))) |
| 40 | #define PAGE_DOWN(addr) ((addr)&(~((PAGE_SIZE)-1))) | 40 | #define PAGE_DOWN(addr) ((addr)&(~((PAGE_SIZE)-1))) |
| 41 | 41 | ||
| 42 | /* align addr on a size boundary - adjust address up/down if needed */ | ||
| 43 | #define _ALIGN_UP(addr, size) (((addr)+((size)-1))&(~((size)-1))) | ||
| 44 | #define _ALIGN_DOWN(addr, size) ((addr)&(~((size)-1))) | ||
| 45 | |||
| 46 | /* align addr on a size boundary - adjust address up if needed */ | ||
| 47 | #define _ALIGN(addr, size) _ALIGN_UP(addr, size) | ||
| 48 | |||
| 49 | #ifndef CONFIG_MMU | 42 | #ifndef CONFIG_MMU |
| 50 | /* | 43 | /* |
| 51 | * PAGE_OFFSET -- the first address of the first page of memory. When not | 44 | * PAGE_OFFSET -- the first address of the first page of memory. When not |
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index b6987bba8556..d61fda836e03 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c | |||
| @@ -69,9 +69,9 @@ int __init of_scan_flat_dt(int (*it)(unsigned long node, | |||
| 69 | u32 sz = be32_to_cpup((__be32 *)p); | 69 | u32 sz = be32_to_cpup((__be32 *)p); |
| 70 | p += 8; | 70 | p += 8; |
| 71 | if (be32_to_cpu(initial_boot_params->version) < 0x10) | 71 | if (be32_to_cpu(initial_boot_params->version) < 0x10) |
| 72 | p = _ALIGN(p, sz >= 8 ? 8 : 4); | 72 | p = ALIGN(p, sz >= 8 ? 8 : 4); |
| 73 | p += sz; | 73 | p += sz; |
| 74 | p = _ALIGN(p, 4); | 74 | p = ALIGN(p, 4); |
| 75 | continue; | 75 | continue; |
| 76 | } | 76 | } |
| 77 | if (tag != OF_DT_BEGIN_NODE) { | 77 | if (tag != OF_DT_BEGIN_NODE) { |
| @@ -80,7 +80,7 @@ int __init of_scan_flat_dt(int (*it)(unsigned long node, | |||
| 80 | } | 80 | } |
| 81 | depth++; | 81 | depth++; |
| 82 | pathp = (char *)p; | 82 | pathp = (char *)p; |
| 83 | p = _ALIGN(p + strlen(pathp) + 1, 4); | 83 | p = ALIGN(p + strlen(pathp) + 1, 4); |
| 84 | if ((*pathp) == '/') { | 84 | if ((*pathp) == '/') { |
| 85 | char *lp, *np; | 85 | char *lp, *np; |
| 86 | for (lp = NULL, np = pathp; *np; np++) | 86 | for (lp = NULL, np = pathp; *np; np++) |
| @@ -109,7 +109,7 @@ unsigned long __init of_get_flat_dt_root(void) | |||
| 109 | p += 4; | 109 | p += 4; |
| 110 | BUG_ON(be32_to_cpup((__be32 *)p) != OF_DT_BEGIN_NODE); | 110 | BUG_ON(be32_to_cpup((__be32 *)p) != OF_DT_BEGIN_NODE); |
| 111 | p += 4; | 111 | p += 4; |
| 112 | return _ALIGN(p + strlen((char *)p) + 1, 4); | 112 | return ALIGN(p + strlen((char *)p) + 1, 4); |
| 113 | } | 113 | } |
| 114 | 114 | ||
| 115 | /** | 115 | /** |
| @@ -138,7 +138,7 @@ void *__init of_get_flat_dt_prop(unsigned long node, const char *name, | |||
| 138 | noff = be32_to_cpup((__be32 *)(p + 4)); | 138 | noff = be32_to_cpup((__be32 *)(p + 4)); |
| 139 | p += 8; | 139 | p += 8; |
| 140 | if (be32_to_cpu(initial_boot_params->version) < 0x10) | 140 | if (be32_to_cpu(initial_boot_params->version) < 0x10) |
| 141 | p = _ALIGN(p, sz >= 8 ? 8 : 4); | 141 | p = ALIGN(p, sz >= 8 ? 8 : 4); |
| 142 | 142 | ||
| 143 | nstr = find_flat_dt_string(noff); | 143 | nstr = find_flat_dt_string(noff); |
| 144 | if (nstr == NULL) { | 144 | if (nstr == NULL) { |
| @@ -151,7 +151,7 @@ void *__init of_get_flat_dt_prop(unsigned long node, const char *name, | |||
| 151 | return (void *)p; | 151 | return (void *)p; |
| 152 | } | 152 | } |
| 153 | p += sz; | 153 | p += sz; |
| 154 | p = _ALIGN(p, 4); | 154 | p = ALIGN(p, 4); |
| 155 | } while (1); | 155 | } while (1); |
| 156 | } | 156 | } |
| 157 | 157 | ||
| @@ -184,7 +184,7 @@ static void *__init unflatten_dt_alloc(unsigned long *mem, unsigned long size, | |||
| 184 | { | 184 | { |
| 185 | void *res; | 185 | void *res; |
| 186 | 186 | ||
| 187 | *mem = _ALIGN(*mem, align); | 187 | *mem = ALIGN(*mem, align); |
| 188 | res = (void *)*mem; | 188 | res = (void *)*mem; |
| 189 | *mem += size; | 189 | *mem += size; |
| 190 | 190 | ||
| @@ -220,7 +220,7 @@ unsigned long __init unflatten_dt_node(unsigned long mem, | |||
| 220 | *p += 4; | 220 | *p += 4; |
| 221 | pathp = (char *)*p; | 221 | pathp = (char *)*p; |
| 222 | l = allocl = strlen(pathp) + 1; | 222 | l = allocl = strlen(pathp) + 1; |
| 223 | *p = _ALIGN(*p + l, 4); | 223 | *p = ALIGN(*p + l, 4); |
| 224 | 224 | ||
| 225 | /* version 0x10 has a more compact unit name here instead of the full | 225 | /* version 0x10 has a more compact unit name here instead of the full |
| 226 | * path. we accumulate the full path size using "fpsize", we'll rebuild | 226 | * path. we accumulate the full path size using "fpsize", we'll rebuild |
| @@ -299,7 +299,7 @@ unsigned long __init unflatten_dt_node(unsigned long mem, | |||
| 299 | noff = be32_to_cpup((__be32 *)((*p) + 4)); | 299 | noff = be32_to_cpup((__be32 *)((*p) + 4)); |
| 300 | *p += 8; | 300 | *p += 8; |
| 301 | if (be32_to_cpu(initial_boot_params->version) < 0x10) | 301 | if (be32_to_cpu(initial_boot_params->version) < 0x10) |
| 302 | *p = _ALIGN(*p, sz >= 8 ? 8 : 4); | 302 | *p = ALIGN(*p, sz >= 8 ? 8 : 4); |
| 303 | 303 | ||
| 304 | pname = find_flat_dt_string(noff); | 304 | pname = find_flat_dt_string(noff); |
| 305 | if (pname == NULL) { | 305 | if (pname == NULL) { |
| @@ -333,7 +333,7 @@ unsigned long __init unflatten_dt_node(unsigned long mem, | |||
| 333 | *prev_pp = pp; | 333 | *prev_pp = pp; |
| 334 | prev_pp = &pp->next; | 334 | prev_pp = &pp->next; |
| 335 | } | 335 | } |
| 336 | *p = _ALIGN((*p) + sz, 4); | 336 | *p = ALIGN((*p) + sz, 4); |
| 337 | } | 337 | } |
| 338 | /* with version 0x10 we may not have the name property, recreate | 338 | /* with version 0x10 we may not have the name property, recreate |
| 339 | * it here from the unit name if absent | 339 | * it here from the unit name if absent |
