public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb•de>
To: linuxppc-dev@ozlabs•org
Cc: paulus@samba•org
Subject: Re: [PATCH 3/7] Celleb: Support for Power/Reset buttons
Date: Wed, 26 Sep 2007 13:55:49 +0200	[thread overview]
Message-ID: <200709261355.50310.arnd@arndb.de> (raw)
In-Reply-To: <20070926.132556.1723232353.kouish@swc.toshiba.co.jp>

On Wednesday 26 September 2007, Ishizaki Kou wrote:
> This is a patch to support Power/Reset buttons on Beat on Celleb.
> 
> On Beat, we have an event from Beat if Power button or Reset button
> is pressed. This patch catches the event and convert it to a signal
> to INIT process.
> 
> /sbin/inittab have no entry to turn the machine power off so we have
> to detect if power button is pressed or not internally in our driver.
> This idea is taken from PS3's event handling subsystem.
> 
> Signed-off-by: Kou Ishizaki <Kou.Ishizaki@toshiba•co.jp>

Basically looks good. At some point I want to do a similar driver
for the IBM cell blade, but I fear there is not much code we
can share.

> +static irqreturn_t beat_power_event(int virq, void *arg)
> +{
> +	printk(KERN_DEBUG "Beat: power button pressed\n");
> +	beat_pm_poweroff_flag = 1;
> +	if (kill_cad_pid(SIGINT, 1)) {
> +		/* Just in case killing init process failed */
> +		beat_power_off();
> +	}
> +	return IRQ_HANDLED;
> +}

I think this should call ctrl_alt_del() instead of doing 
kill_cad_pid() directly.

Also, I think you should better not call the low-level
beat_power_off() function, but rather a high-level function
that goes through the reboot notifiers first.

kernel_restart() seems appropriate for that.

> +static irqreturn_t beat_reset_event(int virq, void *arg)
> +{
> +	printk(KERN_DEBUG "Beat: reset button pressed\n");
> +	beat_pm_poweroff_flag = 0;
> +	if (kill_cad_pid(SIGINT, 1)) {
> +		/* Just in case killing init process failed */
> +		beat_restart(NULL);
> +	}
> +	return IRQ_HANDLED;
> +}

same here, except calling kernel_halt() in the end.

> +static int __init beat_event_init(void)
> +{
> +	if (!machine_is(celleb) || !firmware_has_feature(FW_FEATURE_BEAT))
> +		return -EINVAL;

Shouldn't one of the two be sufficent? It seems to me that you want to
probe for either celleb or BEAT, but not both, considering that celleb
implies BEAT.

	Arnd <><

  reply	other threads:[~2007-09-26 12:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-26  4:25 [PATCH 3/7] Celleb: Support for Power/Reset buttons Ishizaki Kou
2007-09-26 11:55 ` Arnd Bergmann [this message]
2007-09-30 21:17   ` Guennadi Liakhovetski
2007-09-30 21:22     ` Arnd Bergmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200709261355.50310.arnd@arndb.de \
    --to=arnd@arndb$(echo .)de \
    --cc=linuxppc-dev@ozlabs$(echo .)org \
    --cc=paulus@samba$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox