* [PATCH BlueZ v2] mesh: Set global bus earlier
@ 2022-07-25 8:05 Michał Lowas-Rzechonek
2022-07-25 9:09 ` [BlueZ,v2] " bluez.test.bot
2022-07-29 6:01 ` [PATCH BlueZ v2] " Stotland, Inga
0 siblings, 2 replies; 3+ messages in thread
From: Michał Lowas-Rzechonek @ 2022-07-25 8:05 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 | 8 ++++++++
mesh/dbus.h | 1 +
mesh/main.c | 2 ++
3 files changed, 11 insertions(+)
diff --git a/mesh/dbus.c b/mesh/dbus.c
index a7abdc428..6e62abd27 100644
--- a/mesh/dbus.c
+++ b/mesh/dbus.c
@@ -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] 3+ messages in thread* RE: [BlueZ,v2] mesh: Set global bus earlier
2022-07-25 8:05 [PATCH BlueZ v2] mesh: Set global bus earlier Michał Lowas-Rzechonek
@ 2022-07-25 9:09 ` bluez.test.bot
2022-07-29 6:01 ` [PATCH BlueZ v2] " Stotland, Inga
1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2022-07-25 9:09 UTC (permalink / raw)
To: linux-bluetooth, michal.lowas-rzechonek
[-- Attachment #1: Type: text/plain, Size: 1047 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=662693
---Test result---
Test Summary:
CheckPatch PASS 1.01 seconds
GitLint PASS 0.54 seconds
Prep - Setup ELL PASS 32.04 seconds
Build - Prep PASS 0.68 seconds
Build - Configure PASS 9.73 seconds
Build - Make PASS 736.69 seconds
Make Check PASS 11.17 seconds
Make Check w/Valgrind PASS 294.36 seconds
Make Distcheck PASS 246.27 seconds
Build w/ext ELL - Configure PASS 9.89 seconds
Build w/ext ELL - Make PASS 90.77 seconds
Incremental Build w/ patches PASS 0.00 seconds
Scan Build PASS 495.61 seconds
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH BlueZ v2] mesh: Set global bus earlier
2022-07-25 8:05 [PATCH BlueZ v2] mesh: Set global bus earlier Michał Lowas-Rzechonek
2022-07-25 9:09 ` [BlueZ,v2] " bluez.test.bot
@ 2022-07-29 6:01 ` Stotland, Inga
1 sibling, 0 replies; 3+ messages in thread
From: Stotland, Inga @ 2022-07-29 6:01 UTC (permalink / raw)
To: michal.lowas-rzechonek@silvair.com,
linux-bluetooth@vger.kernel.org
Cc: Gix, Brian
Hi Michał,
On Mon, 2022-07-25 at 10:05 +0200, Michał Lowas-Rzechonek wrote:
> 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 | 8 ++++++++
> mesh/dbus.h | 1 +
> mesh/main.c | 2 ++
> 3 files changed, 11 insertions(+)
>
> diff --git a/mesh/dbus.c b/mesh/dbus.c
> index a7abdc428..6e62abd27 100644
> --- a/mesh/dbus.c
> +++ b/mesh/dbus.c
> @@ -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;
> +
Since dbus_set_bus() is called prior to dbus_init(), wouldn't it make
sense to eliminate an input parameter for dbus_init() and to perform a
check (dbus != NULL) and also eliminate
"dbus = bus" statement at the end of dbus_init()?
> /* 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);
> +
It is better to call dbus_set_bus from within ready_callback()
> if (dbus_debug)
> l_dbus_set_debug(dbus, do_debug, "[DBUS] ", NULL);
> l_dbus_set_ready_handler(dbus, ready_callback, dbus, NULL);
Best regards,
Inga
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-07-29 6:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-25 8:05 [PATCH BlueZ v2] mesh: Set global bus earlier Michał Lowas-Rzechonek
2022-07-25 9:09 ` [BlueZ,v2] " bluez.test.bot
2022-07-29 6:01 ` [PATCH BlueZ v2] " Stotland, Inga
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox