Some mtd device does not support lock and unlock functions. Adding this check
avoids crashing when mtd_part_lock/unlock are called for such devices.
Signed-off-by: Zahari Doychev <zahari.doychev@linux.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Delete the partition erase size initialisation to let the code
that follows determine the biggest partition erase size.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
The current code counts the eraseregions a new partition spans and
sets the partitions number of eraseregions accordingly, but the code
forgets to allocate and fill in the eraseregions for the partition
mtd device. This makes the erase operation crash with a NULL pointer
exception.
This patch fixes this with the same approach the kernel uses: Set
the number of eraseregions to 1 unconditionally and the eraseregion
size to the maximum of the eraseregions found in the partition.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
So far mtd partitions were mtd devices, but these were not registered.
This patch changes this. mtd partitions are now registered like real
mtd devices. This makes them part of the device hierarchy.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
struct mtd_info contains members which should not be copied
to the new partition, like for example the class_dev, so
only copy selected members of struct mtd_info to the partition.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
this allow to do not provide block_isbad at mtd driver level
as example spi flash
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>