linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: Notify about device registration before power on
@ 2012-10-30  8:35 Marcel Holtmann
  2012-10-30 11:08 ` Johan Hedberg
  2012-10-31 18:18 ` Gustavo Padovan
  0 siblings, 2 replies; 5+ messages in thread
From: Marcel Holtmann @ 2012-10-30  8:35 UTC (permalink / raw)
  To: linux-bluetooth

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.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
 net/bluetooth/hci_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 8a0ce70..a0a2f97 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -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:
-- 
1.7.11.7


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

* Re: [PATCH] Bluetooth: Notify about device registration before power on
  2012-10-30  8:35 [PATCH] Bluetooth: Notify about device registration before power on Marcel Holtmann
@ 2012-10-30 11:08 ` Johan Hedberg
  2012-10-31 18:18 ` Gustavo Padovan
  1 sibling, 0 replies; 5+ messages in thread
From: Johan Hedberg @ 2012-10-30 11:08 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: linux-bluetooth

Hi Marcel,

On Tue, Oct 30, 2012, Marcel Holtmann wrote:
> 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.
> 
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
>  net/bluetooth/hci_core.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Acked-by: Johan Hedberg <johan.hedberg@intel.com>

Johan

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

* Re: [PATCH] Bluetooth: Notify about device registration before power on
  2012-10-30  8:35 [PATCH] Bluetooth: Notify about device registration before power on Marcel Holtmann
  2012-10-30 11:08 ` Johan Hedberg
@ 2012-10-31 18:18 ` Gustavo Padovan
  2012-10-31 19:09   ` Johan Hedberg
  1 sibling, 1 reply; 5+ messages in thread
From: Gustavo Padovan @ 2012-10-31 18:18 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: linux-bluetooth

Hi Marcel,

* Marcel Holtmann <marcel@holtmann.org> [2012-10-30 01:35:40 -0700]:

> 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.
> 
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
>  net/bluetooth/hci_core.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Patch has been applied to bluetooth-next. Thanks.

	Gustavo

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

* Re: [PATCH] Bluetooth: Notify about device registration before power on
  2012-10-31 18:18 ` Gustavo Padovan
@ 2012-10-31 19:09   ` Johan Hedberg
  2012-10-31 19:34     ` Marcel Holtmann
  0 siblings, 1 reply; 5+ messages in thread
From: Johan Hedberg @ 2012-10-31 19:09 UTC (permalink / raw)
  To: Gustavo Padovan, Marcel Holtmann, linux-bluetooth

Hi Gustavo,

On Wed, Oct 31, 2012, Gustavo Padovan wrote:
> > 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.
> > 
> > Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> > ---
> >  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

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

* Re: [PATCH] Bluetooth: Notify about device registration before power on
  2012-10-31 19:09   ` Johan Hedberg
@ 2012-10-31 19:34     ` Marcel Holtmann
  0 siblings, 0 replies; 5+ messages in thread
From: Marcel Holtmann @ 2012-10-31 19:34 UTC (permalink / raw)
  To: Johan Hedberg; +Cc: Gustavo Padovan, linux-bluetooth

Hi Gustavo,

> > > 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.
> > > 
> > > Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> > > ---
> > >  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).

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



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

end of thread, other threads:[~2012-10-31 19:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-30  8:35 [PATCH] Bluetooth: Notify about device registration before power on Marcel Holtmann
2012-10-30 11:08 ` Johan Hedberg
2012-10-31 18:18 ` Gustavo Padovan
2012-10-31 19:09   ` Johan Hedberg
2012-10-31 19:34     ` Marcel Holtmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).