public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v2] cmd_boot: Add a poweroff command
@ 2015-12-22 22:23 Hans de Goede
  2015-12-23  6:33 ` Wolfgang Denk
  0 siblings, 1 reply; 3+ messages in thread
From: Hans de Goede @ 2015-12-22 22:23 UTC (permalink / raw)
  To: u-boot

From: Michael van Slingerland <michael@deviousops.nl>

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

Signed-off-by: Michael van Slingerland <michael@deviousops.nl>
[hdegoede at redhat.com: Make the cmd conditional on a CMD_POWEROFF Kconfig]
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
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(+)

diff --git a/common/Kconfig b/common/Kconfig
index ccf5475..9d446bf 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -184,6 +184,9 @@ config CMD_XIMG
 	help
 	  Extract a part of a multi-image.
 
+config CMD_POWEROFF
+	bool
+
 endmenu
 
 menu "Environment commands"
diff --git a/common/cmd_boot.c b/common/cmd_boot.c
index 8f2e070..72f2cf3 100644
--- a/common/cmd_boot.c
+++ b/common/cmd_boot.c
@@ -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
diff --git a/include/command.h b/include/command.h
index 2ae9b6c..0524c0b 100644
--- a/include/command.h
+++ b/include/command.h
@@ -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
-- 
2.5.0

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

* [U-Boot] [PATCH v2] cmd_boot: Add a poweroff command
  2015-12-22 22:23 [U-Boot] [PATCH v2] cmd_boot: Add a poweroff command Hans de Goede
@ 2015-12-23  6:33 ` Wolfgang Denk
  2015-12-23 10:52   ` Hans de Goede
  0 siblings, 1 reply; 3+ messages in thread
From: Wolfgang Denk @ 2015-12-23  6:33 UTC (permalink / raw)
  To: u-boot

Dear Hans de Goede,

In message <1450822985-19135-1-git-send-email-hdegoede@redhat.com> you wrote:
> From: Michael van Slingerland <michael@deviousops.nl>
> 
> 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

-- 
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

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

* [U-Boot] [PATCH v2] cmd_boot: Add a poweroff command
  2015-12-23  6:33 ` Wolfgang Denk
@ 2015-12-23 10:52   ` Hans de Goede
  0 siblings, 0 replies; 3+ messages in thread
From: Hans de Goede @ 2015-12-23 10:52 UTC (permalink / raw)
  To: u-boot

Hi,

On 23-12-15 07:33, Wolfgang Denk wrote:
> Dear Hans de Goede,
>
> In message <1450822985-19135-1-git-send-email-hdegoede@redhat.com> you wrote:
>> From: Michael van Slingerland <michael@deviousops.nl>
>>
>> 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.

<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

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

end of thread, other threads:[~2015-12-23 10:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-22 22:23 [U-Boot] [PATCH v2] cmd_boot: Add a poweroff command Hans de Goede
2015-12-23  6:33 ` Wolfgang Denk
2015-12-23 10:52   ` Hans de Goede

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