From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>, Pavel Machek <pavel@ucw.cz>,
pm list <linux-pm@lists.linux-foundation.org>,
ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
Greg KH <greg@kroah.com>, Len Brown <lenb@kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
Alexey Starikovskiy <astarikovskiy@suse.de>,
David Brownell <david-b@pacbell.net>
Subject: Re: [RFC][PATCH 1/3] PM: Introduce new top level suspend and hibernation callbacks
Date: Fri, 21 Mar 2008 09:32:00 +1100 [thread overview]
Message-ID: <1206052320.8420.23.camel@pasglop> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0803201037590.9468-100000@netrider.rowland.org>
On Thu, 2008-03-20 at 10:45 -0400, Alan Stern wrote:
>
> I didn't mention locking because it seemed obvious that locking is
> needed. Of course a flag alone is mostly useless.
>
> But we already _do_ have a lock (dev->sem) and we _don't_ have a flag.
> I was pointing out that some drivers will want to have a flag added.
> Maybe so many drivers will want it that the flag should be added to the
> PM structure, where it will be available for every device. If only a
> few drivers want this new flag, then yes, they can put it in their
> private data structures.
What I'm saying is that a flag set prior to prepare() would be almost
impossible to get right in term of locking for the reasons I explained.
I think this should be under driver reponsibility, using it's own
internal locking. Or else, drivers can rely on failure.
> > However, I think this is mostly a non-issue, because the core _does_
> > provide something here that is useful for drivers who don't want to
> > bother with the above: The failure return from device_add. If drivers
> > don't want to do something akin to what I described, they can just be
> > made to deal gracefully with the failure from device_add that would
> > happen due to the core internal flag being set after the return from
> > prepare().
>
> Relying on a registration failure to handle this sort of thing is _not_
> a good idea. For example, how would the driver distinguish failure
> caused by impending suspend from other sorts of failure?
By the precise error code of course. But as I said, I would expect most
bus drivers to have their own proper implementation that does the right
thing, it's not like it was hard and there aren't that many bus drivers.
Relying on failure is a possibility for simple ones that don't want to
care much, in which case, there is little need to differenciate the
failure caused by suspend from other failures other than maybe printing
some garbage in the log vs. not :-)
Ben.
next prev parent reply other threads:[~2008-03-20 22:34 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-16 23:20 [RFC][PATCH 0/3] PM: Rework suspend and hibernation code for devices Rafael J. Wysocki
2008-03-16 23:22 ` [RFC][PATCH 1/3] PM: Introduce new top level suspend and hibernation callbacks Rafael J. Wysocki
2008-03-18 10:01 ` Pavel Machek
2008-03-18 15:10 ` Alan Stern
2008-03-18 23:54 ` Pavel Machek
2008-03-19 1:04 ` Rafael J. Wysocki
2008-03-19 2:44 ` Alan Stern
2008-03-19 3:49 ` Benjamin Herrenschmidt
2008-03-19 15:19 ` Alan Stern
2008-03-20 3:33 ` Benjamin Herrenschmidt
2008-03-20 14:45 ` Alan Stern
2008-03-20 22:32 ` Benjamin Herrenschmidt [this message]
2008-03-20 18:26 ` Alan Stern
2008-03-20 22:34 ` Benjamin Herrenschmidt
2008-03-20 22:57 ` Alan Stern
2008-03-19 0:53 ` Greg KH
2008-03-19 9:15 ` Pavel Machek
2008-03-19 13:22 ` Rafael J. Wysocki
2008-03-19 18:07 ` Greg KH
2008-03-16 23:24 ` [RFC][PATCH 2/3] PM: New suspend and hibernation callbacks for platform bus type Rafael J. Wysocki
2008-03-18 10:02 ` Pavel Machek
2008-03-16 23:25 ` [RFC][PATCH 3/3] PM: New suspend and hibernation callbacks for PCI " Rafael J. Wysocki
2008-03-18 10:02 ` Pavel Machek
2008-03-19 0:55 ` Greg KH
2008-03-19 13:24 ` Rafael J. Wysocki
2008-03-19 18:06 ` Greg KH
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=1206052320.8420.23.camel@pasglop \
--to=benh@kernel.crashing.org \
--cc=astarikovskiy@suse.de \
--cc=david-b@pacbell.net \
--cc=greg@kroah.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@lists.linux-foundation.org \
--cc=pavel@ucw.cz \
--cc=rjw@sisk.pl \
--cc=stern@rowland.harvard.edu \
/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