Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

kconfig: pass new conf_changed value to the callback

Commit ee06a3ef7e3c ("kconfig: Update config changed flag before calling
callback") pointed out that conf_updated flag must be updated _before_
calling the callback, which needs to know the new value.

Given that, it makes sense to directly pass the new value to the
callback.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

+11 -14
+4 -6
scripts/kconfig/confdata.c
··· 1141 1141 } 1142 1142 1143 1143 static bool conf_changed; 1144 - static void (*conf_changed_callback)(void); 1144 + static void (*conf_changed_callback)(bool); 1145 1145 1146 1146 void conf_set_changed(bool val) 1147 1147 { 1148 - bool changed = conf_changed != val; 1148 + if (conf_changed_callback && conf_changed != val) 1149 + conf_changed_callback(val); 1149 1150 1150 1151 conf_changed = val; 1151 - 1152 - if (conf_changed_callback && changed) 1153 - conf_changed_callback(); 1154 1152 } 1155 1153 1156 1154 bool conf_get_changed(void) ··· 1156 1158 return conf_changed; 1157 1159 } 1158 1160 1159 - void conf_set_changed_callback(void (*fn)(void)) 1161 + void conf_set_changed_callback(void (*fn)(bool)) 1160 1162 { 1161 1163 conf_changed_callback = fn; 1162 1164 }
+3 -4
scripts/kconfig/gconf.c
··· 84 84 gtk_tool_button_set_icon_widget(button, image); 85 85 } 86 86 87 - static void conf_changed(void) 87 + static void conf_changed(bool dirty) 88 88 { 89 - bool changed = conf_get_changed(); 90 - gtk_widget_set_sensitive(save_btn, changed); 91 - gtk_widget_set_sensitive(save_menu_item, changed); 89 + gtk_widget_set_sensitive(save_btn, dirty); 90 + gtk_widget_set_sensitive(save_menu_item, dirty); 92 91 } 93 92 94 93 /* Main Window Initialization */
+1 -1
scripts/kconfig/lkc_proto.h
··· 13 13 int conf_write_autoconf(int overwrite); 14 14 void conf_set_changed(bool val); 15 15 bool conf_get_changed(void); 16 - void conf_set_changed_callback(void (*fn)(void)); 16 + void conf_set_changed_callback(void (*fn)(bool)); 17 17 void conf_set_message_callback(void (*fn)(const char *s)); 18 18 bool conf_errors(void); 19 19
+2 -2
scripts/kconfig/qconf.cc
··· 1849 1849 configSettings->writeSizes("/split2", split2->sizes()); 1850 1850 } 1851 1851 1852 - void ConfigMainWindow::conf_changed(void) 1852 + void ConfigMainWindow::conf_changed(bool dirty) 1853 1853 { 1854 1854 if (saveAction) 1855 - saveAction->setEnabled(conf_get_changed()); 1855 + saveAction->setEnabled(dirty); 1856 1856 } 1857 1857 1858 1858 void fixup_rootmenu(struct menu *menu)
+1 -1
scripts/kconfig/qconf.h
··· 239 239 240 240 char *configname; 241 241 static QAction *saveAction; 242 - static void conf_changed(void); 242 + static void conf_changed(bool); 243 243 public: 244 244 ConfigMainWindow(void); 245 245 public slots: