diff mbox

[2/4] blk-mq-debug: Avoid that sparse complains about req_flags_t usage

Message ID 20170201182059.25601-3-bart.vanassche@sandisk.com (mailing list archive)
State New, archived
Headers show

Commit Message

Bart Van Assche Feb. 1, 2017, 6:20 p.m. UTC
Avoid that sparse reports the following complaints:

block/elevator.c:541:29: warning: incorrect type in assignment (different base types)
block/elevator.c:541:29:    expected bool [unsigned] [usertype] next_sorted
block/elevator.c:541:29:    got restricted req_flags_t

block/blk-mq-debugfs.c:92:54: warning: cast from restricted req_flags_t

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Cc: Omar Sandoval <osandov@fb.com>
---
 block/blk-mq-debugfs.c | 3 ++-
 block/elevator.c       | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

Comments

Omar Sandoval Feb. 1, 2017, 7:08 p.m. UTC | #1
On Wed, Feb 01, 2017 at 10:20:57AM -0800, Bart Van Assche wrote:
> Avoid that sparse reports the following complaints:
> 
> block/elevator.c:541:29: warning: incorrect type in assignment (different base types)
> block/elevator.c:541:29:    expected bool [unsigned] [usertype] next_sorted
> block/elevator.c:541:29:    got restricted req_flags_t
> 
> block/blk-mq-debugfs.c:92:54: warning: cast from restricted req_flags_t

Reviewed-by: Omar Sandoval <osandov@fb.com>

> Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
> Cc: Omar Sandoval <osandov@fb.com>
> ---
>  block/blk-mq-debugfs.c | 3 ++-
>  block/elevator.c       | 2 +-
>  2 files changed, 3 insertions(+), 2 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-block" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/block/blk-mq-debugfs.c b/block/blk-mq-debugfs.c
index 7bcd4b6edf83..aece9116b4f6 100644
--- a/block/blk-mq-debugfs.c
+++ b/block/blk-mq-debugfs.c
@@ -89,7 +89,8 @@  static int blk_mq_debugfs_rq_show(struct seq_file *m, void *v)
 	struct request *rq = list_entry_rq(v);
 
 	seq_printf(m, "%p {.cmd_type=%u, .cmd_flags=0x%x, .rq_flags=0x%x, .tag=%d, .internal_tag=%d}\n",
-		   rq, rq->cmd_type, rq->cmd_flags, (unsigned int)rq->rq_flags,
+		   rq, rq->cmd_type, rq->cmd_flags,
+		   (__force unsigned int)rq->rq_flags,
 		   rq->tag, rq->internal_tag);
 	return 0;
 }
diff --git a/block/elevator.c b/block/elevator.c
index ef7f59469acc..9138efeee0c8 100644
--- a/block/elevator.c
+++ b/block/elevator.c
@@ -538,7 +538,7 @@  void elv_merge_requests(struct request_queue *q, struct request *rq,
 	if (e->uses_mq && e->type->ops.mq.requests_merged)
 		e->type->ops.mq.requests_merged(q, rq, next);
 	else if (e->type->ops.sq.elevator_merge_req_fn) {
-		next_sorted = next->rq_flags & RQF_SORTED;
+		next_sorted = (__force bool)(next->rq_flags & RQF_SORTED);
 		if (next_sorted)
 			e->type->ops.sq.elevator_merge_req_fn(q, rq, next);
 	}