Lines Matching refs:new

276 int add_mtd_blktrans_dev(struct mtd_blktrans_dev *new)  in add_mtd_blktrans_dev()  argument
278 struct mtd_blktrans_ops *tr = new->tr; in add_mtd_blktrans_dev()
288 if (new->devnum == -1) { in add_mtd_blktrans_dev()
292 new->devnum = last_devnum+1; in add_mtd_blktrans_dev()
293 list_add_tail(&new->list, &d->list); in add_mtd_blktrans_dev()
296 } else if (d->devnum == new->devnum) { in add_mtd_blktrans_dev()
299 } else if (d->devnum > new->devnum) { in add_mtd_blktrans_dev()
301 list_add_tail(&new->list, &d->list); in add_mtd_blktrans_dev()
308 if (new->devnum == -1) in add_mtd_blktrans_dev()
309 new->devnum = last_devnum+1; in add_mtd_blktrans_dev()
314 if (new->devnum > (MINORMASK >> tr->part_bits) || in add_mtd_blktrans_dev()
315 (tr->part_bits && new->devnum >= 27 * 26)) in add_mtd_blktrans_dev()
318 list_add_tail(&new->list, &tr->devs); in add_mtd_blktrans_dev()
321 mutex_init(&new->lock); in add_mtd_blktrans_dev()
322 kref_init(&new->ref); in add_mtd_blktrans_dev()
324 new->readonly = 1; in add_mtd_blktrans_dev()
327 new->tag_set = kzalloc(sizeof(*new->tag_set), GFP_KERNEL); in add_mtd_blktrans_dev()
328 if (!new->tag_set) in add_mtd_blktrans_dev()
331 ret = blk_mq_alloc_sq_tag_set(new->tag_set, &mtd_mq_ops, 2, in add_mtd_blktrans_dev()
343 gd = blk_mq_alloc_disk(new->tag_set, &lim, new); in add_mtd_blktrans_dev()
349 new->disk = gd; in add_mtd_blktrans_dev()
350 new->rq = new->disk->queue; in add_mtd_blktrans_dev()
351 gd->private_data = new; in add_mtd_blktrans_dev()
353 gd->first_minor = (new->devnum) << tr->part_bits; in add_mtd_blktrans_dev()
358 if (new->devnum < 26) in add_mtd_blktrans_dev()
360 "%s%c", tr->name, 'a' + new->devnum); in add_mtd_blktrans_dev()
364 'a' - 1 + new->devnum / 26, in add_mtd_blktrans_dev()
365 'a' + new->devnum % 26); in add_mtd_blktrans_dev()
368 "%s%d", tr->name, new->devnum); in add_mtd_blktrans_dev()
372 set_capacity(gd, ((u64)new->size * tr->blksize) >> 9); in add_mtd_blktrans_dev()
375 spin_lock_init(&new->queue_lock); in add_mtd_blktrans_dev()
376 INIT_LIST_HEAD(&new->rq_list); in add_mtd_blktrans_dev()
377 gd->queue = new->rq; in add_mtd_blktrans_dev()
379 if (new->readonly) in add_mtd_blktrans_dev()
382 ret = device_add_disk(&new->mtd->dev, gd, NULL); in add_mtd_blktrans_dev()
386 if (new->disk_attributes) { in add_mtd_blktrans_dev()
388 new->disk_attributes); in add_mtd_blktrans_dev()
394 put_disk(new->disk); in add_mtd_blktrans_dev()
396 blk_mq_free_tag_set(new->tag_set); in add_mtd_blktrans_dev()
398 kfree(new->tag_set); in add_mtd_blktrans_dev()
400 list_del(&new->list); in add_mtd_blktrans_dev()