From a103d401ee0a31428ef3ba7f9a591ef05f1c8d11 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Sat, 5 Jan 2013 08:05:15 -0800 Subject: [PATCH] core: Create new adapters only in one place instead of two --- src/adapter.c | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/src/adapter.c b/src/adapter.c index 83ec0bc5c..85da7a574 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -4264,36 +4264,13 @@ static void read_index_list_complete(uint8_t status, uint16_t length, } for (i = 0; i < num; i++) { - struct btd_adapter *adapter; uint16_t index; index = btohs(rp->index[i]); DBG("Found index %u", index); - adapter = adapter_find_by_id(index); - if (adapter != NULL) { - warn("Ignoring index for an already existing adapter"); - continue; - } - - adapter = adapter_create(index); - if (!adapter) { - error("Unable to create new adapter for index %u", - index); - continue; - } - - DBG("sending read info command for index %u", index); - - if (mgmt_send(mgmt_master, MGMT_OP_READ_INFO, index, 0, NULL, - read_info_complete, - adapter, adapter_destroy) > 0) - continue; - - error("Failed to read controller info for index %u", index); - - adapter_destroy(adapter); + index_added(index, 0, NULL, NULL); } } -- 2.47.3