From patchwork Mon Apr 26 16:31:27 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?J=C3=B6rn_Engel?= X-Patchwork-Id: 50979 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [18.85.46.34]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 66547B7D45 for ; Tue, 27 Apr 2010 02:33:04 +1000 (EST) Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1O6RDg-00056Z-Ih; Mon, 26 Apr 2010 16:31:40 +0000 Received: from lazybastard.de ([212.112.238.170] helo=longford.logfs.org) by bombadil.infradead.org with esmtps (Exim 4.69 #1 (Red Hat Linux)) id 1O6RDe-00055q-K3 for linux-mtd@lists.infradead.org; Mon, 26 Apr 2010 16:31:39 +0000 Received: from joern by longford.logfs.org with local (Exim 4.63) (envelope-from ) id 1O6RDW-00029o-84; Mon, 26 Apr 2010 18:31:30 +0200 Date: Mon, 26 Apr 2010 18:31:27 +0200 From: =?utf-8?B?SsO2cm4=?= Engel To: Jens Axboe Subject: [PATCH 2/2] [MTD] Call bdi_init() and bdi_register() Message-ID: <20100426163126.GD4364@logfs.org> References: <20100422162709.GJ27497@kernel.dk> <20100422203358.GB30749@logfs.org> <20100423100532.GN27497@kernel.dk> <20100423205518.GB7008@logfs.org> <20100426094810.GE27497@kernel.dk> <20100426143253.GB4364@logfs.org> <20100426143803.GM27497@kernel.dk> <20100426144532.GN27497@kernel.dk> <20100426163050.GC4364@logfs.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20100426163050.GC4364@logfs.org> User-Agent: Mutt/1.5.13 (2006-08-11) X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20100426_123138_801671_4394ECB4 X-CRM114-Status: GOOD ( 10.31 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.3.1 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- Cc: Linus Torvalds , linux-kernel@vger.kernel.org, Christoph Hellwig , Paolo Minazzi , linux-mtd@lists.infradead.org, David Woodhouse X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Otherwise we hit a BUG_ON in bdi_queue_work(). Signed-off-by: Joern Engel --- 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;