···349349 PM core will skip the ``suspend``, ``suspend_late`` and350350 ``suspend_noirq`` phases as well as all of the corresponding phases of351351 the subsequent device resume for all of these devices. In that case,352352- the ``->complete`` callback will be invoked directly after the352352+ the ``->complete`` callback will be the next one invoked after the353353 ``->prepare`` callback and is entirely responsible for putting the354354 device into a consistent state as appropriate.355355···361361 runtime PM disabled.362362363363 This feature also can be controlled by device drivers by using the364364- ``DPM_FLAG_NEVER_SKIP`` and ``DPM_FLAG_SMART_PREPARE`` driver power365365- management flags. [Typically, they are set at the time the driver is366366- probed against the device in question by passing them to the364364+ ``DPM_FLAG_NO_DIRECT_COMPLETE`` and ``DPM_FLAG_SMART_PREPARE`` driver365365+ power management flags. [Typically, they are set at the time the driver366366+ is probed against the device in question by passing them to the367367 :c:func:`dev_pm_set_driver_flags` helper function.] If the first of368368 these flags is set, the PM core will not apply the direct-complete369369 procedure described above to the given device and, consequenty, to any···383383 ``->suspend`` methods provided by subsystems (bus types and PM domains384384 in particular) must follow an additional rule regarding what can be done385385 to the devices before their drivers' ``->suspend`` methods are called.386386- Namely, they can only resume the devices from runtime suspend by387387- calling :c:func:`pm_runtime_resume` for them, if that is necessary, and386386+ Namely, they may resume the devices from runtime suspend by387387+ calling :c:func:`pm_runtime_resume` for them, if that is necessary, but388388 they must not update the state of the devices in any other way at that389389 time (in case the drivers need to resume the devices from runtime390390- suspend in their ``->suspend`` methods).390390+ suspend in their ``->suspend`` methods). In fact, the PM core prevents391391+ subsystems or drivers from putting devices into runtime suspend at392392+ these times by calling :c:func:`pm_runtime_get_noresume` before issuing393393+ the ``->prepare`` callback (and calling :c:func:`pm_runtime_put` after394394+ issuing the ``->complete`` callback).391395392396 3. For a number of devices it is convenient to split suspend into the393397 "quiesce device" and "save device state" phases, in which cases···463459464460 Note, however, that new children may be registered below the device as465461 soon as the ``->resume`` callbacks occur; it's not necessary to wait466466- until the ``complete`` phase with that.462462+ until the ``complete`` phase runs.467463468464 Moreover, if the preceding ``->prepare`` callback returned a positive469465 number, the device may have been left in runtime suspend throughout the470470- whole system suspend and resume (the ``suspend``, ``suspend_late``,471471- ``suspend_noirq`` phases of system suspend and the ``resume_noirq``,472472- ``resume_early``, ``resume`` phases of system resume may have been473473- skipped for it). In that case, the ``->complete`` callback is entirely466466+ whole system suspend and resume (its ``->suspend``, ``->suspend_late``,467467+ ``->suspend_noirq``, ``->resume_noirq``,468468+ ``->resume_early``, and ``->resume`` callbacks may have been469469+ skipped). In that case, the ``->complete`` callback is entirely474470 responsible for putting the device into a consistent state after system475471 suspend if necessary. [For example, it may need to queue up a runtime476472 resume request for the device for this purpose.] To check if that is477473 the case, the ``->complete`` callback can consult the device's478478- ``power.direct_complete`` flag. Namely, if that flag is set when the479479- ``->complete`` callback is being run, it has been called directly after480480- the preceding ``->prepare`` and special actions may be required481481- to make the device work correctly afterward.474474+ ``power.direct_complete`` flag. If that flag is set when the475475+ ``->complete`` callback is being run then the direct-complete mechanism476476+ was used, and special actions may be required to make the device work477477+ correctly afterward.482478483479At the end of these phases, drivers should be as functional as they were before484480suspending: I/O can be performed using DMA and IRQs, and the relevant clocks are···579575580576The ``->poweroff``, ``->poweroff_late`` and ``->poweroff_noirq`` callbacks581577should do essentially the same things as the ``->suspend``, ``->suspend_late``582582-and ``->suspend_noirq`` callbacks, respectively. The only notable difference is578578+and ``->suspend_noirq`` callbacks, respectively. A notable difference is583579that they need not store the device register values, because the registers584580should already have been stored during the ``freeze``, ``freeze_late`` or585585-``freeze_noirq`` phases.581581+``freeze_noirq`` phases. Also, on many machines the firmware will power-down582582+the entire system, so it is not necessary for the callback to put the device in583583+a low-power state.586584587585588586Leaving Hibernation···770764771765If it is necessary to resume a device from runtime suspend during a system-wide772766transition into a sleep state, that can be done by calling773773-:c:func:`pm_runtime_resume` for it from the ``->suspend`` callback (or its774774-couterpart for transitions related to hibernation) of either the device's driver775775-or a subsystem responsible for it (for example, a bus type or a PM domain).776776-That is guaranteed to work by the requirement that subsystems must not change777777-the state of devices (possibly except for resuming them from runtime suspend)767767+:c:func:`pm_runtime_resume` from the ``->suspend`` callback (or the ``->freeze``768768+or ``->poweroff`` callback for transitions related to hibernation) of either the769769+device's driver or its subsystem (for example, a bus type or a PM domain).770770+However, subsystems must not otherwise change the runtime status of devices778771from their ``->prepare`` and ``->suspend`` callbacks (or equivalent) *before*779772invoking device drivers' ``->suspend`` callbacks (or equivalent).780773774774+.. _smart_suspend_flag:775775+776776+The ``DPM_FLAG_SMART_SUSPEND`` Driver Flag777777+------------------------------------------778778+781779Some bus types and PM domains have a policy to resume all devices from runtime782780suspend upfront in their ``->suspend`` callbacks, but that may not be really783783-necessary if the driver of the device can cope with runtime-suspended devices.784784-The driver can indicate that by setting ``DPM_FLAG_SMART_SUSPEND`` in785785-:c:member:`power.driver_flags` at the probe time, by passing it to the786786-:c:func:`dev_pm_set_driver_flags` helper. That also may cause middle-layer code781781+necessary if the device's driver can cope with runtime-suspended devices.782782+The driver can indicate this by setting ``DPM_FLAG_SMART_SUSPEND`` in783783+:c:member:`power.driver_flags` at probe time, with the assistance of the784784+:c:func:`dev_pm_set_driver_flags` helper routine.785785+786786+Setting that flag causes the PM core and middle-layer code787787(bus types, PM domains etc.) to skip the ``->suspend_late`` and788788``->suspend_noirq`` callbacks provided by the driver if the device remains in789789-runtime suspend at the beginning of the ``suspend_late`` phase of system-wide790790-suspend (or in the ``poweroff_late`` phase of hibernation), when runtime PM791791-has been disabled for it, under the assumption that its state should not change792792-after that point until the system-wide transition is over (the PM core itself793793-does that for devices whose "noirq", "late" and "early" system-wide PM callbacks794794-are executed directly by it). If that happens, the driver's system-wide resume795795-callbacks, if present, may still be invoked during the subsequent system-wide796796-resume transition and the device's runtime power management status may be set797797-to "active" before enabling runtime PM for it, so the driver must be prepared to798798-cope with the invocation of its system-wide resume callbacks back-to-back with799799-its ``->runtime_suspend`` one (without the intervening ``->runtime_resume`` and800800-so on) and the final state of the device must reflect the "active" runtime PM801801-status in that case.789789+runtime suspend throughout those phases of the system-wide suspend (and790790+similarly for the "freeze" and "poweroff" parts of system hibernation).791791+[Otherwise the same driver792792+callback might be executed twice in a row for the same device, which would not793793+be valid in general.] If the middle-layer system-wide PM callbacks are present794794+for the device then they are responsible for skipping these driver callbacks;795795+if not then the PM core skips them. The subsystem callback routines can796796+determine whether they need to skip the driver callbacks by testing the return797797+value from the :c:func:`dev_pm_skip_suspend` helper function.798798+799799+In addition, with ``DPM_FLAG_SMART_SUSPEND`` set, the driver's ``->thaw_noirq``800800+and ``->thaw_early`` callbacks are skipped in hibernation if the device remained801801+in runtime suspend throughout the preceding "freeze" transition. Again, if the802802+middle-layer callbacks are present for the device, they are responsible for803803+doing this, otherwise the PM core takes care of it.804804+805805+806806+The ``DPM_FLAG_MAY_SKIP_RESUME`` Driver Flag807807+--------------------------------------------802808803809During system-wide resume from a sleep state it's easiest to put devices into804810the full-power state, as explained in :file:`Documentation/power/runtime_pm.rst`.805811[Refer to that document for more information regarding this particular issue as806812well as for information on the device runtime power management framework in807807-general.]808808-809809-However, it often is desirable to leave devices in suspend after system810810-transitions to the working state, especially if those devices had been in813813+general.] However, it often is desirable to leave devices in suspend after814814+system transitions to the working state, especially if those devices had been in811815runtime suspend before the preceding system-wide suspend (or analogous)812812-transition. Device drivers can use the ``DPM_FLAG_LEAVE_SUSPENDED`` flag to813813-indicate to the PM core (and middle-layer code) that they prefer the specific814814-devices handled by them to be left suspended and they have no problems with815815-skipping their system-wide resume callbacks for this reason. Whether or not the816816-devices will actually be left in suspend may depend on their state before the817817-given system suspend-resume cycle and on the type of the system transition under818818-way. In particular, devices are not left suspended if that transition is a819819-restore from hibernation, as device states are not guaranteed to be reflected820820-by the information stored in the hibernation image in that case.816816+transition.821817822822-The middle-layer code involved in the handling of the device is expected to823823-indicate to the PM core if the device may be left in suspend by setting its824824-:c:member:`power.may_skip_resume` status bit which is checked by the PM core825825-during the "noirq" phase of the preceding system-wide suspend (or analogous)826826-transition. The middle layer is then responsible for handling the device as827827-appropriate in its "noirq" resume callback, which is executed regardless of828828-whether or not the device is left suspended, but the other resume callbacks829829-(except for ``->complete``) will be skipped automatically by the PM core if the830830-device really can be left in suspend.818818+To that end, device drivers can use the ``DPM_FLAG_MAY_SKIP_RESUME`` flag to819819+indicate to the PM core and middle-layer code that they allow their "noirq" and820820+"early" resume callbacks to be skipped if the device can be left in suspend821821+after system-wide PM transitions to the working state. Whether or not that is822822+the case generally depends on the state of the device before the given system823823+suspend-resume cycle and on the type of the system transition under way.824824+In particular, the "thaw" and "restore" transitions related to hibernation are825825+not affected by ``DPM_FLAG_MAY_SKIP_RESUME`` at all. [All callbacks are826826+issued during the "restore" transition regardless of the flag settings,827827+and whether or not any driver callbacks828828+are skipped during the "thaw" transition depends whether or not the829829+``DPM_FLAG_SMART_SUSPEND`` flag is set (see `above <smart_suspend_flag_>`_).830830+In addition, a device is not allowed to remain in runtime suspend if any of its831831+children will be returned to full power.]831832832832-For devices whose "noirq", "late" and "early" driver callbacks are invoked833833-directly by the PM core, all of the system-wide resume callbacks are skipped if834834-``DPM_FLAG_LEAVE_SUSPENDED`` is set and the device is in runtime suspend during835835-the ``suspend_noirq`` (or analogous) phase or the transition under way is a836836-proper system suspend (rather than anything related to hibernation) and the837837-device's wakeup settings are suitable for runtime PM (that is, it cannot838838-generate wakeup signals at all or it is allowed to wake up the system from839839-sleep).833833+The ``DPM_FLAG_MAY_SKIP_RESUME`` flag is taken into account in combination with834834+the :c:member:`power.may_skip_resume` status bit set by the PM core during the835835+"suspend" phase of suspend-type transitions. If the driver or the middle layer836836+has a reason to prevent the driver's "noirq" and "early" resume callbacks from837837+being skipped during the subsequent system resume transition, it should838838+clear :c:member:`power.may_skip_resume` in its ``->suspend``, ``->suspend_late``839839+or ``->suspend_noirq`` callback. [Note that the drivers setting840840+``DPM_FLAG_SMART_SUSPEND`` need to clear :c:member:`power.may_skip_resume` in841841+their ``->suspend`` callback in case the other two are skipped.]842842+843843+Setting the :c:member:`power.may_skip_resume` status bit along with the844844+``DPM_FLAG_MAY_SKIP_RESUME`` flag is necessary, but generally not sufficient,845845+for the driver's "noirq" and "early" resume callbacks to be skipped. Whether or846846+not they should be skipped can be determined by evaluating the847847+:c:func:`dev_pm_skip_resume` helper function.848848+849849+If that function returns ``true``, the driver's "noirq" and "early" resume850850+callbacks should be skipped and the device's runtime PM status will be set to851851+"suspended" by the PM core. Otherwise, if the device was runtime-suspended852852+during the preceding system-wide suspend transition and its853853+``DPM_FLAG_SMART_SUSPEND`` is set, its runtime PM status will be set to854854+"active" by the PM core. [Hence, the drivers that do not set855855+``DPM_FLAG_SMART_SUSPEND`` should not expect the runtime PM status of their856856+devices to be changed from "suspended" to "active" by the PM core during857857+system-wide resume-type transitions.]858858+859859+If the ``DPM_FLAG_MAY_SKIP_RESUME`` flag is not set for a device, but860860+``DPM_FLAG_SMART_SUSPEND`` is set and the driver's "late" and "noirq" suspend861861+callbacks are skipped, its system-wide "noirq" and "early" resume callbacks, if862862+present, are invoked as usual and the device's runtime PM status is set to863863+"active" by the PM core before enabling runtime PM for it. In that case, the864864+driver must be prepared to cope with the invocation of its system-wide resume865865+callbacks back-to-back with its ``->runtime_suspend`` one (without the866866+intervening ``->runtime_resume`` and system-wide suspend callbacks) and the867867+final state of the device must reflect the "active" runtime PM status in that868868+case. [Note that this is not a problem at all if the driver's869869+``->suspend_late`` callback pointer points to the same function as its870870+``->runtime_suspend`` one and its ``->resume_early`` callback pointer points to871871+the same function as the ``->runtime_resume`` one, while none of the other872872+system-wide suspend-resume callbacks of the driver are present, for example.]873873+874874+Likewise, if ``DPM_FLAG_MAY_SKIP_RESUME`` is set for a device, its driver's875875+system-wide "noirq" and "early" resume callbacks may be skipped while its "late"876876+and "noirq" suspend callbacks may have been executed (in principle, regardless877877+of whether or not ``DPM_FLAG_SMART_SUSPEND`` is set). In that case, the driver878878+needs to be able to cope with the invocation of its ``->runtime_resume``879879+callback back-to-back with its "late" and "noirq" suspend ones. [For instance,880880+that is not a concern if the driver sets both ``DPM_FLAG_SMART_SUSPEND`` and881881+``DPM_FLAG_MAY_SKIP_RESUME`` and uses the same pair of suspend/resume callback882882+functions for runtime PM and system-wide suspend/resume.]
+26-28
Documentation/power/pci.rst
···10041004time with the help of the dev_pm_set_driver_flags() function and they should not10051005be updated directly afterwards.1006100610071007-The DPM_FLAG_NEVER_SKIP flag prevents the PM core from using the direct-complete10081008-mechanism allowing device suspend/resume callbacks to be skipped if the device10091009-is in runtime suspend when the system suspend starts. That also affects all of10101010-the ancestors of the device, so this flag should only be used if absolutely10111011-necessary.10071007+The DPM_FLAG_NO_DIRECT_COMPLETE flag prevents the PM core from using the10081008+direct-complete mechanism allowing device suspend/resume callbacks to be skipped10091009+if the device is in runtime suspend when the system suspend starts. That also10101010+affects all of the ancestors of the device, so this flag should only be used if10111011+absolutely necessary.1012101210131013-The DPM_FLAG_SMART_PREPARE flag instructs the PCI bus type to only return a10141014-positive value from pci_pm_prepare() if the ->prepare callback provided by the10131013+The DPM_FLAG_SMART_PREPARE flag causes the PCI bus type to return a positive10141014+value from pci_pm_prepare() only if the ->prepare callback provided by the10151015driver of the device returns a positive value. That allows the driver to opt10161016-out from using the direct-complete mechanism dynamically.10161016+out from using the direct-complete mechanism dynamically (whereas setting10171017+DPM_FLAG_NO_DIRECT_COMPLETE means permanent opt-out).1017101810181019The DPM_FLAG_SMART_SUSPEND flag tells the PCI bus type that from the driver's10191020perspective the device can be safely left in runtime suspend during system10201021suspend. That causes pci_pm_suspend(), pci_pm_freeze() and pci_pm_poweroff()10211021-to skip resuming the device from runtime suspend unless there are PCI-specific10221022-reasons for doing that. Also, it causes pci_pm_suspend_late/noirq(),10231023-pci_pm_freeze_late/noirq() and pci_pm_poweroff_late/noirq() to return early10241024-if the device remains in runtime suspend in the beginning of the "late" phase10251025-of the system-wide transition under way. Moreover, if the device is in10261026-runtime suspend in pci_pm_resume_noirq() or pci_pm_restore_noirq(), its runtime10271027-power management status will be changed to "active" (as it is going to be put10281028-into D0 going forward), but if it is in runtime suspend in pci_pm_thaw_noirq(),10291029-the function will set the power.direct_complete flag for it (to make the PM core10301030-skip the subsequent "thaw" callbacks for it) and return.10221022+to avoid resuming the device from runtime suspend unless there are PCI-specific10231023+reasons for doing that. Also, it causes pci_pm_suspend_late/noirq() and10241024+pci_pm_poweroff_late/noirq() to return early if the device remains in runtime10251025+suspend during the "late" phase of the system-wide transition under way.10261026+Moreover, if the device is in runtime suspend in pci_pm_resume_noirq() or10271027+pci_pm_restore_noirq(), its runtime PM status will be changed to "active" (as it10281028+is going to be put into D0 going forward).1031102910321032-Setting the DPM_FLAG_LEAVE_SUSPENDED flag means that the driver prefers the10331033-device to be left in suspend after system-wide transitions to the working state.10341034-This flag is checked by the PM core, but the PCI bus type informs the PM core10351035-which devices may be left in suspend from its perspective (that happens during10361036-the "noirq" phase of system-wide suspend and analogous transitions) and next it10371037-uses the dev_pm_may_skip_resume() helper to decide whether or not to return from10381038-pci_pm_resume_noirq() early, as the PM core will skip the remaining resume10391039-callbacks for the device during the transition under way and will set its10401040-runtime PM status to "suspended" if dev_pm_may_skip_resume() returns "true" for10411041-it.10301030+Setting the DPM_FLAG_MAY_SKIP_RESUME flag means that the driver allows its10311031+"noirq" and "early" resume callbacks to be skipped if the device can be left10321032+in suspend after a system-wide transition into the working state. This flag is10331033+taken into consideration by the PM core along with the power.may_skip_resume10341034+status bit of the device which is set by pci_pm_suspend_noirq() in certain10351035+situations. If the PM core determines that the driver's "noirq" and "early"10361036+resume callbacks should be skipped, the dev_pm_skip_resume() helper function10371037+will return "true" and that will cause pci_pm_resume_noirq() and10381038+pci_pm_resume_early() to return upfront without touching the device and10391039+executing the driver callbacks.10421040104310413.2. Device Runtime Power Management10441042------------------------------------
+7-7
drivers/acpi/acpi_lpss.c
···10411041{10421042 int ret;1043104310441044- if (dev_pm_smart_suspend_and_suspended(dev))10441044+ if (dev_pm_skip_suspend(dev))10451045 return 0;1046104610471047 ret = pm_generic_suspend_late(dev);···10931093 if (pdata->dev_desc->resume_from_noirq)10941094 return 0;1095109510961096+ if (dev_pm_skip_resume(dev))10971097+ return 0;10981098+10961099 return acpi_lpss_do_resume_early(dev);10971100}10981101···11051102 int ret;1106110311071104 /* Follow acpi_subsys_resume_noirq(). */11081108- if (dev_pm_may_skip_resume(dev))11051105+ if (dev_pm_skip_resume(dev))11091106 return 0;11101110-11111111- if (dev_pm_smart_suspend_and_suspended(dev))11121112- pm_runtime_set_active(dev);1113110711141108 ret = pm_generic_resume_noirq(dev);11151109 if (ret)···11691169{11701170 struct lpss_private_data *pdata = acpi_driver_data(ACPI_COMPANION(dev));1171117111721172- if (dev_pm_smart_suspend_and_suspended(dev))11721172+ if (dev_pm_skip_suspend(dev))11731173 return 0;1174117411751175 if (pdata->dev_desc->resume_from_noirq)···11821182{11831183 struct lpss_private_data *pdata = acpi_driver_data(ACPI_COMPANION(dev));1184118411851185- if (dev_pm_smart_suspend_and_suspended(dev))11851185+ if (dev_pm_skip_suspend(dev))11861186 return 0;1187118711881188 if (pdata->dev_desc->resume_from_noirq) {
+1-1
drivers/acpi/acpi_tad.c
···624624 */625625 device_init_wakeup(dev, true);626626 dev_pm_set_driver_flags(dev, DPM_FLAG_SMART_SUSPEND |627627- DPM_FLAG_LEAVE_SUSPENDED);627627+ DPM_FLAG_MAY_SKIP_RESUME);628628 /*629629 * The platform bus type layer tells the ACPI PM domain powers up the630630 * device, so set the runtime PM status of it to "active".
+13-18
drivers/acpi/device_pm.c
···10841084{10851085 int ret;1086108610871087- if (dev_pm_smart_suspend_and_suspended(dev))10871087+ if (dev_pm_skip_suspend(dev))10881088 return 0;1089108910901090 ret = pm_generic_suspend_late(dev);···11001100{11011101 int ret;1102110211031103- if (dev_pm_smart_suspend_and_suspended(dev)) {11041104- dev->power.may_skip_resume = true;11031103+ if (dev_pm_skip_suspend(dev))11051104 return 0;11061106- }1107110511081106 ret = pm_generic_suspend_noirq(dev);11091107 if (ret)···11141116 * acpi_subsys_complete() to take care of fixing up the device's state11151117 * anyway, if need be.11161118 */11171117- dev->power.may_skip_resume = device_may_wakeup(dev) ||11181118- !device_can_wakeup(dev);11191119+ if (device_can_wakeup(dev) && !device_may_wakeup(dev))11201120+ dev->power.may_skip_resume = false;1119112111201122 return 0;11211123}···11271129 */11281130static int acpi_subsys_resume_noirq(struct device *dev)11291131{11301130- if (dev_pm_may_skip_resume(dev))11321132+ if (dev_pm_skip_resume(dev))11311133 return 0;11321132-11331133- /*11341134- * Devices with DPM_FLAG_SMART_SUSPEND may be left in runtime suspend11351135- * during system suspend, so update their runtime PM status to "active"11361136- * as they will be put into D0 going forward.11371137- */11381138- if (dev_pm_smart_suspend_and_suspended(dev))11391139- pm_runtime_set_active(dev);1140113411411135 return pm_generic_resume_noirq(dev);11421136}···11431153 */11441154static int acpi_subsys_resume_early(struct device *dev)11451155{11461146- int ret = acpi_dev_resume(dev);11561156+ int ret;11571157+11581158+ if (dev_pm_skip_resume(dev))11591159+ return 0;11601160+11611161+ ret = acpi_dev_resume(dev);11471162 return ret ? ret : pm_generic_resume_early(dev);11481163}11491164···12131218{12141219 int ret;1215122012161216- if (dev_pm_smart_suspend_and_suspended(dev))12211221+ if (dev_pm_skip_suspend(dev))12171222 return 0;1218122312191224 ret = pm_generic_poweroff_late(dev);···12291234 */12301235static int acpi_subsys_poweroff_noirq(struct device *dev)12311236{12321232- if (dev_pm_smart_suspend_and_suspended(dev))12371237+ if (dev_pm_skip_suspend(dev))12331238 return 0;1234123912351240 return pm_generic_poweroff_noirq(dev);
+113-239
drivers/base/power/main.c
···562562/*------------------------- Resume routines -------------------------*/563563564564/**565565- * suspend_event - Return a "suspend" message for given "resume" one.566566- * @resume_msg: PM message representing a system-wide resume transition.567567- */568568-static pm_message_t suspend_event(pm_message_t resume_msg)569569-{570570- switch (resume_msg.event) {571571- case PM_EVENT_RESUME:572572- return PMSG_SUSPEND;573573- case PM_EVENT_THAW:574574- case PM_EVENT_RESTORE:575575- return PMSG_FREEZE;576576- case PM_EVENT_RECOVER:577577- return PMSG_HIBERNATE;578578- }579579- return PMSG_ON;580580-}581581-582582-/**583583- * dev_pm_may_skip_resume - System-wide device resume optimization check.565565+ * dev_pm_skip_resume - System-wide device resume optimization check.584566 * @dev: Target device.585567 *586586- * Checks whether or not the device may be left in suspend after a system-wide587587- * transition to the working state.568568+ * Return:569569+ * - %false if the transition under way is RESTORE.570570+ * - Return value of dev_pm_skip_suspend() if the transition under way is THAW.571571+ * - The logical negation of %power.must_resume otherwise (that is, when the572572+ * transition under way is RESUME).588573 */589589-bool dev_pm_may_skip_resume(struct device *dev)574574+bool dev_pm_skip_resume(struct device *dev)590575{591591- return !dev->power.must_resume && pm_transition.event != PM_EVENT_RESTORE;576576+ if (pm_transition.event == PM_EVENT_RESTORE)577577+ return false;578578+579579+ if (pm_transition.event == PM_EVENT_THAW)580580+ return dev_pm_skip_suspend(dev);581581+582582+ return !dev->power.must_resume;592583}593593-594594-static pm_callback_t dpm_subsys_resume_noirq_cb(struct device *dev,595595- pm_message_t state,596596- const char **info_p)597597-{598598- pm_callback_t callback;599599- const char *info;600600-601601- if (dev->pm_domain) {602602- info = "noirq power domain ";603603- callback = pm_noirq_op(&dev->pm_domain->ops, state);604604- } else if (dev->type && dev->type->pm) {605605- info = "noirq type ";606606- callback = pm_noirq_op(dev->type->pm, state);607607- } else if (dev->class && dev->class->pm) {608608- info = "noirq class ";609609- callback = pm_noirq_op(dev->class->pm, state);610610- } else if (dev->bus && dev->bus->pm) {611611- info = "noirq bus ";612612- callback = pm_noirq_op(dev->bus->pm, state);613613- } else {614614- return NULL;615615- }616616-617617- if (info_p)618618- *info_p = info;619619-620620- return callback;621621-}622622-623623-static pm_callback_t dpm_subsys_suspend_noirq_cb(struct device *dev,624624- pm_message_t state,625625- const char **info_p);626626-627627-static pm_callback_t dpm_subsys_suspend_late_cb(struct device *dev,628628- pm_message_t state,629629- const char **info_p);630584631585/**632586 * device_resume_noirq - Execute a "noirq resume" callback for given device.···593639 */594640static int device_resume_noirq(struct device *dev, pm_message_t state, bool async)595641{596596- pm_callback_t callback;597597- const char *info;642642+ pm_callback_t callback = NULL;643643+ const char *info = NULL;598644 bool skip_resume;599645 int error = 0;600646···610656 if (!dpm_wait_for_superior(dev, async))611657 goto Out;612658613613- skip_resume = dev_pm_may_skip_resume(dev);659659+ skip_resume = dev_pm_skip_resume(dev);660660+ /*661661+ * If the driver callback is skipped below or by the middle layer662662+ * callback and device_resume_early() also skips the driver callback for663663+ * this device later, it needs to appear as "suspended" to PM-runtime,664664+ * so change its status accordingly.665665+ *666666+ * Otherwise, the device is going to be resumed, so set its PM-runtime667667+ * status to "active", but do that only if DPM_FLAG_SMART_SUSPEND is set668668+ * to avoid confusing drivers that don't use it.669669+ */670670+ if (skip_resume)671671+ pm_runtime_set_suspended(dev);672672+ else if (dev_pm_skip_suspend(dev))673673+ pm_runtime_set_active(dev);614674615615- callback = dpm_subsys_resume_noirq_cb(dev, state, &info);675675+ if (dev->pm_domain) {676676+ info = "noirq power domain ";677677+ callback = pm_noirq_op(&dev->pm_domain->ops, state);678678+ } else if (dev->type && dev->type->pm) {679679+ info = "noirq type ";680680+ callback = pm_noirq_op(dev->type->pm, state);681681+ } else if (dev->class && dev->class->pm) {682682+ info = "noirq class ";683683+ callback = pm_noirq_op(dev->class->pm, state);684684+ } else if (dev->bus && dev->bus->pm) {685685+ info = "noirq bus ";686686+ callback = pm_noirq_op(dev->bus->pm, state);687687+ }616688 if (callback)617689 goto Run;618690619691 if (skip_resume)620692 goto Skip;621621-622622- if (dev_pm_smart_suspend_and_suspended(dev)) {623623- pm_message_t suspend_msg = suspend_event(state);624624-625625- /*626626- * If "freeze" callbacks have been skipped during a transition627627- * related to hibernation, the subsequent "thaw" callbacks must628628- * be skipped too or bad things may happen. Otherwise, resume629629- * callbacks are going to be run for the device, so its runtime630630- * PM status must be changed to reflect the new state after the631631- * transition under way.632632- */633633- if (!dpm_subsys_suspend_late_cb(dev, suspend_msg, NULL) &&634634- !dpm_subsys_suspend_noirq_cb(dev, suspend_msg, NULL)) {635635- if (state.event == PM_EVENT_THAW) {636636- skip_resume = true;637637- goto Skip;638638- } else {639639- pm_runtime_set_active(dev);640640- }641641- }642642- }643693644694 if (dev->driver && dev->driver->pm) {645695 info = "noirq driver ";···655697656698Skip:657699 dev->power.is_noirq_suspended = false;658658-659659- if (skip_resume) {660660- /* Make the next phases of resume skip the device. */661661- dev->power.is_late_suspended = false;662662- dev->power.is_suspended = false;663663- /*664664- * The device is going to be left in suspend, but it might not665665- * have been in runtime suspend before the system suspended, so666666- * its runtime PM status needs to be updated to avoid confusing667667- * the runtime PM framework when runtime PM is enabled for the668668- * device again.669669- */670670- pm_runtime_set_suspended(dev);671671- }672700673701Out:674702 complete_all(&dev->power.completion);···754810 cpuidle_resume();755811}756812757757-static pm_callback_t dpm_subsys_resume_early_cb(struct device *dev,758758- pm_message_t state,759759- const char **info_p)760760-{761761- pm_callback_t callback;762762- const char *info;763763-764764- if (dev->pm_domain) {765765- info = "early power domain ";766766- callback = pm_late_early_op(&dev->pm_domain->ops, state);767767- } else if (dev->type && dev->type->pm) {768768- info = "early type ";769769- callback = pm_late_early_op(dev->type->pm, state);770770- } else if (dev->class && dev->class->pm) {771771- info = "early class ";772772- callback = pm_late_early_op(dev->class->pm, state);773773- } else if (dev->bus && dev->bus->pm) {774774- info = "early bus ";775775- callback = pm_late_early_op(dev->bus->pm, state);776776- } else {777777- return NULL;778778- }779779-780780- if (info_p)781781- *info_p = info;782782-783783- return callback;784784-}785785-786813/**787814 * device_resume_early - Execute an "early resume" callback for given device.788815 * @dev: Device to handle.···764849 */765850static int device_resume_early(struct device *dev, pm_message_t state, bool async)766851{767767- pm_callback_t callback;768768- const char *info;852852+ pm_callback_t callback = NULL;853853+ const char *info = NULL;769854 int error = 0;770855771856 TRACE_DEVICE(dev);···780865 if (!dpm_wait_for_superior(dev, async))781866 goto Out;782867783783- callback = dpm_subsys_resume_early_cb(dev, state, &info);868868+ if (dev->pm_domain) {869869+ info = "early power domain ";870870+ callback = pm_late_early_op(&dev->pm_domain->ops, state);871871+ } else if (dev->type && dev->type->pm) {872872+ info = "early type ";873873+ callback = pm_late_early_op(dev->type->pm, state);874874+ } else if (dev->class && dev->class->pm) {875875+ info = "early class ";876876+ callback = pm_late_early_op(dev->class->pm, state);877877+ } else if (dev->bus && dev->bus->pm) {878878+ info = "early bus ";879879+ callback = pm_late_early_op(dev->bus->pm, state);880880+ }881881+ if (callback)882882+ goto Run;784883785785- if (!callback && dev->driver && dev->driver->pm) {884884+ if (dev_pm_skip_resume(dev))885885+ goto Skip;886886+887887+ if (dev->driver && dev->driver->pm) {786888 info = "early driver ";787889 callback = pm_late_early_op(dev->driver->pm, state);788890 }789891892892+Run:790893 error = dpm_run_callback(callback, dev, state, info);894894+895895+Skip:791896 dev->power.is_late_suspended = false;792897793793- Out:898898+Out:794899 TRACE_RESUME(error);795900796901 pm_runtime_enable(dev);···11801245 device_links_read_unlock(idx);11811246}1182124711831183-static pm_callback_t dpm_subsys_suspend_noirq_cb(struct device *dev,11841184- pm_message_t state,11851185- const char **info_p)11861186-{11871187- pm_callback_t callback;11881188- const char *info;11891189-11901190- if (dev->pm_domain) {11911191- info = "noirq power domain ";11921192- callback = pm_noirq_op(&dev->pm_domain->ops, state);11931193- } else if (dev->type && dev->type->pm) {11941194- info = "noirq type ";11951195- callback = pm_noirq_op(dev->type->pm, state);11961196- } else if (dev->class && dev->class->pm) {11971197- info = "noirq class ";11981198- callback = pm_noirq_op(dev->class->pm, state);11991199- } else if (dev->bus && dev->bus->pm) {12001200- info = "noirq bus ";12011201- callback = pm_noirq_op(dev->bus->pm, state);12021202- } else {12031203- return NULL;12041204- }12051205-12061206- if (info_p)12071207- *info_p = info;12081208-12091209- return callback;12101210-}12111211-12121212-static bool device_must_resume(struct device *dev, pm_message_t state,12131213- bool no_subsys_suspend_noirq)12141214-{12151215- pm_message_t resume_msg = resume_event(state);12161216-12171217- /*12181218- * If all of the device driver's "noirq", "late" and "early" callbacks12191219- * are invoked directly by the core, the decision to allow the device to12201220- * stay in suspend can be based on its current runtime PM status and its12211221- * wakeup settings.12221222- */12231223- if (no_subsys_suspend_noirq &&12241224- !dpm_subsys_suspend_late_cb(dev, state, NULL) &&12251225- !dpm_subsys_resume_early_cb(dev, resume_msg, NULL) &&12261226- !dpm_subsys_resume_noirq_cb(dev, resume_msg, NULL))12271227- return !pm_runtime_status_suspended(dev) &&12281228- (resume_msg.event != PM_EVENT_RESUME ||12291229- (device_can_wakeup(dev) && !device_may_wakeup(dev)));12301230-12311231- /*12321232- * The only safe strategy here is to require that if the device may not12331233- * be left in suspend, resume callbacks must be invoked for it.12341234- */12351235- return !dev->power.may_skip_resume;12361236-}12371237-12381248/**12391249 * __device_suspend_noirq - Execute a "noirq suspend" callback for given device.12401250 * @dev: Device to handle.···11911311 */11921312static int __device_suspend_noirq(struct device *dev, pm_message_t state, bool async)11931313{11941194- pm_callback_t callback;11951195- const char *info;11961196- bool no_subsys_cb = false;13141314+ pm_callback_t callback = NULL;13151315+ const char *info = NULL;11971316 int error = 0;1198131711991318 TRACE_DEVICE(dev);···12061327 if (dev->power.syscore || dev->power.direct_complete)12071328 goto Complete;1208132912091209- callback = dpm_subsys_suspend_noirq_cb(dev, state, &info);13301330+ if (dev->pm_domain) {13311331+ info = "noirq power domain ";13321332+ callback = pm_noirq_op(&dev->pm_domain->ops, state);13331333+ } else if (dev->type && dev->type->pm) {13341334+ info = "noirq type ";13351335+ callback = pm_noirq_op(dev->type->pm, state);13361336+ } else if (dev->class && dev->class->pm) {13371337+ info = "noirq class ";13381338+ callback = pm_noirq_op(dev->class->pm, state);13391339+ } else if (dev->bus && dev->bus->pm) {13401340+ info = "noirq bus ";13411341+ callback = pm_noirq_op(dev->bus->pm, state);13421342+ }12101343 if (callback)12111344 goto Run;1212134512131213- no_subsys_cb = !dpm_subsys_suspend_late_cb(dev, state, NULL);12141214-12151215- if (dev_pm_smart_suspend_and_suspended(dev) && no_subsys_cb)13461346+ if (dev_pm_skip_suspend(dev))12161347 goto Skip;1217134812181349 if (dev->driver && dev->driver->pm) {···12401351Skip:12411352 dev->power.is_noirq_suspended = true;1242135312431243- if (dev_pm_test_driver_flags(dev, DPM_FLAG_LEAVE_SUSPENDED)) {12441244- dev->power.must_resume = dev->power.must_resume ||12451245- atomic_read(&dev->power.usage_count) > 1 ||12461246- device_must_resume(dev, state, no_subsys_cb);12471247- } else {13541354+ /*13551355+ * Skipping the resume of devices that were in use right before the13561356+ * system suspend (as indicated by their PM-runtime usage counters)13571357+ * would be suboptimal. Also resume them if doing that is not allowed13581358+ * to be skipped.13591359+ */13601360+ if (atomic_read(&dev->power.usage_count) > 1 ||13611361+ !(dev_pm_test_driver_flags(dev, DPM_FLAG_MAY_SKIP_RESUME) &&13621362+ dev->power.may_skip_resume))12481363 dev->power.must_resume = true;12491249- }1250136412511365 if (dev->power.must_resume)12521366 dpm_superior_set_must_resume(dev);···13661474 spin_unlock_irq(&parent->power.lock);13671475}1368147613691369-static pm_callback_t dpm_subsys_suspend_late_cb(struct device *dev,13701370- pm_message_t state,13711371- const char **info_p)13721372-{13731373- pm_callback_t callback;13741374- const char *info;13751375-13761376- if (dev->pm_domain) {13771377- info = "late power domain ";13781378- callback = pm_late_early_op(&dev->pm_domain->ops, state);13791379- } else if (dev->type && dev->type->pm) {13801380- info = "late type ";13811381- callback = pm_late_early_op(dev->type->pm, state);13821382- } else if (dev->class && dev->class->pm) {13831383- info = "late class ";13841384- callback = pm_late_early_op(dev->class->pm, state);13851385- } else if (dev->bus && dev->bus->pm) {13861386- info = "late bus ";13871387- callback = pm_late_early_op(dev->bus->pm, state);13881388- } else {13891389- return NULL;13901390- }13911391-13921392- if (info_p)13931393- *info_p = info;13941394-13951395- return callback;13961396-}13971397-13981477/**13991478 * __device_suspend_late - Execute a "late suspend" callback for given device.14001479 * @dev: Device to handle.···13761513 */13771514static int __device_suspend_late(struct device *dev, pm_message_t state, bool async)13781515{13791379- pm_callback_t callback;13801380- const char *info;15161516+ pm_callback_t callback = NULL;15171517+ const char *info = NULL;13811518 int error = 0;1382151913831520 TRACE_DEVICE(dev);···13981535 if (dev->power.syscore || dev->power.direct_complete)13991536 goto Complete;1400153714011401- callback = dpm_subsys_suspend_late_cb(dev, state, &info);15381538+ if (dev->pm_domain) {15391539+ info = "late power domain ";15401540+ callback = pm_late_early_op(&dev->pm_domain->ops, state);15411541+ } else if (dev->type && dev->type->pm) {15421542+ info = "late type ";15431543+ callback = pm_late_early_op(dev->type->pm, state);15441544+ } else if (dev->class && dev->class->pm) {15451545+ info = "late class ";15461546+ callback = pm_late_early_op(dev->class->pm, state);15471547+ } else if (dev->bus && dev->bus->pm) {15481548+ info = "late bus ";15491549+ callback = pm_late_early_op(dev->bus->pm, state);15501550+ }14021551 if (callback)14031552 goto Run;1404155314051405- if (dev_pm_smart_suspend_and_suspended(dev) &&14061406- !dpm_subsys_suspend_noirq_cb(dev, state, NULL))15541554+ if (dev_pm_skip_suspend(dev))14071555 goto Skip;1408155614091557 if (dev->driver && dev->driver->pm) {···16401766 dev->power.direct_complete = false;16411767 }1642176816431643- dev->power.may_skip_resume = false;17691769+ dev->power.may_skip_resume = true;16441770 dev->power.must_resume = false;1645177116461772 dpm_watchdog_set(&wd, dev);···18441970 spin_lock_irq(&dev->power.lock);18451971 dev->power.direct_complete = state.event == PM_EVENT_SUSPEND &&18461972 (ret > 0 || dev->power.no_pm_callbacks) &&18471847- !dev_pm_test_driver_flags(dev, DPM_FLAG_NEVER_SKIP);19731973+ !dev_pm_test_driver_flags(dev, DPM_FLAG_NO_DIRECT_COMPLETE);18481974 spin_unlock_irq(&dev->power.lock);18491975 return 0;18501976}···20022128 spin_unlock_irq(&dev->power.lock);20032129}2004213020052005-bool dev_pm_smart_suspend_and_suspended(struct device *dev)21312131+bool dev_pm_skip_suspend(struct device *dev)20062132{20072133 return dev_pm_test_driver_flags(dev, DPM_FLAG_SMART_SUSPEND) &&20082134 pm_runtime_status_suspended(dev);
···549549 * becaue the HDA driver may require us to enable the audio power550550 * domain during system suspend.551551 */552552- dev_pm_set_driver_flags(kdev, DPM_FLAG_NEVER_SKIP);552552+ dev_pm_set_driver_flags(kdev, DPM_FLAG_NO_DIRECT_COMPLETE);553553554554 pm_runtime_set_autosuspend_delay(kdev, 10000); /* 10s */555555 pm_runtime_mark_last_busy(kdev);
···357357 if (dev->flags & ACCESS_NO_IRQ_SUSPEND) {358358 dev_pm_set_driver_flags(&pdev->dev,359359 DPM_FLAG_SMART_PREPARE |360360- DPM_FLAG_LEAVE_SUSPENDED);360360+ DPM_FLAG_MAY_SKIP_RESUME);361361 } else {362362 dev_pm_set_driver_flags(&pdev->dev,363363 DPM_FLAG_SMART_PREPARE |364364 DPM_FLAG_SMART_SUSPEND |365365- DPM_FLAG_LEAVE_SUSPENDED);365365+ DPM_FLAG_MAY_SKIP_RESUME);366366 }367367368368 /* The code below assumes runtime PM to be disabled. */
+1-1
drivers/misc/mei/pci-me.c
···241241 * MEI requires to resume from runtime suspend mode242242 * in order to perform link reset flow upon system suspend.243243 */244244- dev_pm_set_driver_flags(&pdev->dev, DPM_FLAG_NEVER_SKIP);244244+ dev_pm_set_driver_flags(&pdev->dev, DPM_FLAG_NO_DIRECT_COMPLETE);245245246246 /*247247 * ME maps runtime suspend/resume to D0i states,
+1-1
drivers/misc/mei/pci-txe.c
···128128 * MEI requires to resume from runtime suspend mode129129 * in order to perform link reset flow upon system suspend.130130 */131131- dev_pm_set_driver_flags(&pdev->dev, DPM_FLAG_NEVER_SKIP);131131+ dev_pm_set_driver_flags(&pdev->dev, DPM_FLAG_NO_DIRECT_COMPLETE);132132133133 /*134134 * TXE maps runtime suspend/resume to own power gating states,
···275275 * If the port is already runtime suspended we can keep it that276276 * way.277277 */278278- if (dev_pm_smart_suspend_and_suspended(&dev->port->dev))278278+ if (dev_pm_skip_suspend(&dev->port->dev))279279 return 0;280280281281 pciehp_disable_interrupt(dev);
+17-17
drivers/pci/pci-driver.c
···776776777777static int pci_pm_suspend_late(struct device *dev)778778{779779- if (dev_pm_smart_suspend_and_suspended(dev))779779+ if (dev_pm_skip_suspend(dev))780780 return 0;781781782782 pci_fixup_device(pci_fixup_suspend, to_pci_dev(dev));···789789 struct pci_dev *pci_dev = to_pci_dev(dev);790790 const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;791791792792- if (dev_pm_smart_suspend_and_suspended(dev)) {793793- dev->power.may_skip_resume = true;792792+ if (dev_pm_skip_suspend(dev))794793 return 0;795795- }796794797795 if (pci_has_legacy_pm_support(pci_dev))798796 return pci_legacy_suspend_late(dev, PMSG_SUSPEND);···878880 * pci_pm_complete() to take care of fixing up the device's state879881 * anyway, if need be.880882 */881881- dev->power.may_skip_resume = device_may_wakeup(dev) ||882882- !device_can_wakeup(dev);883883+ if (device_can_wakeup(dev) && !device_may_wakeup(dev))884884+ dev->power.may_skip_resume = false;883885884886 return 0;885887}···891893 pci_power_t prev_state = pci_dev->current_state;892894 bool skip_bus_pm = pci_dev->skip_bus_pm;893895894894- if (dev_pm_may_skip_resume(dev))896896+ if (dev_pm_skip_resume(dev))895897 return 0;896896-897897- /*898898- * Devices with DPM_FLAG_SMART_SUSPEND may be left in runtime suspend899899- * during system suspend, so update their runtime PM status to "active"900900- * as they are going to be put into D0 shortly.901901- */902902- if (dev_pm_smart_suspend_and_suspended(dev))903903- pm_runtime_set_active(dev);904898905899 /*906900 * In the suspend-to-idle case, devices left in D0 during suspend will···916926 return pm->resume_noirq(dev);917927918928 return 0;929929+}930930+931931+static int pci_pm_resume_early(struct device *dev)932932+{933933+ if (dev_pm_skip_resume(dev))934934+ return 0;935935+936936+ return pm_generic_resume_early(dev);919937}920938921939static int pci_pm_resume(struct device *dev)···959961#define pci_pm_suspend_late NULL960962#define pci_pm_suspend_noirq NULL961963#define pci_pm_resume NULL964964+#define pci_pm_resume_early NULL962965#define pci_pm_resume_noirq NULL963966964967#endif /* !CONFIG_SUSPEND */···1126112711271128static int pci_pm_poweroff_late(struct device *dev)11281129{11291129- if (dev_pm_smart_suspend_and_suspended(dev))11301130+ if (dev_pm_skip_suspend(dev))11301131 return 0;1131113211321133 pci_fixup_device(pci_fixup_suspend, to_pci_dev(dev));···11391140 struct pci_dev *pci_dev = to_pci_dev(dev);11401141 const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;1141114211421142- if (dev_pm_smart_suspend_and_suspended(dev))11431143+ if (dev_pm_skip_suspend(dev))11431144 return 0;1144114511451146 if (pci_has_legacy_pm_support(pci_dev))···13571358 .suspend = pci_pm_suspend,13581359 .suspend_late = pci_pm_suspend_late,13591360 .resume = pci_pm_resume,13611361+ .resume_early = pci_pm_resume_early,13601362 .freeze = pci_pm_freeze,13611363 .thaw = pci_pm_thaw,13621364 .poweroff = pci_pm_poweroff,
···544544 * These flags can be set by device drivers at the probe time. They need not be545545 * cleared by the drivers as the driver core will take care of that.546546 *547547- * NEVER_SKIP: Do not skip all system suspend/resume callbacks for the device.548548- * SMART_PREPARE: Check the return value of the driver's ->prepare callback.549549- * SMART_SUSPEND: No need to resume the device from runtime suspend.550550- * LEAVE_SUSPENDED: Avoid resuming the device during system resume if possible.547547+ * NO_DIRECT_COMPLETE: Do not apply direct-complete optimization to the device.548548+ * SMART_PREPARE: Take the driver ->prepare callback return value into account.549549+ * SMART_SUSPEND: Avoid resuming the device from runtime suspend.550550+ * MAY_SKIP_RESUME: Allow driver "noirq" and "early" callbacks to be skipped.551551 *552552- * Setting SMART_PREPARE instructs bus types and PM domains which may want553553- * system suspend/resume callbacks to be skipped for the device to return 0 from554554- * their ->prepare callbacks if the driver's ->prepare callback returns 0 (in555555- * other words, the system suspend/resume callbacks can only be skipped for the556556- * device if its driver doesn't object against that). This flag has no effect557557- * if NEVER_SKIP is set.558558- *559559- * Setting SMART_SUSPEND instructs bus types and PM domains which may want to560560- * runtime resume the device upfront during system suspend that doing so is not561561- * necessary from the driver's perspective. It also may cause them to skip562562- * invocations of the ->suspend_late and ->suspend_noirq callbacks provided by563563- * the driver if they decide to leave the device in runtime suspend.564564- *565565- * Setting LEAVE_SUSPENDED informs the PM core and middle-layer code that the566566- * driver prefers the device to be left in suspend after system resume.552552+ * See Documentation/driver-api/pm/devices.rst for details.567553 */568568-#define DPM_FLAG_NEVER_SKIP BIT(0)554554+#define DPM_FLAG_NO_DIRECT_COMPLETE BIT(0)569555#define DPM_FLAG_SMART_PREPARE BIT(1)570556#define DPM_FLAG_SMART_SUSPEND BIT(2)571571-#define DPM_FLAG_LEAVE_SUSPENDED BIT(3)557557+#define DPM_FLAG_MAY_SKIP_RESUME BIT(3)572558573559struct dev_pm_info {574560 pm_message_t power_state;···744758extern int pm_generic_poweroff(struct device *dev);745759extern void pm_generic_complete(struct device *dev);746760747747-extern bool dev_pm_may_skip_resume(struct device *dev);748748-extern bool dev_pm_smart_suspend_and_suspended(struct device *dev);761761+extern bool dev_pm_skip_resume(struct device *dev);762762+extern bool dev_pm_skip_suspend(struct device *dev);749763750764#else /* !CONFIG_PM_SLEEP */751765