Lines Matching refs:slave
304 struct mtd_part *slave, *next; in del_mtd_partitions() local
306 list_for_each_entry_safe(slave, next, &mtd_partitions, list) in del_mtd_partitions()
307 if (slave->master == master) { in del_mtd_partitions()
308 list_del(&slave->list); in del_mtd_partitions()
309 if (slave->registered) in del_mtd_partitions()
310 del_mtd_device(&slave->mtd); in del_mtd_partitions()
311 kfree(slave); in del_mtd_partitions()
322 struct mtd_part *slave; in add_one_partition() local
325 slave = kzalloc(sizeof(*slave), GFP_KERNEL); in add_one_partition()
326 if (!slave) { in add_one_partition()
332 list_add(&slave->list, &mtd_partitions); in add_one_partition()
335 slave->mtd.type = master->type; in add_one_partition()
336 slave->mtd.flags = master->flags & ~part->mask_flags; in add_one_partition()
337 slave->mtd.size = part->size; in add_one_partition()
338 slave->mtd.writesize = master->writesize; in add_one_partition()
339 slave->mtd.oobsize = master->oobsize; in add_one_partition()
340 slave->mtd.oobavail = master->oobavail; in add_one_partition()
341 slave->mtd.subpage_sft = master->subpage_sft; in add_one_partition()
343 slave->mtd.name = part->name; in add_one_partition()
344 slave->mtd.owner = master->owner; in add_one_partition()
346 slave->mtd.read = part_read; in add_one_partition()
347 slave->mtd.write = part_write; in add_one_partition()
350 slave->mtd.panic_write = part_panic_write; in add_one_partition()
353 slave->mtd.point = part_point; in add_one_partition()
354 slave->mtd.unpoint = part_unpoint; in add_one_partition()
358 slave->mtd.read_oob = part_read_oob; in add_one_partition()
360 slave->mtd.write_oob = part_write_oob; in add_one_partition()
362 slave->mtd.read_user_prot_reg = part_read_user_prot_reg; in add_one_partition()
364 slave->mtd.read_fact_prot_reg = part_read_fact_prot_reg; in add_one_partition()
366 slave->mtd.write_user_prot_reg = part_write_user_prot_reg; in add_one_partition()
368 slave->mtd.lock_user_prot_reg = part_lock_user_prot_reg; in add_one_partition()
370 slave->mtd.get_user_prot_info = part_get_user_prot_info; in add_one_partition()
372 slave->mtd.get_fact_prot_info = part_get_fact_prot_info; in add_one_partition()
374 slave->mtd.sync = part_sync; in add_one_partition()
376 slave->mtd.suspend = part_suspend; in add_one_partition()
377 slave->mtd.resume = part_resume; in add_one_partition()
380 slave->mtd.writev = part_writev; in add_one_partition()
382 slave->mtd.lock = part_lock; in add_one_partition()
384 slave->mtd.unlock = part_unlock; in add_one_partition()
386 slave->mtd.block_isbad = part_block_isbad; in add_one_partition()
388 slave->mtd.block_markbad = part_block_markbad; in add_one_partition()
389 slave->mtd.erase = part_erase; in add_one_partition()
390 slave->master = master; in add_one_partition()
391 slave->offset = part->offset; in add_one_partition()
392 slave->index = partno; in add_one_partition()
394 if (slave->offset == MTDPART_OFS_APPEND) in add_one_partition()
395 slave->offset = cur_offset; in add_one_partition()
396 if (slave->offset == MTDPART_OFS_NXTBLK) { in add_one_partition()
397 slave->offset = cur_offset; in add_one_partition()
400 slave->offset = (mtd_div_by_eb(cur_offset, master) + 1) * master->erasesize; in add_one_partition()
403 (unsigned long long)cur_offset, (unsigned long long)slave->offset); in add_one_partition()
406 if (slave->mtd.size == MTDPART_SIZ_FULL) in add_one_partition()
407 slave->mtd.size = master->size - slave->offset; in add_one_partition()
409 printk(KERN_NOTICE "0x%012llx-0x%012llx : \"%s\"\n", (unsigned long long)slave->offset, in add_one_partition()
410 (unsigned long long)(slave->offset + slave->mtd.size), slave->mtd.name); in add_one_partition()
413 if (slave->offset >= master->size) { in add_one_partition()
415 slave->offset = 0; in add_one_partition()
416 slave->mtd.size = 0; in add_one_partition()
421 if (slave->offset + slave->mtd.size > master->size) { in add_one_partition()
422 slave->mtd.size = master->size - slave->offset; in add_one_partition()
424 part->name, master->name, (unsigned long long)slave->mtd.size); in add_one_partition()
429 u64 end = slave->offset + slave->mtd.size; in add_one_partition()
434 for (i = 0; i < max && regions[i].offset <= slave->offset; i++) in add_one_partition()
441 if (slave->mtd.erasesize < regions[i].erasesize) { in add_one_partition()
442 slave->mtd.erasesize = regions[i].erasesize; in add_one_partition()
445 BUG_ON(slave->mtd.erasesize == 0); in add_one_partition()
448 slave->mtd.erasesize = master->erasesize; in add_one_partition()
451 if ((slave->mtd.flags & MTD_WRITEABLE) && in add_one_partition()
452 mtd_mod_by_eb(slave->offset, &slave->mtd)) { in add_one_partition()
456 slave->mtd.flags &= ~MTD_WRITEABLE; in add_one_partition()
460 if ((slave->mtd.flags & MTD_WRITEABLE) && in add_one_partition()
461 mtd_mod_by_eb(slave->mtd.size, &slave->mtd)) { in add_one_partition()
462 slave->mtd.flags &= ~MTD_WRITEABLE; in add_one_partition()
467 slave->mtd.ecclayout = master->ecclayout; in add_one_partition()
471 while (offs < slave->mtd.size) { in add_one_partition()
473 offs + slave->offset)) in add_one_partition()
474 slave->mtd.ecc_stats.badblocks++; in add_one_partition()
475 offs += slave->mtd.erasesize; in add_one_partition()
482 *part->mtdp = &slave->mtd; in add_one_partition()
483 slave->registered = 0; in add_one_partition()
486 add_mtd_device(&slave->mtd); in add_one_partition()
487 slave->registered = 1; in add_one_partition()
489 return slave; in add_one_partition()
503 struct mtd_part *slave; in add_mtd_partitions() local
510 slave = add_one_partition(master, parts + i, i, cur_offset); in add_mtd_partitions()
511 if (!slave) in add_mtd_partitions()
513 cur_offset = slave->offset + slave->mtd.size; in add_mtd_partitions()