Skip to contentSkip to conversation

PowerPC 44x: use machine_device_initcall() instead of device_initcall() for warp_nand

PATCH In review Valentine Barshak 3 participants 3 messages Apr 4, 2008 – Apr 8, 2008

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

PATCH 1/1 PowerPC 44x: use machine_device_initcall() instead of device_initcall() for warp_nand

With a multiplatform kernel, once built we always have warp_setup_nand_flash() called and NDFC probed, no matter what machine we actually run on. This potentially can cause problems (such as kernel crash), since NDFC is probed at a warp-predefined address. Using machine_device_initcall() NAND devices are registered if we run on a warp only.

---
 arch/powerpc/platforms/44x/warp-nand.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletion(-)
arch/powerpc/platforms/44x/warp-nand.c +2 -1
@@ -11,6 +11,7 @@
 #include <linux/mtd/partitions.h>
 #include <linux/mtd/nand.h>
 #include <linux/mtd/ndfc.h>
+#include <asm/machdep.h>
 
 #ifdef CONFIG_MTD_NAND_NDFC
 
@@ -100,6 +101,6 @@ static int warp_setup_nand_flash(void)
 
 	return 0;
 }
-device_initcall(warp_setup_nand_flash);
+machine_device_initcall(warp, warp_setup_nand_flash);
 
 #endif
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Valentine Barshak

With a multiplatform kernel, once built we always have warp_setup_nand_flash() called
and NDFC probed, no matter what machine we actually run on. This potentially can cause problems (such as kernel crash), since NDFC is probed at a warp-predefined address. Using machine_device_initcall() NAND devices are registered if we run on a warp only.

Quoted 27 lines

---

  arch/powerpc/platforms/44x/warp-nand.c |    3 ++-
  1 files changed, 2 insertions(+), 1 deletion(-)

--- linux-2.6.orig/arch/powerpc/platforms/44x/warp-nand.c 2008-03-06 14:39:46.000000000 +0300
+++ linux-2.6.bld/arch/powerpc/platforms/44x/warp-nand.c 2008-04-04 22:03:36.000000000 +0400
@@ -11,6 +11,7 @@
#include <linux/mtd/partitions.h>
#include <linux/mtd/nand.h>
#include <linux/mtd/ndfc.h>
+#include <asm/machdep.h>

  #ifdef CONFIG_MTD_NAND_NDFC

@@ -100,6 +101,6 @@ static int warp_setup_nand_flash(void)

        return 0;

}
-device_initcall(warp_setup_nand_flash); +machine_device_initcall(warp, warp_setup_nand_flash);

#endif
_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://ozlabs.org/mailman/listinfo/linuxppc-dev

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

Re: [PATCH] PowerPC 44x: use machine_device_initcall() instead ofdevice_initcall() for warp_nand

In reply to Valentine Barshak
Quoted 6 lines · On Fri, 4 Apr 2008 22:24:37 +0400 "Valentine Barshak" <[email protected]>…

With a multiplatform kernel, once built we always have warp_setup_nand_flash() called and NDFC probed, no matter what machine we actually run on. This potentially can cause problems (such as kernel crash), since NDFC is probed at a warp-predefined address. Using machine_device_initcall() NAND devices are registered if we run on a warp only.

Thanks for catching that. I have gotten *way* behind on my email and am only reading this now.

Cheers,
Sean