Commit d6da83d0 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

loop: remove the l argument to loop_add

None of the callers cares about the allocated struct loop_device.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarChaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Link: https://lore.kernel.org/r/20210623145908.92973-4-hch@lst.deSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent bd5c39ed
......@@ -2237,7 +2237,7 @@ static const struct blk_mq_ops loop_mq_ops = {
.complete = lo_complete_rq,
};
static int loop_add(struct loop_device **l, int i)
static int loop_add(int i)
{
struct loop_device *lo;
struct gendisk *disk;
......@@ -2326,7 +2326,6 @@ static int loop_add(struct loop_device **l, int i)
disk->queue = lo->lo_queue;
sprintf(disk->disk_name, "loop%d", i);
add_disk(disk);
*l = lo;
return lo->lo_number;
out_cleanup_tags:
......@@ -2396,7 +2395,7 @@ static void loop_probe(dev_t dev)
mutex_lock(&loop_ctl_mutex);
if (loop_lookup(&lo, idx) < 0)
loop_add(&lo, idx);
loop_add(idx);
mutex_unlock(&loop_ctl_mutex);
}
......@@ -2418,7 +2417,7 @@ static long loop_control_ioctl(struct file *file, unsigned int cmd,
ret = -EEXIST;
break;
}
ret = loop_add(&lo, parm);
ret = loop_add(parm);
break;
case LOOP_CTL_REMOVE:
ret = loop_lookup(&lo, parm);
......@@ -2446,7 +2445,7 @@ static long loop_control_ioctl(struct file *file, unsigned int cmd,
ret = loop_lookup(&lo, -1);
if (ret >= 0)
break;
ret = loop_add(&lo, -1);
ret = loop_add(-1);
}
mutex_unlock(&loop_ctl_mutex);
......@@ -2473,7 +2472,6 @@ MODULE_ALIAS("devname:loop-control");
static int __init loop_init(void)
{
int i, nr;
struct loop_device *lo;
int err;
part_shift = 0;
......@@ -2527,7 +2525,7 @@ static int __init loop_init(void)
/* pre-create number of devices given by config or max_loop */
mutex_lock(&loop_ctl_mutex);
for (i = 0; i < nr; i++)
loop_add(&lo, i);
loop_add(i);
mutex_unlock(&loop_ctl_mutex);
printk(KERN_INFO "loop: module loaded\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment