discover: Don't register multiple boot_timeout waiters
authorJeremy Kerr <jk@ozlabs.org>
Mon, 23 Sep 2013 08:27:17 +0000 (16:27 +0800)
committerJeremy Kerr <jk@ozlabs.org>
Mon, 23 Sep 2013 08:29:35 +0000 (16:29 +0800)
Rather than adding another timeout waiter, just override
handler->default_boot_option and extend the timeout a little.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
discover/device-handler.c

index f9d2dbf5d53f1450d56c0c201738567cfb9b9166..02ae6884db47876cffb740d86841c6f9c40afc82 100644 (file)
@@ -372,8 +372,14 @@ static void set_default(struct device_handler *handler,
                cur_prio = default_option_priority(
                                        handler->default_boot_option);
 
-               if (new_prio >= cur_prio)
-                       return;
+               if (new_prio < cur_prio) {
+                       handler->default_boot_option = opt;
+                       /* extend the timeout a little, so the user sees some
+                        * indication of the change */
+                       handler->sec_to_boot += 2;
+               }
+
+               return;
        }
 
        handler->sec_to_boot = config_get()->autoboot_timeout_sec;