Re: [PATCH 1/6] PM: Introduce PM links framework

Rafael J. Wysocki
2009-08-28T19:10:31Z

On Friday 28 August 2009, Alan Stern wrote:
> On Wed, 26 Aug 2009, Rafael J. Wysocki wrote:
>
> > From: Rafael J. Wysocki <rjw@sisk.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