public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: "Randy.Dunlap" <rdunlap@xenotime.net>
Cc: linux-pm@lists.osdl.org
Subject: Re: what handles disk drive(s) shutdown?
Date: Sat, 11 Feb 2006 00:16:42 +0100	[thread overview]
Message-ID: <20060210231642.GC1947@elf.ucw.cz> (raw)
In-Reply-To: <Pine.LNX.4.58.0602101507470.23838@shark.he.net>

On Pá 10-02-06 15:08:26, Randy.Dunlap wrote:
> On Sat, 11 Feb 2006, Pavel Machek wrote:
> 
> > On Pá 10-02-06 14:59:58, Randy.Dunlap wrote:
> > > On Fri, 10 Feb 2006, Pavel Machek wrote:
> > >
> > > > Hi!
> > > >
> > > > > in Documentation/power/devices.txt, I read:
> > > > >
> > > > > <quote>
> > > > > System shutdown -- at least disks need to be spun down, or data may be
> > > > > lost. Quiesce devices, just to make life easier for BIOS. event =
> > > > > FREEZE, flags = SYSTEM_SHUTDOWN
> > > > > </quote>
> > > > >
> > > > > Is this actually done somewhere?  I can't find /SYSTEM_SHUTDOWN/
> > > > > in any kernel .h or .c files.
> > > >
> > > > I think we do FREEZE during shutdown, but flags never got
> > > > implemented. It seems nobody really needs them, so...
> > >
> > > I'm not particular about the flags, but I do have a case of
> > > needing to do what the comment describes:  spin down disks
> > > during shutdown.  Can anyone suggest how that should be done?
> > >
> > > [I'm currently adding code to use register_reboot_notifier()
> > > and keeping a table of SATA/PATA controllers/channels for use
> > > at shutdown...]
> >
> > No, that is not the right way.
> >
> > void kernel_shutdown_prepare(enum system_states state)
> > {
> >         notifier_call_chain(&reboot_notifier_list,
> >                 (state == SYSTEM_HALT)?SYS_HALT:SYS_POWER_OFF, NULL);
> >         system_state = state;
> >         device_shutdown();
> > }
> >
> > device_shutdown() should do it, AFAICT.
> >
> > If you want to listen to such event, you should just register your
> > driver with sysfs and implement .suspend() method. But I believe PATA
> > does that already...
> 
> I walked thru that code path and didn't see it happening.
> And for PATA, please expect libata, not legacy drivers/ide/.

I think drivers/ide does it right. Feel free to copy it :-).
								Pavel
-- 
Web maintainer for suspend.sf.net (www.sf.net/projects/suspend) wanted...

  reply	other threads:[~2006-02-10 23:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-09 22:11 what handles disk drive(s) shutdown? Randy.Dunlap
2006-02-10  2:50 ` Alan Stern
2006-02-10 22:56 ` Pavel Machek
2006-02-10 22:59   ` Randy.Dunlap
2006-02-10 23:06     ` Pavel Machek
2006-02-10 23:08       ` Randy.Dunlap
2006-02-10 23:16         ` Pavel Machek [this message]
2006-02-11  2:50       ` Dmitry Torokhov
2006-02-15 23:30         ` Pavel Machek

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=20060210231642.GC1947@elf.ucw.cz \
    --to=pavel@ucw.cz \
    --cc=linux-pm@lists.osdl.org \
    --cc=rdunlap@xenotime.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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