mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 0/4] exitcall infrastructure
@ 2015-07-06  7:36 Herve Codina
  2015-07-06  7:36 ` [PATCH 1/4] exitcall: Add " Herve Codina
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Herve Codina @ 2015-07-06  7:36 UTC (permalink / raw)
  To: barebox; +Cc: Herve Codina

This series adds shutdown hooks mechanism.
The mechanism chosen is based on initcall infrastructure and so the name
given is exitcall.
The first patch implement the exitcall infrastructure.
The other patches move old shutdown functions to this new infrastructure.

Herve Codina (4):
  exitcall: Add exitcall infrastructure
  exitcall: move device_shutdown to exitcall infrastructure
  exitcall: move arch_shutdown to exitcall infrastructure
  exitcall: move board_shutdown to exitcall infrastructure

 arch/arm/boards/animeo_ip/init.c          |    2 +-
 arch/arm/cpu/cpu.c                        |    3 ++-
 arch/arm/include/asm/common.h             |    2 --
 arch/arm/lib/barebox.lds.S                |    4 ++++
 arch/blackfin/boards/ipe337/barebox.lds.S |    4 ++++
 arch/blackfin/include/asm/common.h        |    6 ++----
 arch/blackfin/lib/board.c                 |    7 ++++++-
 arch/efi/lib/elf_ia32_efi.lds.S           |    4 ++++
 arch/efi/lib/elf_x86_64_efi.lds.S         |    4 ++++
 arch/mips/lib/barebox.lds.S               |    4 ++++
 arch/nios2/cpu/barebox.lds.S              |    4 ++++
 arch/nios2/lib/board.c                    |    3 ---
 arch/openrisc/cpu/barebox.lds.S           |    4 ++++
 arch/openrisc/lib/board.c                 |    3 ---
 arch/ppc/boards/pcm030/barebox.lds.S      |    5 +++++
 arch/ppc/mach-mpc85xx/barebox.lds.S       |    5 +++++
 arch/sandbox/board/barebox.lds.S          |    5 +++++
 arch/x86/lib/barebox.lds.S                |    9 ++++++++-
 common/startup.c                          |   18 ++++++++++--------
 drivers/base/driver.c                     |    3 ++-
 include/asm-generic/barebox.lds.h         |    9 +++++++++
 include/common.h                          |    3 ---
 include/driver.h                          |    5 -----
 include/init.h                            |   15 +++++++++++++++
 24 files changed, 98 insertions(+), 33 deletions(-)

-- 
1.7.9.5


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/4] exitcall: Add exitcall infrastructure
  2015-07-06  7:36 [PATCH 0/4] exitcall infrastructure Herve Codina
@ 2015-07-06  7:36 ` Herve Codina
  2015-07-06  7:36 ` [PATCH 2/4] exitcall: move device_shutdown to " Herve Codina
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Herve Codina @ 2015-07-06  7:36 UTC (permalink / raw)
  To: barebox; +Cc: Herve Codina

exitcall infrastructure is based on initcall infrastructure.
It allows to have and use exit call hooks on barebox shutdown.

Signed-off-by: Herve Codina <Herve.CODINA@celad.com>
---
 arch/arm/lib/barebox.lds.S                |    4 ++++
 arch/blackfin/boards/ipe337/barebox.lds.S |    4 ++++
 arch/efi/lib/elf_ia32_efi.lds.S           |    4 ++++
 arch/efi/lib/elf_x86_64_efi.lds.S         |    4 ++++
 arch/mips/lib/barebox.lds.S               |    4 ++++
 arch/nios2/cpu/barebox.lds.S              |    4 ++++
 arch/openrisc/cpu/barebox.lds.S           |    4 ++++
 arch/ppc/boards/pcm030/barebox.lds.S      |    5 +++++
 arch/ppc/mach-mpc85xx/barebox.lds.S       |    5 +++++
 arch/sandbox/board/barebox.lds.S          |    5 +++++
 arch/x86/lib/barebox.lds.S                |    9 ++++++++-
 common/startup.c                          |   11 +++++++++++
 include/asm-generic/barebox.lds.h         |    9 +++++++++
 include/init.h                            |   15 +++++++++++++++
 14 files changed, 86 insertions(+), 1 deletion(-)

diff --git a/arch/arm/lib/barebox.lds.S b/arch/arm/lib/barebox.lds.S
index bb0354a..fa5c91e 100644
--- a/arch/arm/lib/barebox.lds.S
+++ b/arch/arm/lib/barebox.lds.S
@@ -89,6 +89,10 @@ SECTIONS
 	__barebox_initcalls_start = .;
 	.barebox_initcalls : { INITCALLS }
 	__barebox_initcalls_end = .;
+	
+	__barebox_exitcalls_start = .;
+	.barebox_exitcalls : { EXITCALLS }
+	__barebox_exitcalls_end = .;
 
 	__usymtab_start = .;
 	__usymtab : { BAREBOX_SYMS }
diff --git a/arch/blackfin/boards/ipe337/barebox.lds.S b/arch/blackfin/boards/ipe337/barebox.lds.S
index 9bb7cc4..89de339 100644
--- a/arch/blackfin/boards/ipe337/barebox.lds.S
+++ b/arch/blackfin/boards/ipe337/barebox.lds.S
@@ -75,6 +75,10 @@ SECTIONS
 	___barebox_initcalls_start = .;
 	.barebox_initcalls : { INITCALLS }
 	___barebox_initcalls_end = .;
+	
+	___barebox_exitcalls_start = .;
+	.barebox_exitcalls : { EXITCALLS }
+	___barebox_exitcalls_end = .;
 
 	___usymtab_start = .;
 	__usymtab : { BAREBOX_SYMS }
diff --git a/arch/efi/lib/elf_ia32_efi.lds.S b/arch/efi/lib/elf_ia32_efi.lds.S
index a5f6287..69f43f5 100644
--- a/arch/efi/lib/elf_ia32_efi.lds.S
+++ b/arch/efi/lib/elf_ia32_efi.lds.S
@@ -56,6 +56,10 @@ SECTIONS
 	__barebox_initcalls : { INITCALLS }
 	__barebox_initcalls_end = .;
 
+	__barebox_exitcalls_start = .;
+	__barebox_exitcalls : { EXITCALLS }
+	__barebox_exitcalls_end = .;
+
 	. = ALIGN(64);
 	__barebox_magicvar_start = .;
 	.barebox_magicvar : { BAREBOX_MAGICVARS }
diff --git a/arch/efi/lib/elf_x86_64_efi.lds.S b/arch/efi/lib/elf_x86_64_efi.lds.S
index d48432d..9aa4e8d 100644
--- a/arch/efi/lib/elf_x86_64_efi.lds.S
+++ b/arch/efi/lib/elf_x86_64_efi.lds.S
@@ -58,6 +58,10 @@ SECTIONS
 	__barebox_initcalls : { INITCALLS }
 	__barebox_initcalls_end = .;
 
+	__barebox_exitcalls_start = .;
+	__barebox_exitcalls : { EXITCALLS }
+	__barebox_exitcalls_end = .;
+
 	. = ALIGN(64);
 	__barebox_magicvar_start = .;
 	.barebox_magicvar : { BAREBOX_MAGICVARS }
diff --git a/arch/mips/lib/barebox.lds.S b/arch/mips/lib/barebox.lds.S
index c690e71..fdc0f1c 100644
--- a/arch/mips/lib/barebox.lds.S
+++ b/arch/mips/lib/barebox.lds.S
@@ -66,6 +66,10 @@ SECTIONS
 	__barebox_initcalls_start = .;
 	.barebox_initcalls : { INITCALLS }
 	__barebox_initcalls_end = .;
+	
+	__barebox_exitcalls_start = .;
+	.barebox_exitcalls : { EXITCALLS }
+	__barebox_exitcalls_end = .;
 
 	__usymtab_start = .;
 	__usymtab : { BAREBOX_SYMS }
diff --git a/arch/nios2/cpu/barebox.lds.S b/arch/nios2/cpu/barebox.lds.S
index 943c507..3d24130 100644
--- a/arch/nios2/cpu/barebox.lds.S
+++ b/arch/nios2/cpu/barebox.lds.S
@@ -62,6 +62,10 @@ SECTIONS
 	__barebox_initcalls_start = .;
 	.barebox_initcalls : { INITCALLS }
 	__barebox_initcalls_end = .;
+	
+	__barebox_exitcalls_start = .;
+	.barebox_exitcalls : { EXITCALLS }
+	__barebox_exitcalls_end = .;
 
 	___usymtab_start = .;
 	__usymtab : { BAREBOX_SYMS }
diff --git a/arch/openrisc/cpu/barebox.lds.S b/arch/openrisc/cpu/barebox.lds.S
index 9c353f3..f8dae10 100644
--- a/arch/openrisc/cpu/barebox.lds.S
+++ b/arch/openrisc/cpu/barebox.lds.S
@@ -64,6 +64,10 @@ SECTIONS
 	__barebox_initcalls_start = .;
 	.barebox_initcalls : { INITCALLS } > ram
 	__barebox_initcalls_end = .;
+	
+	__barebox_exitcalls_start = .;
+	.barebox_exitcalls : { EXITCALLS } > ram
+	__barebox_exitcalls_end = .;
 
 	___usymtab_start = .;
 	__usymtab : { BAREBOX_SYMS } > ram
diff --git a/arch/ppc/boards/pcm030/barebox.lds.S b/arch/ppc/boards/pcm030/barebox.lds.S
index 1332ad1..dc71464 100644
--- a/arch/ppc/boards/pcm030/barebox.lds.S
+++ b/arch/ppc/boards/pcm030/barebox.lds.S
@@ -111,6 +111,11 @@ SECTIONS
   .barebox_initcalls : { INITCALLS }
   __barebox_initcalls_end = .;
   __initcall_entries = (__barebox_initcalls_end - __barebox_initcalls_start) >> 2;
+  
+  __barebox_exitcalls_start = .;
+  .barebox_exitcalls : { EXITCALLS }
+  __barebox_exitcalls_end = .;
+  __exitcall_entries = (__barebox_exitcalls_end - __barebox_exitcalls_start) >> 2;
 
   __usymtab_start = .;
   __usymtab : { BAREBOX_SYMS }
diff --git a/arch/ppc/mach-mpc85xx/barebox.lds.S b/arch/ppc/mach-mpc85xx/barebox.lds.S
index 87ab7ac..f0894a1 100644
--- a/arch/ppc/mach-mpc85xx/barebox.lds.S
+++ b/arch/ppc/mach-mpc85xx/barebox.lds.S
@@ -108,6 +108,11 @@ SECTIONS
   .barebox_initcalls : { INITCALLS }
   __barebox_initcalls_end = .;
   __initcall_entries = (__barebox_initcalls_end - __barebox_initcalls_start)>>2;
+  
+  __barebox_exitcalls_start = .;
+  .barebox_exitcalls : { EXITCALLS }
+  __barebox_exitcalls_end = .;
+  __exitcall_entries = (__barebox_exitcalls_end - __barebox_exitcalls_start)>>2;
 
   __usymtab_start = .;
   __usymtab : { BAREBOX_SYMS }
diff --git a/arch/sandbox/board/barebox.lds.S b/arch/sandbox/board/barebox.lds.S
index db5b7de..6eab4b7 100644
--- a/arch/sandbox/board/barebox.lds.S
+++ b/arch/sandbox/board/barebox.lds.S
@@ -6,6 +6,11 @@ SECTIONS
 	__barebox_initcalls_start = .;
 	__barebox_initcalls : { INITCALLS }
 	__barebox_initcalls_end = .;
+	
+	. = ALIGN(64);
+	__barebox_exitcalls_start = .;
+	__barebox_exitcalls : { EXITCALLS }
+	__barebox_exitcalls_end = .;
 
 	. = ALIGN(64);
 	__barebox_magicvar_start = .;
diff --git a/arch/x86/lib/barebox.lds.S b/arch/x86/lib/barebox.lds.S
index 6cf6b10..bf9ea78 100644
--- a/arch/x86/lib/barebox.lds.S
+++ b/arch/x86/lib/barebox.lds.S
@@ -184,8 +184,15 @@ SECTIONS
 		__barebox_initcalls_end = .;
 		. = ALIGN(4);
 	} > barebox
+	
+	.barebox_exitcalls : AT ( LOADADDR(.barebox_initcalls) + SIZEOF (.barebox_initcalls) ) {
+		__barebox_exitcalls_start = .;
+		EXITCALLS
+		__barebox_exitcalls_end = .;
+		. = ALIGN(4);
+	} > barebox
 
-	.__usymtab : AT ( LOADADDR(.barebox_initcalls) + SIZEOF (.barebox_initcalls) ) {
+	.__usymtab : AT ( LOADADDR(.barebox_exitcalls) + SIZEOF (.barebox_exitcalls) ) {
 		__usymtab_start = .;
 		BAREBOX_SYMS
 		__usymtab_end = .;
diff --git a/common/startup.c b/common/startup.c
index 6178fc5..676e435 100644
--- a/common/startup.c
+++ b/common/startup.c
@@ -44,6 +44,9 @@
 
 extern initcall_t __barebox_initcalls_start[], __barebox_early_initcalls_end[],
 		  __barebox_initcalls_end[];
+		  
+extern exitcall_t __barebox_exitcalls_start[], __barebox_exitcalls_end[];
+
 
 #if defined CONFIG_FS_RAMFS && defined CONFIG_FS_DEVFS
 static int mount_root(void)
@@ -140,6 +143,14 @@ void (*board_shutdown)(void);
  */
 void shutdown_barebox(void)
 {
+	exitcall_t *exitcall;
+	
+	for (exitcall = __barebox_exitcalls_start;
+			exitcall < __barebox_exitcalls_end; exitcall++) {
+		pr_debug("exitcall-> %pS\n", *exitcall);
+		(*exitcall)();
+	}
+	
 	devices_shutdown();
 #ifdef ARCH_SHUTDOWN
 	arch_shutdown();
diff --git a/include/asm-generic/barebox.lds.h b/include/asm-generic/barebox.lds.h
index 00d6eca..6b9833b 100644
--- a/include/asm-generic/barebox.lds.h
+++ b/include/asm-generic/barebox.lds.h
@@ -38,6 +38,15 @@
 	KEEP(*(.initcall.13))			\
 	KEEP(*(.initcall.14))
 
+#define EXITCALLS			\
+	KEEP(*(.exitcall.0))			\
+	KEEP(*(.exitcall.1))			\
+	KEEP(*(.exitcall.2))			\
+	KEEP(*(.exitcall.3))			\
+	KEEP(*(.exitcall.4))			\
+	KEEP(*(.exitcall.5))			\
+	KEEP(*(.exitcall.6))
+	
 #define BAREBOX_CMDS	KEEP(*(SORT_BY_NAME(.barebox_cmd*)))
 
 #define BAREBOX_SYMS	KEEP(*(__usymtab))
diff --git a/include/init.h b/include/init.h
index f619c95..527d49a 100644
--- a/include/init.h
+++ b/include/init.h
@@ -7,17 +7,24 @@
 #define __init
 #define __initdata
 #define __initconst
+#define __exit
+#define __exitdata
 
 /* For assembly routines */
 #define __BARE_INIT	.section ".text_bare_init.text","ax"
 
 #ifndef __ASSEMBLY__
 typedef int (*initcall_t)(void);
+typedef void (*exitcall_t)(void);
 
 #define __define_initcall(level,fn,id) \
 	static initcall_t __initcall_##fn##id __attribute__((__used__)) \
 	__attribute__((__section__(".initcall." level))) = fn
 
+#define __define_exitcall(level,fn,id) \
+	static exitcall_t __exitcall_##fn##id __attribute__((__used__)) \
+	__attribute__((__section__(".exitcall." level))) = fn
+
 
 /*
  * A "pure" initcall has no dependencies on anything else, and purely
@@ -42,6 +49,14 @@ typedef int (*initcall_t)(void);
 #define environment_initcall(fn)	__define_initcall("13",fn,13)
 #define postenvironment_initcall(fn)	__define_initcall("14",fn,14)
 
+#define early_exitcall(fn)		__define_exitcall("0",fn,0)
+#define predevshutdown_exitcall(fn)	__define_exitcall("1",fn,1)
+#define devshutdown_exitcall(fn)	__define_exitcall("2",fn,2)
+#define postdevshutdown_exitcall(fn)	__define_exitcall("3",fn,3)
+#define prearchshutdown_exitcall(fn)	__define_exitcall("4",fn,4)
+#define archshutdown_exitcall(fn)	__define_exitcall("5",fn,5)
+#define postarchshutdown_exitcall(fn)	__define_exitcall("6",fn,6)
+
 /* section for code used very early when
  * - we're not running from where we linked at
  * - bss not cleared
-- 
1.7.9.5


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 2/4] exitcall: move device_shutdown to exitcall infrastructure
  2015-07-06  7:36 [PATCH 0/4] exitcall infrastructure Herve Codina
  2015-07-06  7:36 ` [PATCH 1/4] exitcall: Add " Herve Codina
