drivers/misc: ipanic should have a module parameter to specify dump partition
authorRobert Jarzmik <robert.jarzmik@intel.com>
Fri, 11 May 2012 15:31:49 +0000 (17:31 +0200)
committerbuildbot <buildbot@intel.com>
Mon, 25 Jun 2012 09:04:27 +0000 (02:04 -0700)
BZ: 42097

Previously, dump partition was always number 6 (ie. mmcblk0p6). This
prevents repartitioning and reordering on futur boards.

This patch keeps 6 as the default, but makes the number configurable
as a module param :
 - with kernel commandline emmc_ipanic.ipanic_part_number=3 for mmcblk0p3

Change-Id: I600b08fd22d781f6175039479df000a4cb7eae72
Signed-off-by: Robert Jarzmik <robert.jarzmik@intel.com>
Reviewed-on: http://android.intel.com:8080/52962
Reviewed-by: Puech, Yann <yann.puech@intel.com>
Tested-by: Romieu, Benoit <benoit.romieu@intel.com>
Reviewed-by: buildbot <buildbot@intel.com>
Tested-by: buildbot <buildbot@intel.com>
drivers/misc/emmc_ipanic.c

index 8019fe2..0bb354e 100755 (executable)
 #include <linux/genhd.h>
 #include "emmc_ipanic.h"
 
+static unsigned int ipanic_part_number;
+module_param(ipanic_part_number, uint, 0);
+MODULE_PARM_DESC(ipanic_part_number, "IPanic dump partition on mmcblk0");
+
 #ifdef CONFIG_ANDROID_LOGGER
 #include "../staging/android/logger.h"
 static unsigned char *logcat_name[LOGCAT_BUFF_COUNT] = {
@@ -56,11 +60,14 @@ static unsigned char *logcat_name[LOGCAT_BUFF_COUNT] = {
 };
 #endif
 
+/*
+ * The part_number will be filled in driver init.
+ */
 static struct mmc_emergency_info emmc_info = {
        .init = mmc_emergency_init,
        .write = mmc_emergency_write,
        .emmc_disk_name = "mmcblk0",
-       .part_number = EMMC_PANIC_PART_NUM,
+       .part_number = 0,
        .name = "emmc_ipanic",
        .disk_device = NULL
 };
@@ -965,11 +972,17 @@ int __init emmc_ipanic_init(void)
        /*initialization of drv_ctx */
        memset(&drv_ctx, 0, sizeof(drv_ctx));
        drv_ctx.emmc = &emmc_info;
+       if (!ipanic_part_number)
+               emmc_info.part_number = EMMC_PANIC_PART_NUM;
+       else
+               emmc_info.part_number = ipanic_part_number;
+
        drv_ctx.ipanic_proc_entry_name = ipanic_proc_entry_name;
        drv_ctx.bounce = (void *)__get_free_page(GFP_KERNEL);
 
        INIT_WORK(&proc_removal_work, emmc_ipanic_remove_proc_work);
-       printk(KERN_INFO "Android kernel panic handler initialized!\n");
+       printk(KERN_INFO "Android kernel panic handler initialized on partition %sp%d!\n",
+              emmc_info.emmc_disk_name, emmc_info.part_number);
        return 0;
 }