Skip to contentSkip to conversation

of/flattree: Use common ALIGN() macro instead of arch specific _ALIGN

PATCH In review Grant Likely 2 participants 7 messages Jun 25, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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

---
 arch/microblaze/include/asm/page.h |    7 -------
 drivers/of/fdt.c                   |   20 ++++++++++----------
 2 files changed, 10 insertions(+), 17 deletions(-)
arch/microblaze/include/asm/page.h +0 -7
index 464ff32..2fd4761 100644
@@ -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
drivers/of/fdt.c +10 -10
index b6987bb..d61fda8 100644
@@ -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
Reviewed-by on v1 1/1
#1 lore raw

RE: [PATCH] of/flattree: Use common ALIGN() macro instead of archspecific _ALIGN

Grant,

I need this for the PCI project. I also have a couple of other generalizations of the drivers/of code
to get it to run after boot time in an X86 system...

Steve

Quoted 2 lines

-----Original Message-----
From:

devicetree-discuss-bounces+stephen.neuendorffer=xilinx.com@lists.ozlabs. org [mailto:devicetree-

Quoted 1 line

[email protected]] On

Behalf Of Grant Likely

Quoted 3 lines

Sent: Friday, June 25, 2010 3:03 PM
To: [email protected]; [email protected]
Cc: [email protected];

[email protected]; linux-

Quoted 1 line

[email protected]; [email protected];

[email protected]

Quoted 1 line

Subject: [PATCH] of/flattree: Use common ALIGN() macro instead of

archspecific _ALIGN

Review

Quoted 11 lines

There's no reason to use the powerpc-specific _ALIGN macro in the fdt code. Replace it with ALIGN() from kernel.h

---
 arch/microblaze/include/asm/page.h |    7 -------
 drivers/of/fdt.c                   |   20 ++++++++++----------
 2 files changed, 10 insertions(+), 17 deletions(-)
(quoted diff) +0 -0

b/arch/microblaze/include/asm/page.h

arch/microblaze/include/asm/page.h line 39

Quoted 5 lines

index 464ff32..2fd4761 100644

arch/microblaze/include/asm/page.h +0 -0
@@ -39,13 +39,6 @@
 #define PAGE_UP(addr)

(((addr)+((PAGE_SIZE)-1))&(~((PAGE_SIZE)-1)))

arch/microblaze/include/asm/page.h

Quoted 3 lines
arch/microblaze/include/asm/page.h +0 -1
 #define PAGE_DOWN(addr)	((addr)&(~((PAGE_SIZE)-1)))
 
-/* align addr on a size boundary - adjust address up/down if needed

*/

arch/microblaze/include/asm/page.h line 43

Quoted 1 line
arch/microblaze/include/asm/page.h +0 -1
-#define _ALIGN_UP(addr, size)

(((addr)+((size)-1))&(~((size)-1)))

arch/microblaze/include/asm/page.h

Quoted 8 lines
arch/microblaze/include/asm/page.h +0 -5
-#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

