• Home
  • Raw
  • Download

Lines Matching refs:child

44 	struct mtd_info *child;  in allocate_partition()  local
50 child = kzalloc(sizeof(*child), GFP_KERNEL); in allocate_partition()
52 if (!name || !child) { in allocate_partition()
56 kfree(child); in allocate_partition()
61 child->type = parent->type; in allocate_partition()
62 child->part.flags = parent->flags & ~part->mask_flags; in allocate_partition()
63 child->part.flags |= part->add_flags; in allocate_partition()
64 child->flags = child->part.flags; in allocate_partition()
65 child->part.size = part->size; in allocate_partition()
66 child->writesize = parent->writesize; in allocate_partition()
67 child->writebufsize = parent->writebufsize; in allocate_partition()
68 child->oobsize = parent->oobsize; in allocate_partition()
69 child->oobavail = parent->oobavail; in allocate_partition()
70 child->subpage_sft = parent->subpage_sft; in allocate_partition()
72 child->name = name; in allocate_partition()
73 child->owner = parent->owner; in allocate_partition()
83 child->dev.parent = IS_ENABLED(CONFIG_MTD_PARTITIONED_MASTER) || mtd_is_partition(parent) ? in allocate_partition()
85 child->dev.of_node = part->of_node; in allocate_partition()
86 child->parent = parent; in allocate_partition()
87 child->part.offset = part->offset; in allocate_partition()
88 INIT_LIST_HEAD(&child->partitions); in allocate_partition()
90 if (child->part.offset == MTDPART_OFS_APPEND) in allocate_partition()
91 child->part.offset = cur_offset; in allocate_partition()
92 if (child->part.offset == MTDPART_OFS_NXTBLK) { in allocate_partition()
94 child->part.offset = cur_offset; in allocate_partition()
97 child->part.offset += wr_alignment - remainder; in allocate_partition()
101 child->part.offset); in allocate_partition()
104 if (child->part.offset == MTDPART_OFS_RETAIN) { in allocate_partition()
105 child->part.offset = cur_offset; in allocate_partition()
106 if (parent_size - child->part.offset >= child->part.size) { in allocate_partition()
107 child->part.size = parent_size - child->part.offset - in allocate_partition()
108 child->part.size; in allocate_partition()
111 part->name, parent_size - child->part.offset, in allocate_partition()
112 child->part.size); in allocate_partition()
117 if (child->part.size == MTDPART_SIZ_FULL) in allocate_partition()
118 child->part.size = parent_size - child->part.offset; in allocate_partition()
121 child->part.offset, child->part.offset + child->part.size, in allocate_partition()
122 child->name); in allocate_partition()
125 if (child->part.offset >= parent_size) { in allocate_partition()
127 child->part.offset = 0; in allocate_partition()
128 child->part.size = 0; in allocate_partition()
131 child->erasesize = parent->erasesize; in allocate_partition()
136 if (child->part.offset + child->part.size > parent->size) { in allocate_partition()
137 child->part.size = parent_size - child->part.offset; in allocate_partition()
139 part->name, parent->name, child->part.size); in allocate_partition()
145 u64 end = child->part.offset + child->part.size; in allocate_partition()
150 for (i = 0; i < max && regions[i].offset <= child->part.offset; in allocate_partition()
159 if (child->erasesize < regions[i].erasesize) in allocate_partition()
160 child->erasesize = regions[i].erasesize; in allocate_partition()
162 BUG_ON(child->erasesize == 0); in allocate_partition()
165 child->erasesize = master->erasesize; in allocate_partition()
173 if (!(child->flags & MTD_NO_ERASE)) in allocate_partition()
174 wr_alignment = child->erasesize; in allocate_partition()
176 tmp = mtd_get_master_ofs(child, 0); in allocate_partition()
178 if ((child->flags & MTD_WRITEABLE) && remainder) { in allocate_partition()
182 child->flags &= ~MTD_WRITEABLE; in allocate_partition()
187 tmp = mtd_get_master_ofs(child, 0) + child->part.size; in allocate_partition()
189 if ((child->flags & MTD_WRITEABLE) && remainder) { in allocate_partition()
190 child->flags &= ~MTD_WRITEABLE; in allocate_partition()
195 child->size = child->part.size; in allocate_partition()
196 child->ecc_step_size = parent->ecc_step_size; in allocate_partition()
197 child->ecc_strength = parent->ecc_strength; in allocate_partition()
198 child->bitflip_threshold = parent->bitflip_threshold; in allocate_partition()
203 while (offs < child->part.size) { in allocate_partition()
204 if (mtd_block_isreserved(child, offs)) in allocate_partition()
205 child->ecc_stats.bbtblocks++; in allocate_partition()
206 else if (mtd_block_isbad(child, offs)) in allocate_partition()
207 child->ecc_stats.badblocks++; in allocate_partition()
208 offs += child->erasesize; in allocate_partition()
213 return child; in allocate_partition()
246 struct mtd_info *child; in mtd_add_partition() local
265 child = allocate_partition(parent, &part, -1, offset); in mtd_add_partition()
266 if (IS_ERR(child)) in mtd_add_partition()
267 return PTR_ERR(child); in mtd_add_partition()
270 list_add_tail(&child->part.node, &parent->partitions); in mtd_add_partition()
273 ret = add_mtd_device(child); in mtd_add_partition()
277 mtd_add_partition_attrs(child); in mtd_add_partition()
283 list_del(&child->part.node); in mtd_add_partition()
286 free_partition(child); in mtd_add_partition()
301 struct mtd_info *child, *next; in __mtd_del_partition() local
304 list_for_each_entry_safe(child, next, &mtd->partitions, part.node) { in __mtd_del_partition()
305 err = __mtd_del_partition(child); in __mtd_del_partition()
328 struct mtd_info *child, *next; in __del_mtd_partitions() local
332 list_for_each_entry_safe(child, next, &mtd->partitions, part.node) { in __del_mtd_partitions()
333 if (mtd_has_partitions(child)) in __del_mtd_partitions()
334 __del_mtd_partitions(child); in __del_mtd_partitions()
336 pr_info("Deleting %s MTD partition\n", child->name); in __del_mtd_partitions()
337 ret = del_mtd_device(child); in __del_mtd_partitions()
340 child->name, ret); in __del_mtd_partitions()
345 list_del(&child->part.node); in __del_mtd_partitions()
346 free_partition(child); in __del_mtd_partitions()
368 struct mtd_info *child, *master = mtd_get_master(mtd); in mtd_del_partition() local
372 list_for_each_entry(child, &mtd->partitions, part.node) { in mtd_del_partition()
373 if (child->index == partno) { in mtd_del_partition()
374 ret = __mtd_del_partition(child); in mtd_del_partition()
397 struct mtd_info *child, *master = mtd_get_master(parent); in add_mtd_partitions() local
405 child = allocate_partition(parent, parts + i, i, cur_offset); in add_mtd_partitions()
406 if (IS_ERR(child)) { in add_mtd_partitions()
407 ret = PTR_ERR(child); in add_mtd_partitions()
412 list_add_tail(&child->part.node, &parent->partitions); in add_mtd_partitions()
415 ret = add_mtd_device(child); in add_mtd_partitions()
418 list_del(&child->part.node); in add_mtd_partitions()
421 free_partition(child); in add_mtd_partitions()
425 mtd_add_partition_attrs(child); in add_mtd_partitions()
428 parse_mtd_partitions(child, parts[i].types, NULL); in add_mtd_partitions()
430 cur_offset = child->part.offset + child->part.size; in add_mtd_partitions()
580 struct device_node *child; in mtd_part_of_parse() local
603 for_each_child_of_node(np, child) in mtd_part_of_parse()
604 if (of_device_is_compatible(child, "nvmem-cells")) in mtd_part_of_parse()
605 of_node_set_flag(child, OF_POPULATED); in mtd_part_of_parse()