Lines Matching defs:slave
330 * This function unregisters and destroy all slave MTD objects which are
336 struct mtd_part *slave, *next;
338 list_for_each_entry_safe(slave, next, &mtd_partitions, list)
339 if (slave->master == master) {
340 list_del(&slave->list);
341 del_mtd_device(&slave->mtd);
342 kfree(slave);
353 struct mtd_part *slave;
356 slave = kzalloc(sizeof(*slave), GFP_KERNEL);
357 if (!slave) {
363 list_add(&slave->list, &mtd_partitions);
366 slave->mtd.type = master->type;
367 slave->mtd.flags = master->flags & ~part->mask_flags;
368 slave->mtd.size = part->size;
369 slave->mtd.writesize = master->writesize;
370 slave->mtd.oobsize = master->oobsize;
371 slave->mtd.oobavail = master->oobavail;
372 slave->mtd.subpage_sft = master->subpage_sft;
374 slave->mtd.name = part->name;
375 slave->mtd.owner = master->owner;
376 slave->mtd.backing_dev_info = master->backing_dev_info;
381 slave->mtd.dev.parent = master->dev.parent;
383 slave->mtd.read = part_read;
384 slave->mtd.write = part_write;
387 slave->mtd.panic_write = part_panic_write;
390 slave->mtd.point = part_point;
391 slave->mtd.unpoint = part_unpoint;
395 slave->mtd.get_unmapped_area = part_get_unmapped_area;
397 slave->mtd.read_oob = part_read_oob;
399 slave->mtd.write_oob = part_write_oob;
401 slave->mtd.read_user_prot_reg = part_read_user_prot_reg;
403 slave->mtd.read_fact_prot_reg = part_read_fact_prot_reg;
405 slave->mtd.write_user_prot_reg = part_write_user_prot_reg;
407 slave->mtd.lock_user_prot_reg = part_lock_user_prot_reg;
409 slave->mtd.get_user_prot_info = part_get_user_prot_info;
411 slave->mtd.get_fact_prot_info = part_get_fact_prot_info;
413 slave->mtd.sync = part_sync;
415 slave->mtd.suspend = part_suspend;
416 slave->mtd.resume = part_resume;
419 slave->mtd.writev = part_writev;
421 slave->mtd.lock = part_lock;
423 slave->mtd.unlock = part_unlock;
425 slave->mtd.is_locked = part_is_locked;
427 slave->mtd.block_isbad = part_block_isbad;
429 slave->mtd.block_markbad = part_block_markbad;
430 slave->mtd.erase = part_erase;
431 slave->master = master;
432 slave->offset = part->offset;
434 if (slave->offset == MTDPART_OFS_APPEND)
435 slave->offset = cur_offset;
436 if (slave->offset == MTDPART_OFS_NXTBLK) {
437 slave->offset = cur_offset;
440 slave->offset = (mtd_div_by_eb(cur_offset, master) + 1) * master->erasesize;
443 (unsigned long long)cur_offset, (unsigned long long)slave->offset);
446 if (slave->mtd.size == MTDPART_SIZ_FULL)
447 slave->mtd.size = master->size - slave->offset;
449 printk(KERN_NOTICE "0x%012llx-0x%012llx : \"%s\"\n", (unsigned long long)slave->offset,
450 (unsigned long long)(slave->offset + slave->mtd.size), slave->mtd.name);
453 if (slave->offset >= master->size) {
455 slave->offset = 0;
456 slave->mtd.size = 0;
461 if (slave->offset + slave->mtd.size > master->size) {
462 slave->mtd.size = master->size - slave->offset;
464 part->name, master->name, (unsigned long long)slave->mtd.size);
469 u64 end = slave->offset + slave->mtd.size;
474 for (i = 0; i < max && regions[i].offset <= slave->offset; i++)
482 if (slave->mtd.erasesize < regions[i].erasesize) {
483 slave->mtd.erasesize = regions[i].erasesize;
486 BUG_ON(slave->mtd.erasesize == 0);
489 slave->mtd.erasesize = master->erasesize;
492 if ((slave->mtd.flags & MTD_WRITEABLE) &&
493 mtd_mod_by_eb(slave->offset, &slave->mtd)) {
495 slave->mtd.flags &= ~MTD_WRITEABLE;
499 if ((slave->mtd.flags & MTD_WRITEABLE) &&
500 mtd_mod_by_eb(slave->mtd.size, &slave->mtd)) {
501 slave->mtd.flags &= ~MTD_WRITEABLE;
506 slave->mtd.ecclayout = master->ecclayout;
510 while (offs < slave->mtd.size) {
512 offs + slave->offset))
513 slave->mtd.ecc_stats.badblocks++;
514 offs += slave->mtd.erasesize;
520 add_mtd_device(&slave->mtd);
522 return slave;
527 * and registers slave MTD objects which are bound to the master according to
538 struct mtd_part *slave;
545 slave = add_one_partition(master, parts + i, i, cur_offset);
546 if (!slave)
548 cur_offset = slave->offset + slave->mtd.size;