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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 26 Aug 2009, Rafael J. Wysocki wrote:

> From: Rafael J. Wysocki <rjw@xxxxxxx>
> 
> 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().

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux