public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ] mesh: Set global bus earlier
@ 2022-07-21  8:03 Michał Lowas-Rzechonek
  2022-07-21  9:07 ` [BlueZ] " bluez.test.bot
  0 siblings, 1 reply; 2+ messages in thread
From: Michał Lowas-Rzechonek @ 2022-07-21  8:03 UTC (permalink / raw)
  To: linux-bluetooth

Some io implementations might want to either make calls to other D-Bus
services, or provide additional objects/interfaces that allow
applications to fine-tune their operation, so allow them to use the bus
even before initializing mesh D-Bus interfaces.
---
 mesh/dbus.c | 10 +++++++++-
 mesh/dbus.h |  1 +
 mesh/main.c |  2 ++
 3 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/mesh/dbus.c b/mesh/dbus.c
index a7abdc428..4ed477256 100644
--- a/mesh/dbus.c
+++ b/mesh/dbus.c
@@ -21,7 +21,7 @@
 #include "mesh/error.h"
 #include "mesh/dbus.h"
 
-static struct l_dbus *dbus;
+static struct l_dbus *dbus = NULL;
 
 struct error_entry {
 	const char *dbus_err;
@@ -75,6 +75,11 @@ struct l_dbus_message *dbus_error(struct l_dbus_message *msg, int err,
 				"%s", error_table[err].default_desc);
 }
 
+void dbus_set_bus(struct l_dbus *bus)
+{
+	dbus = bus;
+}
+
 struct l_dbus *dbus_get_bus(void)
 {
 	return dbus;
@@ -82,6 +87,9 @@ struct l_dbus *dbus_get_bus(void)
 
 bool dbus_init(struct l_dbus *bus)
 {
+	if (dbus != bus)
+		return false;
+
 	/* Network interface */
 	if (!mesh_dbus_init(bus))
 		return false;
diff --git a/mesh/dbus.h b/mesh/dbus.h
index 8f00434d6..ab8b0a2cc 100644
--- a/mesh/dbus.h
+++ b/mesh/dbus.h
@@ -14,6 +14,7 @@
 #define DEFAULT_DBUS_TIMEOUT	30
 
 bool dbus_init(struct l_dbus *dbus);
+void dbus_set_bus(struct l_dbus *bus);
 struct l_dbus *dbus_get_bus(void);
 void dbus_append_byte_array(struct l_dbus_message_builder *builder,
 						const uint8_t *data, int len);
diff --git a/mesh/main.c b/mesh/main.c
index dd99c3085..0180c3768 100644
--- a/mesh/main.c
+++ b/mesh/main.c
@@ -278,6 +278,8 @@ int main(int argc, char *argv[])
 		goto done;
 	}
 
+	dbus_set_bus(dbus);
+
 	if (dbus_debug)
 		l_dbus_set_debug(dbus, do_debug, "[DBUS] ", NULL);
 	l_dbus_set_ready_handler(dbus, ready_callback, dbus, NULL);
-- 
2.25.1


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

* RE: [BlueZ] mesh: Set global bus earlier
  2022-07-21  8:03 [PATCH BlueZ] mesh: Set global bus earlier Michał Lowas-Rzechonek
@ 2022-07-21  9:07 ` bluez.test.bot
  0 siblings, 0 replies; 2+ messages in thread
From: bluez.test.bot @ 2022-07-21  9:07 UTC (permalink / raw)
  To: linux-bluetooth, michal.lowas-rzechonek

[-- Attachment #1: Type: text/plain, Size: 1936 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=661746

---Test result---

Test Summary:
CheckPatch                    FAIL      0.76 seconds
GitLint                       PASS      0.53 seconds
Prep - Setup ELL              PASS      31.33 seconds
Build - Prep                  PASS      0.69 seconds
Build - Configure             PASS      10.05 seconds
Build - Make                  PASS      772.96 seconds
Make Check                    PASS      11.92 seconds
Make Check w/Valgrind         PASS      295.51 seconds
Make Distcheck                PASS      251.78 seconds
Build w/ext ELL - Configure   PASS      9.79 seconds
Build w/ext ELL - Make        PASS      87.49 seconds
Incremental Build w/ patches  PASS      0.00 seconds
Scan Build                    PASS      507.15 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script with rule in .checkpatch.conf
Output:
[BlueZ] mesh: Set global bus earlier
ERROR:INITIALISED_STATIC: do not initialise statics to NULL
#98: FILE: mesh/dbus.c:24:
+static struct l_dbus *dbus = NULL;

/github/workspace/src/12924841.patch total: 1 errors, 0 warnings, 43 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

/github/workspace/src/12924841.patch has style problems, please review.

NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.




---
Regards,
Linux Bluetooth


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

end of thread, other threads:[~2022-07-21  9:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-21  8:03 [PATCH BlueZ] mesh: Set global bus earlier Michał Lowas-Rzechonek
2022-07-21  9:07 ` [BlueZ] " bluez.test.bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox