diff options
author | Richard Genoud <richard.genoud@gmail.com> | 2012-07-10 18:23:40 +0200 |
---|---|---|
committer | Artem Bityutskiy <artem.bityutskiy@linux.intel.com> | 2012-09-04 08:38:58 +0200 |
commit | 62082e56cbb807cb325a8968f35dbd922432eb48 (patch) | |
tree | 7774c4a45743e1b7bbefb1c7363c9af3185a51c5 /drivers/mtd | |
parent | mtd: mark mtd_is_partition argument as constant (diff) | |
download | linux-62082e56cbb807cb325a8968f35dbd922432eb48.tar.xz linux-62082e56cbb807cb325a8968f35dbd922432eb48.zip |
mtd: mtdparts: introduce mtd_get_device_size
'mtd_get_device_size()' returns the size of the whole MTD device, that is the
mtd_info master size. This will be used by UBI to calculate the maximum number
of bad blocks (MBB) on a MTD device.
Artem: amended the patch a bit.
Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/mtdpart.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c index 85005846f30d..3a49e6de5e60 100644 --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c @@ -760,3 +760,13 @@ int mtd_is_partition(const 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); |