mtd: simplify get_mtd_device_nm function
Linux-MTD Mailing List
linux-mtd at lists.infradead.org
Tue May 24 21:59:06 EDT 2011
Gitweb: http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=52534f2dba5d033c0c33e515faa2767d7e8e986a
Commit: 52534f2dba5d033c0c33e515faa2767d7e8e986a
Parent: 7c802fbd541448accec7bbc0e72ef38693a29593
Author: Wanlong Gao <wanlong.gao at gmail.com>
AuthorDate: Tue May 17 22:36:18 2011 +0800
Committer: David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Wed May 25 02:05:49 2011 +0100
mtd: simplify get_mtd_device_nm function
'get_mtd_device_nm()' has a piece of code which equivalent to what
'__get_mtd_device()' does - remove this duplicated code and use
''__get_mtd_device()' instead.
Artem: changed commit message.
Artem: while on it, remove an unnecessary extra empty line
Signed-off-by: Wanlong Gao <wanlong.gao at gmail.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy at nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
drivers/mtd/mtdcore.c | 13 ++-----------
1 files changed, 2 insertions(+), 11 deletions(-)
diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
index d162426..8e19091 100644
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -533,7 +533,6 @@ int __get_mtd_device(struct mtd_info *mtd)
return -ENODEV;
if (mtd->get_device) {
-
err = mtd->get_device(mtd);
if (err) {
@@ -571,21 +570,13 @@ struct mtd_info *get_mtd_device_nm(const char *name)
if (!mtd)
goto out_unlock;
- if (!try_module_get(mtd->owner))
+ err = __get_mtd_device(mtd);
+ if (err)
goto out_unlock;
- if (mtd->get_device) {
- err = mtd->get_device(mtd);
- if (err)
- goto out_put;
- }
-
- mtd->usecount++;
mutex_unlock(&mtd_table_mutex);
return mtd;
-out_put:
- module_put(mtd->owner);
out_unlock:
mutex_unlock(&mtd_table_mutex);
return ERR_PTR(err);
More information about the linux-mtd-cvs
mailing list