blk-pm.h 763 B

1234567891011121314151617181920212223242526272829303132333435
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _BLOCK_BLK_PM_H_
  3. #define _BLOCK_BLK_PM_H_
  4. #include <linux/pm_runtime.h>
  5. #ifdef CONFIG_PM
  6. static inline int blk_pm_resume_queue(const bool pm, struct request_queue *q)
  7. {
  8. if (!q->dev || !blk_queue_pm_only(q))
  9. return 1; /* Nothing to do */
  10. if (pm && q->rpm_status != RPM_SUSPENDED)
  11. return 1; /* Request allowed */
  12. pm_request_resume(q->dev);
  13. return 0;
  14. }
  15. static inline void blk_pm_mark_last_busy(struct request *rq)
  16. {
  17. if (rq->q->dev && !(rq->rq_flags & RQF_PM))
  18. pm_runtime_mark_last_busy(rq->q->dev);
  19. }
  20. #else
  21. static inline int blk_pm_resume_queue(const bool pm, struct request_queue *q)
  22. {
  23. return 1;
  24. }
  25. static inline void blk_pm_mark_last_busy(struct request *rq)
  26. {
  27. }
  28. #endif
  29. #endif /* _BLOCK_BLK_PM_H_ */