diff mbox

[U-Boot,21/21] Remove legacy do_reset() function

Message ID 1299519462-25320-22-git-send-email-Kyle.D.Moffett@boeing.com
State Superseded, archived
Headers show

Commit Message

Kyle Moffett March 7, 2011, 5:37 p.m. UTC
All of the users of the legacy do_reset() function have been converted
to __arch_restart() or __board_restart() as appropriate, so the
compatibility calls to do_reset() may be removed.

In addition the do_generic_reset() function is renamed to the now-unused
name do_reset().

Signed-off-by: Kyle Moffett <Kyle.D.Moffett@boeing.com>
---
 common/cmd_boot.c |   27 +++------------------------
 include/command.h |    1 -
 2 files changed, 3 insertions(+), 25 deletions(-)

Comments

Graeme Russ March 7, 2011, 9:55 p.m. UTC | #1
Hi Kyle

On Tue, Mar 8, 2011 at 4:37 AM, Kyle Moffett <Kyle.D.Moffett@boeing.com> wrote:
> All of the users of the legacy do_reset() function have been converted
> to __arch_restart() or __board_restart() as appropriate, so the
> compatibility calls to do_reset() may be removed.
>
> In addition the do_generic_reset() function is renamed to the now-unused
> name do_reset().
>

If it is unused, why not remove it completely?

Regards,

Graeme
Kyle Moffett March 7, 2011, 11 p.m. UTC | #2
Hi!

On Mar 07, 2011, at 16:55, Graeme Russ wrote:
> On Tue, Mar 8, 2011 at 4:37 AM, Kyle Moffett <Kyle.D.Moffett@boeing.com> wrote:
>> All of the users of the legacy do_reset() function have been converted
>> to __arch_restart() or __board_restart() as appropriate, so the
>> compatibility calls to do_reset() may be removed.
>> 
>> In addition the do_generic_reset() function is renamed to the now-unused
>> name do_reset().
> 
> If it is unused, why not remove it completely?

The "reset" command used to invoke "do_reset()".  Partway through this patch series I changed it to invoke a new "do_generic_reset()" function to preserve bisection.

The calltrace looked like this:

=> do_generic_reset()
   => system_restart()
      => __board_restart()
      => __arch_restart()
      => do_reset()

Now that nothing talks about "do_reset()" anymore, I delete that old function and rename "do_generic_reset()" over top of it:

=> do_reset()  [Same as old do_generic_reset()]
   => system_restart()
      => __board_restart()
      => __arch_restart()

Cheers,
Kyle Moffett
Graeme Russ March 7, 2011, 11:03 p.m. UTC | #3
On Tue, Mar 8, 2011 at 10:00 AM, Moffett, Kyle D
<Kyle.D.Moffett@boeing.com> wrote:
> Hi!
>
> On Mar 07, 2011, at 16:55, Graeme Russ wrote:
>> On Tue, Mar 8, 2011 at 4:37 AM, Kyle Moffett <Kyle.D.Moffett@boeing.com> wrote:
>>> All of the users of the legacy do_reset() function have been converted
>>> to __arch_restart() or __board_restart() as appropriate, so the
>>> compatibility calls to do_reset() may be removed.
>>>
>>> In addition the do_generic_reset() function is renamed to the now-unused
>>> name do_reset().
>>
>> If it is unused, why not remove it completely?
>
> The "reset" command used to invoke "do_reset()".  Partway through this patch series I changed it to invoke a new "do_generic_reset()" function to preserve bisection.
>
> The calltrace looked like this:
>
> => do_generic_reset()
>   => system_restart()
>      => __board_restart()
>      => __arch_restart()
>      => do_reset()
>
> Now that nothing talks about "do_reset()" anymore, I delete that old function and rename "do_generic_reset()" over top of it:
>
> => do_reset()  [Same as old do_generic_reset()]
>   => system_restart()
>      => __board_restart()
>      => __arch_restart()
>
> Cheers,
> Kyle Moffett

Go it - Thanks

Regards,

Graeme
diff mbox

Patch

diff --git a/common/cmd_boot.c b/common/cmd_boot.c
index c0f26fc..422d20c 100644
--- a/common/cmd_boot.c
+++ b/common/cmd_boot.c
@@ -72,9 +72,6 @@  void emergency_restart(void)
 	__board_emergency_restart();
 	__arch_emergency_restart();
 
-	/* Fallback to the old do_reset() until everything is converted. */
-	do_reset(NULL, 0, 0, NULL);
-
 	printf("EMERGENCY RESTART: All attempts to reboot failed!");
 	hang();
 }
@@ -129,11 +126,6 @@  int system_restart(void)
 
 	/* Now call into the architecture-specific code */
 	err = __arch_restart();
-	if (err)
-		goto failed;
-
-	/* Fallback to the old do_reset() until everything is converted. */
-	err = do_reset(NULL, 0, 0, NULL);
 
 failed:
 	printf("*** SYSTEM RESTART FAILED ***\n");
@@ -157,7 +149,7 @@  int __board_restart(void)
 __attribute__((__weak__))
 int __arch_restart(void)
 {
-	/* Fallthrough to legacy do_reset() code */
+	/* Some architectures have no generic reboot capability */
 	return 0;
 }
 
@@ -166,24 +158,11 @@  int __arch_restart(void)
  *
  * This is what you get when you type "reset" at the command line.
  */
-int do_generic_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
 	return system_restart();
 }
 
-/*
- * Empty legacy "do_reset" stub.
- *
- * This allows a platform using the new __board_restart() and
- * __arch_restart() hooks to completely omit the old do_reset() function.
- */
-int do_reset_stub(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
-{
-	return 0;
-}
-__attribute__((__weak__,__alias__("do_reset_stub")))
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
-
 /* -------------------------------------------------------------------- */
 
 U_BOOT_CMD(
@@ -194,7 +173,7 @@  U_BOOT_CMD(
 );
 
 U_BOOT_CMD(
-	reset, 1, 0,	do_generic_reset,
+	reset, 1, 0,	do_reset,
 	"Perform RESET of the CPU",
 	""
 );
diff --git a/include/command.h b/include/command.h
index ad8c915..d87f45d 100644
--- a/include/command.h
+++ b/include/command.h
@@ -99,7 +99,6 @@  extern int cmd_get_data_size(char* arg, int default_size);
 extern int do_bootd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
 #endif
 extern int do_bootm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
-extern int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
 
 /* Generic system restart functions */
 __attribute__((__noreturn__))