aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/kconfig
diff options
context:
space:
mode:
authorMichal Marek <mmarek@suse.cz>2013-02-25 15:50:05 -0500
committerMichal Marek <mmarek@suse.cz>2013-02-25 15:51:57 -0500
commite3900e74f26fc924c8e9e2a922bd40369b0bb517 (patch)
tree6e868575d346032ba9408f350c6e5369e0e52b0d /scripts/kconfig
parent62dc989921df2a98d1a73aacd085abe941cb9828 (diff)
parent02f3e53a131c8aa3fe3c954058f1add5beeae621 (diff)
Merge branch 'kbuild/rc-fixes' into kbuild/kconfig
There is one kconfig fix in the rc-fixes branch that I forgot to submit for 3.8, so let's add it to the kconfig branch for 3.9-rc1.
Diffstat (limited to 'scripts/kconfig')
-rw-r--r--scripts/kconfig/expr.h5
-rw-r--r--scripts/kconfig/list.h91
-rw-r--r--scripts/kconfig/lkc_proto.h4
-rw-r--r--scripts/kconfig/lxdialog/dialog.h1
-rw-r--r--scripts/kconfig/mconf.c6
-rw-r--r--scripts/kconfig/menu.c14
6 files changed, 106 insertions, 15 deletions
diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h
index bd2e09895553..cdd48600e02a 100644
--- a/scripts/kconfig/expr.h
+++ b/scripts/kconfig/expr.h
@@ -12,7 +12,7 @@ extern "C" {
12 12
13#include <assert.h> 13#include <assert.h>
14#include <stdio.h> 14#include <stdio.h>
15#include <sys/queue.h> 15#include "list.h"
16#ifndef __cplusplus 16#ifndef __cplusplus
17#include <stdbool.h> 17#include <stdbool.h>
18#endif 18#endif
@@ -175,12 +175,11 @@ struct menu {
175#define MENU_ROOT 0x0002 175#define MENU_ROOT 0x0002
176 176
177struct jump_key { 177struct jump_key {
178 CIRCLEQ_ENTRY(jump_key) entries; 178 struct list_head entries;
179 size_t offset; 179 size_t offset;
180 struct menu *target; 180 struct menu *target;
181 int index; 181 int index;
182}; 182};
183CIRCLEQ_HEAD(jk_head, jump_key);
184 183
185#define JUMP_NB 9 184#define JUMP_NB 9
186 185
diff --git a/scripts/kconfig/list.h b/scripts/kconfig/list.h
new file mode 100644
index 000000000000..0ae730be5f49
--- /dev/null
+++ b/scripts/kconfig/list.h
@@ -0,0 +1,91 @@
1#ifndef LIST_H
2#define LIST_H
3
4/*
5 * Copied from include/linux/...
6 */
7
8#undef offsetof
9#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
10
11/**
12 * container_of - cast a member of a structure out to the containing structure
13 * @ptr: the pointer to the member.
14 * @type: the type of the container struct this is embedded in.
15 * @member: the name of the member within the struct.
16 *
17 */
18#define container_of(ptr, type, member) ({ \
19 const typeof( ((type *)0)->member ) *__mptr = (ptr); \
20 (type *)( (char *)__mptr - offsetof(type,member) );})
21
22
23struct list_head {
24 struct list_head *next, *prev;
25};
26
27
28#define LIST_HEAD_INIT(name) { &(name), &(name) }
29
30#define LIST_HEAD(name) \
31 struct list_head name = LIST_HEAD_INIT(name)
32
33/**
34 * list_entry - get the struct for this entry
35 * @ptr: the &struct list_head pointer.
36 * @type: the type of the struct this is embedded in.
37 * @member: the name of the list_struct within the struct.
38 */
39#define list_entry(ptr, type, member) \
40 container_of(ptr, type, member)
41
42/**
43 * list_for_each_entry - iterate over list of given type
44 * @pos: the type * to use as a loop cursor.
45 * @head: the head for your list.
46 * @member: the name of the list_struct within the struct.
47 */
48#define list_for_each_entry(pos, head, member) \
49 for (pos = list_entry((head)->next, typeof(*pos), member); \
50 &pos->member != (head); \
51 pos = list_entry(pos->member.next, typeof(*pos), member))
52
53/**
54 * list_empty - tests whether a list is empty
55 * @head: the list to test.
56 */
57static inline int list_empty(const struct list_head *head)
58{
59 return head->next == head;
60}
61
62/*
63 * Insert a new entry between two known consecutive entries.
64 *
65 * This is only for internal list manipulation where we know
66 * the prev/next entries already!
67 */
68static inline void __list_add(struct list_head *_new,
69 struct list_head *prev,
70 struct list_head *next)
71{
72 next->prev = _new;
73 _new->next = next;
74 _new->prev = prev;
75 prev->next = _new;
76}
77
78/**
79 * list_add_tail - add a new entry
80 * @new: new entry to be added
81 * @head: list head to add it before
82 *
83 * Insert a new entry before the specified head.
84 * This is useful for implementing queues.
85 */
86static inline void list_add_tail(struct list_head *_new, struct list_head *head)
87{
88 __list_add(_new, head->prev, head);
89}
90
91#endif
diff --git a/scripts/kconfig/lkc_proto.h b/scripts/kconfig/lkc_proto.h
index 1d1c08537f1e..ef1a7381f956 100644
--- a/scripts/kconfig/lkc_proto.h
+++ b/scripts/kconfig/lkc_proto.h
@@ -21,9 +21,9 @@ P(menu_get_root_menu,struct menu *,(struct menu *menu));
21P(menu_get_parent_menu,struct menu *,(struct menu *menu)); 21P(menu_get_parent_menu,struct menu *,(struct menu *menu));
22P(menu_has_help,bool,(struct menu *menu)); 22P(menu_has_help,bool,(struct menu *menu));
23P(menu_get_help,const char *,(struct menu *menu)); 23P(menu_get_help,const char *,(struct menu *menu));
24P(get_symbol_str, void, (struct gstr *r, struct symbol *sym, struct jk_head 24P(get_symbol_str, void, (struct gstr *r, struct symbol *sym, struct list_head
25 *head)); 25 *head));
26P(get_relations_str, struct gstr, (struct symbol **sym_arr, struct jk_head 26P(get_relations_str, struct gstr, (struct symbol **sym_arr, struct list_head
27 *head)); 27 *head));
28P(menu_get_ext_help,void,(struct menu *menu, struct gstr *help)); 28P(menu_get_ext_help,void,(struct menu *menu, struct gstr *help));
29 29
diff --git a/scripts/kconfig/lxdialog/dialog.h b/scripts/kconfig/lxdialog/dialog.h
index ee17a5264d5b..307022a8beef 100644
--- a/scripts/kconfig/lxdialog/dialog.h
+++ b/scripts/kconfig/lxdialog/dialog.h
@@ -221,7 +221,6 @@ int dialog_menu(const char *title, const char *prompt,
221 const void *selected, int *s_scroll); 221 const void *selected, int *s_scroll);
222int dialog_checklist(const char *title, const char *prompt, int height, 222int dialog_checklist(const char *title, const char *prompt, int height,
223 int width, int list_height); 223 int width, int list_height);
224extern char dialog_input_result[];
225int dialog_inputbox(const char *title, const char *prompt, int height, 224int dialog_inputbox(const char *title, const char *prompt, int height,
226 int width, const char *init); 225 int width, const char *init);
227 226
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c
index 680135effd9b..566288a76370 100644
--- a/scripts/kconfig/mconf.c
+++ b/scripts/kconfig/mconf.c
@@ -313,7 +313,7 @@ static void set_config_filename(const char *config_filename)
313 313
314 314
315struct search_data { 315struct search_data {
316 struct jk_head *head; 316 struct list_head *head;
317 struct menu **targets; 317 struct menu **targets;
318 int *keys; 318 int *keys;
319}; 319};
@@ -324,7 +324,7 @@ static void update_text(char *buf, size_t start, size_t end, void *_data)
324 struct jump_key *pos; 324 struct jump_key *pos;
325 int k = 0; 325 int k = 0;
326 326
327 CIRCLEQ_FOREACH(pos, data->head, entries) { 327 list_for_each_entry(pos, data->head, entries) {
328 if (pos->offset >= start && pos->offset < end) { 328 if (pos->offset >= start && pos->offset < end) {
329 char header[4]; 329 char header[4];
330 330
@@ -381,7 +381,7 @@ again:
381 381
382 sym_arr = sym_re_search(dialog_input); 382 sym_arr = sym_re_search(dialog_input);
383 do { 383 do {
384 struct jk_head head = CIRCLEQ_HEAD_INITIALIZER(head); 384 LIST_HEAD(head);
385 struct menu *targets[JUMP_NB]; 385 struct menu *targets[JUMP_NB];
386 int keys[JUMP_NB + 1], i; 386 int keys[JUMP_NB + 1], i;
387 struct search_data data = { 387 struct search_data data = {
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index 84a2ba2077aa..f3bffa309333 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -508,7 +508,7 @@ const char *menu_get_help(struct menu *menu)
508} 508}
509 509
510static void get_prompt_str(struct gstr *r, struct property *prop, 510static void get_prompt_str(struct gstr *r, struct property *prop,
511 struct jk_head *head) 511 struct list_head *head)
512{ 512{
513 int i, j; 513 int i, j;
514 struct menu *submenu[8], *menu, *location = NULL; 514 struct menu *submenu[8], *menu, *location = NULL;
@@ -544,12 +544,13 @@ static void get_prompt_str(struct gstr *r, struct property *prop,
544 } else 544 } else
545 jump->target = location; 545 jump->target = location;
546 546
547 if (CIRCLEQ_EMPTY(head)) 547 if (list_empty(head))
548 jump->index = 0; 548 jump->index = 0;
549 else 549 else
550 jump->index = CIRCLEQ_LAST(head)->index + 1; 550 jump->index = list_entry(head->prev, struct jump_key,
551 entries)->index + 1;
551 552
552 CIRCLEQ_INSERT_TAIL(head, jump, entries); 553 list_add_tail(&jump->entries, head);
553 } 554 }
554 555
555 if (i > 0) { 556 if (i > 0) {
@@ -573,7 +574,8 @@ static void get_prompt_str(struct gstr *r, struct property *prop,
573/* 574/*
574 * head is optional and may be NULL 575 * head is optional and may be NULL
575 */ 576 */
576void get_symbol_str(struct gstr *r, struct symbol *sym, struct jk_head *head) 577void get_symbol_str(struct gstr *r, struct symbol *sym,
578 struct list_head *head)
577{ 579{
578 bool hit; 580 bool hit;
579 struct property *prop; 581 struct property *prop;
@@ -612,7 +614,7 @@ void get_symbol_str(struct gstr *r, struct symbol *sym, struct jk_head *head)
612 str_append(r, "\n\n"); 614 str_append(r, "\n\n");
613} 615}
614 616
615struct gstr get_relations_str(struct symbol **sym_arr, struct jk_head *head) 617struct gstr get_relations_str(struct symbol **sym_arr, struct list_head *head)
616{ 618{
617 struct symbol *sym; 619 struct symbol *sym;
618 struct gstr res = str_new(); 620 struct gstr res = str_new();