@@ -13,8 +13,10 @@ static inline void blk_pm_requeue_request(struct request *rq)
static inline void blk_pm_add_request(struct request_queue *q,
struct request *rq)
{
- if (q->dev && !(rq->rq_flags & RQF_PREEMPT) &&
- (q->rpm_status == RPM_SUSPENDED || q->rpm_status == RPM_SUSPENDING))
+ if (!q->dev || (rq->rq_flags & RQF_PREEMPT))
+ return;
+ WARN_ON_ONCE(atomic_read(&q->dev->power.usage_count) == 0);
+ if (q->rpm_status == RPM_SUSPENDED || q->rpm_status == RPM_SUSPENDING)
pm_request_resume(q->dev);
}
Make it easier to determine from which code path a pm_runtime_get*() call is missing by issuing a warning if such a call is missing. Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com> Cc: Christoph Hellwig <hch@lst.de> Cc: Jianchao Wang <jianchao.w.wang@oracle.com> Cc: Ming Lei <ming.lei@redhat.com> Cc: Alan Stern <stern@rowland.harvard.edu> Cc: Johannes Thumshirn <jthumshirn@suse.de> --- block/blk-pm.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)