* [PATCH 1/6] kconfig: remove unneeded code for user-supplied values being out of range
@ 2024-06-01 18:20 Masahiro Yamada
2024-06-01 18:20 ` [PATCH 2/6] kconfig: qconf: remove initial call to conf_changed() Masahiro Yamada
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Masahiro Yamada @ 2024-06-01 18:20 UTC (permalink / raw)
To: linux-kbuild; +Cc: linux-kernel, Masahiro Yamada
This is a leftover from commit ce1fc9345a59 ("kconfig: do not clear
SYMBOL_DEF_USER when the value is out of range").
This code is now redundant because if a user-supplied value is out
of range, the value adjusted by sym_validate_range() differs, and
conf_unsaved has already been incremented a few lines above.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---
scripts/kconfig/confdata.c | 13 -------------
1 file changed, 13 deletions(-)
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index 387503daf0f7..85b53069ba7a 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -533,19 +533,6 @@ int conf_read(const char *name)
*/
if (sym->visible == no && !conf_unsaved)
sym->flags &= ~SYMBOL_DEF_USER;
- switch (sym->type) {
- case S_STRING:
- case S_INT:
- case S_HEX:
- /* Reset a string value if it's out of range */
- if (sym_string_within_range(sym, sym->def[S_DEF_USER].val))
- break;
- sym->flags &= ~SYMBOL_VALID;
- conf_unsaved++;
- break;
- default:
- break;
- }
}
}
--
2.40.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/6] kconfig: qconf: remove initial call to conf_changed()
2024-06-01 18:20 [PATCH 1/6] kconfig: remove unneeded code for user-supplied values being out of range Masahiro Yamada
@ 2024-06-01 18:20 ` Masahiro Yamada
2024-06-01 18:20 ` [PATCH 3/6] kconfig: gconf: give a proper initial state to the Save button Masahiro Yamada
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Masahiro Yamada @ 2024-06-01 18:20 UTC (permalink / raw)
To: linux-kbuild; +Cc: linux-kernel, Masahiro Yamada
If any CONFIG option is changed while loading the .config file,
conf_read() calls conf_set_changed(true) and then the conf_changed()
callback.
With conf_read() moved after window initialization, the explicit
conf_changed() call can be removed.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---
scripts/kconfig/qconf.cc | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index c6c42c0f4e5d..e62e862ea283 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -1397,8 +1397,6 @@ ConfigMainWindow::ConfigMainWindow(void)
conf_set_changed_callback(conf_changed);
- // Set saveAction's initial state
- conf_changed();
configname = xstrdup(conf_get_configname());
QAction *saveAsAction = new QAction("Save &As...", this);
@@ -1904,7 +1902,6 @@ int main(int ac, char** av)
conf_parse(name);
fixup_rootmenu(&rootmenu);
- conf_read(NULL);
//zconfdump(stdout);
configApp = new QApplication(ac, av);
@@ -1916,6 +1913,9 @@ int main(int ac, char** av)
//zconfdump(stdout);
configApp->connect(configApp, SIGNAL(lastWindowClosed()), SLOT(quit()));
configApp->connect(configApp, SIGNAL(aboutToQuit()), v, SLOT(saveSettings()));
+
+ conf_read(NULL);
+
v->show();
configApp->exec();
--
2.40.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/6] kconfig: gconf: give a proper initial state to the Save button
2024-06-01 18:20 [PATCH 1/6] kconfig: remove unneeded code for user-supplied values being out of range Masahiro Yamada
2024-06-01 18:20 ` [PATCH 2/6] kconfig: qconf: remove initial call to conf_changed() Masahiro Yamada
@ 2024-06-01 18:20 ` Masahiro Yamada
2024-06-01 18:20 ` [PATCH 4/6] kconfig: gconf: remove unnecessary forward declarations Masahiro Yamada
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Masahiro Yamada @ 2024-06-01 18:20 UTC (permalink / raw)
To: linux-kbuild; +Cc: linux-kernel, Masahiro Yamada
Currently, the initial state of the "Save" button is always active.
If none of the CONFIG options are changed while loading the .config
file, the "Save" button should be greyed out.
This can be fixed by calling conf_read() after widget initialization.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---
scripts/kconfig/gconf.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c
index cc400ffe6615..e04dbafd3add 100644
--- a/scripts/kconfig/gconf.c
+++ b/scripts/kconfig/gconf.c
@@ -1422,7 +1422,6 @@ int main(int ac, char *av[])
conf_parse(name);
fixup_rootmenu(&rootmenu);
- conf_read(NULL);
/* Load the interface and connect signals */
init_main_window(glade_file);
@@ -1430,6 +1429,8 @@ int main(int ac, char *av[])
init_left_tree();
init_right_tree();
+ conf_read(NULL);
+
switch (view_mode) {
case SINGLE_VIEW:
display_tree_part();
--
2.40.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 4/6] kconfig: gconf: remove unnecessary forward declarations
2024-06-01 18:20 [PATCH 1/6] kconfig: remove unneeded code for user-supplied values being out of range Masahiro Yamada
2024-06-01 18:20 ` [PATCH 2/6] kconfig: qconf: remove initial call to conf_changed() Masahiro Yamada
2024-06-01 18:20 ` [PATCH 3/6] kconfig: gconf: give a proper initial state to the Save button Masahiro Yamada
@ 2024-06-01 18:20 ` Masahiro Yamada
2024-06-01 18:20 ` [PATCH 5/6] kconfig: gconf: move conf_changed() definition up Masahiro Yamada
2024-06-01 18:20 ` [PATCH 6/6] kconfig: pass new the conf_changed value to the callback Masahiro Yamada
4 siblings, 0 replies; 6+ messages in thread
From: Masahiro Yamada @ 2024-06-01 18:20 UTC (permalink / raw)
To: linux-kbuild; +Cc: linux-kernel, Masahiro Yamada
These are defined before their call sites.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---
scripts/kconfig/gconf.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c
index e04dbafd3add..3dc459d9840c 100644
--- a/scripts/kconfig/gconf.c
+++ b/scripts/kconfig/gconf.c
@@ -65,8 +65,6 @@ static void display_list(void);
static void display_tree(struct menu *menu);
static void display_tree_part(void);
static void update_tree(struct menu *src, GtkTreeIter * dst);
-static void set_node(GtkTreeIter * node, struct menu *menu, gchar ** row);
-static gchar **fill_row(struct menu *menu);
static void conf_changed(void);
static void replace_button_icon(GladeXML *xml, GdkDrawable *window,
--
2.40.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 5/6] kconfig: gconf: move conf_changed() definition up
2024-06-01 18:20 [PATCH 1/6] kconfig: remove unneeded code for user-supplied values being out of range Masahiro Yamada
` (2 preceding siblings ...)
2024-06-01 18:20 ` [PATCH 4/6] kconfig: gconf: remove unnecessary forward declarations Masahiro Yamada
@ 2024-06-01 18:20 ` Masahiro Yamada
2024-06-01 18:20 ` [PATCH 6/6] kconfig: pass new the conf_changed value to the callback Masahiro Yamada
4 siblings, 0 replies; 6+ messages in thread
From: Masahiro Yamada @ 2024-06-01 18:20 UTC (permalink / raw)
To: linux-kbuild; +Cc: linux-kernel, Masahiro Yamada
Define conf_changed() before its call site to remove the forward
declaration.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---
scripts/kconfig/gconf.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c
index 3dc459d9840c..2bf74aee5eff 100644
--- a/scripts/kconfig/gconf.c
+++ b/scripts/kconfig/gconf.c
@@ -65,7 +65,6 @@ static void display_list(void);
static void display_tree(struct menu *menu);
static void display_tree_part(void);
static void update_tree(struct menu *src, GtkTreeIter * dst);
-static void conf_changed(void);
static void replace_button_icon(GladeXML *xml, GdkDrawable *window,
GtkStyle *style, gchar *btn_name, gchar **xpm)
@@ -85,6 +84,13 @@ static void replace_button_icon(GladeXML *xml, GdkDrawable *window,
gtk_tool_button_set_icon_widget(button, image);
}
+static void conf_changed(void)
+{
+ bool changed = conf_get_changed();
+ gtk_widget_set_sensitive(save_btn, changed);
+ gtk_widget_set_sensitive(save_menu_item, changed);
+}
+
/* Main Window Initialization */
static void init_main_window(const gchar *glade_file)
{
@@ -1445,10 +1451,3 @@ int main(int ac, char *av[])
return 0;
}
-
-static void conf_changed(void)
-{
- bool changed = conf_get_changed();
- gtk_widget_set_sensitive(save_btn, changed);
- gtk_widget_set_sensitive(save_menu_item, changed);
-}
--
2.40.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 6/6] kconfig: pass new the conf_changed value to the callback
2024-06-01 18:20 [PATCH 1/6] kconfig: remove unneeded code for user-supplied values being out of range Masahiro Yamada
` (3 preceding siblings ...)
2024-06-01 18:20 ` [PATCH 5/6] kconfig: gconf: move conf_changed() definition up Masahiro Yamada
@ 2024-06-01 18:20 ` Masahiro Yamada
4 siblings, 0 replies; 6+ messages in thread
From: Masahiro Yamada @ 2024-06-01 18:20 UTC (permalink / raw)
To: linux-kbuild; +Cc: linux-kernel, Masahiro Yamada
Commit ee06a3ef7e3c ("kconfig: Update config changed flag before calling
callback") pointed out that conf_updated flag must be updated before
calling the callback because it needs to know the new value.
If so, it makes sense to pass the new value to the callback.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---
scripts/kconfig/confdata.c | 10 ++++------
scripts/kconfig/gconf.c | 7 +++----
scripts/kconfig/lkc_proto.h | 2 +-
scripts/kconfig/qconf.cc | 4 ++--
scripts/kconfig/qconf.h | 2 +-
5 files changed, 11 insertions(+), 14 deletions(-)
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index 85b53069ba7a..946185506380 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -1141,16 +1141,14 @@ int conf_write_autoconf(int overwrite)
}
static bool conf_changed;
-static void (*conf_changed_callback)(void);
+static void (*conf_changed_callback)(bool);
void conf_set_changed(bool val)
{
- bool changed = conf_changed != val;
+ if (conf_changed_callback && conf_changed != val)
+ conf_changed_callback(val);
conf_changed = val;
-
- if (conf_changed_callback && changed)
- conf_changed_callback();
}
bool conf_get_changed(void)
@@ -1158,7 +1156,7 @@ bool conf_get_changed(void)
return conf_changed;
}
-void conf_set_changed_callback(void (*fn)(void))
+void conf_set_changed_callback(void (*fn)(bool))
{
conf_changed_callback = fn;
}
diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c
index 2bf74aee5eff..baa1c512de3c 100644
--- a/scripts/kconfig/gconf.c
+++ b/scripts/kconfig/gconf.c
@@ -84,11 +84,10 @@ static void replace_button_icon(GladeXML *xml, GdkDrawable *window,
gtk_tool_button_set_icon_widget(button, image);
}
-static void conf_changed(void)
+static void conf_changed(bool dirty)
{
- bool changed = conf_get_changed();
- gtk_widget_set_sensitive(save_btn, changed);
- gtk_widget_set_sensitive(save_menu_item, changed);
+ gtk_widget_set_sensitive(save_btn, dirty);
+ gtk_widget_set_sensitive(save_menu_item, dirty);
}
/* Main Window Initialization */
diff --git a/scripts/kconfig/lkc_proto.h b/scripts/kconfig/lkc_proto.h
index d76aaf4ea117..c663fd8b35d2 100644
--- a/scripts/kconfig/lkc_proto.h
+++ b/scripts/kconfig/lkc_proto.h
@@ -13,7 +13,7 @@ int conf_write(const char *name);
int conf_write_autoconf(int overwrite);
void conf_set_changed(bool val);
bool conf_get_changed(void);
-void conf_set_changed_callback(void (*fn)(void));
+void conf_set_changed_callback(void (*fn)(bool));
void conf_set_message_callback(void (*fn)(const char *s));
bool conf_errors(void);
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index e62e862ea283..03fa096074b4 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -1849,10 +1849,10 @@ void ConfigMainWindow::saveSettings(void)
configSettings->writeSizes("/split2", split2->sizes());
}
-void ConfigMainWindow::conf_changed(void)
+void ConfigMainWindow::conf_changed(bool dirty)
{
if (saveAction)
- saveAction->setEnabled(conf_get_changed());
+ saveAction->setEnabled(dirty);
}
void fixup_rootmenu(struct menu *menu)
diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h
index 78b0a1dfcd53..53373064d90a 100644
--- a/scripts/kconfig/qconf.h
+++ b/scripts/kconfig/qconf.h
@@ -239,7 +239,7 @@ class ConfigMainWindow : public QMainWindow {
char *configname;
static QAction *saveAction;
- static void conf_changed(void);
+ static void conf_changed(bool);
public:
ConfigMainWindow(void);
public slots:
--
2.40.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-06-01 18:20 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-01 18:20 [PATCH 1/6] kconfig: remove unneeded code for user-supplied values being out of range Masahiro Yamada
2024-06-01 18:20 ` [PATCH 2/6] kconfig: qconf: remove initial call to conf_changed() Masahiro Yamada
2024-06-01 18:20 ` [PATCH 3/6] kconfig: gconf: give a proper initial state to the Save button Masahiro Yamada
2024-06-01 18:20 ` [PATCH 4/6] kconfig: gconf: remove unnecessary forward declarations Masahiro Yamada
2024-06-01 18:20 ` [PATCH 5/6] kconfig: gconf: move conf_changed() definition up Masahiro Yamada
2024-06-01 18:20 ` [PATCH 6/6] kconfig: pass new the conf_changed value to the callback Masahiro Yamada
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox