Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 
0003 #ifndef _BLOCK_BLK_PM_H_
0004 #define _BLOCK_BLK_PM_H_
0005 
0006 #include <linux/pm_runtime.h>
0007 
0008 #ifdef CONFIG_PM
0009 static inline int blk_pm_resume_queue(const bool pm, struct request_queue *q)
0010 {
0011     if (!q->dev || !blk_queue_pm_only(q))
0012         return 1;   /* Nothing to do */
0013     if (pm && q->rpm_status != RPM_SUSPENDED)
0014         return 1;   /* Request allowed */
0015     pm_request_resume(q->dev);
0016     return 0;
0017 }
0018 
0019 static inline void blk_pm_mark_last_busy(struct request *rq)
0020 {
0021     if (rq->q->dev && !(rq->rq_flags & RQF_PM))
0022         pm_runtime_mark_last_busy(rq->q->dev);
0023 }
0024 #else
0025 static inline int blk_pm_resume_queue(const bool pm, struct request_queue *q)
0026 {
0027     return 1;
0028 }
0029 
0030 static inline void blk_pm_mark_last_busy(struct request *rq)
0031 {
0032 }
0033 #endif
0034 
0035 #endif /* _BLOCK_BLK_PM_H_ */