plugin: Order plugin init by priority
PATCH 1/1 plugin: Order plugin init by priority
The init order matters for some plugins, e.g. wiimote Add them to a sorted list before calling add_plugin
--- src/plugin.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
src/plugin.c +11 -6
@@ -37,10 +37,10 @@ struct bluetooth_plugin {static int compare_priority (gconstpointer a,gconstpointer b) { -const struct bluetooth_plugin *plugin1 = a; -const struct bluetooth_plugin *plugin2 = b; +const struct bluetooth_plugin_desc *plugin1 = a; +const struct bluetooth_plugin_desc *plugin2 = b; -return plugin2->desc->priority - plugin1->desc->priority; +return plugin2->priority - plugin1->priority; }static int init_plugin (const struct bluetooth_plugin_desc *desc)
@@ -86,7 +86,7 @@ static gboolean add_external_plugin(void *handle,__btd_enable_debug (desc->debug_start, desc->debug_stop); - plugins =g_slist_insert_sorted (plugins, plugin, compare_priority); + plugins =g_slist_append (plugins, plugin);DBG ("Plugin %s loaded" , desc->name);return TRUE;
@@ -109,7 +109,7 @@ static void add_plugin(const struct bluetooth_plugin_desc *desc)return ; } - plugins =g_slist_insert_sorted (plugins, plugin, compare_priority); + plugins =g_slist_append (plugins, plugin);DBG ("Plugin %s loaded" , desc->name); }
@@ -201,6 +201,7 @@ static void external_plugin_init(char **cli_disabled, char **cli_enabled)void plugin_init (const char *enable,const char *disable) { +GSList *builtins =NULL ;char **cli_disabled =NULL ;char **cli_enabled =NULL ;unsigned int i;
@@ -222,12 +223,16 @@ void plugin_init(const char *enable, const char *disable) cli_disabled))continue ; -add_plugin (__bluetooth_builtin[i]); + builtins =g_slist_insert_sorted (builtins, + (void *) __bluetooth_builtin[i], compare_priority); } +g_slist_foreach (builtins, (GFunc ) add_plugin,NULL ); + if IS_ENABLED(EXTERNAL_PLUGINS)external_plugin_init (cli_enabled, cli_disabled); +g_slist_free (builtins);g_strfreev (cli_enabled);g_strfreev (cli_disabled); }
Signature · 1 line
2.47.1
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=921910
---Test result---
Test Summary:
CheckPatch PENDING 0.37 seconds GitLint PENDING 0.30 seconds BuildEll PASS 20.83 seconds BluezMake FAIL 76.30 seconds MakeCheck FAIL 1939.41 seconds MakeDistcheck PASS 159.72 seconds CheckValgrind FAIL 55.98 seconds CheckSmatch FAIL 140.47 seconds bluezmakeextell FAIL 66.92 seconds IncrementalBuild PENDING 0.41 seconds ScanBuild PASS 857.26 seconds
Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:
##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:
##############################
Test: BluezMake - FAIL
Desc: Build BlueZ
Output:
tools/mgmt-tester.c: In function ‘main’:tools/mgmt-tester.c:12893:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without 12893 | int main(int argc, char *argv[])
| ^~~~
src/plugin.c: In function ‘plugin_init’:src/plugin.c:230:28: error: cast between incompatible function types from ‘void (*)(const struct bluetooth_plugin_desc *)’ to ‘void (*)(void *, void *)’ [-Werror=cast-function-type]
230 | g_slist_foreach(builtins, (GFunc) add_plugin, NULL);
| ^
cc1: all warnings being treated as errors
make[1]: *** [Makefile:11054: src/bluetoothd-plugin.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:4695: all] Error 2
##############################
Test: MakeCheck - FAIL
Desc: Run Bluez Make Check
Output:
unit/test-avdtp.c: In function ‘main’:unit/test-avdtp.c:766:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without
766 | int main(int argc, char *argv[])
| ^~~~
unit/test-avrcp.c: In function ‘main’:
unit/test-avrcp.c:989:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without
989 | int main(int argc, char *argv[])
| ^~~~src/plugin.c: In function ‘plugin_init’:src/plugin.c:230:28: error: cast between incompatible function types from ‘void (*)(const struct bluetooth_plugin_desc *)’ to ‘void (*)(void *, void *)’ [-Werror=cast-function-type]
230 | g_slist_foreach(builtins, (GFunc) add_plugin, NULL);
| ^
cc1: all warnings being treated as errors
make[1]: *** [Makefile:11054: src/bluetoothd-plugin.o] Error 1
make: *** [Makefile:12363: check] Error 2
##############################
Test: CheckValgrind - FAIL
Desc: Run Bluez Make Check with Valgrind
Output:
tools/mgmt-tester.c: In function ‘main’:tools/mgmt-tester.c:12893:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without 12893 | int main(int argc, char *argv[])
| ^~~~
src/plugin.c: In function ‘plugin_init’:src/plugin.c:230:28: error: cast between incompatible function types from ‘void (*)(const struct bluetooth_plugin_desc *)’ to ‘void (*)(void *, void *)’ [-Werror=cast-function-type]
230 | g_slist_foreach(builtins, (GFunc) add_plugin, NULL);
| ^
cc1: all warnings being treated as errors
make[1]: *** [Makefile:11054: src/bluetoothd-plugin.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:12363: check] Error 2
##############################
Test: CheckSmatch - FAIL
Desc: Run smatch tool with source
Output:
src/shared/crypto.c:271:21: warning: Variable length array is used.src/shared/crypto.c:272:23: warning: Variable length array is used.src/shared/gatt-helpers.c:768:31: warning: Variable length array is used.src/shared/gatt-helpers.c:830:31: warning: Variable length array is used.src/shared/gatt-helpers.c:1323:31: warning: Variable length array is used.src/shared/gatt-helpers.c:1354:23: warning: Variable length array is used.src/shared/gatt-server.c:278:25: warning: Variable length array is used.src/shared/gatt-server.c:618:25: warning: Variable length array is used.src/shared/gatt-server.c:716:25: warning: Variable length array is used.src/shared/bap.c:296:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structuressrc/shared/shell.c: note: in included file (through /usr/include/readline/readline.h):/usr/include/readline/rltypedefs.h:35:23: warning: non-ANSI function declaration of function 'Function'/usr/include/readline/rltypedefs.h:36:25: warning: non-ANSI function declaration of function 'VFunction'/usr/include/readline/rltypedefs.h:37:27: warning: non-ANSI function declaration of function 'CPFunction'/usr/include/readline/rltypedefs.h:38:29: warning: non-ANSI function declaration of function 'CPPFunction'src/shared/crypto.c:271:21: warning: Variable length array is used.src/shared/crypto.c:272:23: warning: Variable length array is used.src/shared/gatt-helpers.c:768:31: warning: Variable length array is used.src/shared/gatt-helpers.c:830:31: warning: Variable length array is used.src/shared/gatt-helpers.c:1323:31: warning: Variable length array is used.src/shared/gatt-helpers.c:1354:23: warning: Variable length array is used.src/shared/gatt-server.c:278:25: warning: Variable length array is used.src/shared/gatt-server.c:618:25: warning: Variable length array is used.src/shared/gatt-server.c:716:25: warning: Variable length array is used.src/shared/bap.c:296:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structuressrc/shared/shell.c: note: in included file (through /usr/include/readline/readline.h):/usr/include/readline/rltypedefs.h:35:23: warning: non-ANSI function declaration of function 'Function'/usr/include/readline/rltypedefs.h:36:25: warning: non-ANSI function declaration of function 'VFunction'/usr/include/readline/rltypedefs.h:37:27: warning: non-ANSI function declaration of function 'CPFunction'/usr/include/readline/rltypedefs.h:38:29: warning: non-ANSI function declaration of function 'CPPFunction'tools/mesh-cfgtest.c:1453:17: warning: unknown escape sequence: '\%'tools/sco-tester.c: note: in included file:./lib/bluetooth.h:232:15: warning: array of flexible structures./lib/bluetooth.h:237:31: warning: array of flexible structurestools/bneptest.c:634:39: warning: unknown escape sequence: '\%'tools/seq2bseq.c:57:26: warning: Variable length array is used.tools/obex-client-tool.c: note: in included file (through /usr/include/readline/readline.h):/usr/include/readline/rltypedefs.h:35:23: warning: non-ANSI function declaration of function 'Function'/usr/include/readline/rltypedefs.h:36:25: warning: non-ANSI function declaration of function 'VFunction'/usr/include/readline/rltypedefs.h:37:27: warning: non-ANSI function declaration of function 'CPFunction'/usr/include/readline/rltypedefs.h:38:29: warning: non-ANSI function declaration of function 'CPPFunction'android/avctp.c:505:34: warning: Variable length array is used.android/avctp.c:556:34: warning: Variable length array is used.unit/test-avrcp.c:373:26: warning: Variable length array is used.unit/test-avrcp.c:398:26: warning: Variable length array is used.unit/test-avrcp.c:414:24: warning: Variable length array is used.android/avrcp-lib.c:1085:34: warning: Variable length array is used.android/avrcp-lib.c:1583:34: warning: Variable length array is used.android/avrcp-lib.c:1612:34: warning: Variable length array is used.android/avrcp-lib.c:1638:34: warning: Variable length array is used.src/plugin.c: In function ‘plugin_init’:src/plugin.c:230:28: error: cast between incompatible function types from ‘void (*)(const struct bluetooth_plugin_desc *)’ to ‘void (*)(void *, void *)’ [-Werror=cast-function-type]
230 | g_slist_foreach(builtins, (GFunc) add_plugin, NULL);
| ^
cc1: all warnings being treated as errors
make[1]: *** [Makefile:11054: src/bluetoothd-plugin.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:4695: all] Error 2
##############################
Test: bluezmakeextell - FAIL
Desc: Build Bluez with External ELL
Output:
src/plugin.c: In function ‘plugin_init’:src/plugin.c:230:28: error: cast between incompatible function types from ‘void (*)(const struct bluetooth_plugin_desc *)’ to ‘void (*)(void *, void *)’ [-Werror=cast-function-type]
230 | g_slist_foreach(builtins, (GFunc) add_plugin, NULL);
| ^
cc1: all warnings being treated as errors
make[1]: *** [Makefile:11054: src/bluetoothd-plugin.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:4695: all] Error 2
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:
---
Regards,
Linux Bluetooth