diff options
author | Andrzej Kaczmarek <andrzej.kaczmarek@tieto.com> | 2012-09-19 12:22:19 +0200 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2012-09-21 13:54:29 +0300 |
commit | df77cece961f8eaf229ac5b6d22837b75c9bbe0a (patch) | |
tree | 008e4d3272fab014df94e02950c6492e997e2b21 /plugins | |
parent | 6723b9f6d90f233bfd07a1a0150c362f34289243 (diff) | |
download | bluez-df77cece961f8eaf229ac5b6d22837b75c9bbe0a.tar.gz |
dbusoob: Simplify DBusConnection object handling
This patch removes local reference to DBusConnection object and uses
btd_get_dbus_connection() call wherever such object is needed instead.
Pointer returned by this call is guaranteed to be valid for entire
bluetoothd lifetime and thus do not need to be refcounted.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/dbusoob.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/plugins/dbusoob.c b/plugins/dbusoob.c index 11b259402..543b27247 100644 --- a/plugins/dbusoob.c +++ b/plugins/dbusoob.c @@ -63,7 +63,6 @@ struct oob_data { }; static GSList *oob_requests = NULL; -static DBusConnection *connection = NULL; static gint oob_request_cmp(gconstpointer a, gconstpointer b) { @@ -129,7 +128,7 @@ done: return; } - if (!g_dbus_send_message(connection, reply)) + if (!g_dbus_send_message(btd_get_dbus_connection(), reply)) error("D-Bus send failed"); } @@ -331,8 +330,10 @@ static int oob_probe(struct btd_adapter *adapter) { const char *path = adapter_get_path(adapter); - if (!g_dbus_register_interface(connection, path, OOB_INTERFACE, - oob_methods, NULL, NULL, adapter, NULL)) { + if (!g_dbus_register_interface(btd_get_dbus_connection(), + path, OOB_INTERFACE, + oob_methods, NULL, NULL, + adapter, NULL)) { error("OOB interface init failed on path %s", path); return -EIO; } @@ -344,8 +345,8 @@ static void oob_remove(struct btd_adapter *adapter) { read_local_data_complete(adapter, NULL, NULL); - g_dbus_unregister_interface(connection, adapter_get_path(adapter), - OOB_INTERFACE); + g_dbus_unregister_interface(btd_get_dbus_connection(), + adapter_get_path(adapter), OOB_INTERFACE); } static struct btd_adapter_driver oob_driver = { @@ -358,8 +359,6 @@ static int dbusoob_init(void) { DBG("Setup dbusoob plugin"); - connection = btd_get_dbus_connection(); - oob_register_cb(read_local_data_complete); return btd_register_adapter_driver(&oob_driver); |