All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ v2] plugin: Order plugin init by priority
@ 2025-01-03 12:55 Blaise Duszynski
  2025-01-03 13:54 ` [BlueZ,v2] " bluez.test.bot
  2025-01-07 15:10 ` [PATCH BlueZ v2] " patchwork-bot+bluetooth
  0 siblings, 2 replies; 3+ messages in thread
From: Blaise Duszynski @ 2025-01-03 12:55 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Blaise Duszynski

The init order matters for some plugins, e.g. wiimote
Add them to a sorted list before calling add_plugin
---
Cast has been removed and add_plugin is adjusted for g_slist_foreach

 src/plugin.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/src/plugin.c b/src/plugin.c
index 00d3d7b6a..a566bd2f4 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -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,14 +86,15 @@ 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;
 }
 
-static void add_plugin(const struct bluetooth_plugin_desc *desc)
+static void add_plugin(void *data, void *user_data)
 {
+	struct bluetooth_plugin_desc *desc = data;
 	struct bluetooth_plugin *plugin;
 
 	DBG("Loading %s plugin", desc->name);
@@ -109,7 +110,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 +202,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 +224,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, 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);
 }
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [BlueZ,v2] plugin: Order plugin init by priority
  2025-01-03 12:55 [PATCH BlueZ v2] plugin: Order plugin init by priority Blaise Duszynski
@ 2025-01-03 13:54 ` bluez.test.bot
  2025-01-07 15:10 ` [PATCH BlueZ v2] " patchwork-bot+bluetooth
  1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2025-01-03 13:54 UTC (permalink / raw)
  To: linux-bluetooth, blaised

[-- Attachment #1: Type: text/plain, Size: 1260 bytes --]

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=922047

---Test result---

Test Summary:
CheckPatch                    PENDING   0.22 seconds
GitLint                       PENDING   0.25 seconds
BuildEll                      PASS      20.62 seconds
BluezMake                     PASS      1508.95 seconds
MakeCheck                     PASS      13.33 seconds
MakeDistcheck                 PASS      159.48 seconds
CheckValgrind                 PASS      215.26 seconds
CheckSmatch                   PASS      273.34 seconds
bluezmakeextell               PASS      99.30 seconds
IncrementalBuild              PENDING   0.26 seconds
ScanBuild                     PASS      853.33 seconds

Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:

##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:

##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:



---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH BlueZ v2] plugin: Order plugin init by priority
  2025-01-03 12:55 [PATCH BlueZ v2] plugin: Order plugin init by priority Blaise Duszynski
  2025-01-03 13:54 ` [BlueZ,v2] " bluez.test.bot
@ 2025-01-07 15:10 ` patchwork-bot+bluetooth
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+bluetooth @ 2025-01-07 15:10 UTC (permalink / raw)
  To: Blaise Duszynski; +Cc: linux-bluetooth, BlaiseD

Hello:

This patch was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:

On Fri,  3 Jan 2025 06:55:32 -0600 you wrote:
> The init order matters for some plugins, e.g. wiimote
> Add them to a sorted list before calling add_plugin
> ---
> Cast has been removed and add_plugin is adjusted for g_slist_foreach
> 
>  src/plugin.c | 20 +++++++++++++-------
>  1 file changed, 13 insertions(+), 7 deletions(-)

Here is the summary with links:
  - [BlueZ,v2] plugin: Order plugin init by priority
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=79900d49ac68

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-01-07 15:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-03 12:55 [PATCH BlueZ v2] plugin: Order plugin init by priority Blaise Duszynski
2025-01-03 13:54 ` [BlueZ,v2] " bluez.test.bot
2025-01-07 15:10 ` [PATCH BlueZ v2] " patchwork-bot+bluetooth

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.