@ 2015-07-06  7:36 ` Herve Codina
  2015-07-06  7:36 ` [PATCH 3/4] exitcall: move arch_shutdown " Herve Codina
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Herve Codina @ 2015-07-06  7:36 UTC (permalink / raw)
  To: barebox; +Cc: Herve Codina

Signed-off-by: Herve Codina <Herve.CODINA@celad.com>
---
 common/startup.c      |    1 -
 drivers/base/driver.c |    3 ++-
 include/driver.h      |    5 -----
 3 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/common/startup.c b/common/startup.c
index 676e435..e9ab248 100644
--- a/common/startup.c
+++ b/common/startup.c
@@ -151,7 +151,6 @@ void shutdown_barebox(void)
 		(*exitcall)();
 	}
 	
-	devices_shutdown();
 #ifdef ARCH_SHUTDOWN
 	arch_shutdown();
 #endif
diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index 338bea1..943deb4 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -459,7 +459,7 @@ const char *dev_id(const struct device_d *dev)
 	return buf;
 }
 
-void devices_shutdown(void)
+static void devices_shutdown(void)
 {
 	struct device_d *dev;
 
@@ -468,6 +468,7 @@ void devices_shutdown(void)
 			dev->bus->remove(dev);
 	}
 }
+devshutdown_exitcall(devices_shutdown);
 
 int dev_get_drvdata(struct device_d *dev, const void **data)
 {
diff --git a/include/driver.h b/include/driver.h
index d0cdcc9..d862ed0 100644
--- a/include/driver.h
+++ b/include/driver.h
@@ -339,11 +339,6 @@ int mem_memmap(struct cdev *cdev, void **map, int flags);
 /* Use this if you have nothing to do in your drivers probe function */
 int dummy_probe(struct device_d *);
 
-/* Iterate over all activated devices (i.e. the ones with drivers and shut
- * them down.
- */
-void devices_shutdown(void);
-
 int generic_memmap_ro(struct cdev *dev, void **map, int flags);
 int generic_memmap_rw(struct cdev *dev, void **map, int flags);
 
-- 
1.7.9.5


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 3/4] exitcall: move arch_shutdown to exitcall infrastructure
  2015-07-06  7:36 [PATCH 0/4] exitcall infrastructure Herve Codina
  2015-07-06  7:36 ` [PATCH 1/4] exitcall: Add " Herve Codina
  2015-07-06  7:36 ` [PATCH 2/4] exitcall: move device_shutdown to " Herve Codina
