summaryrefslogtreecommitdiff
path: root/drivers/bluetooth
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/bluetooth')
-rw-r--r--drivers/bluetooth/bluesleep.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/drivers/bluetooth/bluesleep.c b/drivers/bluetooth/bluesleep.c
index fae677189fa9..910e510e0b7e 100644
--- a/drivers/bluetooth/bluesleep.c
+++ b/drivers/bluetooth/bluesleep.c
@@ -274,7 +274,7 @@ static int bluesleep_hci_event(struct notifier_block *this,
return NOTIFY_DONE;
switch (event) {
- case HCI_DEV_UP:
+ case HCI_DEV_REG:
if (!bluesleep_hdev) {
bluesleep_hdev = hdev;
if (bsi->has_ext_wake == 1) {
@@ -287,7 +287,19 @@ static int bluesleep_hci_event(struct notifier_block *this,
bluesleep_start();
}
break;
+ case HCI_DEV_UP:
+#if BT_ENABLE_IRQ_WAKE
+ if (enable_irq_wake(bsi->host_wake_irq))
+ BT_ERR("Couldn't enable BT_HOST_WAKE as wakeup interrupt");
+#endif
+ break;
case HCI_DEV_DOWN:
+#if BT_ENABLE_IRQ_WAKE
+ if (disable_irq_wake(bsi->host_wake_irq))
+ BT_ERR("Couldn't disable hostwake IRQ wakeup mode\n");
+#endif
+ break;
+ case HCI_DEV_UNREG:
bluesleep_stop();
bluesleep_hdev = NULL;
bsi->uport = NULL;
@@ -353,7 +365,6 @@ static irqreturn_t bluesleep_hostwake_isr(int irq, void *dev_id)
*/
static int bluesleep_start(void)
{
- int retval;
unsigned long irq_flags;
spin_lock_irqsave(&rw_lock, irq_flags);
@@ -377,13 +388,6 @@ static int bluesleep_start(void)
set_bit(BT_EXT_WAKE, &flags);
}
-#if BT_ENABLE_IRQ_WAKE
- retval = enable_irq_wake(bsi->host_wake_irq);
- if (retval < 0) {
- BT_ERR("Couldn't enable BT_HOST_WAKE as wakeup interrupt");
- goto fail;
- }
-#endif
set_bit(BT_PROTO, &flags);
return 0;
fail:
@@ -391,7 +395,7 @@ fail:
del_timer(&tx_timer);
atomic_inc(&open_count);
- return retval;
+ return 0;
}
/**
@@ -421,11 +425,6 @@ static void bluesleep_stop(void)
atomic_inc(&open_count);
spin_unlock_irqrestore(&rw_lock, irq_flags);
-
-#if BT_ENABLE_IRQ_WAKE
- if (disable_irq_wake(bsi->host_wake_irq))
- BT_ERR("Couldn't disable hostwake IRQ wakeup mode\n");
-#endif
}
/**
* Read the <code>BT_WAKE</code> GPIO pin value via the proc interface.