mconf/nconf: mark empty menus/menuconfigs different from non-empty ones
[firefly-linux-kernel-4.4.55.git] / scripts / kconfig / menu.c
index b5c7d90df9df801dac0ca12d64b609e686e74b62..6d11c8f63eb02b17386266aa10b09a3c495204b3 100644 (file)
@@ -430,6 +430,22 @@ bool menu_has_prompt(struct menu *menu)
        return true;
 }
 
+/*
+ * Determine if a menu is empty.
+ * A menu is considered empty if it contains no or only
+ * invisible entries.
+ */
+bool menu_is_empty(struct menu *menu)
+{
+       struct menu *child;
+
+       for (child = menu->list; child; child = child->next) {
+               if (menu_is_visible(child))
+                       return(false);
+       }
+       return(true);
+}
+
 bool menu_is_visible(struct menu *menu)
 {
        struct menu *child;