Index: drivers//mtd/mtdcore.c =================================================================== RCS file: /home/cvs/mtd/drivers/mtd/mtdcore.c,v retrieving revision 1.34 diff -u -b -B -w -p -u -r1.34 mtdcore.c --- drivers//mtd/mtdcore.c 24 Jan 2003 23:32:25 -0000 1.34 +++ drivers//mtd/mtdcore.c 5 Feb 2003 11:25:52 -0000 @@ -29,29 +29,37 @@ static struct mtd_info *mtd_table[MAX_MT static struct mtd_notifier *mtd_notifiers = NULL; /** - * add_mtd_device - register an MTD device + * add_mtd_device_full - register an MTD device at a particular minor number * @mtd: pointer to new MTD device info structure + * @minor: requested minor number. -1 to for the first free. * - * Add a device to the list of MTD devices present in the system, and - * notify each currently active MTD 'user' of its arrival. Returns - * zero on success or 1 on failure, which currently will only happen - * if the number of present devices exceeds MAX_MTD_DEVICES (i.e. 16) + * Add a device to the list of MTD devices present in the system, + * and notifies each currently active MTD 'user' of its + * arrival. Returns zero on success or 1 on failure, which + * currently only occurs if the requested minor number has + * already been allocated or if minor exceeds MAX_MTD_DEVICES + * (i.e. 16) */ - -int add_mtd_device(struct mtd_info *mtd) +int add_mtd_device_full(struct mtd_info *mtd, int minor) { - int i; + struct mtd_notifier *not=mtd_notifiers; down(&mtd_table_mutex); - for (i=0; i< MAX_MTD_DEVICES; i++) - if (!mtd_table[i]) - { - struct mtd_notifier *not=mtd_notifiers; + if ( minor == -1 ) { + for (minor = 0; minor < MAX_MTD_DEVICES; minor++) + if (!mtd_table[minor]) + break; + } - mtd_table[i] = mtd; - mtd->index = i; - DEBUG(0, "mtd: Giving out device %d to %s\n",i, mtd->name); + if ( minor >= MAX_MTD_DEVICES || minor < 0 || mtd_table[minor] ) { + up(&mtd_table_mutex); + return 1; + } + + mtd_table[minor] = mtd; + mtd->index = minor; + DEBUG(0, "mtd: Giving out device %d to %s\n",minor, mtd->name); while (not) { (*(not->add))(mtd); @@ -62,8 +70,18 @@ int add_mtd_device(struct mtd_info *mtd) return 0; } - up(&mtd_table_mutex); - return 1; +/** + * add_mtd_device - register an MTD device + * @mtd: pointer to new MTD device info structure + * + * Add a device to the list of MTD devices present in the system, and + * notify each currently active MTD 'user' of its arrival. Returns + * zero on success or 1 on failure, which currently will only happen + * if the number of present devices exceeds MAX_MTD_DEVICES (i.e. 16) + */ +int add_mtd_device(struct mtd_info *mtd) +{ + return add_mtd_device(mtd, -1); } /** Index: drivers//mtd/chips/map_ram.c =================================================================== RCS file: /home/cvs/mtd/drivers/mtd/chips/map_ram.c,v retrieving revision 1.14 diff -u -b -B -w -p -u -r1.14 map_ram.c --- drivers//mtd/chips/map_ram.c 2 Oct 2001 15:05:12 -0000 1.14 +++ drivers//mtd/chips/map_ram.c 5 Feb 2003 11:25:52 -0000 @@ -107,6 +107,8 @@ static int mapram_erase (struct mtd_info for (i=0; ilen; i++) map->write8(map, 0xFF, instr->addr + i); + instr->state = MTD_ERASE_DONE; + if (instr->callback) instr->callback(instr);