From: Benjamin Herrenschmidt <benh-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
To: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
jeremy.kerr-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org
Subject: Re: [PATCH 1/3] of/flattree: Use common ALIGN() macro instead of arch specific _ALIGN
Date: Mon, 19 Jul 2010 10:03:11 +1000 [thread overview]
Message-ID: <1279497791.10390.1750.camel@pasglop> (raw)
In-Reply-To: <20100714233130.21887.73872.stgit@angua>
On Wed, 2010-07-14 at 17:31 -0600, Grant Likely wrote:
> 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-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
Acked-by: Benjamin Herrenschmidt <benh-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
> ---
> arch/microblaze/include/asm/page.h | 7 -------
> 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 464ff32..2fd4761 100644
> --- a/arch/microblaze/include/asm/page.h
> +++ b/arch/microblaze/include/asm/page.h
> @@ -39,13 +39,6 @@
> #define PAGE_UP(addr) (((addr)+((PAGE_SIZE)-1))&(~((PAGE_SIZE)-1)))
> #define PAGE_DOWN(addr) ((addr)&(~((PAGE_SIZE)-1)))
>
> -/* align addr on a size boundary - adjust address up/down if needed */
> -#define _ALIGN_UP(addr, size) (((addr)+((size)-1))&(~((size)-1)))
> -#define _ALIGN_DOWN(addr, size) ((addr)&(~((size)-1)))
> -
> -/* align addr on a size boundary - adjust address up if needed */
> -#define _ALIGN(addr, size) _ALIGN_UP(addr, size)
> -
> #ifndef CONFIG_MMU
> /*
> * 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 b6987bb..d61fda8 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,
> u32 sz = be32_to_cpup((__be32 *)p);
> p += 8;
> if (be32_to_cpu(initial_boot_params->version) < 0x10)
> - p = _ALIGN(p, sz >= 8 ? 8 : 4);
> + p = ALIGN(p, sz >= 8 ? 8 : 4);
> p += sz;
> - p = _ALIGN(p, 4);
> + p = ALIGN(p, 4);
> continue;
> }
> if (tag != OF_DT_BEGIN_NODE) {
> @@ -80,7 +80,7 @@ int __init of_scan_flat_dt(int (*it)(unsigned long node,
> }
> depth++;
> pathp = (char *)p;
> - p = _ALIGN(p + strlen(pathp) + 1, 4);
> + p = ALIGN(p + strlen(pathp) + 1, 4);
> if ((*pathp) == '/') {
> char *lp, *np;
> for (lp = NULL, np = pathp; *np; np++)
> @@ -109,7 +109,7 @@ unsigned long __init of_get_flat_dt_root(void)
> p += 4;
> BUG_ON(be32_to_cpup((__be32 *)p) != OF_DT_BEGIN_NODE);
> p += 4;
> - return _ALIGN(p + strlen((char *)p) + 1, 4);
> + return ALIGN(p + strlen((char *)p) + 1, 4);
> }
>
> /**
> @@ -138,7 +138,7 @@ void *__init of_get_flat_dt_prop(unsigned long node, const char *name,
> noff = be32_to_cpup((__be32 *)(p + 4));
> p += 8;
> if (be32_to_cpu(initial_boot_params->version) < 0x10)
> - p = _ALIGN(p, sz >= 8 ? 8 : 4);
> + p = ALIGN(p, sz >= 8 ? 8 : 4);
>
> nstr = find_flat_dt_string(noff);
> if (nstr == NULL) {
> @@ -151,7 +151,7 @@ void *__init of_get_flat_dt_prop(unsigned long node, const char *name,
> return (void *)p;
> }
> p += sz;
> - p = _ALIGN(p, 4);
> + p = ALIGN(p, 4);
> } while (1);
> }
>
> @@ -184,7 +184,7 @@ static void *__init unflatten_dt_alloc(unsigned long *mem, unsigned long size,
> {
> void *res;
>
> - *mem = _ALIGN(*mem, align);
> + *mem = ALIGN(*mem, align);
> res = (void *)*mem;
> *mem += size;
>
> @@ -220,7 +220,7 @@ unsigned long __init unflatten_dt_node(unsigned long mem,
> *p += 4;
> pathp = (char *)*p;
> l = allocl = strlen(pathp) + 1;
> - *p = _ALIGN(*p + l, 4);
> + *p = ALIGN(*p + l, 4);
>
> /* version 0x10 has a more compact unit name here instead of the full
> * 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,
> noff = be32_to_cpup((__be32 *)((*p) + 4));
> *p += 8;
> if (be32_to_cpu(initial_boot_params->version) < 0x10)
> - *p = _ALIGN(*p, sz >= 8 ? 8 : 4);
> + *p = ALIGN(*p, sz >= 8 ? 8 : 4);
>
> pname = find_flat_dt_string(noff);
> if (pname == NULL) {
> @@ -333,7 +333,7 @@ unsigned long __init unflatten_dt_node(unsigned long mem,
> *prev_pp = pp;
> prev_pp = &pp->next;
> }
> - *p = _ALIGN((*p) + sz, 4);
> + *p = ALIGN((*p) + sz, 4);
> }
> /* with version 0x10 we may not have the name property, recreate
> * it here from the unit name if absent
prev parent reply other threads:[~2010-07-19 0:03 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-14 23:31 [PATCH 1/3] of/flattree: Use common ALIGN() macro instead of arch specific _ALIGN Grant Likely
2010-07-14 23:31 ` [PATCH 2/3] of/flattree: Fix crash when device tree absent Grant Likely
2010-07-15 1:11 ` Jeremy Kerr
[not found] ` <1279156262.15089.68.camel-353AF/3W9ll+urZeOPWqwQ@public.gmane.org>
2010-07-15 6:15 ` Grant Likely
[not found] ` <AANLkTikD3ZhhVg4PTuG5Zkc38oW1I6yaQyKqcv9rAaoR-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-07-15 7:26 ` Jeremy Kerr
2010-07-19 0:04 ` Benjamin Herrenschmidt
2010-07-19 4:37 ` Grant Likely
2010-07-14 23:31 ` [PATCH 3/3] of: Remove unused of_find_device_by_phandle() Grant Likely
2010-07-19 0:06 ` Benjamin Herrenschmidt
2010-07-15 1:12 ` [PATCH 1/3] of/flattree: Use common ALIGN() macro instead of arch specific _ALIGN Jeremy Kerr
2010-07-19 0:03 ` Benjamin Herrenschmidt [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1279497791.10390.1750.camel@pasglop \
--to=benh-xvmvhmargas8u2djnn8i7kb+6bgklq7r@public.gmane.org \
--cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
--cc=grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org \
--cc=jeremy.kerr-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox