summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/mtdpart.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-10-03 05:49:15 +0200
committerLinus Torvalds <torvalds@linux-foundation.org>2012-10-03 05:49:15 +0200
commit65b99c74fdd325d1ffa2e5663295888704712604 (patch)
tree6ccec0803316bbefc1ea82add70245a9586c5fff /drivers/mtd/mtdpart.c
parentMerge tag 'upstream-3.7-rc1' of git://git.infradead.org/linux-ubifs (diff)
parentUBI: fix trivial typo 'it' => 'is' (diff)
downloadlinux-65b99c74fdd325d1ffa2e5663295888704712604.tar.xz
linux-65b99c74fdd325d1ffa2e5663295888704712604.zip
Merge tag 'upstream-3.7-rc1' of git://git.infradead.org/linux-ubi
Pull UBI changes from Artem Bityutskiy: "The main change is the way we reserve eraseblocks for bad blocks handling. We used to reserve 2% of the partition, but now we are more aggressive and we reserve 2% of the entire chip, which is what actually manufacturers specify in data sheets. We introduced an option to users to override the default, though. There are a couple of fixes as well, and a number of cleanups." * tag 'upstream-3.7-rc1' of git://git.infradead.org/linux-ubi: (24 commits) UBI: fix trivial typo 'it' => 'is' UBI: load after mtd device drivers UBI: print less UBI: use pr_ helper instead of printk UBI: comply with coding style UBI: erase free PEB with bitflip in EC header UBI: fix autoresize handling in R/O mode UBI: add max_beb_per1024 to attach ioctl UBI: allow specifying bad PEBs limit using module parameter UBI: check max_beb_per1024 value in ubi_attach_mtd_dev UBI: prepare for max_beb_per1024 module parameter addition UBI: introduce MTD_PARAM_MAX_COUNT UBI: separate bad_peb_limit in a function arm: sam9_l9260_defconfig: correct CONFIG_MTD_UBI_BEB_LIMIT UBI: use the whole MTD device size to get bad_peb_limit mtd: mtdparts: introduce mtd_get_device_size mtd: mark mtd_is_partition argument as constant arm: sam9_l9260_defconfig: remove non-existing config option UBI: kill CONFIG_MTD_UBI_BEB_RESERVE UBI: limit amount of reserved eraseblocks for bad PEB handling ...
Diffstat (limited to 'drivers/mtd/mtdpart.c')
-rw-r--r--drivers/mtd/mtdpart.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
index d518e4db8a0b..3a49e6de5e60 100644
--- a/drivers/mtd/mtdpart.c
+++ b/drivers/mtd/mtdpart.c
@@ -744,7 +744,7 @@ int parse_mtd_partitions(struct mtd_info *master, const char **types,
return ret;
}
-int mtd_is_partition(struct mtd_info *mtd)
+int mtd_is_partition(const struct mtd_info *mtd)
{
struct mtd_part *part;
int ispart = 0;
@@ -760,3 +760,13 @@ int mtd_is_partition(struct mtd_info *mtd)
return ispart;
}
EXPORT_SYMBOL_GPL(mtd_is_partition);
+
+/* Returns the size of the entire flash chip */
+uint64_t mtd_get_device_size(const struct mtd_info *mtd)
+{
+ if (!mtd_is_partition(mtd))
+ return mtd->size;
+
+ return PART(mtd)->master->size;
+}
+EXPORT_SYMBOL_GPL(mtd_get_device_size);