X-Git-Url: http://git.cascardo.info/?a=blobdiff_plain;f=block%2Fblk-core.c;h=827f8badd143fbf7571b608264571691af6686c5;hb=fcab86add71623e3963d7565c0d61bb9d99aea7c;hp=45f4d7efbf349efa77f8c9d425e1d0ece4fbd9d4;hpb=48d10bda1f2c69980601a61194015bb0790fb7ab;p=cascardo%2Flinux.git diff --git a/block/blk-core.c b/block/blk-core.c index 45f4d7efbf34..827f8badd143 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -3529,6 +3529,30 @@ void blk_post_runtime_resume(struct request_queue *q, int err) spin_unlock_irq(q->queue_lock); } EXPORT_SYMBOL(blk_post_runtime_resume); + +/** + * blk_set_runtime_active - Force runtime status of the queue to be active + * @q: the queue of the device + * + * If the device is left runtime suspended during system suspend the resume + * hook typically resumes the device and corrects runtime status + * accordingly. However, that does not affect the queue runtime PM status + * which is still "suspended". This prevents processing requests from the + * queue. + * + * 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. + */ +void blk_set_runtime_active(struct request_queue *q) +{ + 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); +} +EXPORT_SYMBOL(blk_set_runtime_active); #endif int __init blk_dev_init(void)