Commits

Ricardo Gomez  committed 57ac775 Draft

Use kgdbretry param

  • Participants
  • Parent commits 476cd6c

Comments (0)

Files changed (1)

File drivers/serial/kgdboc.c

 static int configured		= -1;
 
 static char config[MAX_CONFIG_LEN];
+static int config_retry_time = 0;
 static struct kparam_string kps = {
 	.string			= config,
 	.maxlen			= MAX_CONFIG_LEN,
 
 __setup("kgdboc=", kgdboc_option_setup);
 
+static int kgdbretry_option_setup(char *opt)
+{
+	if (strlen(opt) > MAX_CONFIG_LEN) {
+		printk(KERN_ERR "kgdbretry: config string too long\n");
+		return -ENOSPC;
+	}
+	config_retry_time = simple_strtoul(opt, NULL, 10);
+
+	return 0;
+}
+
+__setup("kgdbretry=", kgdbretry_option_setup);
+
 static void cleanup_kgdboc(void)
 {
 	kgdboc_unregister_kbd();
 		goto do_register;
 
 	p = tty_find_polling_driver(cptr, &tty_line);
-	if (!p)
+	if (!p) {
+		printk("kgdb will retry in %d secs\n", config_retry_time);
+		if (config_retry_time > 0) {
+			INIT_DELAYED_WORK(&ttycheck_work, ttycheck_func);
+			schedule_delayed_work(&ttycheck_work, config_retry_time * HZ);
+			return -ENODEV;
+		}
 		goto noconfig;
+	}
 
 	cons = console_drivers;
 	while (cons) {