mtd: diskonchip: remove two-phase partitioning / registration
Linux-MTD Mailing List
linux-mtd at lists.infradead.org
Tue Jun 23 10:59:07 PDT 2015
Gitweb: http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=6a7c7334fe250b53c42eb9d3887fd42bdc9d0d28
Commit: 6a7c7334fe250b53c42eb9d3887fd42bdc9d0d28
Parent: e5babdf928e5d0c432a8d4b99f20421ce14d1ab6
Author: Brian Norris <computersforpeace at gmail.com>
AuthorDate: Mon Jun 1 16:17:17 2015 -0700
Committer: Brian Norris <computersforpeace at gmail.com>
CommitDate: Tue Jun 16 18:46:09 2015 -0700
mtd: diskonchip: remove two-phase partitioning / registration
It is a Bad Idea (TM) to call mtd_device_register() or
mtd_device_parse_register() twice on the same master MTD. Among other
things, it makes partition overrides (e.g., cmdlinepart) much more
difficult.
Since commit 727dc612c46b ("mtd: part: Create the master device node
when partitioned"), we now have a config option that accomplishes the
same purpose as the double-registration done in diskonchip.c -- it
forces the master MTD to *always* be registered, while partitions may
optionally show up in addition. Eventually, we might like to make
CONFIG_MTD_PARTITIONED_MASTER into the default, but this could be
disruptive to user-space expectations of MTD numbering, so we'll take
that slowly.
Signed-off-by: Brian Norris <computersforpeace at gmail.com>
Cc: Richard Weinberger <richard at nod.at>
Cc: Alexander Shiyan <shc_work at mail.ru>
---
drivers/mtd/nand/diskonchip.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/drivers/mtd/nand/diskonchip.c b/drivers/mtd/nand/diskonchip.c
index e580014..7da266a 100644
--- a/drivers/mtd/nand/diskonchip.c
+++ b/drivers/mtd/nand/diskonchip.c
@@ -1301,10 +1301,7 @@ static int __init nftl_scan_bbt(struct mtd_info *mtd)
if (ret)
return ret;
- mtd_device_register(mtd, NULL, 0);
- if (!no_autopart)
- mtd_device_register(mtd, parts, numparts);
- return 0;
+ return mtd_device_register(mtd, parts, no_autopart ? 0 : numparts);
}
static int __init inftl_scan_bbt(struct mtd_info *mtd)
@@ -1358,10 +1355,7 @@ static int __init inftl_scan_bbt(struct mtd_info *mtd)
autopartitioning, but I want to give it more thought. */
if (!numparts)
return -EIO;
- mtd_device_register(mtd, NULL, 0);
- if (!no_autopart)
- mtd_device_register(mtd, parts, numparts);
- return 0;
+ return mtd_device_register(mtd, parts, no_autopart ? 0 : numparts);
}
static inline int __init doc2000_init(struct mtd_info *mtd)
More information about the linux-mtd-cvs
mailing list