linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/11] RFC: Common machine reset handling
@ 2013-10-31  6:27 Domenico Andreoli
  2013-10-31  6:27 ` [PATCH 01/11] machine-reset: platform generic handling Domenico Andreoli
                   ` (12 more replies)
  0 siblings, 13 replies; 21+ messages in thread
From: Domenico Andreoli @ 2013-10-31  6:27 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

  I've been looking for a solution to my bcm4760 watchdog based restart
hook when I noticed that the kernel reboot/shutdown mechanism is having
a few unaddressed issues.

Those I identified are:

 1) context pointer often needed by the reset hook
    (currently local static data is used for this pourpose)
 2) unclear ownership/policy in case of multiple reset hooks
    (currently almost nobody seems to care much)
 
I put together this patchset to explore some possible interface
and improve the status, essentially moving away from the
function-pointer-assignament kind of reset hook registration.

It is meant to be platform agnostic and sits in kernel/machine_reset.c. It
opts in only when needed and when supported.

A common usage, as reset hook provider (drivers, boardfiles):

	void restart_hook(void *dev, enum reboot_mode mode, const char *cmd)
{
	/* reboot the board */
}

void release_hook(void *dev)
{
	/* release the hook */
}

void init_restart_hook(void *dev)
{
	struct reset_hook hook;
	reset_hook_init(&hook);
	hook.restart = restart_hook;
	hook.release = release_hook; /* optional */
	set_machine_reset(RESET_RESTART, &hook, dev);
}


A common usage, as reset hook consumer (arch specific hooks, kernel):

	void machine_restart(char *command)
{
	if (_machine_restart)
		_machine_restart(command);
	else
		default_restart(reboot_mode, command);
}

void machine_halt(void)
{
	if (_machine_halt)
		_machine_halt();
	else
		default_halt();
}

void machine_power_off(void)
{
	if (pm_power_off)
		pm_power_off();
	else
		default_power_off();
}


I don't see these impressive diffstats but at least it's possible to free
some static data along the way. Maybe there are some other desiderata that
could be satisfied?

Comments are welcome.

Thanks,
Domenico

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

end of thread, other threads:[~2013-11-01 16:12 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-31  6:27 [PATCH 00/11] RFC: Common machine reset handling Domenico Andreoli
2013-10-31  6:27 ` [PATCH 01/11] machine-reset: platform generic handling Domenico Andreoli
2013-10-31  6:27 ` [PATCH 02/11] ARM: use the common machine reset handling Domenico Andreoli
2013-10-31  6:27 ` [PATCH 03/11] ARM64: " Domenico Andreoli
2013-10-31  6:27 ` [PATCH 04/11] MIPS: " Domenico Andreoli
2013-11-01  5:11   ` Vineet Gupta
2013-11-01  5:26     ` Domenico Andreoli
2013-10-31  6:27 ` [PATCH 05/11] ARM: vexpress: consolidate machine reset func Domenico Andreoli
2013-10-31  6:27 ` [PATCH 06/11] ARM: vexpress: use the common machine reset handling Domenico Andreoli
2013-10-31  6:27 ` [PATCH 07/11] ARM: bcm2835: " Domenico Andreoli
2013-10-31  6:27 ` [PATCH 08/11] ARM: u300: " Domenico Andreoli
2013-10-31 14:40   ` Linus Walleij
2013-10-31 15:19     ` Domenico Andreoli
2013-10-31  6:27 ` [PATCH 09/11] ARM: tps65910: " Domenico Andreoli
2013-10-31  6:27 ` [PATCH 10/11] max8907: " Domenico Andreoli
2013-10-31  6:27 ` [PATCH 11/11] ARM: sp805: " Domenico Andreoli
2013-10-31 10:21 ` [PATCH 00/11] RFC: Common " Russell King - ARM Linux
2013-10-31 21:49 ` Stephen Warren
2013-11-01  5:16   ` Domenico Andreoli
2013-11-01 15:58     ` Stephen Warren
2013-11-01 16:12       ` Russell King - ARM Linux

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).