Lines Matching +full:post +full:- +full:processing

1 // SPDX-License-Identifier: GPL-2.0
3 #include <linux/blk-mq.h>
4 #include <linux/blk-pm.h>
7 #include "blk-mq.h"
8 #include "blk-mq-tag.h"
11 * blk_pm_runtime_init - Block layer runtime PM initialization routine
16 * Initialize runtime-PM-related fields for @q and start auto suspend for
17 * @dev. Drivers that want to take advantage of request-based runtime PM
24 * the autosuspend delay is set to -1 to make runtime suspend impossible
33 q->dev = dev; in blk_pm_runtime_init()
34 q->rpm_status = RPM_ACTIVE; in blk_pm_runtime_init()
35 pm_runtime_set_autosuspend_delay(q->dev, -1); in blk_pm_runtime_init()
36 pm_runtime_use_autosuspend(q->dev); in blk_pm_runtime_init()
41 * blk_pre_runtime_suspend - Pre runtime suspend check
58 * 0 - OK to runtime suspend the device
59 * -EBUSY - Device should not be runtime suspended
65 if (!q->dev) in blk_pre_runtime_suspend()
68 WARN_ON_ONCE(q->rpm_status != RPM_ACTIVE); in blk_pre_runtime_suspend()
70 spin_lock_irq(&q->queue_lock); in blk_pre_runtime_suspend()
71 q->rpm_status = RPM_SUSPENDING; in blk_pre_runtime_suspend()
72 spin_unlock_irq(&q->queue_lock); in blk_pre_runtime_suspend()
76 * non-PM blk_queue_enter() calls are in progress to avoid that any in blk_pre_runtime_suspend()
77 * new non-PM blk_queue_enter() calls succeed before the pm_only in blk_pre_runtime_suspend()
81 ret = -EBUSY; in blk_pre_runtime_suspend()
82 /* Switch q_usage_counter from per-cpu to atomic mode. */ in blk_pre_runtime_suspend()
87 * blk_queue_enter() calls see the pm-only state. See also in blk_pre_runtime_suspend()
90 percpu_ref_switch_to_atomic_sync(&q->q_usage_counter); in blk_pre_runtime_suspend()
91 if (percpu_ref_is_zero(&q->q_usage_counter)) in blk_pre_runtime_suspend()
93 /* Switch q_usage_counter back to per-cpu mode. */ in blk_pre_runtime_suspend()
97 spin_lock_irq(&q->queue_lock); in blk_pre_runtime_suspend()
98 q->rpm_status = RPM_ACTIVE; in blk_pre_runtime_suspend()
99 pm_runtime_mark_last_busy(q->dev); in blk_pre_runtime_suspend()
100 spin_unlock_irq(&q->queue_lock); in blk_pre_runtime_suspend()
110 * blk_post_runtime_suspend - Post runtime suspend processing
124 if (!q->dev) in blk_post_runtime_suspend()
127 spin_lock_irq(&q->queue_lock); in blk_post_runtime_suspend()
129 q->rpm_status = RPM_SUSPENDED; in blk_post_runtime_suspend()
131 q->rpm_status = RPM_ACTIVE; in blk_post_runtime_suspend()
132 pm_runtime_mark_last_busy(q->dev); in blk_post_runtime_suspend()
134 spin_unlock_irq(&q->queue_lock); in blk_post_runtime_suspend()
142 * blk_pre_runtime_resume - Pre runtime resume processing
154 if (!q->dev) in blk_pre_runtime_resume()
157 spin_lock_irq(&q->queue_lock); in blk_pre_runtime_resume()
158 q->rpm_status = RPM_RESUMING; in blk_pre_runtime_resume()
159 spin_unlock_irq(&q->queue_lock); in blk_pre_runtime_resume()
164 * blk_post_runtime_resume - Post runtime resume processing
170 * whether the device's runtime-resume succeeded; even if it failed the
183 * blk_set_runtime_active - Force runtime status of the queue to be active
189 * which is still "suspended". This prevents processing requests from the
193 * runtime PM status and re-enable peeking requests from the queue. It
203 if (!q->dev) in blk_set_runtime_active()
206 spin_lock_irq(&q->queue_lock); in blk_set_runtime_active()
207 old_status = q->rpm_status; in blk_set_runtime_active()
208 q->rpm_status = RPM_ACTIVE; in blk_set_runtime_active()
209 pm_runtime_mark_last_busy(q->dev); in blk_set_runtime_active()
210 pm_request_autosuspend(q->dev); in blk_set_runtime_active()
211 spin_unlock_irq(&q->queue_lock); in blk_set_runtime_active()