mtd: Use get_mtd_device_nm() to find named device in get_sb_mtd()
PATCH 2/6 mtd: Use get_mtd_device_nm() to find named device in get_sb_mtd()
This removes the need to know the number of MTD devices.
Signed-off-by Ben Hutchings <[email protected]>
--- drivers/mtd/mtdsuper.c | 18 ++++++------------ 1 files changed, 6 insertions(+), 12 deletions(-)
drivers/mtd/mtdsuper.c +6 -12
@@ -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",
Signature · 7 lines
1.5.5 -- Ben Hutchings, Senior Software Engineer, Solarflare Communications Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked.
Quoted 23 lines · Ben Hutchings
This removes the need to know the number of MTD devices.
Signed-off-by Ben Hutchings <[email protected]>--- drivers/mtd/mtdsuper.c | 18 ++++++------------ 1 files changed, 6 insertions(+), 12 deletions(-)drivers/mtd/mtdsuper.c +0
-8@@ -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);
drivers/mtd/mtdsuper.c int get_sb_mtd(struct file_system_type *fs_type, int flags, · line 158
Quoted 10 lines
drivers/mtd/mtdsuper.c +6
-4- -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);
Since now your indentation level is less, you could de-uglify the 'get_sb_mtd_aux()' as well, while you are on it. But this is minor.
Signature · 2 lines
Best Regards, Artem Bityutskiy (Артём Битюцкий)
Quoted 6 lines · Ben Hutchings
This removes the need to know the number of MTD devices.
Signed-off-by Ben Hutchings <[email protected]>--- drivers/mtd/mtdsuper.c | 18 ++++++------------ 1 files changed, 6 insertions(+), 12 deletions(-)
Reviewed-by Artem Bityutskiy <[email protected]>
Signature · 2 lines
Best Regards, Artem Bityutskiy (Артём Битюцкий)