public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: Alok Barsode <alokbarsode@gmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: marcel@holtmann.org, Alok Barsode <alok.barsode@azingo.com>
Subject: [PATCH 3/8] Modifying device_devreg_setup. Check if device is up in device_devreg_setup instead of using devup parameter.
Date: Mon, 27 Apr 2009 19:45:40 +0530	[thread overview]
Message-ID: <1240841745-11006-3-git-send-email-alok.barsode@gmail.com> (raw)
In-Reply-To: <1240841745-11006-1-git-send-email-alok.barsode@gmail.com>

From: Alok Barsode <alok.barsode@azingo.com>

---
 src/main.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/main.c b/src/main.c
index 02b4ebf..d12edc5 100644
--- a/src/main.c
+++ b/src/main.c
@@ -477,9 +477,10 @@ fail:
 	exit(1);
 }
 
-static void device_devreg_setup(int dev_id, gboolean devup)
+static void device_devreg_setup(int dev_id)
 {
 	struct hci_dev_info di;
+	gboolean devup;
 
 	init_device(dev_id);
 
@@ -488,6 +489,8 @@ static void device_devreg_setup(int dev_id, gboolean devup)
 	if (hci_devinfo(dev_id, &di) < 0)
 		return;
 
+	devup = hci_test_bit(HCI_UP, &di.flags);
+
 	if (!hci_test_bit(HCI_RAW, &di.flags))
 		manager_register_adapter(dev_id, devup);
 }
@@ -528,10 +531,10 @@ static void init_all_devices(int ctl)
 	for (i = 0; i < dl->dev_num; i++, dr++) {
 		gboolean devup;
 
-		devup = hci_test_bit(HCI_UP, &dr->dev_opt);
-
 		info("HCI dev %d registered", dr->dev_id);
-		device_devreg_setup(dr->dev_id, devup);
+		device_devreg_setup(dr->dev_id);
+
+		devup = hci_test_bit(HCI_UP, &dr->dev_opt);
 		if (devup) {
 			info("HCI dev %d already up", dr->dev_id);
 			device_devup_setup(dr->dev_id);
@@ -561,7 +564,7 @@ void device_event(int event, int dev_id)
 	switch (event) {
 	case HCI_DEV_REG:
 		info("HCI dev %d registered", dev_id);
-		device_devreg_setup(dev_id, FALSE);
+		device_devreg_setup(dev_id);
 		break;
 
 	case HCI_DEV_UNREG:
-- 
1.5.6.3

  parent reply	other threads:[~2009-04-27 14:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-27 14:15 [PATCH 1/8] Initialing HCI raw socket plugin "hciops" Alok Barsode
2009-04-27 14:15 ` [PATCH 2/8] exporting device_event() Alok Barsode
2009-04-27 14:15 ` Alok Barsode [this message]
2009-04-27 14:15 ` [PATCH 4/8] Using device_event to register and setup already known devices Alok Barsode
2009-04-27 14:15 ` [PATCH 5/8] Initializing hciops plugin. Adding IO event handing Alok Barsode
2009-04-27 14:15 ` [PATCH 6/8] Moving all adapter initialization code to hciops plugin Alok Barsode
2009-04-27 14:15 ` [PATCH 7/8] Adding btd_register_adapter_ops framework Alok Barsode
2009-04-27 14:15 ` [PATCH 8/8] Exporting init_known_adapters from hciops plugin Alok Barsode

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=1240841745-11006-3-git-send-email-alok.barsode@gmail.com \
    --to=alokbarsode@gmail.com \
    --cc=alok.barsode@azingo.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=marcel@holtmann.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