[RFC PATCH 10/21] amiflop: use lib tagset init helper

From: Chaitanya Kulkarni
Date: Tue Oct 04 2022 - 23:27:34 EST


Use the block layer helper to initialize the common fields of tag_set
such as blk_mq_ops, number of h/w queues, queue depth, command size,
numa_node, timeout, BLK_MQ_F_XXX flags, driver data. This initialization
is spread all over the block drivers. This avoids the code repetation of
the inialization code of the tag set in current block drivers and any
future ones.

Signed-off-by: Chaitanya Kulkarni <kch@xxxxxxxxxx>
---
drivers/block/amiflop.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/block/amiflop.c b/drivers/block/amiflop.c
index 4c8b2ba579ee..af3f9a4b46ab 100644
--- a/drivers/block/amiflop.c
+++ b/drivers/block/amiflop.c
@@ -1813,12 +1813,10 @@ static int fd_alloc_drive(int drive)
goto out;

memset(&unit[drive].tag_set, 0, sizeof(unit[drive].tag_set));
- unit[drive].tag_set.ops = &amiflop_mq_ops;
- unit[drive].tag_set.nr_hw_queues = 1;
+ blk_mq_init_tag_set(&unit[drive].tag_set, &amiflop_mq_ops, 1, 2, 0,
+ NUMA_NO_NODE, 0, BLK_MQ_F_SHOULD_MERGE, NULL);
unit[drive].tag_set.nr_maps = 1;
- unit[drive].tag_set.queue_depth = 2;
- unit[drive].tag_set.numa_node = NUMA_NO_NODE;
- unit[drive].tag_set.flags = BLK_MQ_F_SHOULD_MERGE;
+
if (blk_mq_alloc_tag_set(&unit[drive].tag_set))
goto out_cleanup_trackbuf;

--
2.29.0