Linux bluetooth development
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH] Fix initialization when adapter is already up
Date: Mon, 24 Jan 2011 11:13:07 +0200	[thread overview]
Message-ID: <1295860387-10608-1-git-send-email-luiz.dentz@gmail.com> (raw)

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


             reply	other threads:[~2011-01-24  9:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-24  9:13 Luiz Augusto von Dentz [this message]
2011-01-24  9:56 ` [PATCH] Fix initialization when adapter is already up Johan Hedberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1295860387-10608-1-git-send-email-luiz.dentz@gmail.com \
    --to=luiz.dentz@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox