device: Fix probing service twice 14/204914/1
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Mon, 19 Feb 2018 12:51:50 +0000 (14:51 +0200)
committerAmit Purwar <amit.purwar@samsung.com>
Mon, 15 Apr 2019 03:30:37 +0000 (09:00 +0530)
If there is already a service for a given profile there is no point in
probing it again.

Change-Id: I932148183acaf832763e7cc9e419312957d91d72
Signed-off-by: Amit Purwar <amit.purwar@samsung.com>
src/device.c

index ea880e9..a736cd1 100644 (file)
@@ -6337,6 +6337,7 @@ static struct btd_service *probe_service(struct btd_device *device,
                                                struct btd_profile *profile,
                                                GSList *uuids)
 {
+       GSList *l;
        struct btd_service *service;
 
        if (profile->device_probe == NULL)
@@ -6345,6 +6346,10 @@ static struct btd_service *probe_service(struct btd_device *device,
        if (!device_match_profile(device, profile, uuids))
                return NULL;
 
+       l = find_service_with_profile(device->services, profile);
+       if (l)
+               return l->data;
+
        service = service_create(device, profile);
 
        if (service_probe(service)) {