Skip to contentSkip to conversation

Bluetooth: Notify about device registration before power on

PATCH In review Marcel Holtmann 3 participants 5 messages Oct 30, 2012 – Oct 31, 2012

Subsystems (2)
lore
Share & tools
lore

Marcel Holtmann

author maintainer
#0 lore raw

PATCH 1/1 Bluetooth: Notify about device registration before power on

It is important that the monitor interface gets notified about a new device before its power on procedure has been started.

For some reason that is no longer working as expected and the power on procedure runs first. It is safe to just notify about device registration and trigger the power on procedure afterwards.

---
 net/bluetooth/hci_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/bluetooth/hci_core.c +2 -2
index 8a0ce70..a0a2f97 100644
@@ -1754,11 +1754,11 @@ int hci_register_dev(struct hci_dev *hdev)
 	if (hdev->dev_type != HCI_AMP)
 		set_bit(HCI_AUTO_OFF, &hdev->dev_flags);
 
-	schedule_work(&hdev->power_on);
-
 	hci_notify(hdev, HCI_DEV_REG);
 	hci_dev_hold(hdev);
 
+	schedule_work(&hdev->power_on);
+
 	return id;
 
 err_wqueue:
Signature · 1 line
1.7.11.7
Acked-by on v1 1/1
#1 lore raw

Hi Marcel,

Quoted 11 lines · Marcel Holtmann

It is important that the monitor interface gets notified about a new device before its power on procedure has been started.

For some reason that is no longer working as expected and the power on procedure runs first. It is safe to just notify about device registration and trigger the power on procedure afterwards.

---
 net/bluetooth/hci_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Johan

#2 lore raw
In reply to Marcel Holtmann

Hi Marcel,

Quoted 11 lines · Marcel Holtmann

It is important that the monitor interface gets notified about a new device before its power on procedure has been started.

For some reason that is no longer working as expected and the power on procedure runs first. It is safe to just notify about device registration and trigger the power on procedure afterwards.

---
 net/bluetooth/hci_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch has been applied to bluetooth-next. Thanks.

Gustavo

#3 lore raw

Hi Gustavo,

Quoted 7 lines · Gustavo Padovan
Quoted 7 lines

It is important that the monitor interface gets notified about a new device before its power on procedure has been started.

For some reason that is no longer working as expected and the power on procedure runs first. It is safe to just notify about device registration and trigger the power on procedure afterwards.

Quoted 6 lines
Quoted 4 lines
---
 net/bluetooth/hci_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch has been applied to bluetooth-next. Thanks.

I guess you mean bluetooth.git? (that's where the patch is right now - not bluetooth-next). Also, I don't think the Cc: stable addition was necessary since this scheduling behavior seems to be something only introduced for 3.7 (not 100% sure about this though).

Johan

author maintainer
#4 lore raw

Hi Gustavo,

Quoted 12 lines
Quoted 12 lines
Quoted 11 lines

It is important that the monitor interface gets notified about a new device before its power on procedure has been started.

For some reason that is no longer working as expected and the power on procedure runs first. It is safe to just notify about device registration and trigger the power on procedure afterwards.

---
 net/bluetooth/hci_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 6 lines
Quoted 1 line

Patch has been applied to bluetooth-next. Thanks.

I guess you mean bluetooth.git? (that's where the patch is right now - not bluetooth-next). Also, I don't think the Cc: stable addition was necessary since this scheduling behavior seems to be something only introduced for 3.7 (not 100% sure about this though).

I did not send this to stable, because I think it is 3.7-rc only behavior. Feel free to test it. With the help of btmon it is really easy to see if the New Index event arrives before the first HCI command or not. Remember that this only applies for newly attached devices and btmon already running.

Regards

Marcel