From: Masahiro Yamada <masahiroy@kernel.org>
To: linux-kbuild@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Masahiro Yamada <masahiroy@kernel.org>
Subject: [PATCH 6/6] kconfig: pass new the conf_changed value to the callback
Date: Sun, 2 Jun 2024 03:20:43 +0900 [thread overview]
Message-ID: <20240601182043.876249-6-masahiroy@kernel.org> (raw)
In-Reply-To: <20240601182043.876249-1-masahiroy@kernel.org>
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
prev parent reply other threads:[~2024-06-01 18:20 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Masahiro Yamada [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240601182043.876249-6-masahiroy@kernel.org \
--to=masahiroy@kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox