POST: Remove duplicated post_hotkey_pressed() functions
PATCH 1/1 POST: Remove duplicated post_hotkey_pressed() functions
This patch introduces a weak default function for post_hotkey_pressed(), returning 0, for boards without hotkey support. The long-running tests won't be started on those boards. This default function was implemented in many board directories. By implementing this weak default we can remove all those duplicate versions.
Boards with hotkey support, can override this weak default function by defining one in their board specific code.
--- board/amcc/katmai/katmai.c | 11 ----------- board/amcc/kilauea/kilauea.c | 11 ----------- board/amcc/makalu/makalu.c | 11 ----------- board/amcc/ocotea/ocotea.c | 12 ------------ board/amcc/sequoia/sequoia.c | 11 ----------- board/amcc/taishan/taishan.c | 11 ----------- board/amcc/yucca/yucca.c | 11 ----------- board/cm5200/cm5200.c | 8 -------- board/esd/pmc440/pmc440.c | 11 ----------- board/gen860t/gen860t.c | 11 ----------- board/korat/korat.c | 11 ----------- board/kup/common/kup.c | 11 ----------- board/mpl/mip405/mip405.c | 11 ----------- board/netstal/hcu4/hcu4.c | 11 ----------- board/netstal/hcu5/hcu5.c | 11 ----------- board/netstal/mcu25/mcu25.c | 11 ----------- board/netta/netta.c | 11 ----------- board/prodrive/alpr/alpr.c | 12 ------------ board/sacsng/sacsng.c | 12 ------------ board/ssv/adnpesc1/adnpesc1.c | 11 ----------- board/uc100/uc100.c | 12 ------------ post/post.c | 16 ++++++++++++++++ 22 files changed, 16 insertions(+), 232 deletions(-)
board/amcc/katmai/katmai.c +0 -11
@@ -441,17 +441,6 @@ void pcie_setup_hoses(int busno) }#endif /* defined(CONFIG_PCI) */ -#ifdef CONFIG_POST -/* -* Returns 1 if keys pressed to start the power-on long-running tests -* Called from board_init_f(). -*/ -int post_hotkeys_pressed (void ) -{ -return (ctrlc ()); -} -#endif -int board_eth_init (bd_t *bis) {cpu_eth_init (bis);
board/amcc/kilauea/kilauea.c +0 -11
@@ -366,14 +366,3 @@ void pcie_setup_hoses(int busno) } }#endif - -#if defined(CONFIG_POST ) -/* -* Returns 1 if keys pressed to start the power-on long-running tests -* Called from board_init_f(). -*/ -int post_hotkeys_pressed (void ) -{ -return 0 ;/* No hotkeys supported */ -} -#endif /* CONFIG_POST */
board/amcc/makalu/makalu.c +0 -11
@@ -322,14 +322,3 @@ void pcie_setup_hoses(int busno) } }#endif - -#if defined(CONFIG_POST ) -/* -* Returns 1 if keys pressed to start the power-on long-running tests -* Called from board_init_f(). -*/ -int post_hotkeys_pressed (void ) -{ -return 0 ;/* No hotkeys supported */ -} -#endif /* CONFIG_POST */
board/amcc/ocotea/ocotea.c +0 -12
@@ -496,15 +496,3 @@ void fpga_init(void)return ; } - -#ifdef CONFIG_POST -/* -* Returns 1 if keys pressed to start the power-on long-running tests -* Called from board_init_f(). -*/ -int post_hotkeys_pressed (void ) -{ - -return (ctrlc ()); -} -#endif
board/amcc/sequoia/sequoia.c +0 -11
@@ -530,17 +530,6 @@ int is_pci_host(struct pci_controller *hose) }#endif /* defined(CONFIG_PCI) */ -#if defined(CONFIG_POST ) -/* -* Returns 1 if keys pressed to start the power-on long-running tests -* Called from board_init_f(). -*/ -int post_hotkeys_pressed (void ) -{ -return 0 ;/* No hotkeys supported */ -} -#endif /* CONFIG_POST */ -#if defined(CONFIG_NAND_U_BOOT ) || defined(CONFIG_SYS_RAMBOOT )/* * On NAND-booting sequoia, we need to patch the chips select numbers
board/amcc/taishan/taishan.c +0 -11
@@ -302,17 +302,6 @@ int is_pci_host(struct pci_controller *hose) }#endif /* defined(CONFIG_PCI) */ -#ifdef CONFIG_POST -/* -* Returns 1 if keys pressed to start the power-on long-running tests -* Called from board_init_f(). -*/ -int post_hotkeys_pressed (void ) -{ -return (ctrlc ()); -} -#endif -int board_eth_init (bd_t *bis) {cpu_eth_init (bis);
board/amcc/yucca/yucca.c +0 -11
@@ -929,17 +929,6 @@ void fpga_init(void)return ; } -#ifdef CONFIG_POST -/* -* Returns 1 if keys pressed to start the power-on long-running tests -* Called from board_init_f(). -*/ -int post_hotkeys_pressed (void ) -{ -return (ctrlc ()); -} -#endif -/*---------------------------------------------------------------------------+ | onboard_pci_arbiter_selected => from EPLD +---------------------------------------------------------------------------*/
board/cm5200/cm5200.c +0 -8
@@ -330,14 +330,6 @@ int board_early_init_r(void) } -#ifdef CONFIG_POST -int post_hotkeys_pressed (void ) -{ -return 0 ; -} -#endif /* CONFIG_POST */ - -#if defined(CONFIG_POST ) || defined(CONFIG_LOGBUFFER )void post_word_store (ulong a) {
board/esd/pmc440/pmc440.c +0 -11
@@ -741,17 +741,6 @@ int is_pci_host(struct pci_controller *hose) }#endif /* defined(CONFIG_PCI) */ -#if defined(CONFIG_POST ) -/* -* Returns 1 if keys pressed to start the power-on long-running tests -* Called from board_init_f(). -*/ -int post_hotkeys_pressed (void ) -{ -return 0 ;/* No hotkeys supported */ -} -#endif /* CONFIG_POST */ -#ifdef CONFIG_RESET_PHY_R void reset_phy (void ) {
board/gen860t/gen860t.c +0 -11
@@ -292,14 +292,3 @@ void board_poweroff (void)puts ("### Please power off the board ###\n" );while (1 ); } - -#ifdef CONFIG_POST -/* -* Returns 1 if keys pressed to start the power-on long-running tests -* Called from board_init_f(). -*/ -int post_hotkeys_pressed (void ) -{ -return 0 ;/* No hotkeys supported */ -} -#endif
board/korat/korat.c +0 -11
@@ -769,17 +769,6 @@ int is_pci_host(struct pci_controller *hose) }#endif /* defined(CONFIG_PCI) */ -#if defined(CONFIG_POST ) -/* -* Returns 1 if keys pressed to start the power-on long-running tests -* Called from board_init_f(). -*/ -int post_hotkeys_pressed (void ) -{ -return 0 ;/* No hotkeys supported */ -} -#endif /* CONFIG_POST */ -#if defined(CONFIG_OF_LIBFDT ) && defined(CONFIG_OF_BOARD_SETUP )void ft_board_setup (void *blob,bd_t *bd) {
board/kup/common/kup.c +0 -11
@@ -70,14 +70,3 @@ void poweron_key (void)else setenv ("key1" ,"on" ); } - -#ifdef CONFIG_POST -/* -* Returns 1 if keys pressed to start the power-on long-running tests -* Called from board_init_f(). -*/ -int post_hotkeys_pressed (void ) -{ -return (0 ); -} -#endif
board/mpl/mip405/mip405.c +0 -11
@@ -706,17 +706,6 @@ void print_mip405_rev (void) } -#ifdef CONFIG_POST -/* -* Returns 1 if keys pressed to start the power-on long-running tests -* Called from board_init_f(). -*/ -int post_hotkeys_pressed (void ) -{ -return 0 ;/* No hotkeys supported */ -} -#endif -extern int mk_date (char *,struct rtc_time *);int last_stage_init (void )
board/netstal/hcu4/hcu4.c +0 -11
@@ -174,17 +174,6 @@ phys_size_t initdram(int board_type)return dram_size; } -#if defined(CONFIG_POST ) -/* -* Returns 1 if keys pressed to start the power-on long-running tests -* Called from board_init_f(). -*/ -int post_hotkeys_pressed (void ) -{ -return 0 ;/* No hotkeys supported */ -} -#endif /* CONFIG_POST */ -#if defined(CONFIG_OF_LIBFDT ) && defined(CONFIG_OF_BOARD_SETUP )void ft_board_setup (void *blob,bd_t *bd) {
board/netstal/hcu5/hcu5.c +0 -11
@@ -481,17 +481,6 @@ int is_pci_host(struct pci_controller *hose) }#endif /* defined(CONFIG_PCI) */ -#if defined(CONFIG_POST ) -/* -* Returns 1 if keys pressed to start the power-on long-running tests -* Called from board_init_f(). -*/ -int post_hotkeys_pressed (void ) -{ -return 0 ;/* No hotkeys supported */ -} -#endif /* CONFIG_POST */ -#if defined(CONFIG_OF_LIBFDT ) && defined(CONFIG_OF_BOARD_SETUP )void ft_board_setup (void *blob,bd_t *bd) {
board/netstal/mcu25/mcu25.c +0 -11
@@ -173,17 +173,6 @@ phys_size_t initdram(int board_type)return dram_size; } -#if defined(CONFIG_POST ) -/* -* Returns 1 if keys pressed to start the power-on long-running tests -* Called from board_init_f(). -*/ -int post_hotkeys_pressed (void ) -{ -return 0 ;/* No hotkeys supported */ -} -#endif /* CONFIG_POST */ -#if defined(CONFIG_OF_LIBFDT ) && defined(CONFIG_OF_BOARD_SETUP )void ft_board_setup (void *blob,bd_t *bd) {
board/netta/netta.c +0 -11
@@ -564,17 +564,6 @@ int pcmcia_init(void)#endif -#ifdef CONFIG_POST -/* -* Returns 1 if keys pressed to start the power-on long-running tests -* Called from board_init_f(). -*/ -int post_hotkeys_pressed (void ) -{ -return 0 ;/* No hotkeys supported */ -} -#endif -#ifdef CONFIG_HW_WATCHDOG void hw_watchdog_reset (void )
board/prodrive/alpr/alpr.c +0 -12
@@ -287,15 +287,3 @@ void pci_master_init(struct pci_controller *hose) out32r(PCIL0_POM1SA, ~(0x10000000 - 1) | 1); /* 256MB + enable region */ }#endif /* defined(CONFIG_PCI) && defined(CONFIG_SYS_PCI_MASTER_INIT) */ - -#ifdef CONFIG_POST -/* -* Returns 1 if keys pressed to start the power-on long-running tests -* Called from board_init_f(). -*/ -int post_hotkeys_pressed (void ) -{ - -return (ctrlc ()); -} -#endif
board/sacsng/sacsng.c +0 -12
@@ -869,15 +869,3 @@ void spi_cs_deactivate(struct spi_slave *slave)#endif #endif /* CONFIG_MISC_INIT_R */ - -#ifdef CONFIG_POST -/* -* Returns 1 if keys pressed to start the power-on long-running tests -* Called from board_init_f(). -*/ -int post_hotkeys_pressed (void ) -{ -return 0 ;/* No hotkeys supported */ -} - -#endif
board/ssv/adnpesc1/adnpesc1.c +0 -11
@@ -91,17 +91,6 @@ void spi_cs_deactivate(struct spi_slave *slave)#endif -#if defined(CONFIG_POST ) -/* -* Returns 1 if keys pressed to start the power-on long-running tests -* Called from board_init_f(). -*/ -int post_hotkeys_pressed (void ) -{ -return 0 ;/* No hotkeys supported */ -} -#endif /* CONFIG_POST */ -#ifdef CONFIG_CMD_NET int board_eth_init (bd_t *bis) {
board/uc100/uc100.c +0 -12
@@ -268,15 +268,3 @@ int misc_init_r (void)return 0 ; } - - -#ifdef CONFIG_POST -/* -* Returns 1 if keys pressed to start the power-on long-running tests -* Called from board_init_f(). -*/ -int post_hotkeys_pressed (void ) -{ -return 0 ;/* No hotkeys supported */ -} -#endif
post/post.c +16 -0
@@ -58,6 +58,22 @@ int post_init_f (void)return res; } +/* +* Supply a default implementation for post_hotkeys_pressed() for boards +* without hotkey support. We always return 0 here, so that the +* long-running tests won't be started. +* +* Boards with hotkey support can override this weak default function +* by defining one in their board specific code. +*/ +int __post_hotkeys_pressed (void ) +{ +return 0 ;/* No hotkeys supported */ +} +int post_hotkeys_pressed (void ) + __attribute__((weak,alias ("__post_hotkeys_pressed" ))); + +void post_bootmode_init (void ) {int bootmode =post_bootmode_get (0 );
Signature · 1 line
1.6.5.1
PATCH 1/1 POST: Remove duplicated post_hotkey_pressed() functions
Dear Stefan Roese,
Quoted 8 lines · In message <[email protected]> you wrote:
This patch introduces a weak default function for
post_hotkey_pressed(), returning 0, for boards without hotkey support. The long-running tests won't be started on those boards. This default function was implemented in many board directories. By implementing this weak default we can remove all those duplicate versions.Boards with hotkey support, can override this weak default function by defining one in their board specific code.
Hm... but the implementations were actually different. Some boards used ctrlc() so they would catch a (prebably previously pressed) ^C:
Quoted 2 lines
board/amcc/katmai/katmai.c +0
-0
...
board/amcc/katmai/katmai.c void pcie_setup_hoses(int busno) · line 453
Quoted 5 lines
board/amcc/katmai/katmai.c +0
-5-int post_hotkeys_pressed (void ) -{ -return (ctrlc ()); -} -#endif
...while others unconditionally return 09, without checking for ^C:
Quoted 2 lines
board/amcc/kilauea/kilauea.c +0
-0
...
board/amcc/kilauea/kilauea.c void pcie_setup_hoses(int busno) · line 378
Quoted 4 lines
board/amcc/kilauea/kilauea.c +0
-4-int post_hotkeys_pressed (void ) -{ -return 0 ;/* No hotkeys supported */ -}
Are you sure the suggested change does not change the behavious on any of these boards?
Best regards,
Wolfgang Denk
Signature · 6 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Nobody trips over mountains. It is the small pebble that causes you to stumble. Pass all the pebbles in your path and you will find you have crossed the mountain.
PATCH 1/1 POST: Remove duplicated post_hotkey_pressed() functions
Hi Wolfgang,
Quoted 20 lines · On Tuesday 24 November 2009 23:35:02 Wolfgang Denk wrote:
Hm... but the implementations were actually different. Some boards
used
ctrlc()so they would catch a (prebably previously pressed) ^C:Quoted 2 lines
board/amcc/katmai/katmai.c +0
-0..
board/amcc/katmai/katmai.c void pcie_setup_hoses(int busno) · line 453
Quoted 5 lines
board/amcc/katmai/katmai.c +0
-5-int post_hotkeys_pressed (void ) -{ -return (ctrlc ()); -} -#endif ..while others unconditionally return 09, without checking for ^C:
Quoted 2 lines
board/amcc/kilauea/kilauea.c +0
-0..
Quoted 7 lines
board/amcc/kilauea/kilauea.c void pcie_setup_hoses(int busno) · line 378
Quoted 4 lines
board/amcc/kilauea/kilauea.c +0
-4-int post_hotkeys_pressed (void ) -{ -return 0 ;/* No hotkeys supported */ -}Are you sure the suggested change does not change the behavious on any of these boards?
Yes. The boards with this ctrlc() checking don't have POST support enabled at all (e.g. Katmai). So the behaviour is not changed.
Cheers,
Stefan
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office at denx.de
PATCH 1/1 POST: Remove duplicated post_hotkey_pressed() functions
In reply to Stefan RoeseDear Stefan Roese,
Quoted 26 lines · In message <[email protected]> you wrote:
This patch introduces a weak default function for
post_hotkey_pressed(), returning 0, for boards without hotkey support. The long-running tests won't be started on those boards. This default function was implemented in many board directories. By implementing this weak default we can remove all those duplicate versions.Boards with hotkey support, can override this weak default function by defining one in their board specific code.
Signed-off-by Stefan Roese <[email protected]>--- board/amcc/katmai/katmai.c | 11 ----------- board/amcc/kilauea/kilauea.c | 11 ----------- board/amcc/makalu/makalu.c | 11 ----------- board/amcc/ocotea/ocotea.c | 12 ------------ board/amcc/sequoia/sequoia.c | 11 ----------- board/amcc/taishan/taishan.c | 11 ----------- board/amcc/yucca/yucca.c | 11 ----------- board/cm5200/cm5200.c | 8 -------- board/esd/pmc440/pmc440.c | 11 ----------- board/gen860t/gen860t.c | 11 ----------- board/korat/korat.c | 11 ----------- board/kup/common/kup.c | 11 ----------- board/mpl/mip405/mip405.c | 11 ----------- board/netstal/hcu4/hcu4.c | 11 ----------- board/netstal/hcu5/hcu5.c | 11 -----------
Quoted 8 lines
board/netstal/mcu25/mcu25.c | 11 ----------- board/netta/netta.c | 11 ----------- board/prodrive/alpr/alpr.c | 12 ------------ board/sacsng/sacsng.c | 12 ------------ board/ssv/adnpesc1/adnpesc1.c | 11 ----------- board/uc100/uc100.c | 12 ------------ post/post.c | 16 ++++++++++++++++ 22 files changed, 16 insertions(+), 232 deletions(-)
Sorry, but this patch does not apply - please rebase against the "next" branch and resubmit:
Applying: POST: Remove duplicated post_hotkey_pressed() functions
error: patch failed: board/amcc/kilauea/kilauea.c:366
error: board/amcc/kilauea/kilauea.c: patch does not apply
error: patch failed: board/amcc/makalu/makalu.c:322
error: board/amcc/makalu/makalu.c: patch does not apply
error: patch failed: board/amcc/sequoia/sequoia.c:530
error: board/amcc/sequoia/sequoia.c: patch does not apply
error: patch failed: board/amcc/taishan/taishan.c:302
error: board/amcc/taishan/taishan.c: patch does not apply
error: patch failed: board/korat/korat.c:769
error: board/korat/korat.c: patch does not apply
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
Auto-merging board/amcc/katmai/katmai.c
Auto-merging board/amcc/kilauea/kilauea.c
CONFLICT (content): Merge conflict in board/amcc/kilauea/kilauea.c Auto-merging board/amcc/makalu/makalu.c
CONFLICT (content): Merge conflict in board/amcc/makalu/makalu.c Auto-merging board/amcc/ocotea/ocotea.c
Auto-merging board/amcc/sequoia/sequoia.c
CONFLICT (content): Merge conflict in board/amcc/sequoia/sequoia.c Auto-merging board/amcc/taishan/taishan.c
CONFLICT (content): Merge conflict in board/amcc/taishan/taishan.c Auto-merging board/amcc/yucca/yucca.c
Auto-merging board/esd/pmc440/pmc440.c
Auto-merging board/korat/korat.c
CONFLICT (content): Merge conflict in board/korat/korat.c Auto-merging board/netstal/hcu5/hcu5.c
Auto-merging board/prodrive/alpr/alpr.c
Failed to merge in the changes.
Patch failed at 0001 POST: Remove duplicated post_hotkey_pressed() functions
Best regards,
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de The high cost of living hasn't affected its popularity.