* [PATCH 2/6] mtd: Use get_mtd_device_nm() to find named device in get_sb_mtd()
@ 2010-01-05 15:20 Ben Hutchings
2010-01-10 10:21 ` Artem Bityutskiy
2010-01-10 10:35 ` Artem Bityutskiy
0 siblings, 2 replies; 3+ messages in thread
From: Ben Hutchings @ 2010-01-05 15:20 UTC (permalink / raw)
To: David Woodhouse; +Cc: linux-mtd
This removes the need to know the number of MTD devices.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
drivers/mtd/mtdsuper.c | 18 ++++++------------
1 files changed, 6 insertions(+), 12 deletions(-)
diff --git a/drivers/mtd/mtdsuper.c b/drivers/mtd/mtdsuper.c
index af8b42e..d257052 100644
--- a/drivers/mtd/mtdsuper.c
+++ b/drivers/mtd/mtdsuper.c
@@ -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",
--
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.
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH 2/6] mtd: Use get_mtd_device_nm() to find named device in get_sb_mtd()
2010-01-05 15:20 [PATCH 2/6] mtd: Use get_mtd_device_nm() to find named device in get_sb_mtd() Ben Hutchings
@ 2010-01-10 10:21 ` Artem Bityutskiy
2010-01-10 10:35 ` Artem Bityutskiy
1 sibling, 0 replies; 3+ messages in thread
From: Artem Bityutskiy @ 2010-01-10 10:21 UTC (permalink / raw)
To: Ben Hutchings; +Cc: linux-mtd, David Woodhouse
On Tue, 2010-01-05 at 15:20 +0000, Ben Hutchings wrote:
> This removes the need to know the number of MTD devices.
>
> Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
> ---
> drivers/mtd/mtdsuper.c | 18 ++++++------------
> 1 files changed, 6 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/mtd/mtdsuper.c b/drivers/mtd/mtdsuper.c
> index af8b42e..d257052 100644
> --- a/drivers/mtd/mtdsuper.c
> +++ b/drivers/mtd/mtdsuper.c
> @@ -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);
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.
--
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH 2/6] mtd: Use get_mtd_device_nm() to find named device in get_sb_mtd()
2010-01-05 15:20 [PATCH 2/6] mtd: Use get_mtd_device_nm() to find named device in get_sb_mtd() Ben Hutchings
2010-01-10 10:21 ` Artem Bityutskiy
@ 2010-01-10 10:35 ` Artem Bityutskiy
1 sibling, 0 replies; 3+ messages in thread
From: Artem Bityutskiy @ 2010-01-10 10:35 UTC (permalink / raw)
To: Ben Hutchings; +Cc: linux-mtd, David Woodhouse
On Tue, 2010-01-05 at 15:20 +0000, Ben Hutchings wrote:
> This removes the need to know the number of MTD devices.
>
> Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
> ---
> drivers/mtd/mtdsuper.c | 18 ++++++------------
> 1 files changed, 6 insertions(+), 12 deletions(-)
Reviewed-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
--
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-01-10 10:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-05 15:20 [PATCH 2/6] mtd: Use get_mtd_device_nm() to find named device in get_sb_mtd() Ben Hutchings
2010-01-10 10:21 ` Artem Bityutskiy
2010-01-10 10:35 ` Artem Bityutskiy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox