diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2020-08-06 16:50:07 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2020-08-06 16:50:07 -0700 |
commit | dfdf16ecfd6abafc22b7f02364d9bb879ca8a5ee (patch) | |
tree | 634f3ddf9bacc60daddc01366a78420c9a86e66e /block | |
parent | d7806bbd22cabc3e3b0a985cfcffa29cf156bb30 (diff) | |
parent | bf1a28f92a8b00ee8ce48cc11338980e31ddb7b3 (diff) |
Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull SCSI updates from James Bottomley:
"This consists of the usual driver updates (ufs, qla2xxx, tcmu, lpfc,
hpsa, zfcp, scsi_debug) and minor bug fixes.
We also have a huge docbook fix update like most other subsystems and
no major update to the core (the few non trivial updates are either
minor fixes or removing an unused feature [scsi_sdb_cache])"
* tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (307 commits)
scsi: scsi_transport_srp: Sanitize scsi_target_block/unblock sequences
scsi: ufs-mediatek: Apply DELAY_AFTER_LPM quirk to Micron devices
scsi: ufs: Introduce device quirk "DELAY_AFTER_LPM"
scsi: virtio-scsi: Correctly handle the case where all LUNs are unplugged
scsi: scsi_debug: Implement tur_ms_to_ready parameter
scsi: scsi_debug: Fix request sense
scsi: lpfc: Fix typo in comment for ULP
scsi: ufs-mediatek: Prevent LPM operation on undeclared VCC
scsi: iscsi: Do not put host in iscsi_set_flashnode_param()
scsi: hpsa: Correct ctrl queue depth
scsi: target: tcmu: Make TMR notification optional
scsi: target: tcmu: Implement tmr_notify callback
scsi: target: tcmu: Fix and simplify timeout handling
scsi: target: tcmu: Factor out new helper ring_insert_padding
scsi: target: tcmu: Do not queue aborted commands
scsi: target: tcmu: Use priv pointer in se_cmd
scsi: target: Add tmr_notify backend function
scsi: target: Modify core_tmr_abort_task()
scsi: target: iscsi: Fix inconsistent debug message
scsi: target: iscsi: Fix login error when receiving
...
Diffstat (limited to 'block')
-rw-r--r-- | block/blk-pm.c | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/block/blk-pm.c b/block/blk-pm.c index 1adc1cd748b4..b85234d758f7 100644 --- a/block/blk-pm.c +++ b/block/blk-pm.c @@ -164,9 +164,8 @@ EXPORT_SYMBOL(blk_pre_runtime_resume); * * Description: * Update the queue's runtime status according to the return value of the - * device's runtime_resume function. If it is successfully resumed, process - * the requests that are queued into the device's queue when it is resuming - * and then mark last busy and initiate autosuspend for it. + * device's runtime_resume function. If the resume was successful, call + * blk_set_runtime_active() to do the real work of restarting the queue. * * This function should be called near the end of the device's * runtime_resume callback. @@ -175,19 +174,13 @@ void blk_post_runtime_resume(struct request_queue *q, int err) { if (!q->dev) return; - - spin_lock_irq(&q->queue_lock); if (!err) { - q->rpm_status = RPM_ACTIVE; - pm_runtime_mark_last_busy(q->dev); - pm_request_autosuspend(q->dev); + blk_set_runtime_active(q); } else { + spin_lock_irq(&q->queue_lock); q->rpm_status = RPM_SUSPENDED; + spin_unlock_irq(&q->queue_lock); } - spin_unlock_irq(&q->queue_lock); - - if (!err) - blk_clear_pm_only(q); } EXPORT_SYMBOL(blk_post_runtime_resume); @@ -204,15 +197,25 @@ EXPORT_SYMBOL(blk_post_runtime_resume); * This function can be used in driver's resume hook to correct queue * runtime PM status and re-enable peeking requests from the queue. It * should be called before first request is added to the queue. + * + * This function is also called by blk_post_runtime_resume() for successful + * runtime resumes. It does everything necessary to restart the queue. */ void blk_set_runtime_active(struct request_queue *q) { - if (q->dev) { - spin_lock_irq(&q->queue_lock); - q->rpm_status = RPM_ACTIVE; - pm_runtime_mark_last_busy(q->dev); - pm_request_autosuspend(q->dev); - spin_unlock_irq(&q->queue_lock); - } + int old_status; + + if (!q->dev) + return; + + spin_lock_irq(&q->queue_lock); + old_status = q->rpm_status; + q->rpm_status = RPM_ACTIVE; + pm_runtime_mark_last_busy(q->dev); + pm_request_autosuspend(q->dev); + spin_unlock_irq(&q->queue_lock); + + if (old_status != RPM_ACTIVE) + blk_clear_pm_only(q); } EXPORT_SYMBOL(blk_set_runtime_active); |