null_blk: Improve nullb_device_##NAME##_store() readability
authorBart Van Assche <bvanassche@acm.org>
Mon, 30 Sep 2019 23:00:46 +0000 (16:00 -0700)
committerJens Axboe <axboe@kernel.dk>
Mon, 7 Oct 2019 14:32:08 +0000 (08:32 -0600)
Introduce a local variable to make the code easier to read. This patch
does not change any functionality but makes the next patch in this
series easier to read.

Cc: Christoph Hellwig <hch@infradead.org>
Cc: Ming Lei <ming.lei@redhat.com>
Cc: Hannes Reinecke <hare@suse.com>
Cc: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/null_blk_main.c

index 0e7da5015ccd5f8a7d6314d24eb8bfd52b15d4c9..f5747cfd806feb5c17059176475363b97410e429 100644 (file)
@@ -274,10 +274,11 @@ static ssize_t                                                                    \
 nullb_device_##NAME##_store(struct config_item *item, const char *page,                \
                            size_t count)                                       \
 {                                                                              \
-       if (test_bit(NULLB_DEV_FL_CONFIGURED, &to_nullb_device(item)->flags))   \
+       struct nullb_device *dev = to_nullb_device(item);                       \
+                                                                               \
+       if (test_bit(NULLB_DEV_FL_CONFIGURED, &dev->flags))                     \
                return -EBUSY;                                                  \
-       return nullb_device_##TYPE##_attr_store(                                \
-                       &to_nullb_device(item)->NAME, page, count);             \
+       return nullb_device_##TYPE##_attr_store(&dev->NAME, page, count);       \
 }                                                                              \
 CONFIGFS_ATTR(nullb_device_, NAME);