Lines Matching full:child

50 	struct mtd_info *child;  in allocate_partition()  local
56 child = kzalloc(sizeof(*child), GFP_KERNEL); in allocate_partition()
58 if (!name || !child) { in allocate_partition()
62 kfree(child); in allocate_partition()
67 child->type = parent->type; in allocate_partition()
68 child->part.flags = parent->flags & ~part->mask_flags; in allocate_partition()
69 child->part.flags |= part->add_flags; in allocate_partition()
70 child->flags = child->part.flags; in allocate_partition()
71 child->part.size = part->size; in allocate_partition()
72 child->writesize = parent->writesize; in allocate_partition()
73 child->writebufsize = parent->writebufsize; in allocate_partition()
74 child->oobsize = parent->oobsize; in allocate_partition()
75 child->oobavail = parent->oobavail; in allocate_partition()
76 child->subpage_sft = parent->subpage_sft; in allocate_partition()
78 child->name = name; in allocate_partition()
79 child->owner = parent->owner; in allocate_partition()
89 child->dev.parent = IS_ENABLED(CONFIG_MTD_PARTITIONED_MASTER) || mtd_is_partition(parent) ? in allocate_partition()
91 child->dev.of_node = part->of_node; in allocate_partition()
92 child->parent = parent; in allocate_partition()
93 child->part.offset = part->offset; in allocate_partition()
94 INIT_LIST_HEAD(&child->partitions); in allocate_partition()
96 if (child->part.offset == MTDPART_OFS_APPEND) in allocate_partition()
97 child->part.offset = cur_offset; in allocate_partition()
98 if (child->part.offset == MTDPART_OFS_NXTBLK) { in allocate_partition()
100 child->part.offset = cur_offset; in allocate_partition()
103 child->part.offset += wr_alignment - remainder; in allocate_partition()
107 child->part.offset); in allocate_partition()
110 if (child->part.offset == MTDPART_OFS_RETAIN) { in allocate_partition()
111 child->part.offset = cur_offset; in allocate_partition()
112 if (parent_size - child->part.offset >= child->part.size) { in allocate_partition()
113 child->part.size = parent_size - child->part.offset - in allocate_partition()
114 child->part.size; in allocate_partition()
117 part->name, parent_size - child->part.offset, in allocate_partition()
118 child->part.size); in allocate_partition()
123 if (child->part.size == MTDPART_SIZ_FULL) in allocate_partition()
124 child->part.size = parent_size - child->part.offset; in allocate_partition()
127 child->part.offset, child->part.offset + child->part.size, in allocate_partition()
128 child->name); in allocate_partition()
131 if (child->part.offset >= parent_size) { in allocate_partition()
133 child->part.offset = 0; in allocate_partition()
134 child->part.size = 0; in allocate_partition()
137 child->erasesize = parent->erasesize; in allocate_partition()
142 if (child->part.offset + child->part.size > parent->size) { in allocate_partition()
143 child->part.size = parent_size - child->part.offset; in allocate_partition()
145 part->name, parent->name, child->part.size); in allocate_partition()
151 u64 end = child->part.offset + child->part.size; in allocate_partition()
156 for (i = 0; i < max && regions[i].offset <= child->part.offset; in allocate_partition()
165 if (child->erasesize < regions[i].erasesize) in allocate_partition()
166 child->erasesize = regions[i].erasesize; in allocate_partition()
168 BUG_ON(child->erasesize == 0); in allocate_partition()
171 child->erasesize = master->erasesize; in allocate_partition()
175 * Child erasesize might differ from the parent one if the parent in allocate_partition()
179 if (!(child->flags & MTD_NO_ERASE)) in allocate_partition()
180 wr_alignment = child->erasesize; in allocate_partition()
182 tmp = mtd_get_master_ofs(child, 0); in allocate_partition()
184 if ((child->flags & MTD_WRITEABLE) && remainder) { in allocate_partition()
188 child->flags &= ~MTD_WRITEABLE; in allocate_partition()
193 tmp = mtd_get_master_ofs(child, 0) + child->part.size; in allocate_partition()
195 if ((child->flags & MTD_WRITEABLE) && remainder) { in allocate_partition()
196 child->flags &= ~MTD_WRITEABLE; in allocate_partition()
201 child->size = child->part.size; in allocate_partition()
202 child->ecc_step_size = parent->ecc_step_size; in allocate_partition()
203 child->ecc_strength = parent->ecc_strength; in allocate_partition()
204 child->bitflip_threshold = parent->bitflip_threshold; in allocate_partition()
209 while (offs < child->part.size) { in allocate_partition()
210 if (mtd_block_isreserved(child, offs)) in allocate_partition()
211 child->ecc_stats.bbtblocks++; in allocate_partition()
212 else if (mtd_block_isbad(child, offs)) in allocate_partition()
213 child->ecc_stats.badblocks++; in allocate_partition()
214 offs += child->erasesize; in allocate_partition()
219 return child; in allocate_partition()
252 struct mtd_info *child; in mtd_add_partition() local
271 child = allocate_partition(parent, &part, -1, offset); in mtd_add_partition()
272 if (IS_ERR(child)) in mtd_add_partition()
273 return PTR_ERR(child); in mtd_add_partition()
276 list_add_tail(&child->part.node, &parent->partitions); in mtd_add_partition()
279 ret = add_mtd_device(child); in mtd_add_partition()
283 mtd_add_partition_attrs(child); in mtd_add_partition()
289 list_del(&child->part.node); in mtd_add_partition()
292 free_partition(child); in mtd_add_partition()
307 struct mtd_info *child, *next; in __mtd_del_partition() local
310 list_for_each_entry_safe(child, next, &mtd->partitions, part.node) { in __mtd_del_partition()
311 err = __mtd_del_partition(child); in __mtd_del_partition()
332 struct mtd_info *child, *next; in __del_mtd_partitions() local
335 list_for_each_entry_safe(child, next, &mtd->partitions, part.node) { in __del_mtd_partitions()
336 if (mtd_has_partitions(child)) in __del_mtd_partitions()
337 __del_mtd_partitions(child); in __del_mtd_partitions()
339 pr_info("Deleting %s MTD partition\n", child->name); in __del_mtd_partitions()
340 list_del_init(&child->part.node); in __del_mtd_partitions()
341 ret = del_mtd_device(child); in __del_mtd_partitions()
344 child->name, ret); in __del_mtd_partitions()
369 struct mtd_info *child, *master = mtd_get_master(mtd); in mtd_del_partition() local
373 list_for_each_entry(child, &mtd->partitions, part.node) { in mtd_del_partition()
374 if (child->index == partno) { in mtd_del_partition()
375 ret = __mtd_del_partition(child); in mtd_del_partition()
387 * and registers the child MTD objects which are bound to the parent according
398 struct mtd_info *child, *master = mtd_get_master(parent); in add_mtd_partitions() local
406 child = allocate_partition(parent, parts + i, i, cur_offset); in add_mtd_partitions()
407 if (IS_ERR(child)) { in add_mtd_partitions()
408 ret = PTR_ERR(child); in add_mtd_partitions()
413 list_add_tail(&child->part.node, &parent->partitions); in add_mtd_partitions()
416 ret = add_mtd_device(child); in add_mtd_partitions()
419 list_del(&child->part.node); in add_mtd_partitions()
422 free_partition(child); in add_mtd_partitions()
426 mtd_add_partition_attrs(child); in add_mtd_partitions()
429 parse_mtd_partitions(child, parts[i].types, NULL); in add_mtd_partitions()
431 cur_offset = child->part.offset + child->part.size; in add_mtd_partitions()
581 struct device_node *child; in mtd_part_of_parse() local
604 for_each_child_of_node(np, child) in mtd_part_of_parse()
605 if (of_device_is_compatible(child, "nvmem-cells")) in mtd_part_of_parse()
606 of_node_set_flag(child, OF_POPULATED); in mtd_part_of_parse()