[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200908282111.19925.rjw@sisk.pl>
Date: Fri, 28 Aug 2009 21:11:19 +0200
From: "Rafael J. Wysocki" <rjw@...k.pl>
To: Alan Stern <stern@...land.harvard.edu>
Cc: "linux-pm" <linux-pm@...ts.linux-foundation.org>,
LKML <linux-kernel@...r.kernel.org>, Len Brown <lenb@...nel.org>,
Pavel Machek <pavel@....cz>,
ACPI Devel Maling List <linux-acpi@...r.kernel.org>,
Arjan van de Ven <arjan@...radead.org>,
Zhang Rui <rui.zhang@...el.com>,
Dmitry Torokhov <dmitry.torokhov@...il.com>,
Linux PCI <linux-pci@...r.kernel.org>
Subject: Re: [PATCH 1/6] PM: Introduce PM links framework
On Friday 28 August 2009, Alan Stern wrote:
> On Wed, 26 Aug 2009, Rafael J. Wysocki wrote:
>
> > From: Rafael J. Wysocki <rjw@...k.pl>
> >
> > Introduce a framework for representing off-tree PM dependencies
> > between devices.
> >
> > There are PM dependencies between devices that are not reflected by
> > the structure of the device tree. In other words, as far as PM is
> > concerned, a device may depend on some other devices which are not
> > its children and none of which is its parent.
> >
> > Every such dependency involves two devices, one of which is a
> > "master" and the other of which is a "slave", meaning that the
> > "slave" have to be suspended before the "master" and cannot be
> > woken up before it. Thus every device can be given two lists of
> > "dependency objects", one for the dependencies where the device is
> > the "master" and the other for the dependencies where the device is
> > the "slave". Then, each "dependency object" can be represented as
>
>
> > Index: linux-2.6/drivers/base/power/common.c
> > ===================================================================
> > --- /dev/null
> > +++ linux-2.6/drivers/base/power/common.c
>
> > +/**
> > + * device_for_each_master - Execute given function for each master of a device.
> > + * @slave: Device whose masters to execute the function for.
> > + * @data: Data pointer to pass to the function.
> > + * @fn: Function to execute for each master of @slave.
> > + *
> > + * The function is executed for the parent of the device, if there is one, and
> > + * for each device connected to it via a pm_link object where @slave is the
> > + * "slave".
> > + */
> > +int device_for_each_master(struct device *slave, void *data,
> > + int (*fn)(struct device *dev, void *data))
> > +{
> > + struct pm_link *link;
> > + int idx;
> > + int error = 0;
> > +
> > + if (slave->parent) {
> > + error = fn(slave->parent, data);
> > + if (error)
> > + return error;
> > + }
> > +
> > + idx = srcu_read_lock(&pm_link_ss);
> > +
> > + list_for_each_entry(link, &slave->power.slave_links, slave_hook) {
>
> This needs to use list_for_each_entry_rcu. Likewise in
> device_for_each_slave().
OK, I wasn't sure about that.
Thanks,
Rafael
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists