Skip to content

Commit

Permalink
mtd: Use get_mtd_device_nm() to find named device in get_sb_mtd()
Browse files Browse the repository at this point in the history
This removes the need to know the number of MTD devices.

Signed-off-by: Ben Hutchings <[email protected]>
Signed-off-by: Artem Bityutskiy <[email protected]>
Signed-off-by: David Woodhouse <[email protected]>
  • Loading branch information
Ben Hutchings authored and David Woodhouse committed Feb 25, 2010
1 parent f1332ba commit 677c2ae
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions drivers/mtd/mtdsuper.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,18 +150,12 @@ int get_sb_mtd(struct file_system_type *fs_type, int flags,
DEBUG(1, "MTDSB: mtd:%%s, name \"%s\"\n",
dev_name + 4);

for (mtdnr = 0; mtdnr < MAX_MTD_DEVICES; mtdnr++) {
mtd = get_mtd_device(NULL, mtdnr);
if (!IS_ERR(mtd)) {
if (!strcmp(mtd->name, dev_name + 4))
return get_sb_mtd_aux(
fs_type, flags,
dev_name, data, mtd,
fill_super, mnt);

put_mtd_device(mtd);
}
}
mtd = get_mtd_device_nm(dev_name + 4);
if (!IS_ERR(mtd))
return get_sb_mtd_aux(
fs_type, flags,
dev_name, data, mtd,
fill_super, mnt);

printk(KERN_NOTICE "MTD:"
" MTD device with name \"%s\" not found.\n",
Expand Down

0 comments on commit 677c2ae

Please sign in to comment.