Patchwork [1/1] mtd: ofpart: Replicate mtd cmdline "lk" option with device tree "lock" property

login
register
mail settings
Submitter Josh Radel
Date Nov. 14, 2012, 10:11 p.m.
Message ID <1352931092-8916-1-git-send-email-jradel@gmail.com>
Download mbox | patch
Permalink /patch/199037/
State Accepted
Commit ab0b00bc6ebcfbff42dedb3bf53f0ece79b27e88
Headers show

Comments

Josh Radel - Nov. 14, 2012, 10:11 p.m.
The mtd partition command line parser already supports a "lk" option to mask
MTD_POWERUP_LOCK. This extends that same functionality to device tree
partition specifications.

Signed-off-by: Josh Radel <jradel@gmail.com>
---
 drivers/mtd/ofpart.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
Artem Bityutskiy - Nov. 22, 2012, 8:14 a.m.
On Wed, 2012-11-14 at 14:11 -0800, Josh Radel wrote:
> The mtd partition command line parser already supports a "lk" option to mask
> MTD_POWERUP_LOCK. This extends that same functionality to device tree
> partition specifications.
> 
> Signed-off-by: Josh Radel <jradel@gmail.com>

Pushed to l2-mtd.git, thanks!

Patch

diff --git a/drivers/mtd/ofpart.c b/drivers/mtd/ofpart.c
index d9127e2..dbd3aa5 100644
--- a/drivers/mtd/ofpart.c
+++ b/drivers/mtd/ofpart.c
@@ -71,7 +71,10 @@  static int parse_ofpart_partitions(struct mtd_info *master,
 		(*pparts)[i].name = (char *)partname;
 
 		if (of_get_property(pp, "read-only", &len))
-			(*pparts)[i].mask_flags = MTD_WRITEABLE;
+			(*pparts)[i].mask_flags |= MTD_WRITEABLE;
+
+		if (of_get_property(pp, "lock", &len))
+			(*pparts)[i].mask_flags |= MTD_POWERUP_LOCK;
 
 		i++;
 	}