OSDN Git Service

profile: Remove UUID list from probe function
authorMikel Astiz <mikel.astiz@bmw-carit.de>
Fri, 26 Apr 2013 06:17:00 +0000 (08:17 +0200)
committerJohan Hedberg <johan.hedberg@intel.com>
Fri, 26 Apr 2013 07:12:09 +0000 (10:12 +0300)
Each instance of btd_profile is associated to one single remote UUID
and therefore the list provided by the callback is redundant and can be
removed.

17 files changed:
profiles/audio/manager.c
profiles/cyclingspeed/cyclingspeed.c
profiles/deviceinfo/deviceinfo.c
profiles/gatt/gas.c
profiles/health/hdp_manager.c
profiles/heartrate/heartrate.c
profiles/input/hog.c
profiles/input/manager.c
profiles/network/manager.c
profiles/proximity/manager.c
profiles/proximity/reporter.c
profiles/proximity/reporter.h
profiles/scanparam/scan.c
profiles/thermometer/thermometer.c
src/device.c
src/profile.c
src/profile.h

index 8131a3e..f9c0ca6 100644 (file)
@@ -101,8 +101,7 @@ static void audio_remove(struct btd_profile *p, struct btd_device *device)
        audio_device_unregister(dev);
 }
 
-static int a2dp_source_probe(struct btd_profile *p, struct btd_device *device,
-                                                               GSList *uuids)
+static int a2dp_source_probe(struct btd_profile *p, struct btd_device *device)
 {
        struct audio_device *audio_dev;
 
@@ -117,8 +116,7 @@ static int a2dp_source_probe(struct btd_profile *p, struct btd_device *device,
        return 0;
 }
 
-static int a2dp_sink_probe(struct btd_profile *p, struct btd_device *device,
-                                                               GSList *uuids)
+static int a2dp_sink_probe(struct btd_profile *p, struct btd_device *device)
 {
        struct audio_device *audio_dev;
 
@@ -133,8 +131,7 @@ static int a2dp_sink_probe(struct btd_profile *p, struct btd_device *device,
        return 0;
 }
 
-static int avrcp_probe(struct btd_profile *p, struct btd_device *device,
-                                                               GSList *uuids)
+static int avrcp_probe(struct btd_profile *p, struct btd_device *device)
 {
        struct audio_device *audio_dev;
 
index 125007e..744bd4b 100644 (file)
@@ -1180,8 +1180,7 @@ static const GDBusMethodTable cyclingspeed_device_methods[] = {
        { }
 };
 
-static int csc_device_probe(struct btd_profile *p,
-                               struct btd_device *device, GSList *uuids)
+static int csc_device_probe(struct btd_profile *p, struct btd_device *device)
 {
        struct btd_adapter *adapter;
        struct csc_adapter *cadapter;
index 471241b..08f53b3 100644 (file)
@@ -199,8 +199,7 @@ static void deviceinfo_unregister(struct btd_device *device)
 }
 
 static int deviceinfo_driver_probe(struct btd_profile *p,
-                                       struct btd_device *device,
-                                       GSList *uuids)
+                                               struct btd_device *device)
 {
        struct gatt_primary *prim;
 
index bc8dbb5..4c7af4b 100644 (file)
@@ -407,8 +407,7 @@ static void gas_unregister(struct btd_device *device)
        gas_free(gas);
 }
 
-static int gatt_driver_probe(struct btd_profile *p, struct btd_device *device,
-                                                               GSList *uuids)
+static int gatt_driver_probe(struct btd_profile *p, struct btd_device *device)
 {
        struct gatt_primary *gap, *gatt;
 
index 5428724..3777fd4 100644 (file)
@@ -54,8 +54,7 @@ static void hdp_adapter_remove(struct btd_profile *p,
        hdp_adapter_unregister(adapter);
 }
 
-static int hdp_driver_probe(struct btd_profile *p, struct btd_device *device,
-                                                               GSList *uuids)
+static int hdp_driver_probe(struct btd_profile *p, struct btd_device *device)
 {
        return hdp_device_register(device);
 }
index 0520f5c..18a9448 100644 (file)
@@ -842,7 +842,7 @@ static void heartrate_adapter_remove(struct btd_profile *p,
 }
 
 static int heartrate_device_probe(struct btd_profile *p,
-                               struct btd_device *device, GSList *uuids)
+                                               struct btd_device *device)
 {
        struct gatt_primary *prim;
 
index eadc860..eec0eee 100644 (file)
@@ -820,8 +820,7 @@ static void resume_callback(void)
        g_slist_foreach(devices, set_suspend, GINT_TO_POINTER(suspend));
 }
 
-static int hog_probe(struct btd_profile *p, struct btd_device *device,
-                                                               GSList *uuids)
+static int hog_probe(struct btd_profile *p, struct btd_device *device)
 {
        const char *path = device_get_path(device);
        GSList *primaries, *l;
index 8bbf768..d3d4cf3 100644 (file)
@@ -55,8 +55,7 @@ static void input_remove(struct btd_device *device, const char *uuid)
        input_device_unregister(path, uuid);
 }
 
-static int hid_device_probe(struct btd_profile *p, struct btd_device *device,
-                                                               GSList *uuids)
+static int hid_device_probe(struct btd_profile *p, struct btd_device *device)
 {
        const char *path = device_get_path(device);
        const sdp_record_t *rec = btd_device_get_record(device, HID_UUID);
index 53bb652..4aa6a2b 100644 (file)
@@ -74,8 +74,7 @@ done:
                                conf_security ? "true" : "false");
 }
 
-static int panu_probe(struct btd_profile *p, struct btd_device *device,
-                                                               GSList *uuids)
+static int panu_probe(struct btd_profile *p, struct btd_device *device)
 {
        DBG("path %s", device_get_path(device));
 
@@ -118,8 +117,7 @@ static void panu_server_remove(struct btd_profile *p,
        server_unregister(adapter, BNEP_SVC_PANU);
 }
 
-static int gn_probe(struct btd_profile *p, struct btd_device *device,
-                                                               GSList *uuids)
+static int gn_probe(struct btd_profile *p, struct btd_device *device)
 {
        DBG("path %s", device_get_path(device));
 
@@ -155,8 +153,7 @@ static void gn_server_remove(struct btd_profile *p,
        server_unregister(adapter, BNEP_SVC_GN);
 }
 
-static int nap_probe(struct btd_profile *p, struct btd_device *device,
-                                                               GSList *uuids)
+static int nap_probe(struct btd_profile *p, struct btd_device *device)
 {
        DBG("path %s", device_get_path(device));
 
index 81bfc3b..f24428b 100644 (file)
@@ -49,7 +49,7 @@ static struct enabled enabled  = {
 };
 
 static int monitor_linkloss_probe(struct btd_profile *p,
-                               struct btd_device *device, GSList *uuids)
+                                               struct btd_device *device)
 {
        struct gatt_primary *linkloss;
 
@@ -61,7 +61,7 @@ static int monitor_linkloss_probe(struct btd_profile *p,
 }
 
 static int monitor_immediate_probe(struct btd_profile *p,
-                               struct btd_device *device, GSList *uuids)
+                                               struct btd_device *device)
 {
        struct gatt_primary *immediate;
 
@@ -73,7 +73,7 @@ static int monitor_immediate_probe(struct btd_profile *p,
 }
 
 static int monitor_txpower_probe(struct btd_profile *p,
-                               struct btd_device *device, GSList *uuids)
+                                               struct btd_device *device)
 {
        struct gatt_primary *txpower;
 
index 31c33ef..66f52fe 100644 (file)
@@ -203,8 +203,7 @@ static void register_reporter_device(struct btd_device *device,
        radapter->devices = g_slist_prepend(radapter->devices, device);
 }
 
-int reporter_device_probe(struct btd_profile *p, struct btd_device *device,
-                                                               GSList *uuids)
+int reporter_device_probe(struct btd_profile *p, struct btd_device *device)
 {
        struct reporter_adapter *radapter;
        struct btd_adapter *adapter = device_get_adapter(device);
index 6a7066d..b02ae9c 100644 (file)
@@ -37,8 +37,7 @@ enum {
 };
 
 void reporter_device_remove(struct btd_profile *p, struct btd_device *device);
-int reporter_device_probe(struct btd_profile *p, struct btd_device *device,
-                                                               GSList *uuids);
+int reporter_device_probe(struct btd_profile *p, struct btd_device *device);
 
 int reporter_adapter_probe(struct btd_profile *p, struct btd_adapter *adapter);
 void reporter_adapter_remove(struct btd_profile *p,
index abbd129..deb0653 100644 (file)
@@ -266,8 +266,7 @@ static void scan_unregister(struct btd_device *device)
        g_free(scan);
 }
 
-static int scan_param_probe(struct btd_profile *p, struct btd_device *device,
-                                                               GSList *uuids)
+static int scan_param_probe(struct btd_profile *p, struct btd_device *device)
 {
        struct gatt_primary *prim;
 
index 8550500..ae8ccb2 100644 (file)
@@ -1281,8 +1281,7 @@ static void thermometer_adapter_unregister(struct btd_adapter *adapter)
 }
 
 static int thermometer_device_probe(struct btd_profile *p,
-                                       struct btd_device *device,
-                                       GSList *uuids)
+                                               struct btd_device *device)
 {
        struct gatt_primary *tattr;
 
index 18beed9..01afd49 100644 (file)
@@ -2330,7 +2330,6 @@ struct probe_data {
 static void dev_probe(struct btd_profile *p, void *user_data)
 {
        struct probe_data *d = user_data;
-       GSList *probe_uuids;
        int err;
 
        if (p->device_probe == NULL)
@@ -2339,24 +2338,19 @@ static void dev_probe(struct btd_profile *p, void *user_data)
        if (!device_match_profile(d->dev, p, d->uuids))
                return;
 
-       probe_uuids = g_slist_append(NULL, (char *) p->remote_uuid);
-
-       err = p->device_probe(p, d->dev, probe_uuids);
+       err = p->device_probe(p, d->dev);
        if (err < 0) {
                error("%s profile probe failed for %s", p->name, d->addr);
-               g_slist_free(probe_uuids);
                return;
        }
 
        d->dev->profiles = g_slist_append(d->dev->profiles, p);
-       g_slist_free(probe_uuids);
 }
 
 void device_probe_profile(gpointer a, gpointer b)
 {
        struct btd_device *device = a;
        struct btd_profile *profile = b;
-       GSList *probe_uuids;
        char addr[18];
        int err;
 
@@ -2366,19 +2360,15 @@ void device_probe_profile(gpointer a, gpointer b)
        if (!device_match_profile(device, profile, device->uuids))
                return;
 
-       probe_uuids = g_slist_append(NULL, (char *) profile->remote_uuid);
-
        ba2str(&device->bdaddr, addr);
 
-       err = profile->device_probe(profile, device, probe_uuids);
+       err = profile->device_probe(profile, device);
        if (err < 0) {
                error("%s profile probe failed for %s", profile->name, addr);
-               g_slist_free(probe_uuids);
                return;
        }
 
        device->profiles = g_slist_append(device->profiles, profile);
-       g_slist_free(probe_uuids);
 
        if (!profile->auto_connect || !device->general_connect)
                return;
index 55e72dd..7bd7970 100644 (file)
@@ -1397,8 +1397,7 @@ static void ext_adapter_remove(struct btd_profile *p,
        }
 }
 
-static int ext_device_probe(struct btd_profile *p, struct btd_device *dev,
-                                                               GSList *uuids)
+static int ext_device_probe(struct btd_profile *p, struct btd_device *dev)
 {
        struct ext_profile *ext;
 
@@ -1406,7 +1405,7 @@ static int ext_device_probe(struct btd_profile *p, struct btd_device *dev,
        if (!ext)
                return -ENOENT;
 
-       DBG("%s probed with %u UUIDs", ext->name, g_slist_length(uuids));
+       DBG("%s probed with UUID %s", ext->name, p->remote_uuid);
 
        return 0;
 }
index 5d78b37..5622f23 100644 (file)
@@ -34,8 +34,7 @@ struct btd_profile {
 
        bool auto_connect;
 
-       int (*device_probe) (struct btd_profile *p, struct btd_device *device,
-                                                               GSList *uuids);
+       int (*device_probe) (struct btd_profile *p, struct btd_device *device);
        void (*device_remove) (struct btd_profile *p,
                                                struct btd_device *device);