From mboxrd@z Thu Jan 1 00:00:00 1970 From: Heiko Schocher Date: Wed, 21 Nov 2018 07:46:46 +0100 Subject: [U-Boot] [PATCH v3 09/11] mtd: Don't stop MTD partition creation when it fails on one device In-Reply-To: <20181119205955.32042-10-boris.brezillon@bootlin.com> References: <20181119205955.32042-1-boris.brezillon@bootlin.com> <20181119205955.32042-10-boris.brezillon@bootlin.com> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hello Boris, Am 19.11.2018 um 21:59 schrieb Boris Brezillon: > MTD partition creation code is a bit tricky. It tries to figure out > when things have changed (either MTD dev list or mtdparts/mtdids vars) > and when that happens it first deletes all the partitions that had been > previously created and then creates the new ones based on the new > mtdparts/mtdids values. > But before deleting the old partitions, it ensures that none of the > currently registered parts are being used and bails out when that's > not the case. So, we end up in a situation where, if at least one MTD > dev has one of its partitions used by someone (UBI for instance), the > partitions update logic no longer works for other devs. > > Rework the code to relax the logic and allow updates of MTD parts on > devices that are not being used (we still refuse to updates parts on > devices who have at least one of their partitions used by someone). > > Fixes: 5db66b3aee6f ("cmd: mtd: add 'mtd' command") > Signed-off-by: Boris Brezillon > --- > Changes in v3: > - None > > Changes in v2: > - New patch > > Changes in v3: > - Re-create partitions when our last attempt do delete all existing > parts failed. This way we can update parts after ubi detach has > been called without having to change mtdparts/mtdids. > --- > drivers/mtd/mtd_uboot.c | 96 +++++++++++++++++++++++++++++------------ > drivers/mtd/mtdpart.c | 12 ++++++ > include/linux/mtd/mtd.h | 2 + > 3 files changed, 82 insertions(+), 28 deletions(-) Tested-by: Heiko Schocher bye, Heiko -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-52 Fax: +49-8142-66989-80 Email: hs at denx.de