From: Wanlong Gao <wanlong.gao@gmail.com>
To: dwmw2@infradead.org, akpm@linux-foundation.org
Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org,
Wanlong Gao <wanlong.gao@gmail.com>
Subject: [PATCH 1/2] driver:mtd:use the wrapped __get_mtd_device in get_mtd_device_nm
Date: Tue, 17 May 2011 22:36:18 +0800 [thread overview]
Message-ID: <1305642979-7419-1-git-send-email-wanlong.gao@gmail.com> (raw)
From: Wanlong Gao <wanlong.gao@gmail.com>
Use the wrapped function __get_mtd_device in the function
get_mtd_device_nm instead of these get device reference codes.
Signed-off-by: Wanlong Gao <wanlong.gao@gmail.com>
---
drivers/mtd/mtdcore.c | 12 ++----------
1 files changed, 2 insertions(+), 10 deletions(-)
diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
index da69bc8..9b7ad35 100644
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -570,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);
--
1.7.4.1
next reply other threads:[~2011-05-17 14:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-17 14:36 Wanlong Gao [this message]
2011-05-17 14:36 ` [PATCH 2/2] driver:mtd:fix the bad format in the mtdcore.c Wanlong Gao
2011-05-20 5:38 ` Artem Bityutskiy
2011-05-20 5:34 ` [PATCH 1/2] driver:mtd:use the wrapped __get_mtd_device in get_mtd_device_nm Artem Bityutskiy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1305642979-7419-1-git-send-email-wanlong.gao@gmail.com \
--to=wanlong.gao@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=dwmw2@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).