From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from 3a.49.1343.static.theplanet.com ([67.19.73.58] helo=pug.o-hand.com) by canuck.infradead.org with esmtps (Exim 4.63 #1 (Red Hat Linux)) id 1HNA6D-0005Mw-AC for linux-mtd@lists.infradead.org; Fri, 02 Mar 2007 10:55:48 -0500 Subject: [PATCH 5/9] mtd: Allow dynamic major/minor number for mtd block devices From: Richard Purdie To: Nick Piggin , Hugh Dickins , kernel list , linux-mtd , David Woodhouse Content-Type: text/plain Date: Fri, 02 Mar 2007 15:54:49 +0000 Message-Id: <1172850889.11149.125.camel@localhost.localdomain> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Allow mtd block devices to have a dynamically allocated major/minor numbers if tr->major == 0. Signed-off-by: Richard Purdie --- drivers/mtd/mtd_blkdevs.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) Index: linux/drivers/mtd/mtd_blkdevs.c =================================================================== --- linux.orig/drivers/mtd/mtd_blkdevs.c 2007-02-28 18:16:52.000000000 +0000 +++ linux/drivers/mtd/mtd_blkdevs.c 2007-03-02 14:46:29.000000000 +0000 @@ -380,13 +380,16 @@ int register_mtd_blktrans(struct mtd_blk mutex_lock(&mtd_table_mutex); ret = register_blkdev(tr->major, tr->name); - if (ret) { + if (ret < 0) { printk(KERN_WARNING "Unable to register %s block device on major %d: %d\n", tr->name, tr->major, ret); kfree(tr->blkcore_priv); mutex_unlock(&mtd_table_mutex); return ret; } + if (!tr->major) + tr->major = ret; + spin_lock_init(&tr->blkcore_priv->queue_lock); init_completion(&tr->blkcore_priv->thread_dead); init_waitqueue_head(&tr->blkcore_priv->thread_wq);