diff options
Diffstat (limited to 'block')
-rw-r--r-- | block/blk-core.c | 8 | ||||
-rw-r--r-- | block/blk.h | 5 | ||||
-rw-r--r-- | block/bsg.c | 4 | ||||
-rw-r--r-- | block/genhd.c | 2 |
4 files changed, 11 insertions, 8 deletions
diff --git a/block/blk-core.c b/block/blk-core.c index af7301581172..fd4749391e17 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -626,14 +626,14 @@ blk_init_allocated_queue_node(struct request_queue *q, request_fn_proc *rfn, } EXPORT_SYMBOL(blk_init_allocated_queue_node); -int blk_get_queue(struct request_queue *q) +bool blk_get_queue(struct request_queue *q) { if (likely(!blk_queue_dead(q))) { - kobject_get(&q->kobj); - return 0; + __blk_get_queue(q); + return true; } - return 1; + return false; } EXPORT_SYMBOL(blk_get_queue); diff --git a/block/blk.h b/block/blk.h index fc3c41b2fd24..8d421156fefb 100644 --- a/block/blk.h +++ b/block/blk.h @@ -13,6 +13,11 @@ extern struct kmem_cache *blk_requestq_cachep; extern struct kobj_type blk_queue_ktype; extern struct ida blk_queue_ida; +static inline void __blk_get_queue(struct request_queue *q) +{ + kobject_get(&q->kobj); +} + void init_request_from_bio(struct request *req, struct bio *bio); void blk_rq_bio_prep(struct request_queue *q, struct request *rq, struct bio *bio); diff --git a/block/bsg.c b/block/bsg.c index 702f1316bb8f..167d586cece6 100644 --- a/block/bsg.c +++ b/block/bsg.c @@ -769,12 +769,10 @@ static struct bsg_device *bsg_add_device(struct inode *inode, struct file *file) { struct bsg_device *bd; - int ret; #ifdef BSG_DEBUG unsigned char buf[32]; #endif - ret = blk_get_queue(rq); - if (ret) + if (!blk_get_queue(rq)) return ERR_PTR(-ENXIO); bd = bsg_alloc_device(); diff --git a/block/genhd.c b/block/genhd.c index 02e9fca80825..c958169d24f0 100644 --- a/block/genhd.c +++ b/block/genhd.c @@ -615,7 +615,7 @@ void add_disk(struct gendisk *disk) * Take an extra ref on queue which will be put on disk_release() * so that it sticks around as long as @disk is there. */ - WARN_ON_ONCE(blk_get_queue(disk->queue)); + WARN_ON_ONCE(!blk_get_queue(disk->queue)); retval = sysfs_create_link(&disk_to_dev(disk)->kobj, &bdi->dev->kobj, "bdi"); |