Re: [RFC] machine_reboot and friends

From: Dave Hansen (haveblue@us.ibm.com)
Date: Sun Jun 08 2003 - 00:18:48 EST


On Fri, 2003-06-06 at 14:51, Anders Gustafsson wrote:
> What if machine_restart/machine_halt/machine_power_off were made
> functionpointers instead? And let the architectures assign to them
> instead of defining the functions? Some architectures are already
> doing this.

We don't usually abstract out architecture features with function
pointers. The more standard way is with definitions in
architecture-specific files. Also, the

               if(machine_restart)
                       machine_restart(NULL);

stuff is fairly messy, and it would probably be preferable to do
something like this instead:

void machine_restart(void)
{
               if(arch_machine_restart)
                       arch_machine_restart(NULL);
}

Then, let the architectures define arch_machine_restart(), and keep tons
of duplicate if()s from being scattered around.

> A bit orthogonal: Different architechtures do different things if the action
> fails (or is unimplemented), some panic, some return, some do "for(;;);",
> isn't it about time someone defined the semantics for these functions?

Not really. It's architecture specific :) Some machines simply don't
have a recourse when something that low-level fails. Is there a case
when something happens that you don't expect? The three architecures
that I compile for work happily, and as I expect.

-- 
Dave Hansen
haveblue@us.ibm.com

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun Jun 15 2003 - 22:00:18 EST