aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorCornelia Huck <cornelia.huck@de.ibm.com>2009-03-04 06:44:00 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2009-03-24 19:38:26 -0400
commitffa6a7054d172a2f57248dff2de600ca795c5656 (patch)
treef93c6234bb90295c52fcef09e367ed77ff6c3645 /include
parent60530afe1ee8a5532cb09d0ab5bc3f1a6495b780 (diff)
Driver core: Fix device_move() vs. dpm list ordering, v2
dpm_list currently relies on the fact that child devices will be registered after their parents to get a correct suspend order. Using device_move() however destroys this assumption, as an already registered device may be moved under a newly registered one. This patch adds a new argument to device_move(), allowing callers to specify how dpm_list should be adapted. Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include')
-rw-r--r--include/linux/device.h3
-rw-r--r--include/linux/pm.h11
2 files changed, 13 insertions, 1 deletions
diff --git a/include/linux/device.h b/include/linux/device.h
index 914c1016dd8f..f98d0cfb4f81 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -494,7 +494,8 @@ extern int device_for_each_child(struct device *dev, void *data,
494extern struct device *device_find_child(struct device *dev, void *data, 494extern struct device *device_find_child(struct device *dev, void *data,
495 int (*match)(struct device *dev, void *data)); 495 int (*match)(struct device *dev, void *data));
496extern int device_rename(struct device *dev, char *new_name); 496extern int device_rename(struct device *dev, char *new_name);
497extern int device_move(struct device *dev, struct device *new_parent); 497extern int device_move(struct device *dev, struct device *new_parent,
498 enum dpm_order dpm_order);
498 499
499/* 500/*
500 * Root device objects for grouping under /sys/devices 501 * Root device objects for grouping under /sys/devices
diff --git a/include/linux/pm.h b/include/linux/pm.h
index 24ba5f67b3a3..1d4e2d289821 100644
--- a/include/linux/pm.h
+++ b/include/linux/pm.h
@@ -400,6 +400,9 @@ extern void __suspend_report_result(const char *function, void *fn, int ret);
400 400
401#else /* !CONFIG_PM_SLEEP */ 401#else /* !CONFIG_PM_SLEEP */
402 402
403#define device_pm_lock() do {} while (0)
404#define device_pm_unlock() do {} while (0)
405
403static inline int device_suspend(pm_message_t state) 406static inline int device_suspend(pm_message_t state)
404{ 407{
405 return 0; 408 return 0;
@@ -409,6 +412,14 @@ static inline int device_suspend(pm_message_t state)
409 412
410#endif /* !CONFIG_PM_SLEEP */ 413#endif /* !CONFIG_PM_SLEEP */
411 414
415/* How to reorder dpm_list after device_move() */
416enum dpm_order {
417 DPM_ORDER_NONE,
418 DPM_ORDER_DEV_AFTER_PARENT,
419 DPM_ORDER_PARENT_BEFORE_DEV,
420 DPM_ORDER_DEV_LAST,
421};
422
412/* 423/*
413 * Global Power Management flags 424 * Global Power Management flags
414 * Used to keep APM and ACPI from both being active 425 * Used to keep APM and ACPI from both being active