From: Tanu Kaskinen Date: Mon, 17 Dec 2012 07:01:03 +0000 (+0200) Subject: bluetooth: Remove pa_bluetooth_discovery_sync(). X-Git-Tag: v3.99.1~200 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=baa62fb6155fd7053b586477331a81e476cead36;p=platform%2Fupstream%2Fpulseaudio.git bluetooth: Remove pa_bluetooth_discovery_sync(). pa_bluetooth_discovery_sync() waited until all pending method calls had completed. I don't understand what the benefit of that could be, so I removed the function. We should avoid blocking as much as possible, and the code that used pa_bluetooth_discovery_sync() didn't look like it really needed to wait for anything. --- diff --git a/src/modules/bluetooth/bluetooth-util.c b/src/modules/bluetooth/bluetooth-util.c index 61c52f5..f216d9b 100644 --- a/src/modules/bluetooth/bluetooth-util.c +++ b/src/modules/bluetooth/bluetooth-util.c @@ -1049,9 +1049,6 @@ pa_bluetooth_device* pa_bluetooth_discovery_get_by_address(pa_bluetooth_discover pa_assert(PA_REFCNT_VALUE(y) > 0); pa_assert(address); - if (!pa_hook_is_firing(&y->hooks[PA_BLUETOOTH_HOOK_DEVICE_CONNECTION_CHANGED])) - pa_bluetooth_discovery_sync(y); - while ((d = pa_hashmap_iterate(y->devices, &state, NULL))) if (pa_streq(d->address, address)) return device_is_audio_ready(d) ? d : NULL; @@ -1066,9 +1063,6 @@ pa_bluetooth_device* pa_bluetooth_discovery_get_by_path(pa_bluetooth_discovery * pa_assert(PA_REFCNT_VALUE(y) > 0); pa_assert(path); - if (!pa_hook_is_firing(&y->hooks[PA_BLUETOOTH_HOOK_DEVICE_CONNECTION_CHANGED])) - pa_bluetooth_discovery_sync(y); - if ((d = pa_hashmap_get(y->devices, path))) if (device_is_audio_ready(d)) return d; @@ -1764,13 +1758,6 @@ void pa_bluetooth_discovery_unref(pa_bluetooth_discovery *y) { pa_xfree(y); } -void pa_bluetooth_discovery_sync(pa_bluetooth_discovery *y) { - pa_assert(y); - pa_assert(PA_REFCNT_VALUE(y) > 0); - - pa_dbus_sync_pending_list(&y->pending); -} - pa_hook* pa_bluetooth_discovery_hook(pa_bluetooth_discovery *y, pa_bluetooth_hook_t hook) { pa_assert(y); pa_assert(PA_REFCNT_VALUE(y) > 0); diff --git a/src/modules/bluetooth/bluetooth-util.h b/src/modules/bluetooth/bluetooth-util.h index 59db33c..b7c5973 100644 --- a/src/modules/bluetooth/bluetooth-util.h +++ b/src/modules/bluetooth/bluetooth-util.h @@ -141,8 +141,6 @@ pa_bluetooth_discovery* pa_bluetooth_discovery_get(pa_core *core); pa_bluetooth_discovery* pa_bluetooth_discovery_ref(pa_bluetooth_discovery *y); void pa_bluetooth_discovery_unref(pa_bluetooth_discovery *d); -void pa_bluetooth_discovery_sync(pa_bluetooth_discovery *d); - pa_bluetooth_device* pa_bluetooth_discovery_get_by_path(pa_bluetooth_discovery *d, const char* path); pa_bluetooth_device* pa_bluetooth_discovery_get_by_address(pa_bluetooth_discovery *d, const char* address); diff --git a/src/modules/bluetooth/module-bluetooth-discover.c b/src/modules/bluetooth/module-bluetooth-discover.c index 41981f6..f6e3b83 100644 --- a/src/modules/bluetooth/module-bluetooth-discover.c +++ b/src/modules/bluetooth/module-bluetooth-discover.c @@ -40,15 +40,14 @@ PA_MODULE_AUTHOR("Joao Paulo Rechi Vita"); PA_MODULE_DESCRIPTION("Detect available bluetooth audio devices and load bluetooth audio drivers"); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_USAGE("async= " - "sco_sink= " +PA_MODULE_USAGE("sco_sink= " "sco_source= "); PA_MODULE_LOAD_ONCE(TRUE); static const char* const valid_modargs[] = { "sco_sink", "sco_source", - "async", + "async", /* deprecated */ NULL }; @@ -128,7 +127,6 @@ static pa_hook_result_t load_module_for_device(pa_bluetooth_discovery *y, const int pa__init(pa_module* m) { struct userdata *u; pa_modargs *ma = NULL; - pa_bool_t async = FALSE; pa_assert(m); @@ -137,10 +135,8 @@ int pa__init(pa_module* m) { goto fail; } - if (pa_modargs_get_value_boolean(ma, "async", &async) < 0) { - pa_log("Failed to parse async argument."); - goto fail; - } + if (pa_modargs_get_value(ma, "async", NULL)) + pa_log_warn("The 'async' argument is deprecated and does nothing."); m->userdata = u = pa_xnew0(struct userdata, 1); u->module = m; @@ -155,9 +151,6 @@ int pa__init(pa_module* m) { u->slot = pa_hook_connect(pa_bluetooth_discovery_hook(u->discovery, PA_BLUETOOTH_HOOK_DEVICE_CONNECTION_CHANGED), PA_HOOK_NORMAL, (pa_hook_cb_t) load_module_for_device, u); - if (!async) - pa_bluetooth_discovery_sync(u->discovery); - return 0; fail: