Skip to contentSkip to conversation

cmd_boot: Add a poweroff command

PATCH Superseded Hans de Goede 2 participants 3 messages Dec 22, 2015 – Dec 23, 2015

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 cmd_boot: Add a poweroff command

From: Michael van Slingerland <[email protected]>

Add a 'poweroff' command to boot commands, this only gets enabled if the board Kconfig does a "select CMD_POWEROFF".

[hdegoede at redhat.com: Make the cmd conditional on a CMD_POWEROFF Kconfig]

---
Changes in v2:
-Improve poweroff help text
-Remove unnecessary #ifdef from command.h

---
 common/Kconfig    | 3 +++
 common/cmd_boot.c | 8 ++++++++
 include/command.h | 1 +
 3 files changed, 12 insertions(+)
common/Kconfig +3 -0
index ccf5475..9d446bf 100644
@@ -184,6 +184,9 @@ config CMD_XIMG
 	help
 	  Extract a part of a multi-image.
 
+config CMD_POWEROFF
+	bool
+
 endmenu
 
 menu "Environment commands"
common/cmd_boot.c +8 -0
index 8f2e070..72f2cf3 100644
@@ -61,3 +61,11 @@ U_BOOT_CMD(
 	"Perform RESET of the CPU",
 	""
 );
+
+#ifdef CONFIG_CMD_POWEROFF
+U_BOOT_CMD(
+	poweroff, 1, 0,	do_poweroff,
+	"Perform POWEROFF of the device",
+	""
+);
+#endif
include/command.h +1 -0
index 2ae9b6c..0524c0b 100644
@@ -110,6 +110,7 @@ extern int common_diskboot(cmd_tbl_t *cmdtp, const char *intf, int argc,
 			   char *const argv[]);
 
 extern int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
+extern int do_poweroff(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
 
 /*
  * Error codes that commands return to cmd_process(). We use the standard 0
Signature · 1 line
2.5.0
#1 lore raw

PATCH v2 1/1 cmd_boot: Add a poweroff command

Dear Hans de Goede,

Quoted 4 lines · In message <[email protected]> you wrote:

From: Michael van Slingerland <[email protected]>

Add a 'poweroff' command to boot commands, this only gets enabled if the board Kconfig does a "select CMD_POWEROFF".

Do you plan to submit any code that will actually implement and use this feature?

As is, this is just dead code, and anybody who enables the option just runs into build errors.

As is:

NAK.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
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
"Data is a lot like humans: It is  born.  Matures.  Gets  married  to
other  data, divorced. Gets old. One thing that it doesn't do is die.
It has to be killed."                                 - Arthur Miller
#2 lore raw

PATCH v2 1/1 cmd_boot: Add a poweroff command

Hi,

Quoted 11 lines · Wolfgang Denk

Dear Hans de Goede,

Quoted 4 lines · In message <[email protected]> you wrote:

From: Michael van Slingerland <[email protected]>

Add a 'poweroff' command to boot commands, this only gets enabled if the board Kconfig does a "select CMD_POWEROFF".

Do you plan to submit any code that will actually implement and use this feature?

Quoted 6 lines

As is, this is just dead code, and anybody who enables the option just runs into build errors.

As is:

NAK.

<sigh> as you may have noticed this is a v2 of this patch, v1 was part of a set which did actually implement support for this and came with a coverletter explaining why this is a desirable feature.

Regards,

Hans