diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2005-10-29 16:03:24 +0100 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2005-10-29 16:03:24 +0100 |
commit | 822e5e72697ce06e4425c17d161b0482c7d9b6d4 (patch) | |
tree | 0668a09f5da7722ea972d203c931a39dea8b6a5f | |
parent | 0d2ef7d73e0b5173af3940139569bebd2375f441 (diff) | |
download | op-kernel-dev-822e5e72697ce06e4425c17d161b0482c7d9b6d4.zip op-kernel-dev-822e5e72697ce06e4425c17d161b0482c7d9b6d4.tar.gz |
[ARM] Fix MTD device/partition destruction
We should not delete MTD partitions when we registered a MTD
device.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r-- | drivers/mtd/maps/sa1100-flash.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/mtd/maps/sa1100-flash.c b/drivers/mtd/maps/sa1100-flash.c index 50a1d43..c38c2c3 100644 --- a/drivers/mtd/maps/sa1100-flash.c +++ b/drivers/mtd/maps/sa1100-flash.c @@ -137,6 +137,7 @@ struct sa_info { struct mtd_partition *parts; struct mtd_info *mtd; int num_subdev; + unsigned int nr_parts; struct sa_subdev_info subdev[0]; }; @@ -228,8 +229,12 @@ static void sa1100_destroy(struct sa_info *info, struct flash_platform_data *pla int i; if (info->mtd) { - del_mtd_partitions(info->mtd); - + if (info->nr_parts == 0) + del_mtd_device(info->mtd); +#ifdef CONFIG_MTD_PARTITIONS + else + del_mtd_partitions(info->mtd); +#endif #ifdef CONFIG_MTD_CONCAT if (info->mtd != info->subdev[0].mtd) mtd_concat_destroy(info->mtd); @@ -396,6 +401,8 @@ static int __init sa1100_mtd_probe(struct device *dev) add_mtd_partitions(info->mtd, parts, nr_parts); } + info->nr_parts = nr_parts; + dev_set_drvdata(dev, info); err = 0; |