@ 2015-07-06  7:36 ` Herve Codina
  2015-07-06  7:36 ` [PATCH 4/4] exitcall: move board_shutdown " Herve Codina
  2015-07-06 11:52 ` [PATCH 0/4] " Sascha Hauer
  4 siblings, 0 replies; 7+ messages in thread
From: Herve Codina @ 2015-07-06  7:36 UTC (permalink / raw)
  To: barebox; +Cc: Herve Codina

Signed-off-by: Herve Codina <Herve.CODINA@celad.com>
---
 arch/arm/cpu/cpu.c                 |    3 ++-
 arch/arm/include/asm/common.h      |    2 --
 arch/blackfin/include/asm/common.h |    6 ++----
 arch/blackfin/lib/board.c          |    7 ++++++-
 arch/nios2/lib/board.c             |    3 ---
 arch/openrisc/lib/board.c          |    3 ---
 common/startup.c                   |    3 ---
 include/common.h                   |    2 --
 8 files changed, 10 insertions(+), 19 deletions(-)

diff --git a/arch/arm/cpu/cpu.c b/arch/arm/cpu/cpu.c
index badd676..5e70802 100644
--- a/arch/arm/cpu/cpu.c
+++ b/arch/arm/cpu/cpu.c
@@ -93,7 +93,7 @@ void mmu_disable(void)
  * This function is called by shutdown_barebox to get a clean
  * memory/cache state.
  */
-void arch_shutdown(void)
+static void arch_shutdown(void)
 {
 	uint32_t r;
 
@@ -108,6 +108,7 @@ void arch_shutdown(void)
 	r |= PSR_I_BIT;
 	__asm__ __volatile__("msr cpsr, %0" : : "r"(r));
 }
+archshutdown_exitcall(arch_shutdown);
 
 extern unsigned long arm_stack_top;
 
diff --git a/arch/arm/include/asm/common.h b/arch/arm/include/asm/common.h
index 9ff3b19..07ae619 100644
--- a/arch/arm/include/asm/common.h
+++ b/arch/arm/include/asm/common.h
@@ -1,8 +1,6 @@
 #ifndef __ASM_ARM_COMMON_H
 #define __ASM_ARM_COMMON_H
 
-#define ARCH_SHUTDOWN
-
 static inline unsigned long get_pc(void)
 {
 	unsigned long pc;
diff --git a/arch/blackfin/include/asm/common.h b/arch/blackfin/include/asm/common.h
index fa58e37..5760fb9 100644
--- a/arch/blackfin/include/asm/common.h
+++ b/arch/blackfin/include/asm/common.h
@@ -1,5 +1,3 @@
 
-/* We have to disable instruction cache before
- * executing an external program
- */
-#define ARCH_SHUTDOWN
+/* nothing special */
+
diff --git a/arch/blackfin/lib/board.c b/arch/blackfin/lib/board.c
index 88ad618..4731887 100644
--- a/arch/blackfin/lib/board.c
+++ b/arch/blackfin/lib/board.c
@@ -38,7 +38,12 @@ void __noreturn blackfin_start_barebox(void)
 	start_barebox();
 }
 
-void arch_shutdown(void)
+/* We have to disable instruction cache before
+ * executing an external program
+ */
+static void arch_shutdown(void)
 {
 	icache_disable();
 }
+archshutdown_exitcall(arch_shutdown);
+
diff --git a/arch/nios2/lib/board.c b/arch/nios2/lib/board.c
index 7c4dc76..c04dda9 100644
--- a/arch/nios2/lib/board.c
+++ b/arch/nios2/lib/board.c
@@ -31,6 +31,3 @@ void __noreturn nios_start_barebox(void)
 	start_barebox();
 }
 
-void arch_shutdown(void)
-{
-}
diff --git a/arch/openrisc/lib/board.c b/arch/openrisc/lib/board.c
index 98033b4..ff527e2 100644
--- a/arch/openrisc/lib/board.c
+++ b/arch/openrisc/lib/board.c
@@ -30,6 +30,3 @@ void __noreturn openrisc_start_barebox(void)
 	start_barebox();
 }
 
-void arch_shutdown(void)
-{
-}
diff --git a/common/startup.c b/common/startup.c
index e9ab248..4ed390c 100644
--- a/common/startup.c
+++ b/common/startup.c
@@ -151,9 +151,6 @@ void shutdown_barebox(void)
 		(*exitcall)();
 	}
 	
-#ifdef ARCH_SHUTDOWN
-	arch_shutdown();
-#endif
 	if (board_shutdown)
 		board_shutdown();
 }
diff --git a/include/common.h b/include/common.h
index eef371c..6766c02 100644
--- a/include/common.h
+++ b/include/common.h
@@ -124,8 +124,6 @@ extern void (*board_shutdown)(void);
  */
 extern void (*do_execute)(void *func, int argc, char *argv[]);
 
-void arch_shutdown(void);
-
 int run_shell(void);
 
 #ifdef CONFIG_SHELL_HUSH
-- 
1.7.9.5


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 4/4] exitcall: move board_shutdown to exitcall infrastructure
  2015-07-06  7:36 [PATCH 0/4] exitcall infrastructure Herve Codina
                   ` (2 preceding siblings ...)
  2015-07-06  7:36 ` [PATCH 3/4] exitcall: move arch_shutdown " Herve Codina
@ 2015-07-06  7:36 ` Herve Codina
  2015-07-06 11:52 ` [PATCH 0/4] " Sascha Hauer
  4 siblings, 0 replies; 7+ messages in thread
From: Herve Codina @ 2015-07-06  7:36 UTC (permalink / raw)
  To: barebox; +Cc: Herve Codina

Signed-off-by: Herve Codina <Herve.CODINA@celad.com>
---
 arch/arm/boards/animeo_ip/init.c |    2 +-
 common/startup.c                 |    5 -----
 include/common.h                 |    1 -
 3 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/arch/arm/boards/animeo_ip/init.c b/arch/arm/boards/animeo_ip/init.c
index 0fda013..2069ab3 100644
--- a/arch/arm/boards/animeo_ip/init.c
+++ b/arch/arm/boards/animeo_ip/init.c
@@ -346,6 +346,7 @@ static void animeo_ip_shutdown(void)
 	animeo_ip_shutdown_uart(IOMEM(AT91SAM9260_BASE_US0));
 	animeo_ip_shutdown_uart(IOMEM(AT91SAM9260_BASE_US1));
 }
+postdevshutdown_exitcall(animeo_ip_shutdown);
 
 static int animeo_ip_console_init(void)
 {
@@ -353,7 +354,6 @@ static int animeo_ip_console_init(void)
 
 	usart0 = at91_register_uart(1, ATMEL_UART_RTS);
 	usart1 = at91_register_uart(2, ATMEL_UART_RTS);
-	board_shutdown = animeo_ip_shutdown;
 
 	barebox_set_model("Somfy Animeo IP");
 	barebox_set_hostname("animeoip");
diff --git a/common/startup.c b/common/startup.c
index 4ed390c..dc12415 100644
--- a/common/startup.c
+++ b/common/startup.c
@@ -135,8 +135,6 @@ void __noreturn hang (void)
 	for (;;);
 }
 
-void (*board_shutdown)(void);
-
 /* Everything needed to cleanly shutdown barebox.
  * Should be called before starting an OS to get
  * the devices into a clean state
@@ -150,7 +148,4 @@ void shutdown_barebox(void)
 		pr_debug("exitcall-> %pS\n", *exitcall);
 		(*exitcall)();
 	}
-	
-	if (board_shutdown)
-		board_shutdown();
 }
diff --git a/include/common.h b/include/common.h
index 6766c02..6b9dd4d 100644
--- a/include/common.h
+++ b/include/common.h
@@ -116,7 +116,6 @@ extern int (*barebox_main)(void);
 
 void __noreturn start_barebox(void);
 void shutdown_barebox(void);
-extern void (*board_shutdown)(void);
 
 /*
  * architectures which have special calling conventions for
-- 
1.7.9.5


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/4] exitcall infrastructure
  2015-07-06  7:36 [PATCH 0/4] exitcall infrastructure Herve Codina
                   ` (3 preceding siblings ...)
  2015-07-06  7:36 ` [PATCH 4/4] exitcall: move board_shutdown " Herve Codina
@ 2015-07-06 11:52 ` Sascha Hauer
  2015-07-06 12:19   ` Herve Codina
  4 siblings, 1 reply; 7+ messages in thread
From: Sascha Hauer @ 2015-07-06 11:52 UTC (permalink / raw)
  To: Herve Codina; +Cc: barebox

On Mon, Jul 06, 2015 at 09:36:42AM +0200, Herve Codina wrote:
> This series adds shutdown hooks mechanism.
> The mechanism chosen is based on initcall infrastructure and so the name
> given is exitcall.
> The first patch implement the exitcall infrastructure.
> The other patches move old shutdown functions to this new infrastructure.
> 
> Herve Codina (4):
>   exitcall: Add exitcall infrastructure
>   exitcall: move device_shutdown to exitcall infrastructure
>   exitcall: move arch_shutdown to exitcall infrastructure
>   exitcall: move board_shutdown to exitcall infrastructure

Applied, thanks. Please watch out for trailing whitespaces next time. I
removed several while applying.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/4] exitcall infrastructure
  2015-07-06 11:52 ` [PATCH 0/4] " Sascha Hauer
