From 5ed0c1764e452c5b5a367881afef75242c5e931f Mon Sep 17 00:00:00 2001 From: Shawn Lin Date: Tue, 14 Feb 2017 14:50:02 +0800 Subject: [PATCH] block/partitions/rk: extend the property setting for NVMe In order not to cause ABI regression, let's invent a new androidboot.mode for NVMe instead. Just elaborate a bit more that we now doesn't support mtd devices, otherwise we should rework it to make it more scalable. Change-Id: I115ffd0e5c4986f2e76fcbcf6700c31f297f7950 Signed-off-by: Shawn Lin --- block/partitions/rk.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/block/partitions/rk.c b/block/partitions/rk.c index 93d9356a1748..73a8f8db3be4 100755 --- a/block/partitions/rk.c +++ b/block/partitions/rk.c @@ -276,17 +276,26 @@ static int parse_cmdline_partitions(sector_t n, static void rkpart_bootmode_fixup(void) { - const char mode[] = " androidboot.mode=emmc"; + const char mode_emmc[] = " androidboot.mode=emmc"; + const char mode_nvme[] = " androidboot.mode=nvme"; const char charger[] = " androidboot.charger.emmc=1"; char *new_command_line; size_t saved_command_line_len = strlen(saved_command_line); if (strstr(saved_command_line, "androidboot.mode=charger")) { - new_command_line = kzalloc(saved_command_line_len + strlen(charger) + 1, GFP_KERNEL); - sprintf(new_command_line, "%s%s", saved_command_line, charger); + new_command_line = kzalloc(saved_command_line_len + + strlen(charger) + 1, GFP_KERNEL); + sprintf(new_command_line, "%s%s", + saved_command_line, charger); } else { - new_command_line = kzalloc(saved_command_line_len + strlen(mode) + 1, GFP_KERNEL); - sprintf(new_command_line, "%s%s", saved_command_line, mode); + new_command_line = kzalloc(saved_command_line_len + + strlen(mode_emmc) + 1, GFP_KERNEL); + if (strstr(saved_command_line, "storagemedia=nvme")) + sprintf(new_command_line, "%s%s", + saved_command_line, mode_nvme); + else + sprintf(new_command_line, "%s%s", + saved_command_line, mode_emmc); } saved_command_line = new_command_line; } -- 2.34.1