A bit cost has to be added in fast IO path for supporting runtime PM, and introduce this helper so that drivers incapable of runtime PM may not be affected by this feature. Cc: "Rafael J. Wysocki" <rjw@xxxxxxxxxxxxx> Cc: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> Cc: linux-pm@xxxxxxxxxxxxxxx Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> Cc: Christoph Hellwig <hch@xxxxxx> Cc: Bart Van Assche <bart.vanassche@xxxxxxx> Cc: "James E.J. Bottomley" <jejb@xxxxxxxxxxxxxxxxxx> Cc: "Martin K. Petersen" <martin.petersen@xxxxxxxxxx> Cc: linux-scsi@xxxxxxxxxxxxxxx Signed-off-by: Ming Lei <ming.lei@xxxxxxxxxx> --- include/linux/blk-mq.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h index d710e92874cc..998ad6602448 100644 --- a/include/linux/blk-mq.h +++ b/include/linux/blk-mq.h @@ -180,6 +180,7 @@ enum { BLK_MQ_F_SHOULD_MERGE = 1 << 0, BLK_MQ_F_TAG_SHARED = 1 << 1, BLK_MQ_F_SG_MERGE = 1 << 2, + BLK_MQ_F_SUPPORT_RPM = 1 << 3, BLK_MQ_F_BLOCKING = 1 << 5, BLK_MQ_F_NO_SCHED = 1 << 6, BLK_MQ_F_ALLOC_POLICY_START_BIT = 8, @@ -249,6 +250,15 @@ static inline u16 blk_mq_unique_tag_to_tag(u32 unique_tag) return unique_tag & BLK_MQ_UNIQUE_TAG_MASK; } +static inline bool blk_mq_support_runtime_pm(struct request_queue *q) +{ + struct blk_mq_tag_set *set = q->tag_set; + + if (!q->dev || !set || !(set->flags & BLK_MQ_F_SUPPORT_RPM)) + return false; + + return true; +} int blk_mq_request_started(struct request *rq); void blk_mq_start_request(struct request *rq); -- 2.9.5