Re: [PATCH v2 1/3] powerpc: Factor out common code in setup-common.c
From: Nicholas Piggin
Date: Tue Aug 09 2016 - 20:54:35 EST
On Tue, 9 Aug 2016 09:30:54 -0700
Andrey Smirnov <andrew.smirnov@xxxxxxxxx> wrote:
> On Sun, Jul 31, 2016 at 8:40 PM, Nicholas Piggin <npiggin@xxxxxxxxx> wrote:
> > On Thu, 28 Jul 2016 16:07:16 -0700
> > Andrey Smirnov <andrew.smirnov@xxxxxxxxx> wrote:
> >
> >> Factor out a small bit of common code in machine_restart(),
> >> machine_power_off() and machine_halt().
> >>
> >> Signed-off-by: Andrey Smirnov <andrew.smirnov@xxxxxxxxx>
> >> ---
> >>
> >> No changes compared to v1.
> >>
> >> arch/powerpc/kernel/setup-common.c | 23 ++++++++++++++---------
> >> 1 file changed, 14 insertions(+), 9 deletions(-)
> >>
> >> diff --git a/arch/powerpc/kernel/setup-common.c
> >> b/arch/powerpc/kernel/setup-common.c index 714b4ba..5cd3283 100644
> >> --- a/arch/powerpc/kernel/setup-common.c
> >> +++ b/arch/powerpc/kernel/setup-common.c
> >> @@ -130,15 +130,22 @@ void machine_shutdown(void)
> >> ppc_md.machine_shutdown();
> >> }
> >>
> >> +static void machine_hang(void)
> >> +{
> >> + pr_emerg("System Halted, OK to turn off power\n");
> >> + local_irq_disable();
> >> + while (1)
> >> + ;
> >> +}
> >
> > What's the intended semantics of this function? A default power
> > off handler when the platform supplies none?
>
> I was mostly trying to avoid code duplication in
> machine_halt/machine_restart/machine_power_off and didn't intend that
> function to be used outside. The semantics is just - to hang the CPU
> when things didn't go as expected and code that was supposed to
> restart/halt/power off the machine failed.
>
> > Would ppc_power_off()
> > be a good name?
>
> Calling it "power_off" seems a bit misleading, the function doesn't
> really try to do anything related to powering off, really.
Okay I don't feel too strongly against it.
Thanks,
Nick