drivers/of/fdt.c int __init of_scan_flat_dt(int (*it)(unsigned long

Quoted 5 lines
drivers/of/fdt.c +0 -0
index b6987bb..d61fda8 100644
@@ -69,9 +69,9 @@ int __init of_scan_flat_dt(int (*it)(unsigned long

node,

drivers/of/fdt.c int __init of_scan_flat_dt(int (*it)(unsigned long node,

Quoted 3 lines
drivers/of/fdt.c +0 -0
 			u32 sz = be32_to_cpup((__be32 *)p);
 			p += 8;
 			if (be32_to_cpu(initial_boot_params->version) <

0x10)

drivers/of/fdt.c int __init of_scan_flat_dt(int (*it)(unsigned long

Quoted 9 lines
drivers/of/fdt.c +2 -2
-				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,

drivers/of/fdt.c void *__init of_get_flat_dt_prop(unsigned long

Quoted 18 lines
drivers/of/fdt.c +2 -2
 		}
 		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,

drivers/of/fdt.c void *__init of_get_flat_dt_prop(unsigned long

Quoted 9 lines
drivers/of/fdt.c +1 -1
 		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,

drivers/of/fdt.c static void *__init unflatten_dt_alloc(unsigned

Quoted 9 lines
drivers/of/fdt.c +1 -1
 			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,

drivers/of/fdt.c unsigned long __init unflatten_dt_node(unsigned

Quoted 9 lines
drivers/of/fdt.c +1 -1
 {
 	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,

drivers/of/fdt.c unsigned long __init unflatten_dt_node(unsigned long mem,

Quoted 7 lines
drivers/of/fdt.c +1 -1
 	*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

drivers/of/fdt.c unsigned long __init unflatten_dt_node(unsigned · line 226

Quoted 1 line
drivers/of/fdt.c +0 -0
 	 * path. we accumulate the full path size using "fpsize", we'll

rebuild

drivers/of/fdt.c unsigned long __init unflatten_dt_node(unsigned

Quoted 1 line
drivers/of/fdt.c +0 -0
@@ -299,7 +299,7 @@ unsigned long __init unflatten_dt_node(unsigned

long mem,

drivers/of/fdt.c unsigned long __init unflatten_dt_node(unsigned

Quoted 9 lines
drivers/of/fdt.c +1 -1
 		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,

Quoted 9 lines
drivers/of/fdt.c +1 -1
 			*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
Quoted 4 lines

_______________________________________________
devicetree-discuss mailing list
[email protected]
https://lists.ozlabs.org/listinfo/devicetree-discuss

This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.

#2 lore raw

Re: [PATCH] of/flattree: Use common ALIGN() macro instead of archspecific _ALIGN

Quoted 5 lines · Stephen Neuendorffer

Grant,

I need this for the PCI project.  I also have a couple of other generalizations of the drivers/of code
to get it to run after boot time in an X86 system...

Send me your patches! :-) Get them to me soon and I'll queue them up for the next merge window.

g.

Quoted 162 lines

Steve

Quoted 2 lines

-----Original Message-----
From:

devicetree-discuss-bounces+stephen.neuendorffer=xilinx.com-uLR06cmDAlaKREJ1Ck/[email protected] org [mailto:devicetree-

Quoted 1 line

discuss-bounces+stephen.neuendorffer=xilinx.com-uLR06cmDAlY/[email protected]] On

Behalf Of Grant Likely

Quoted 3 lines

Sent: Friday, June 25, 2010 3:03 PM
To: [email protected]; [email protected]
Cc: microblaze-uclinux-rVRm/[email protected];

devicetree-discuss-uLR06cmDAlY/[email protected]; linux-

Quoted 1 line

[email protected]; [email protected];

[email protected]

Quoted 1 line

Subject: [PATCH] of/flattree: Use common ALIGN() macro instead of

archspecific _ALIGN

Review

Quoted 11 lines

There's no reason to use the powerpc-specific _ALIGN macro in the fdt code.  Replace it with ALIGN() from kernel.h

---
 arch/microblaze/include/asm/page.h |    7 ------- drivers/of/fdt.c                   |   20 ++++++++++----------

 2 files changed, 10 insertions(+), 17 deletions(-)
(quoted diff) +0 -0

b/arch/microblaze/include/asm/page.h

arch/microblaze/include/asm/page.h line 39

Quoted 5 lines

index 464ff32..2fd4761 100644

arch/microblaze/include/asm/page.h +0 -0
@@ -39,13 +39,6 @@
  #define PAGE_UP(addr)

(((addr)+((PAGE_SIZE)-1))&(~((PAGE_SIZE)-1)))

arch/microblaze/include/asm/page.h

Quoted 3 lines
arch/microblaze/include/asm/page.h +0 -1
  #define PAGE_DOWN(addr)      ((addr)&(~((PAGE_SIZE)-1)))
 
-/* align addr on a size boundary - adjust address up/down if needed

*/

arch/microblaze/include/asm/page.h line 43

Quoted 1 line
arch/microblaze/include/asm/page.h +0 -1
-#define _ALIGN_UP(addr, size)

(((addr)+((size)-1))&(~((size)-1)))

arch/microblaze/include/asm/page.h

Quoted 8 lines
arch/microblaze/include/asm/page.h +0 -5
-#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

drivers/of/fdt.c int __init of_scan_flat_dt(int (*it)(unsigned long

Quoted 5 lines
drivers/of/fdt.c +0 -0
index b6987bb..d61fda8 100644
@@ -69,9 +69,9 @@ int __init of_scan_flat_dt(int (*it)(unsigned long

node,

Quoted 3 lines
drivers/of/fdt.c +0 -0
                       u32 sz = be32_to_cpup((__be32 *)p);
                       p += 8;

                      if (be32_to_cpu(initial_boot_params->version) <

0x10)

drivers/of/fdt.c int __init of_scan_flat_dt(int (*it)(unsigned long

Quoted 9 lines

-                             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) {

drivers/of/fdt.c +0 -0
@@ -80,7 +80,7 @@ int __init of_scan_flat_dt(int (*it)(unsigned long

node,

drivers/of/fdt.c void *__init of_get_flat_dt_prop(unsigned long

Quoted 18 lines
drivers/of/fdt.c +2 -2
               }
               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,

drivers/of/fdt.c void *__init of_get_flat_dt_prop(unsigned long

Quoted 9 lines
drivers/of/fdt.c +1 -1
               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,

drivers/of/fdt.c static void *__init unflatten_dt_alloc(unsigned

Quoted 9 lines
drivers/of/fdt.c +1 -1
                       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,

drivers/of/fdt.c unsigned long __init unflatten_dt_node(unsigned

Quoted 9 lines
drivers/of/fdt.c +1 -1
  {
       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,

drivers/of/fdt.c unsigned long __init unflatten_dt_node(unsigned long mem,

Quoted 7 lines
drivers/of/fdt.c +1 -1
       *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

drivers/of/fdt.c unsigned long __init unflatten_dt_node(unsigned · line 226

Quoted 1 line
drivers/of/fdt.c +0 -0
        * path. we accumulate the full path size using "fpsize", we'll

rebuild

drivers/of/fdt.c unsigned long __init unflatten_dt_node(unsigned

Quoted 1 line
drivers/of/fdt.c +0 -0
@@ -299,7 +299,7 @@ unsigned long __init unflatten_dt_node(unsigned

long mem,

drivers/of/fdt.c unsigned long __init unflatten_dt_node(unsigned

Quoted 9 lines
drivers/of/fdt.c +1 -1
               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,

Quoted 9 lines
drivers/of/fdt.c +1 -1
                       *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
Quoted 4 lines

_______________________________________________
devicetree-discuss mailing list devicetree-discuss-uLR06cmDAlY/[email protected]
https://lists.ozlabs.org/listinfo/devicetree-discuss

This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.

Signature · 2 lines
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
#3 lore raw

RE: [PATCH] of/flattree: Use common ALIGN() macro instead of archspecific _ALIGN

Quoted 13 lines

-----Original Message-----
From: glikely-s3s/[email protected] [mailto:glikely-s3s/[email protected]] On Behalf Of Grant Likely
Sent: Friday, June 25, 2010 4:16 PM
To: Stephen Neuendorffer
Cc: [email protected]; [email protected]; [email protected]; devicetree- discuss-uLR06cmDAlY/[email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH] of/flattree: Use common ALIGN() macro instead of archspecific _ALIGN

Quoted 2 lines · Stephen Neuendorffer

Grant,

Quoted 8 lines
Quoted 3 lines

I need this for the PCI project.  I also have a couple of other generalizations of the drivers/of code
to get it to run after boot time in an X86 system...

Send me your patches! :-) Get them to me soon and I'll queue them up for the next merge window.

g.

Dangit, I just got the code compiling, and now I find out that X86 doesn't support out_be32()... :) You'd think that somewhere somebody might have realized that all the duplicated driver macros that do that are a bad idea...

Steve

Quoted 169 lines
Quoted 153 lines

Steve

Quoted 2 lines

-----Original Message-----
From:

devicetree-discuss-bounces+stephen.neuendorffer=xilinx.com-uLR06cmDAlY@public.gmane.orglabs. org [mailto:devicetree-

Quoted 1 line

discuss-bounces+stephen.neuendorffer=xilinx.com-uLR06cmDAlY/[email protected]] On

Behalf Of Grant Likely

Quoted 3 lines

Sent: Friday, June 25, 2010 3:03 PM
To: [email protected]; [email protected]
Cc: microblaze-uclinux-rVRm/[email protected];

devicetree-discuss-uLR06cmDAlY/[email protected]; linux-

Quoted 1 line

[email protected]; [email protected];

[email protected]

Quoted 1 line

Subject: [PATCH] of/flattree: Use common ALIGN() macro instead of

archspecific _ALIGN

Review

Quoted 11 lines

There's no reason to use the powerpc-specific _ALIGN macro in the fdt code.  Replace it with ALIGN() from kernel.h

---
 arch/microblaze/include/asm/page.h |    7 ------- drivers/of/fdt.c                   |   20 ++++++++++----------

 2 files changed, 10 insertions(+), 17 deletions(-)
(quoted diff) +0 -0

b/arch/microblaze/include/asm/page.h

arch/microblaze/include/asm/page.h line 39

Quoted 5 lines

index 464ff32..2fd4761 100644

arch/microblaze/include/asm/page.h +0 -0
@@ -39,13 +39,6 @@
  #define PAGE_UP(addr)

(((addr)+((PAGE_SIZE)-1))&(~((PAGE_SIZE)-1)))

arch/microblaze/include/asm/page.h

Quoted 3 lines
arch/microblaze/include/asm/page.h +0 -1
  #define PAGE_DOWN(addr)      ((addr)&(~((PAGE_SIZE)-1)))
 
-/* align addr on a size boundary - adjust address up/down if needed

*/

arch/microblaze/include/asm/page.h line 43

Quoted 1 line
arch/microblaze/include/asm/page.h +0 -1
-#define _ALIGN_UP(addr, size)

(((addr)+((size)-1))&(~((size)-1)))

arch/microblaze/include/asm/page.h

Quoted 8 lines
arch/microblaze/include/asm/page.h +0 -5
-#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

drivers/of/fdt.c int __init of_scan_flat_dt(int (*it)(unsigned long

Quoted 5 lines
drivers/of/fdt.c +0 -0
index b6987bb..d61fda8 100644
@@ -69,9 +69,9 @@ int __init of_scan_flat_dt(int (*it)(unsigned long

node,

Quoted 3 lines
drivers/of/fdt.c +0 -0
                       u32 sz = be32_to_cpup((__be32 *)p);
                       p += 8;

                      if (be32_to_cpu(initial_boot_params->version) <

0x10)

drivers/of/fdt.c int __init of_scan_flat_dt(int (*it)(unsigned long

Quoted 9 lines

-                             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) {

drivers/of/fdt.c +0 -0
@@ -80,7 +80,7 @@ int __init of_scan_flat_dt(int (*it)(unsigned long

node,

drivers/of/fdt.c void *__init of_get_flat_dt_prop(unsigned long

Quoted 18 lines
drivers/of/fdt.c +2 -2
               }
               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,

drivers/of/fdt.c void *__init of_get_flat_dt_prop(unsigned long

Quoted 9 lines
drivers/of/fdt.c +1 -1
               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,

drivers/of/fdt.c static void *__init unflatten_dt_alloc(unsigned

Quoted 9 lines
drivers/of/fdt.c +1 -1
                       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,

drivers/of/fdt.c unsigned long __init unflatten_dt_node(unsigned

Quoted 9 lines
drivers/of/fdt.c +1 -1
  {
       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,

drivers/of/fdt.c unsigned long __init unflatten_dt_node(unsigned long mem,

Quoted 7 lines
drivers/of/fdt.c +1 -1
       *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

drivers/of/fdt.c unsigned long __init unflatten_dt_node(unsigned · line 226

Quoted 1 line
drivers/of/fdt.c +0 -0
        * path. we accumulate the full path size using "fpsize", we'll

rebuild

drivers/of/fdt.c unsigned long __init unflatten_dt_node(unsigned

Quoted 1 line
drivers/of/fdt.c +0 -0
@@ -299,7 +299,7 @@ unsigned long __init unflatten_dt_node(unsigned

long mem,

drivers/of/fdt.c unsigned long __init unflatten_dt_node(unsigned

Quoted 9 lines
drivers/of/fdt.c +1 -1
               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,

Quoted 9 lines
drivers/of/fdt.c +1 -1
                       *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
Quoted 7 lines
Quoted 4 lines

_______________________________________________
devicetree-discuss mailing list devicetree-discuss-uLR06cmDAlY/[email protected]
https://lists.ozlabs.org/listinfo/devicetree-discuss

This email and any attachments are intended for the sole use of the named recipient(s) and

contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.

Quoted 3 lines
Quoted 3 lines

--
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.

#4 lore raw

Re: [PATCH] of/flattree: Use common ALIGN() macro instead of archspecific _ALIGN

Quoted 17 lines · Stephen Neuendorffer
Quoted 17 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Grant Likely
Sent: Friday, June 25, 2010 4:16 PM
To: Stephen Neuendorffer
Cc: [email protected]; [email protected]; [email protected]; devicetree- [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH] of/flattree: Use common ALIGN() macro instead of archspecific _ALIGN

Quoted 5 lines · Stephen Neuendorffer

Grant,

I need this for the PCI project.  I also have a couple of other generalizations of the drivers/of code
to get it to run after boot time in an X86 system...

Quoted 8 lines
Quoted 4 lines

Send me your patches!  :-)  Get them to me soon and I'll queue them up for the next merge window.

g.

Dangit, I just got the code compiling, and now I find out that X86 doesn't support out_be32()...  :) You'd think that somewhere somebody might have realized that all the duplicated driver macros that do that are a bad idea...

:-)

I think iowrite32be should be cross-arch safe. in_*, out_* was mostly a powerpc/sparc thing.

g.

#5 lore raw

RE: [PATCH] of/flattree: Use common ALIGN() macro instead of archspecific _ALIGN

Quoted 39 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Grant Likely
Sent: Friday, June 25, 2010 4:34 PM
To: Stephen Neuendorffer
Cc: [email protected]; [email protected]; [email protected]; devicetree- [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH] of/flattree: Use common ALIGN() macro instead of archspecific _ALIGN

Quoted 17 lines · Stephen Neuendorffer
Quoted 17 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Grant Likely
Sent: Friday, June 25, 2010 4:16 PM
To: Stephen Neuendorffer
Cc: [email protected]; [email protected]; [email protected]; devicetree- [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH] of/flattree: Use common ALIGN() macro instead of archspecific _ALIGN

Quoted 5 lines · Stephen Neuendorffer

Grant,

I need this for the PCI project.  I also have a couple of other generalizations of the drivers/of code
to get it to run after boot time in an X86 system...

Quoted 8 lines
Quoted 4 lines

Send me your patches!  :-)  Get them to me soon and I'll queue them up for the next merge window.

g.

Dangit, I just got the code compiling, and now I find out that X86 doesn't support out_be32()...  :) You'd think that somewhere somebody might have realized that all the duplicated driver macros that do that are a bad idea...

Quoted 6 lines

:-)

I think iowrite32be should be cross-arch safe. in_*, out_* was mostly a powerpc/sparc thing.

g.

See.. I told you it was a good idea to have that abstracted.. :)

S

This email and any attachments are intended for the sole use of the named recipient(s) and contain(s) confidential information that may be proprietary, privileged or copyrighted under applicable law. If you are not the intended recipient, do not read, copy, or forward this email message or any attachments. Delete this email message and any attachments immediately.

#6 lore raw

Re: [PATCH] of/flattree: Use common ALIGN() macro instead of archspecific _ALIGN

Quoted 39 lines · Stephen Neuendorffer
Quoted 39 lines

-----Original Message-----
From: glikely-s3s/[email protected] [mailto:glikely-s3s/[email protected]] On Behalf Of Grant Likely
Sent: Friday, June 25, 2010 4:34 PM
To: Stephen Neuendorffer
Cc: [email protected]; [email protected]; [email protected]; devicetree- discuss-uLR06cmDAlY/[email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH] of/flattree: Use common ALIGN() macro instead of archspecific _ALIGN

Quoted 25 lines · Stephen Neuendorffer
Quoted 13 lines

-----Original Message-----
From: glikely-s3s/[email protected] [mailto:glikely-s3s/[email protected]] On Behalf Of Grant Likely
Sent: Friday, June 25, 2010 4:16 PM
To: Stephen Neuendorffer
Cc: [email protected]; [email protected]; [email protected]; devicetree- discuss-uLR06cmDAlY/[email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH] of/flattree: Use common ALIGN() macro instead of archspecific _ALIGN

Quoted 2 lines · Stephen Neuendorffer

Grant,

Quoted 8 lines
Quoted 3 lines

I need this for the PCI project.  I also have a couple of other generalizations of the drivers/of code
to get it to run after boot time in an X86 system...

Send me your patches!  :-)  Get them to me soon and I'll queue them up for the next merge window.

g.

Dangit, I just got the code compiling, and now I find out that X86 doesn't support out_be32()...  :) You'd think that somewhere somebody might have realized that all the duplicated driver macros that do that are a bad idea...

Quoted 8 lines
Quoted 6 lines

:-)

I think iowrite32be should be cross-arch safe.  in_*, out_* was mostly a powerpc/sparc thing.

g.

See.. I told you it was a good idea to have that abstracted.. :)

'course the real problem is not the access macros, but rather the fact that sometime the xilinx registers are wired up as big-endian, and sometimes as little-endian.

g.