public inbox for linux-pm@vger.kernel.org
 help / color / mirror / Atom feed
From: Cornelia Huck <cornelia.huck@de.ibm.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Marcel Holtmann <marcel@holtmann.org>,
	Heiko Carstens <heiko.carstens@de.ibm.com>,
	Martin Schwidefsky <schwidefsky@de.ibm.com>,
	Linux-pm mailing list <linux-pm@lists.linux-foundation.org>
Subject: Re: [RFC][Patch 0/3] Fix device_move() vs. dpm_list issues.
Date: Tue, 3 Mar 2009 16:24:46 +0100	[thread overview]
Message-ID: <20090303162446.3aff4457@gondolin> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0903030953310.3274-100000@iolanthe.rowland.org>

On Tue, 3 Mar 2009 09:55:27 -0500 (EST),
Alan Stern <stern@rowland.harvard.edu> wrote:

> On Tue, 3 Mar 2009, Ming Lei wrote:
> 
> > 2009/3/3 Cornelia Huck <cornelia.huck@de.ibm.com>:
> > > Hi,
> > >
> > > in thread [1], we discussed the issue of device_move() causing a
> > > reordering of devices without adapting the ancestral order in dpm_list.
> > > If a device is moved to a new parent that was registered after the
> > > device itself, it would still be after its new parent in dpm_list, thus
> > > causing the parent to be suspended before its child.
> > >
> > > This patchset attempts to remedy this situation by introducing an
> > > interface for a driver to manipulate dpm_list with the dpm_list_mtx
> > > held. (device_move() does not have enough information to do this
> > > manipulation itself.) The calling sequence for a driver would be:
> > >
> > > - lock the dpm_list
> > > - call device_move()
> > > - if device_move() succeeded, fix up dpm_list
> > > - unlock the dpm_list
> > 
> > IMHO, It is better to fix up dpm_list inside device_move() , like device_add(),
> > which may let s390, bluetooth or other possible users more happy with
> > device_remove().

Maybe I'm a bit dense today, but I don't understand the problem with
device_remove()?

> 
> I agree; it would be cleaner if device_move() could fix up dpm_list 
> directly.  If it doesn't have enough information to do so then change 
> the interface so that it does.  That should be pretty easy since there 
> are only a handful of callers.

The only really obvious one is 'move to NULL' -> 'move to end of
dpm_list'.
AFAICS, for that device_move() would need the following
parameters:
- device to be moved
- new parent
- which device to move in dpm_list (device, parent, or none)
and then still the moves I do in the s390 code don't seem obvious for
the driver core to get.

Given that the callers still need to specify what to do, I find it much
easier (and the resulting code much more understandable) if the callers
fix up dpm_list...

  reply	other threads:[~2009-03-03 15:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-03 10:20 [RFC][Patch 0/3] Fix device_move() vs. dpm_list issues Cornelia Huck
2009-03-03 14:02 ` Ming Lei
2009-03-03 14:55   ` Alan Stern
2009-03-03 15:24     ` Cornelia Huck [this message]
2009-03-03 19:53       ` Alan Stern
2009-03-04 10:01         ` Cornelia Huck
2009-03-04  1:49       ` Ming Lei

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=20090303162446.3aff4457@gondolin \
    --to=cornelia.huck@de.ibm.com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=marcel@holtmann.org \
    --cc=schwidefsky@de.ibm.com \
    --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