Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH] Fix initialization when adapter is already up
@ 2011-01-24  9:13 Luiz Augusto von Dentz
  2011-01-24  9:56 ` Johan Hedberg
  0 siblings, 1 reply; 2+ messages in thread
From: Luiz Augusto von Dentz @ 2011-01-24  9:13 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.dentz-von@nokia.com>

When handling HCI_DEV_REG event it should not be necessary to generate a
HCI_DEV_UP since init_known_adapters already does it in case the adapter
is ulready up.
---
 plugins/hciops.c |   26 ++------------------------
 1 files changed, 2 insertions(+), 24 deletions(-)

diff --git a/plugins/hciops.c b/plugins/hciops.c
index 7240d51..260ac7d 100644
--- a/plugins/hciops.c
+++ b/plugins/hciops.c
@@ -2253,25 +2253,6 @@ fail:
 	exit(1);
 }
 
-static void device_devreg_setup(int index)
-{
-	struct hci_dev_info di;
-
-	DBG("hci%d", index);
-
-	init_device(index);
-
-	memset(&di, 0, sizeof(di));
-
-	if (hci_devinfo(index, &di) < 0)
-		return;
-
-	if (ignore_device(&di))
-		return;
-
-	devs[index].already_up = hci_test_bit(HCI_UP, &di.flags);
-}
-
 static void init_conn_list(int index)
 {
 	struct dev_info *dev = &devs[index];
@@ -2318,11 +2299,7 @@ static void device_event(int event, int index)
 	switch (event) {
 	case HCI_DEV_REG:
 		info("HCI dev %d registered", index);
-		device_devreg_setup(index);
-		if (devs[index].already_up) {
-			init_conn_list(index);
-			device_event(HCI_DEV_UP, index);
-		}
+		init_device(index);
 		break;
 
 	case HCI_DEV_UNREG:
@@ -2418,6 +2395,7 @@ static gboolean init_known_adapters(gpointer user_data)
 		if (!dev->already_up)
 			continue;
 
+		init_conn_list(dr->dev_id);
 		hciops_stop_inquiry(dr->dev_id);
 
 		dev->pending = 0;
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-01-24  9:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-24  9:13 [PATCH] Fix initialization when adapter is already up Luiz Augusto von Dentz
2011-01-24  9:56 ` Johan Hedberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox