diff --git a/profiles/audio/manager.c b/profiles/audio/manager.c
index dece7f6..3a6ea85 100644
--- a/profiles/audio/manager.c
+++ b/profiles/audio/manager.c
gint ref;
};
-struct profile_req {
- struct btd_device *device;
- struct btd_profile *profile;
-};
-
static GKeyFile *config = NULL;
static GSList *adapters = NULL;
static GSList *devices = NULL;
return 0;
}
-static struct profile_req *new_profile_request(struct btd_device *dev,
- struct btd_profile *profile)
-{
- struct profile_req *req;
-
- req = g_new0(struct profile_req, 1);
- req->device = dev;
- req->profile = profile;
-
- return req;
-}
-
static void connect_cb(struct audio_device *dev, int err, void *data)
{
- struct profile_req *req = data;
+ struct btd_profile *profile = data;
- device_profile_connected(req->device, req->profile, err);
-
- g_free(req);
+ device_profile_connected(dev->btd_dev, profile, err);
}
static void disconnect_cb(struct audio_device *dev, int err, void *data)
{
- struct profile_req *req = data;
-
- device_profile_disconnected(req->device, req->profile, err);
+ struct btd_profile *profile = data;
- g_free(req);
+ device_profile_disconnected(dev->btd_dev, profile, err);
}
static int a2dp_source_connect(struct btd_device *dev,
{
const gchar *path = device_get_path(dev);
struct audio_device *audio_dev;
- struct profile_req *req;
- int err;
DBG("path %s", path);
return -1;
}
- req = new_profile_request(dev, profile);
-
- err = source_connect(audio_dev, connect_cb, req);
- if (err < 0) {
- g_free(req);
- return err;
- }
-
- return 0;
+ return source_connect(audio_dev, connect_cb, profile);
}
static int a2dp_source_disconnect(struct btd_device *dev,
{
const gchar *path = device_get_path(dev);
struct audio_device *audio_dev;
- struct profile_req *req;
- int err;
DBG("path %s", path);
return -1;
}
- req = new_profile_request(dev, profile);
-
- err = source_disconnect(audio_dev, FALSE, disconnect_cb, req);
- if (err < 0) {
- g_free(req);
- return err;
- }
-
- return 0;
+ return source_disconnect(audio_dev, FALSE, disconnect_cb, profile);
}
static int a2dp_sink_connect(struct btd_device *dev,
{
const gchar *path = device_get_path(dev);
struct audio_device *audio_dev;
- struct profile_req *req;
- int err;
DBG("path %s", path);
return -1;
}
- req = new_profile_request(dev, profile);
-
- err = sink_connect(audio_dev, connect_cb, req);
- if (err < 0) {
- g_free(req);
- return err;
- }
-
- return 0;
+ return sink_connect(audio_dev, connect_cb, profile);
}
static int a2dp_sink_disconnect(struct btd_device *dev,
{
const gchar *path = device_get_path(dev);
struct audio_device *audio_dev;
- struct profile_req *req;
- int err;
DBG("path %s", path);
return -1;
}
- req = new_profile_request(dev, profile);
-
- err = sink_disconnect(audio_dev, FALSE, disconnect_cb, req);
- if (err < 0) {
- g_free(req);
- return err;
- }
-
- return 0;
+ return sink_disconnect(audio_dev, FALSE, disconnect_cb, profile);
}
static int avrcp_control_connect(struct btd_device *dev,
{
const gchar *path = device_get_path(dev);
struct audio_device *audio_dev;
- struct profile_req *req;
- int err;
DBG("path %s", path);
return -1;
}
- req = new_profile_request(dev, profile);
-
- err = control_connect(audio_dev, connect_cb, req);
- if (err < 0) {
- g_free(req);
- return err;
- }
-
- return 0;
+ return control_connect(audio_dev, connect_cb, profile);
}
static int avrcp_control_disconnect(struct btd_device *dev,
{
const gchar *path = device_get_path(dev);
struct audio_device *audio_dev;
- struct profile_req *req;
- int err;
DBG("path %s", path);
return -1;
}
- req = new_profile_request(dev, profile);
-
- err = control_disconnect(audio_dev, disconnect_cb, req);
- if (err < 0) {
- g_free(req);
- return err;
- }
-
- return 0;
+ return control_disconnect(audio_dev, disconnect_cb, profile);
}
static struct audio_adapter *audio_adapter_ref(struct audio_adapter *adp)