* [PATCH 1/2] driver:mtd:use the wrapped __get_mtd_device in get_mtd_device_nm @ 2011-05-17 14:36 Wanlong Gao 2011-05-17 14:36 ` [PATCH 2/2] driver:mtd:fix the bad format in the mtdcore.c Wanlong Gao 2011-05-20 5:34 ` [PATCH 1/2] driver:mtd:use the wrapped __get_mtd_device in get_mtd_device_nm Artem Bityutskiy 0 siblings, 2 replies; 4+ messages in thread From: Wanlong Gao @ 2011-05-17 14:36 UTC (permalink / raw) To: dwmw2, akpm; +Cc: linux-mtd, linux-kernel, Wanlong Gao 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 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] driver:mtd:fix the bad format in the mtdcore.c 2011-05-17 14:36 [PATCH 1/2] driver:mtd:use the wrapped __get_mtd_device in get_mtd_device_nm Wanlong Gao @ 2011-05-17 14:36 ` 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 1 sibling, 1 reply; 4+ messages in thread From: Wanlong Gao @ 2011-05-17 14:36 UTC (permalink / raw) To: dwmw2, akpm; +Cc: linux-mtd, linux-kernel, Wanlong Gao From: Wanlong Gao <wanlong.gao@gmail.com> Fix the bad format in the mtdcore.c. Signed-off-by: Wanlong Gao <wanlong.gao@gmail.com> --- drivers/mtd/mtdcore.c | 34 +++++++++++++++++----------------- 1 files changed, 17 insertions(+), 17 deletions(-) diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c index 9b7ad35..524e030 100644 --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c @@ -615,7 +615,7 @@ int default_mtd_writev(struct mtd_info *mtd, const struct kvec *vecs, if(!mtd->write) { ret = -EROFS; } else { - for (i=0; i<count; i++) { + for (i = 0; i < count; i++) { if (!vecs[i].iov_len) continue; ret = mtd->write(mtd, to, vecs[i].iov_len, &thislen, vecs[i].iov_base); @@ -651,8 +651,8 @@ static struct proc_dir_entry *proc_mtd; static inline int mtd_proc_info(char *buf, struct mtd_info *this) { return sprintf(buf, "mtd%d: %8.8llx %8.8x \"%s\"\n", this->index, - (unsigned long long)this->size, - this->erasesize, this->name); + (unsigned long long)this->size, + this->erasesize, this->name); } static int mtd_read_proc (char *page, char **start, off_t off, int count, @@ -660,30 +660,30 @@ static int mtd_read_proc (char *page, char **start, off_t off, int count, { struct mtd_info *mtd; int len, l; - off_t begin = 0; + off_t begin = 0; mutex_lock(&mtd_table_mutex); len = sprintf(page, "dev: size erasesize name\n"); mtd_for_each_device(mtd) { l = mtd_proc_info(page + len, mtd); - len += l; - if (len+begin > off+count) - goto done; - if (len+begin < off) { - begin += len; - len = 0; - } - } + len += l; + if (len + begin > off + count) + goto done; + if (len + begin < off) { + begin += len; + len = 0; + } + } - *eof = 1; + *eof = 1; done: mutex_unlock(&mtd_table_mutex); - if (off >= len+begin) - return 0; - *start = page + (off-begin); - return ((count < begin+len-off) ? count : begin+len-off); + if (off >= len + begin) + return 0; + *start = page + (off - begin); + return ((count < begin + len - off) ? count : begin + len - off); } #endif /* CONFIG_PROC_FS */ -- 1.7.4.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] driver:mtd:fix the bad format in the mtdcore.c 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 0 siblings, 0 replies; 4+ messages in thread From: Artem Bityutskiy @ 2011-05-20 5:38 UTC (permalink / raw) To: Wanlong Gao; +Cc: dwmw2, akpm, linux-mtd, linux-kernel On Tue, 2011-05-17 at 22:36 +0800, Wanlong Gao wrote: > From: Wanlong Gao <wanlong.gao@gmail.com> > > Fix the bad format in the mtdcore.c. > > Signed-off-by: Wanlong Gao <wanlong.gao@gmail.com> > --- > drivers/mtd/mtdcore.c | 34 +++++++++++++++++----------------- > 1 files changed, 17 insertions(+), 17 deletions(-) This patch does not apply to my l2 tree because proc-related functions have been re-worked recently, see http://git.infradead.org/users/dedekind/l2-mtd-2.6.git/commit/b930b5a0cee30792579a1893a732a485c1f1f0ba Please, send a patch on top of l2-mtd-2.6.git: git://git.infradead.org/users/dedekind/l2-mtd-2.6.git -- Best Regards, Artem Bityutskiy (Артём Битюцкий) ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] driver:mtd:use the wrapped __get_mtd_device in get_mtd_device_nm 2011-05-17 14:36 [PATCH 1/2] driver:mtd:use the wrapped __get_mtd_device in get_mtd_device_nm Wanlong Gao 2011-05-17 14:36 ` [PATCH 2/2] driver:mtd:fix the bad format in the mtdcore.c Wanlong Gao @ 2011-05-20 5:34 ` Artem Bityutskiy 1 sibling, 0 replies; 4+ messages in thread From: Artem Bityutskiy @ 2011-05-20 5:34 UTC (permalink / raw) To: Wanlong Gao; +Cc: dwmw2, akpm, linux-mtd, linux-kernel On Tue, 2011-05-17 at 22:36 +0800, Wanlong Gao wrote: > 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> Pushed this patch to l2-mtd-2.6.git, thanks. -- Best Regards, Artem Bityutskiy (Артём Битюцкий) ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-05-20 5:41 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2011-05-17 14:36 [PATCH 1/2] driver:mtd:use the wrapped __get_mtd_device in get_mtd_device_nm Wanlong Gao 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
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).