public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb•de>
To: Guennadi Liakhovetski <g.liakhovetski@gmx•de>
Cc: linuxppc-dev@ozlabs•org, paulus@samba•org
Subject: Re: [PATCH 3/7] Celleb: Support for Power/Reset buttons
Date: Sun, 30 Sep 2007 23:22:51 +0200	[thread overview]
Message-ID: <200709302322.52076.arnd@arndb.de> (raw)
In-Reply-To: <Pine.LNX.4.60.0709302259510.10318@poirot.grange>

On Sunday 30 September 2007, you wrote:
>=20
> > kernel_restart() seems appropriate for that.
>=20
> Now a comment to this one says:
>=20
> =A0*=A0=A0=A0=A0=A0=A0This is not safe to call in interrupt context.
>=20
> and AFAIU, this is called from an interrupt. Am I missing anything or=20
> would this be wrong to call kernel_restart() here?

It should be called through a workqueue, afaics, do avoid calling
a sleeping notifier from an interrupt.

> > > +static irqreturn_t beat_reset_event(int virq, void *arg)
> > > +{
> > > +=A0=A0=A0printk(KERN_DEBUG "Beat: reset button pressed\n");
> > > +=A0=A0=A0beat_pm_poweroff_flag =3D 0;
> > > +=A0=A0=A0if (kill_cad_pid(SIGINT, 1)) {
> > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0/* Just in case killing init proces=
s failed */
> > > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0beat_restart(NULL);
> > > +=A0=A0=A0}
> > > +=A0=A0=A0return IRQ_HANDLED;
> > > +}
> >=20
> > same here, except calling kernel_halt() in the end.
>=20
> kernel_halt() doesn't have a similar comment, but it does call the=20
> kernel_shutdown_prepare() too, so, seems like it should not be called fro=
m=20
> an interrupt either?

yes

> Now, another question, is it generally good to hard-wire "reset" and=20
> "power-off" buttons in the kernel? Isn't it better to just register them=
=20
> as input event sources and let userspace (power-management daemon) decide=
=20
> what to do with them? Like poweroff / reboot / suspend / hibernate / ...

Tough question. I can see arguments for either way, but I guess I'd tend
to handling it in the kernel, choosing simplicity over consistency.

	Arnd <><

      reply	other threads:[~2007-09-30 21:39 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
2007-09-30 21:17   ` Guennadi Liakhovetski
2007-09-30 21:22     ` Arnd Bergmann [this message]

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=200709302322.52076.arnd@arndb.de \
    --to=arnd@arndb$(echo .)de \
    --cc=g.liakhovetski@gmx$(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