[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100426163126.GD4364@logfs.org>
Date: Mon, 26 Apr 2010 18:31:27 +0200
From: Jörn Engel <joern@...fs.org>
To: Jens Axboe <jens.axboe@...cle.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
David Woodhouse <dwmw2@...radead.org>,
linux-mtd@...ts.infradead.org, linux-kernel@...r.kernel.org,
Christoph Hellwig <hch@...radead.org>,
Paolo Minazzi <paolo.minazzi@...il.com>
Subject: [PATCH 2/2] [MTD] Call bdi_init() and bdi_register()
Otherwise we hit a BUG_ON in bdi_queue_work().
Signed-off-by: Joern Engel <joern@...fs.org>
---
drivers/mtd/mtdcore.c | 17 ++++++++++++++++-
1 files changed, 16 insertions(+), 1 deletions(-)
diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
index cb4858b..8dd3e46 100644
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -299,7 +299,7 @@ static struct device_type mtd_devtype = {
int add_mtd_device(struct mtd_info *mtd)
{
- int i;
+ int i, err;
if (!mtd->backing_dev_info) {
switch (mtd->type) {
@@ -322,6 +322,12 @@ int add_mtd_device(struct mtd_info *mtd)
if (!mtd_table[i]) {
struct mtd_notifier *not;
+ err = bdi_register(mtd->backing_dev_info, NULL, "mtd%d",
+ i);
+ if (err) {
+ /* We lose the errno information :( */
+ break;
+ }
mtd_table[i] = mtd;
mtd->index = i;
mtd->usecount = 0;
@@ -692,6 +698,15 @@ static int __init init_mtd(void)
int ret;
ret = class_register(&mtd_class);
+ ret = bdi_init(&mtd_bdi_unmappable);
+ if (ret)
+ return ret;
+ ret = bdi_init(&mtd_bdi_ro_mappable);
+ if (ret)
+ return ret;
+ ret = bdi_init(&mtd_bdi_rw_mappable);
+ if (ret)
+ return ret;
if (ret) {
pr_err("Error registering mtd class: %d\n", ret);
return ret;
--
1.6.2.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists