[pulseaudio-discuss] [PATCH next v0 8/8] bluetooth: Remove pa_bluetooth_device_get_transport()

Mikel Astiz mikel.astiz.oss at gmail.com
Wed Dec 5 08:23:18 PST 2012


From: Mikel Astiz <mikel.astiz at bmw-carit.de>

With the use of an array to represent a device's transpors, the function
becomes trivial and thus can be removed.
---
 src/modules/bluetooth/bluetooth-util.c          | 9 ---------
 src/modules/bluetooth/bluetooth-util.h          | 1 -
 src/modules/bluetooth/module-bluetooth-device.c | 3 ++-
 3 files changed, 2 insertions(+), 11 deletions(-)

diff --git a/src/modules/bluetooth/bluetooth-util.c b/src/modules/bluetooth/bluetooth-util.c
index 2f7d753..89af928 100644
--- a/src/modules/bluetooth/bluetooth-util.c
+++ b/src/modules/bluetooth/bluetooth-util.c
@@ -975,15 +975,6 @@ pa_bluetooth_device* pa_bluetooth_discovery_get_by_path(pa_bluetooth_discovery *
     return NULL;
 }
 
-pa_bluetooth_transport* pa_bluetooth_device_get_transport(pa_bluetooth_device *d, enum profile profile) {
-    pa_assert(d);
-
-    if (profile == PROFILE_OFF)
-        return NULL;
-
-    return d->transports[profile];
-}
-
 bool pa_bluetooth_device_any_audio_connected(const pa_bluetooth_device *d) {
     pa_assert(d);
 
diff --git a/src/modules/bluetooth/bluetooth-util.h b/src/modules/bluetooth/bluetooth-util.h
index f6ffece..59d0d2e 100644
--- a/src/modules/bluetooth/bluetooth-util.h
+++ b/src/modules/bluetooth/bluetooth-util.h
@@ -145,7 +145,6 @@ 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);
 
-pa_bluetooth_transport* pa_bluetooth_device_get_transport(pa_bluetooth_device *d, enum profile profile);
 bool pa_bluetooth_device_any_audio_connected(const pa_bluetooth_device *d);
 
 int pa_bluetooth_transport_acquire(pa_bluetooth_transport *t, const char *accesstype, size_t *imtu, size_t *omtu);
diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c
index 40b2fcf..467e095 100644
--- a/src/modules/bluetooth/module-bluetooth-device.c
+++ b/src/modules/bluetooth/module-bluetooth-device.c
@@ -1992,9 +1992,10 @@ static int setup_transport(struct userdata *u) {
 
     pa_assert(u);
     pa_assert(!u->transport);
+    pa_assert(u->profile != PROFILE_OFF);
 
     /* check if profile has a transport */
-    t = pa_bluetooth_device_get_transport(u->device, u->profile);
+    t = u->device->transports[u->profile];
     if (t == NULL) {
         pa_log_warn("Profile has no transport");
         return -1;
-- 
1.7.11.7



More information about the pulseaudio-discuss mailing list