// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright 2010-2011 Calxeda, Inc.
+ * Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
*/
#include <common.h>
char *(*item_choice)(void *);
void *item_choice_data;
struct list_head items;
+ int item_cnt;
};
/*
if (!m || !choice)
return -EINVAL;
- if (!m->prompt)
+ if (!m->prompt || m->item_cnt == 1)
return menu_default_choice(m, choice);
return menu_interactive_choice(m, choice);
item->data = item_data;
list_add_tail(&item->list, &m->items);
+ m->item_cnt++;
return 1;
}
m->item_data_print = item_data_print;
m->item_choice = item_choice;
m->item_choice_data = item_choice_data;
+ m->item_cnt = 0;
if (title) {
m->title = strdup(title);