pm.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548
  1. /*
  2. * pm.h - Power management interface
  3. *
  4. * Copyright (C) 2000 Andrew Henroid
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  19. */
  20. #ifndef _LINUX_PM_H
  21. #define _LINUX_PM_H
  22. #include <linux/list.h>
  23. #include <linux/workqueue.h>
  24. #include <linux/spinlock.h>
  25. #include <linux/wait.h>
  26. #include <linux/timer.h>
  27. #include <linux/completion.h>
  28. /*
  29. * Callbacks for platform drivers to implement.
  30. */
  31. extern void (*pm_idle)(void);
  32. extern void (*pm_power_off)(void);
  33. extern void (*pm_power_off_prepare)(void);
  34. /*
  35. * Device power management
  36. */
  37. struct device;
  38. typedef struct pm_message {
  39. int event;
  40. } pm_message_t;
  41. /**
  42. * struct dev_pm_ops - device PM callbacks
  43. *
  44. * Several driver power state transitions are externally visible, affecting
  45. * the state of pending I/O queues and (for drivers that touch hardware)
  46. * interrupts, wakeups, DMA, and other hardware state. There may also be
  47. * internal transitions to various low power modes, which are transparent
  48. * to the rest of the driver stack (such as a driver that's ON gating off
  49. * clocks which are not in active use).
  50. *
  51. * The externally visible transitions are handled with the help of the following
  52. * callbacks included in this structure:
  53. *
  54. * @prepare: Prepare the device for the upcoming transition, but do NOT change
  55. * its hardware state. Prevent new children of the device from being
  56. * registered after @prepare() returns (the driver's subsystem and
  57. * generally the rest of the kernel is supposed to prevent new calls to the
  58. * probe method from being made too once @prepare() has succeeded). If
  59. * @prepare() detects a situation it cannot handle (e.g. registration of a
  60. * child already in progress), it may return -EAGAIN, so that the PM core
  61. * can execute it once again (e.g. after the new child has been registered)
  62. * to recover from the race condition. This method is executed for all
  63. * kinds of suspend transitions and is followed by one of the suspend
  64. * callbacks: @suspend(), @freeze(), or @poweroff().
  65. * The PM core executes @prepare() for all devices before starting to
  66. * execute suspend callbacks for any of them, so drivers may assume all of
  67. * the other devices to be present and functional while @prepare() is being
  68. * executed. In particular, it is safe to make GFP_KERNEL memory
  69. * allocations from within @prepare(). However, drivers may NOT assume
  70. * anything about the availability of the user space at that time and it
  71. * is not correct to request firmware from within @prepare() (it's too
  72. * late to do that). [To work around this limitation, drivers may
  73. * register suspend and hibernation notifiers that are executed before the
  74. * freezing of tasks.]
  75. *
  76. * @complete: Undo the changes made by @prepare(). This method is executed for
  77. * all kinds of resume transitions, following one of the resume callbacks:
  78. * @resume(), @thaw(), @restore(). Also called if the state transition
  79. * fails before the driver's suspend callback (@suspend(), @freeze(),
  80. * @poweroff()) can be executed (e.g. if the suspend callback fails for one
  81. * of the other devices that the PM core has unsuccessfully attempted to
  82. * suspend earlier).
  83. * The PM core executes @complete() after it has executed the appropriate
  84. * resume callback for all devices.
  85. *
  86. * @suspend: Executed before putting the system into a sleep state in which the
  87. * contents of main memory are preserved. Quiesce the device, put it into
  88. * a low power state appropriate for the upcoming system state (such as
  89. * PCI_D3hot), and enable wakeup events as appropriate.
  90. *
  91. * @resume: Executed after waking the system up from a sleep state in which the
  92. * contents of main memory were preserved. Put the device into the
  93. * appropriate state, according to the information saved in memory by the
  94. * preceding @suspend(). The driver starts working again, responding to
  95. * hardware events and software requests. The hardware may have gone
  96. * through a power-off reset, or it may have maintained state from the
  97. * previous suspend() which the driver may rely on while resuming. On most
  98. * platforms, there are no restrictions on availability of resources like
  99. * clocks during @resume().
  100. *
  101. * @freeze: Hibernation-specific, executed before creating a hibernation image.
  102. * Quiesce operations so that a consistent image can be created, but do NOT
  103. * otherwise put the device into a low power device state and do NOT emit
  104. * system wakeup events. Save in main memory the device settings to be
  105. * used by @restore() during the subsequent resume from hibernation or by
  106. * the subsequent @thaw(), if the creation of the image or the restoration
  107. * of main memory contents from it fails.
  108. *
  109. * @thaw: Hibernation-specific, executed after creating a hibernation image OR
  110. * if the creation of the image fails. Also executed after a failing
  111. * attempt to restore the contents of main memory from such an image.
  112. * Undo the changes made by the preceding @freeze(), so the device can be
  113. * operated in the same way as immediately before the call to @freeze().
  114. *
  115. * @poweroff: Hibernation-specific, executed after saving a hibernation image.
  116. * Quiesce the device, put it into a low power state appropriate for the
  117. * upcoming system state (such as PCI_D3hot), and enable wakeup events as
  118. * appropriate.
  119. *
  120. * @restore: Hibernation-specific, executed after restoring the contents of main
  121. * memory from a hibernation image. Driver starts working again,
  122. * responding to hardware events and software requests. Drivers may NOT
  123. * make ANY assumptions about the hardware state right prior to @restore().
  124. * On most platforms, there are no restrictions on availability of
  125. * resources like clocks during @restore().
  126. *
  127. * @suspend_noirq: Complete the operations of ->suspend() by carrying out any
  128. * actions required for suspending the device that need interrupts to be
  129. * disabled
  130. *
  131. * @resume_noirq: Prepare for the execution of ->resume() by carrying out any
  132. * actions required for resuming the device that need interrupts to be
  133. * disabled
  134. *
  135. * @freeze_noirq: Complete the operations of ->freeze() by carrying out any
  136. * actions required for freezing the device that need interrupts to be
  137. * disabled
  138. *
  139. * @thaw_noirq: Prepare for the execution of ->thaw() by carrying out any
  140. * actions required for thawing the device that need interrupts to be
  141. * disabled
  142. *
  143. * @poweroff_noirq: Complete the operations of ->poweroff() by carrying out any
  144. * actions required for handling the device that need interrupts to be
  145. * disabled
  146. *
  147. * @restore_noirq: Prepare for the execution of ->restore() by carrying out any
  148. * actions required for restoring the operations of the device that need
  149. * interrupts to be disabled
  150. *
  151. * All of the above callbacks, except for @complete(), return error codes.
  152. * However, the error codes returned by the resume operations, @resume(),
  153. * @thaw(), @restore(), @resume_noirq(), @thaw_noirq(), and @restore_noirq() do
  154. * not cause the PM core to abort the resume transition during which they are
  155. * returned. The error codes returned in that cases are only printed by the PM
  156. * core to the system logs for debugging purposes. Still, it is recommended
  157. * that drivers only return error codes from their resume methods in case of an
  158. * unrecoverable failure (i.e. when the device being handled refuses to resume
  159. * and becomes unusable) to allow us to modify the PM core in the future, so
  160. * that it can avoid attempting to handle devices that failed to resume and
  161. * their children.
  162. *
  163. * It is allowed to unregister devices while the above callbacks are being
  164. * executed. However, it is not allowed to unregister a device from within any
  165. * of its own callbacks.
  166. *
  167. * There also are the following callbacks related to run-time power management
  168. * of devices:
  169. *
  170. * @runtime_suspend: Prepare the device for a condition in which it won't be
  171. * able to communicate with the CPU(s) and RAM due to power management.
  172. * This need not mean that the device should be put into a low power state.
  173. * For example, if the device is behind a link which is about to be turned
  174. * off, the device may remain at full power. If the device does go to low
  175. * power and is capable of generating run-time wake-up events, remote
  176. * wake-up (i.e., a hardware mechanism allowing the device to request a
  177. * change of its power state via a wake-up event, such as PCI PME) should
  178. * be enabled for it.
  179. *
  180. * @runtime_resume: Put the device into the fully active state in response to a
  181. * wake-up event generated by hardware or at the request of software. If
  182. * necessary, put the device into the full power state and restore its
  183. * registers, so that it is fully operational.
  184. *
  185. * @runtime_idle: Device appears to be inactive and it might be put into a low
  186. * power state if all of the necessary conditions are satisfied. Check
  187. * these conditions and handle the device as appropriate, possibly queueing
  188. * a suspend request for it. The return value is ignored by the PM core.
  189. */
  190. struct dev_pm_ops {
  191. int (*prepare)(struct device *dev);
  192. void (*complete)(struct device *dev);
  193. int (*suspend)(struct device *dev);
  194. int (*resume)(struct device *dev);
  195. int (*freeze)(struct device *dev);
  196. int (*thaw)(struct device *dev);
  197. int (*poweroff)(struct device *dev);
  198. int (*restore)(struct device *dev);
  199. int (*suspend_noirq)(struct device *dev);
  200. int (*resume_noirq)(struct device *dev);
  201. int (*freeze_noirq)(struct device *dev);
  202. int (*thaw_noirq)(struct device *dev);
  203. int (*poweroff_noirq)(struct device *dev);
  204. int (*restore_noirq)(struct device *dev);
  205. int (*runtime_suspend)(struct device *dev);
  206. int (*runtime_resume)(struct device *dev);
  207. int (*runtime_idle)(struct device *dev);
  208. };
  209. /*
  210. * Use this if you want to use the same suspend and resume callbacks for suspend
  211. * to RAM and hibernation.
  212. */
  213. #define SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \
  214. const struct dev_pm_ops name = { \
  215. .suspend = suspend_fn, \
  216. .resume = resume_fn, \
  217. .freeze = suspend_fn, \
  218. .thaw = resume_fn, \
  219. .poweroff = suspend_fn, \
  220. .restore = resume_fn, \
  221. }
  222. /**
  223. * PM_EVENT_ messages
  224. *
  225. * The following PM_EVENT_ messages are defined for the internal use of the PM
  226. * core, in order to provide a mechanism allowing the high level suspend and
  227. * hibernation code to convey the necessary information to the device PM core
  228. * code:
  229. *
  230. * ON No transition.
  231. *
  232. * FREEZE System is going to hibernate, call ->prepare() and ->freeze()
  233. * for all devices.
  234. *
  235. * SUSPEND System is going to suspend, call ->prepare() and ->suspend()
  236. * for all devices.
  237. *
  238. * HIBERNATE Hibernation image has been saved, call ->prepare() and
  239. * ->poweroff() for all devices.
  240. *
  241. * QUIESCE Contents of main memory are going to be restored from a (loaded)
  242. * hibernation image, call ->prepare() and ->freeze() for all
  243. * devices.
  244. *
  245. * RESUME System is resuming, call ->resume() and ->complete() for all
  246. * devices.
  247. *
  248. * THAW Hibernation image has been created, call ->thaw() and
  249. * ->complete() for all devices.
  250. *
  251. * RESTORE Contents of main memory have been restored from a hibernation
  252. * image, call ->restore() and ->complete() for all devices.
  253. *
  254. * RECOVER Creation of a hibernation image or restoration of the main
  255. * memory contents from a hibernation image has failed, call
  256. * ->thaw() and ->complete() for all devices.
  257. *
  258. * The following PM_EVENT_ messages are defined for internal use by
  259. * kernel subsystems. They are never issued by the PM core.
  260. *
  261. * USER_SUSPEND Manual selective suspend was issued by userspace.
  262. *
  263. * USER_RESUME Manual selective resume was issued by userspace.
  264. *
  265. * REMOTE_WAKEUP Remote-wakeup request was received from the device.
  266. *
  267. * AUTO_SUSPEND Automatic (device idle) runtime suspend was
  268. * initiated by the subsystem.
  269. *
  270. * AUTO_RESUME Automatic (device needed) runtime resume was
  271. * requested by a driver.
  272. */
  273. #define PM_EVENT_ON 0x0000
  274. #define PM_EVENT_FREEZE 0x0001
  275. #define PM_EVENT_SUSPEND 0x0002
  276. #define PM_EVENT_HIBERNATE 0x0004
  277. #define PM_EVENT_QUIESCE 0x0008
  278. #define PM_EVENT_RESUME 0x0010
  279. #define PM_EVENT_THAW 0x0020
  280. #define PM_EVENT_RESTORE 0x0040
  281. #define PM_EVENT_RECOVER 0x0080
  282. #define PM_EVENT_USER 0x0100
  283. #define PM_EVENT_REMOTE 0x0200
  284. #define PM_EVENT_AUTO 0x0400
  285. #define PM_EVENT_SLEEP (PM_EVENT_SUSPEND | PM_EVENT_HIBERNATE)
  286. #define PM_EVENT_USER_SUSPEND (PM_EVENT_USER | PM_EVENT_SUSPEND)
  287. #define PM_EVENT_USER_RESUME (PM_EVENT_USER | PM_EVENT_RESUME)
  288. #define PM_EVENT_REMOTE_RESUME (PM_EVENT_REMOTE | PM_EVENT_RESUME)
  289. #define PM_EVENT_AUTO_SUSPEND (PM_EVENT_AUTO | PM_EVENT_SUSPEND)
  290. #define PM_EVENT_AUTO_RESUME (PM_EVENT_AUTO | PM_EVENT_RESUME)
  291. #define PMSG_ON ((struct pm_message){ .event = PM_EVENT_ON, })
  292. #define PMSG_FREEZE ((struct pm_message){ .event = PM_EVENT_FREEZE, })
  293. #define PMSG_QUIESCE ((struct pm_message){ .event = PM_EVENT_QUIESCE, })
  294. #define PMSG_SUSPEND ((struct pm_message){ .event = PM_EVENT_SUSPEND, })
  295. #define PMSG_HIBERNATE ((struct pm_message){ .event = PM_EVENT_HIBERNATE, })
  296. #define PMSG_RESUME ((struct pm_message){ .event = PM_EVENT_RESUME, })
  297. #define PMSG_THAW ((struct pm_message){ .event = PM_EVENT_THAW, })
  298. #define PMSG_RESTORE ((struct pm_message){ .event = PM_EVENT_RESTORE, })
  299. #define PMSG_RECOVER ((struct pm_message){ .event = PM_EVENT_RECOVER, })
  300. #define PMSG_USER_SUSPEND ((struct pm_message) \
  301. { .event = PM_EVENT_USER_SUSPEND, })
  302. #define PMSG_USER_RESUME ((struct pm_message) \
  303. { .event = PM_EVENT_USER_RESUME, })
  304. #define PMSG_REMOTE_RESUME ((struct pm_message) \
  305. { .event = PM_EVENT_REMOTE_RESUME, })
  306. #define PMSG_AUTO_SUSPEND ((struct pm_message) \
  307. { .event = PM_EVENT_AUTO_SUSPEND, })
  308. #define PMSG_AUTO_RESUME ((struct pm_message) \
  309. { .event = PM_EVENT_AUTO_RESUME, })
  310. /**
  311. * Device power management states
  312. *
  313. * These state labels are used internally by the PM core to indicate the current
  314. * status of a device with respect to the PM core operations.
  315. *
  316. * DPM_ON Device is regarded as operational. Set this way
  317. * initially and when ->complete() is about to be called.
  318. * Also set when ->prepare() fails.
  319. *
  320. * DPM_PREPARING Device is going to be prepared for a PM transition. Set
  321. * when ->prepare() is about to be called.
  322. *
  323. * DPM_RESUMING Device is going to be resumed. Set when ->resume(),
  324. * ->thaw(), or ->restore() is about to be called.
  325. *
  326. * DPM_SUSPENDING Device has been prepared for a power transition. Set
  327. * when ->prepare() has just succeeded.
  328. *
  329. * DPM_OFF Device is regarded as inactive. Set immediately after
  330. * ->suspend(), ->freeze(), or ->poweroff() has succeeded.
  331. * Also set when ->resume()_noirq, ->thaw_noirq(), or
  332. * ->restore_noirq() is about to be called.
  333. *
  334. * DPM_OFF_IRQ Device is in a "deep sleep". Set immediately after
  335. * ->suspend_noirq(), ->freeze_noirq(), or
  336. * ->poweroff_noirq() has just succeeded.
  337. */
  338. enum dpm_state {
  339. DPM_INVALID,
  340. DPM_ON,
  341. DPM_PREPARING,
  342. DPM_RESUMING,
  343. DPM_SUSPENDING,
  344. DPM_OFF,
  345. DPM_OFF_IRQ,
  346. };
  347. /**
  348. * Device run-time power management status.
  349. *
  350. * These status labels are used internally by the PM core to indicate the
  351. * current status of a device with respect to the PM core operations. They do
  352. * not reflect the actual power state of the device or its status as seen by the
  353. * driver.
  354. *
  355. * RPM_ACTIVE Device is fully operational. Indicates that the device
  356. * bus type's ->runtime_resume() callback has completed
  357. * successfully.
  358. *
  359. * RPM_SUSPENDED Device bus type's ->runtime_suspend() callback has
  360. * completed successfully. The device is regarded as
  361. * suspended.
  362. *
  363. * RPM_RESUMING Device bus type's ->runtime_resume() callback is being
  364. * executed.
  365. *
  366. * RPM_SUSPENDING Device bus type's ->runtime_suspend() callback is being
  367. * executed.
  368. */
  369. enum rpm_status {
  370. RPM_ACTIVE = 0,
  371. RPM_RESUMING,
  372. RPM_SUSPENDED,
  373. RPM_SUSPENDING,
  374. };
  375. /**
  376. * Device run-time power management request types.
  377. *
  378. * RPM_REQ_NONE Do nothing.
  379. *
  380. * RPM_REQ_IDLE Run the device bus type's ->runtime_idle() callback
  381. *
  382. * RPM_REQ_SUSPEND Run the device bus type's ->runtime_suspend() callback
  383. *
  384. * RPM_REQ_RESUME Run the device bus type's ->runtime_resume() callback
  385. */
  386. enum rpm_request {
  387. RPM_REQ_NONE = 0,
  388. RPM_REQ_IDLE,
  389. RPM_REQ_SUSPEND,
  390. RPM_REQ_RESUME,
  391. };
  392. struct dev_pm_info {
  393. pm_message_t power_state;
  394. unsigned int can_wakeup:1;
  395. unsigned int should_wakeup:1;
  396. unsigned async_suspend:1;
  397. enum dpm_state status; /* Owned by the PM core */
  398. #ifdef CONFIG_PM_SLEEP
  399. struct list_head entry;
  400. struct completion completion;
  401. #endif
  402. #ifdef CONFIG_PM_RUNTIME
  403. struct timer_list suspend_timer;
  404. unsigned long timer_expires;
  405. struct work_struct work;
  406. wait_queue_head_t wait_queue;
  407. spinlock_t lock;
  408. atomic_t usage_count;
  409. atomic_t child_count;
  410. unsigned int disable_depth:3;
  411. unsigned int ignore_children:1;
  412. unsigned int idle_notification:1;
  413. unsigned int request_pending:1;
  414. unsigned int deferred_resume:1;
  415. unsigned int run_wake:1;
  416. unsigned int runtime_auto:1;
  417. enum rpm_request request;
  418. enum rpm_status runtime_status;
  419. int runtime_error;
  420. #endif
  421. };
  422. /*
  423. * The PM_EVENT_ messages are also used by drivers implementing the legacy
  424. * suspend framework, based on the ->suspend() and ->resume() callbacks common
  425. * for suspend and hibernation transitions, according to the rules below.
  426. */
  427. /* Necessary, because several drivers use PM_EVENT_PRETHAW */
  428. #define PM_EVENT_PRETHAW PM_EVENT_QUIESCE
  429. /*
  430. * One transition is triggered by resume(), after a suspend() call; the
  431. * message is implicit:
  432. *
  433. * ON Driver starts working again, responding to hardware events
  434. * and software requests. The hardware may have gone through
  435. * a power-off reset, or it may have maintained state from the
  436. * previous suspend() which the driver will rely on while
  437. * resuming. On most platforms, there are no restrictions on
  438. * availability of resources like clocks during resume().
  439. *
  440. * Other transitions are triggered by messages sent using suspend(). All
  441. * these transitions quiesce the driver, so that I/O queues are inactive.
  442. * That commonly entails turning off IRQs and DMA; there may be rules
  443. * about how to quiesce that are specific to the bus or the device's type.
  444. * (For example, network drivers mark the link state.) Other details may
  445. * differ according to the message:
  446. *
  447. * SUSPEND Quiesce, enter a low power device state appropriate for
  448. * the upcoming system state (such as PCI_D3hot), and enable
  449. * wakeup events as appropriate.
  450. *
  451. * HIBERNATE Enter a low power device state appropriate for the hibernation
  452. * state (eg. ACPI S4) and enable wakeup events as appropriate.
  453. *
  454. * FREEZE Quiesce operations so that a consistent image can be saved;
  455. * but do NOT otherwise enter a low power device state, and do
  456. * NOT emit system wakeup events.
  457. *
  458. * PRETHAW Quiesce as if for FREEZE; additionally, prepare for restoring
  459. * the system from a snapshot taken after an earlier FREEZE.
  460. * Some drivers will need to reset their hardware state instead
  461. * of preserving it, to ensure that it's never mistaken for the
  462. * state which that earlier snapshot had set up.
  463. *
  464. * A minimally power-aware driver treats all messages as SUSPEND, fully
  465. * reinitializes its device during resume() -- whether or not it was reset
  466. * during the suspend/resume cycle -- and can't issue wakeup events.
  467. *
  468. * More power-aware drivers may also use low power states at runtime as
  469. * well as during system sleep states like PM_SUSPEND_STANDBY. They may
  470. * be able to use wakeup events to exit from runtime low-power states,
  471. * or from system low-power states such as standby or suspend-to-RAM.
  472. */
  473. #ifdef CONFIG_PM_SLEEP
  474. extern void device_pm_lock(void);
  475. extern int sysdev_resume(void);
  476. extern void dpm_resume_noirq(pm_message_t state);
  477. extern void dpm_resume_end(pm_message_t state);
  478. extern void device_pm_unlock(void);
  479. extern int sysdev_suspend(pm_message_t state);
  480. extern int dpm_suspend_noirq(pm_message_t state);
  481. extern int dpm_suspend_start(pm_message_t state);
  482. extern void __suspend_report_result(const char *function, void *fn, int ret);
  483. #define suspend_report_result(fn, ret) \
  484. do { \
  485. __suspend_report_result(__func__, fn, ret); \
  486. } while (0)
  487. extern void device_pm_wait_for_dev(struct device *sub, struct device *dev);
  488. #else /* !CONFIG_PM_SLEEP */
  489. #define device_pm_lock() do {} while (0)
  490. #define device_pm_unlock() do {} while (0)
  491. static inline int dpm_suspend_start(pm_message_t state)
  492. {
  493. return 0;
  494. }
  495. #define suspend_report_result(fn, ret) do {} while (0)
  496. static inline void device_pm_wait_for_dev(struct device *a, struct device *b) {}
  497. #endif /* !CONFIG_PM_SLEEP */
  498. /* How to reorder dpm_list after device_move() */
  499. enum dpm_order {
  500. DPM_ORDER_NONE,
  501. DPM_ORDER_DEV_AFTER_PARENT,
  502. DPM_ORDER_PARENT_BEFORE_DEV,
  503. DPM_ORDER_DEV_LAST,
  504. };
  505. /*
  506. * Global Power Management flags
  507. * Used to keep APM and ACPI from both being active
  508. */
  509. extern unsigned int pm_flags;
  510. #define PM_APM 1
  511. #define PM_ACPI 2
  512. #endif /* _LINUX_PM_H */