@ 2015-07-06 12:19   ` Herve Codina
  0 siblings, 0 replies; 7+ messages in thread
From: Herve Codina @ 2015-07-06 12:19 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox



Le 06/07/2015 13:52, Sascha Hauer a écrit :
> On Mon, Jul 06, 2015 at 09:36:42AM +0200, Herve Codina wrote:
>> This series adds shutdown hooks mechanism.
>> The mechanism chosen is based on initcall infrastructure and so the name
>> given is exitcall.
>> The first patch implement the exitcall infrastructure.
>> The other patches move old shutdown functions to this new infrastructure.
>>
>> Herve Codina (4):
>>   exitcall: Add exitcall infrastructure
>>   exitcall: move device_shutdown to exitcall infrastructure
>>   exitcall: move arch_shutdown to exitcall infrastructure
>>   exitcall: move board_shutdown to exitcall infrastructure
> 
> Applied, thanks. Please watch out for trailing whitespaces next time. I
> removed several while applying.
Oups, i am sorry for this additional work.
I will be more carefull about whitespaces.

Thanks,
Herve
> 
> Sascha
> 

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-07-06 12:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-06  7:36 [PATCH 0/4] exitcall infrastructure Herve Codina
2015-07-06  7:36 ` [PATCH 1/4] exitcall: Add " Herve Codina
2015-07-06  7:36 ` [PATCH 2/4] exitcall: move device_shutdown to " Herve Codina
2015-07-06  7:36 ` [PATCH 3/4] exitcall: move arch_shutdown " Herve Codina
2015-07-06  7:36 ` [PATCH 4/4] exitcall: move board_shutdown " Herve Codina
2015-07-06 11:52 ` [PATCH 0/4] " Sascha Hauer
2015-07-06 12:19   ` Herve Codina

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox