Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1452165 > unrolled thread
| Started by | Andrey Smirnov <andrew.smirnov@gmail.com> |
|---|---|
| First post | 2016-07-29 01:10 +0200 |
| Last post | 2016-08-10 03:00 +0200 |
| Articles | 4 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH v2 1/3] powerpc: Factor out common code in setup-common.c Andrey Smirnov <andrew.smirnov@gmail.com> - 2016-07-29 01:10 +0200
Re: [PATCH v2 1/3] powerpc: Factor out common code in setup-common.c Nicholas Piggin <npiggin@gmail.com> - 2016-08-01 05:50 +0200
Re: [PATCH v2 1/3] powerpc: Factor out common code in setup-common.c Andrey Smirnov <andrew.smirnov@gmail.com> - 2016-08-09 18:50 +0200
Re: [PATCH v2 1/3] powerpc: Factor out common code in setup-common.c Nicholas Piggin <npiggin@gmail.com> - 2016-08-10 03:00 +0200
| From | Andrey Smirnov <andrew.smirnov@gmail.com> |
|---|---|
| Date | 2016-07-29 01:10 +0200 |
| Subject | [PATCH v2 1/3] powerpc: Factor out common code in setup-common.c |
| Message-ID | <s02Bb-4AR-3@gated-at.bofh.it> |
Factor out a small bit of common code in machine_restart(),
machine_power_off() and machine_halt().
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
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)
+ ;
+}
+
void machine_restart(char *cmd)
{
machine_shutdown();
if (ppc_md.restart)
ppc_md.restart(cmd);
+
smp_send_stop();
- printk(KERN_EMERG "System Halted, OK to turn off power\n");
- local_irq_disable();
- while (1) ;
+ machine_hang();
}
void machine_power_off(void)
@@ -146,10 +153,9 @@ void machine_power_off(void)
machine_shutdown();
if (pm_power_off)
pm_power_off();
+
smp_send_stop();
- printk(KERN_EMERG "System Halted, OK to turn off power\n");
- local_irq_disable();
- while (1) ;
+ machine_hang();
}
/* Used by the G5 thermal driver */
EXPORT_SYMBOL_GPL(machine_power_off);
@@ -162,10 +168,9 @@ void machine_halt(void)
machine_shutdown();
if (ppc_md.halt)
ppc_md.halt();
+
smp_send_stop();
- printk(KERN_EMERG "System Halted, OK to turn off power\n");
- local_irq_disable();
- while (1) ;
+ machine_hang();
}
--
2.5.5
[toc] | [next] | [standalone]
| From | Nicholas Piggin <npiggin@gmail.com> |
|---|---|
| Date | 2016-08-01 05:50 +0200 |
| Subject | Re: [PATCH v2 1/3] powerpc: Factor out common code in setup-common.c |
| Message-ID | <s1coN-Tv-7@gated-at.bofh.it> |
| In reply to | #1452165 |
On Thu, 28 Jul 2016 16:07:16 -0700
Andrey Smirnov <andrew.smirnov@gmail.com> 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@gmail.com>
> ---
>
> 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? Would ppc_power_off()
be a good name? Should the smp_send_stop() call be moved here?
It seems like a reasonable cleanup though.
Thanks,
Nick
[toc] | [prev] | [next] | [standalone]
| From | Andrey Smirnov <andrew.smirnov@gmail.com> |
|---|---|
| Date | 2016-08-09 18:50 +0200 |
| Message-ID | <s4io2-1E1-13@gated-at.bofh.it> |
| In reply to | #1452960 |
On Sun, Jul 31, 2016 at 8:40 PM, Nicholas Piggin <npiggin@gmail.com> wrote:
> On Thu, 28 Jul 2016 16:07:16 -0700
> Andrey Smirnov <andrew.smirnov@gmail.com> 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@gmail.com>
>> ---
>>
>> 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.
Thanks,
Andrey
[toc] | [prev] | [next] | [standalone]
| From | Nicholas Piggin <npiggin@gmail.com> |
|---|---|
| Date | 2016-08-10 03:00 +0200 |
| Subject | Re: [PATCH v2 1/3] powerpc: Factor out common code in setup-common.c |
| Message-ID | <s4q2d-6uv-1@gated-at.bofh.it> |
| In reply to | #1458956 |
On Tue, 9 Aug 2016 09:30:54 -0700
Andrey Smirnov <andrew.smirnov@gmail.com> wrote:
> On Sun, Jul 31, 2016 at 8:40 PM, Nicholas Piggin <npiggin@gmail.com> wrote:
> > On Thu, 28 Jul 2016 16:07:16 -0700
> > Andrey Smirnov <andrew.smirnov@gmail.com> 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@gmail.com>
> >> ---
> >>
> >> 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
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web