From: Laura Abbott <labbott-rxtnV0ftBwyoClj4AeEUq9i2O/JbrIOy@public.gmane.org>
To: Marcel Holtmann <marcel-kz+m5ild9QBg9hUCZPvPmw@public.gmane.org>
Cc: Laura Abbott
<labbott-rxtnV0ftBwyoClj4AeEUq9i2O/JbrIOy@public.gmane.org>,
Alan Stern
<stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz@public.gmane.org>,
Takashi Iwai <tiwai-l3A5Bk7waGM@public.gmane.org>,
Oliver Neukum <oneukum-IBi9RG/b67k@public.gmane.org>,
Ming Lei <ming.lei-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>,
"David S. Miller" <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>,
Johan Hedberg
<johan.hedberg-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
"Rafael J. Wysocki"
<rafael.j.wysocki-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
"Gustavo F. Padovan"
<gustavo-THi1TnShQwVAfugRpC6u6w@public.gmane.org>,
<linux-bluetooth-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Linux Kernel Mailing List
<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
USB list <linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
netdev <netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: [PATCH 1/2] Bluetooth: Add reset_resume function
Date: Mon, 1 Jun 2015 18:14:41 -0700 [thread overview]
Message-ID: <1433207682-15064-1-git-send-email-labbott@fedoraproject.org> (raw)
In-Reply-To: <DF182762-5B64-4B76-8D3E-AF3728102881-kz+m5ild9QBg9hUCZPvPmw@public.gmane.org>
Bluetooth devices off of some buses such as USB may lose power across
suspend/resume. When this happens, drivers may need to have the setup
function called again and behave differently than a cold power on.
Add a reset_resume function for drivers to call. During the
reset_resume case, the flag HCI_RESET_RESUME will be set to allow
drivers to differentate.
Signed-off-by: Laura Abbott <labbott-rxtnV0ftBwyoClj4AeEUq9i2O/JbrIOy@public.gmane.org>
---
This matches with what hci_reset_dev does and also ensures
the setup function gets called again.
---
include/net/bluetooth/hci.h | 1 +
include/net/bluetooth/hci_core.h | 1 +
net/bluetooth/hci_core.c | 16 ++++++++++++++++
3 files changed, 18 insertions(+)
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index d95da83..6285410 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -185,6 +185,7 @@ enum {
HCI_RAW,
HCI_RESET,
+ HCI_RESET_RESUME,
};
/* HCI socket flags */
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index a056c2b..14f9c72 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -941,6 +941,7 @@ int hci_register_dev(struct hci_dev *hdev);
void hci_unregister_dev(struct hci_dev *hdev);
int hci_suspend_dev(struct hci_dev *hdev);
int hci_resume_dev(struct hci_dev *hdev);
+int hci_reset_resume_dev(struct hci_dev *hdev);
int hci_reset_dev(struct hci_dev *hdev);
int hci_dev_open(__u16 dev);
int hci_dev_close(__u16 dev);
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index c4802f3..090762b 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -1558,6 +1558,7 @@ static int hci_dev_do_close(struct hci_dev *hdev)
BT_DBG("%s %p", hdev->name, hdev);
if (!hci_dev_test_flag(hdev, HCI_UNREGISTER) &&
+ !test_bit(HCI_RESET_RESUME, &hdev->flags) &&
test_bit(HCI_UP, &hdev->flags)) {
/* Execute vendor specific shutdown routine */
if (hdev->shutdown)
@@ -2110,6 +2111,7 @@ static void hci_power_on(struct work_struct *work)
*/
mgmt_index_added(hdev);
}
+ hci_dev_test_and_clear_flag(hdev, HCI_RESET_RESUME);
}
static void hci_power_off(struct work_struct *work)
@@ -3298,6 +3300,20 @@ int hci_reset_dev(struct hci_dev *hdev)
}
EXPORT_SYMBOL(hci_reset_dev);
+/*
+ * For USB reset_resume callbacks
+ */
+int hci_reset_resume_dev(struct hci_dev *hdev)
+{
+ set_bit(HCI_RESET_RESUME, &hdev->flags);
+ hci_dev_do_close(hdev);
+ hci_dev_set_flag(hdev, HCI_SETUP);
+
+ queue_work(hdev->req_workqueue, &hdev->power_on);
+ return 0;
+}
+EXPORT_SYMBOL(hci_reset_resume_dev);
+
/* Receive frame from HCI drivers */
int hci_recv_frame(struct hci_dev *hdev, struct sk_buff *skb)
{
--
2.4.1
next prev parent reply other threads:[~2015-06-02 1:14 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-12 0:52 [RESEND][PATCH] Bluetooth: Make request workqueue freezable Laura Abbott
2015-05-12 1:07 ` Marcel Holtmann
2015-05-12 1:46 ` Laura Abbott
2015-05-12 15:14 ` Marcel Holtmann
2015-05-13 1:18 ` Laura Abbott
[not found] ` <5552A655.2030005-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-05-19 9:46 ` Takashi Iwai
2015-05-19 14:26 ` Alan Stern
2015-05-19 14:52 ` Oliver Neukum
2015-05-19 15:22 ` Marcel Holtmann
2015-05-19 17:17 ` Alan Stern
2015-05-19 17:13 ` Takashi Iwai
2015-05-19 17:42 ` Oliver Neukum
[not found] ` <1432057375.3970.4.camel-IBi9RG/b67k@public.gmane.org>
2015-05-20 6:29 ` Takashi Iwai
2015-05-20 8:40 ` Oliver Neukum
2015-05-20 9:46 ` Marcel Holtmann
2015-05-20 12:44 ` Takashi Iwai
2015-05-20 23:42 ` Laura Abbott
2015-05-21 4:21 ` Takashi Iwai
2015-05-21 12:07 ` Marcel Holtmann
2015-05-21 12:36 ` Takashi Iwai
2015-05-21 14:18 ` Alan Stern
2015-05-21 14:39 ` Marcel Holtmann
[not found] ` <33C25745-6839-4858-9A3E-19EC6408ECED-kz+m5ild9QBg9hUCZPvPmw@public.gmane.org>
2015-05-21 15:26 ` Alan Stern
2015-05-21 15:35 ` Takashi Iwai
[not found] ` <s5hsiaq3pv4.wl-tiwai-l3A5Bk7waGM@public.gmane.org>
2015-05-21 17:27 ` Arend van Spriel
2015-05-21 17:32 ` Takashi Iwai
2015-05-21 20:46 ` Arend van Spriel
[not found] ` <555E442A.808-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
2015-05-22 11:30 ` Oliver Neukum
2015-05-21 17:37 ` Alan Stern
2015-05-21 18:11 ` Takashi Iwai
2015-05-21 18:17 ` Laura Abbott
2015-05-22 0:21 ` Laura Abbott
[not found] ` <555E767B.2040808-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-05-22 3:13 ` Marcel Holtmann
2015-05-28 0:47 ` Laura Abbott
[not found] ` <DF182762-5B64-4B76-8D3E-AF3728102881-kz+m5ild9QBg9hUCZPvPmw@public.gmane.org>
2015-06-02 1:14 ` Laura Abbott [this message]
[not found] ` <1433207682-15064-1-git-send-email-labbott-rxtnV0ftBwyoClj4AeEUq9i2O/JbrIOy@public.gmane.org>
2015-06-02 1:28 ` [PATCH 1/2] Bluetooth: Add reset_resume function Marcel Holtmann
[not found] ` <BB3BCC01-8BF0-4A17-B8E6-F17B875F1997-kz+m5ild9QBg9hUCZPvPmw@public.gmane.org>
2015-06-02 14:17 ` Josh Boyer
[not found] ` <CA+5PVA6o2=dF5BrJQojhMjJhsAiM9vaADd_ix3SAvVEbLXkjCQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-06-02 15:07 ` Marcel Holtmann
2015-06-02 7:47 ` Oliver Neukum
2015-06-02 1:14 ` [PATCH 2/2] Bluetooth: btusb: " Laura Abbott
[not found] ` <1433207682-15064-2-git-send-email-labbott-rxtnV0ftBwyoClj4AeEUq9i2O/JbrIOy@public.gmane.org>
2015-06-02 1:32 ` Marcel Holtmann
2015-05-22 7:37 ` [RESEND][PATCH] Bluetooth: Make request workqueue freezable Arend van Spriel
2015-05-22 7:41 ` Arend van Spriel
2015-05-21 15:04 ` Takashi Iwai
2015-05-20 10:02 ` Ming Lei
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=1433207682-15064-1-git-send-email-labbott@fedoraproject.org \
--to=labbott-rxtnv0ftbwyoclj4aeeuq9i2o/jbrioy@public.gmane.org \
--cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
--cc=gustavo-THi1TnShQwVAfugRpC6u6w@public.gmane.org \
--cc=johan.hedberg-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=linux-bluetooth-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=marcel-kz+m5ild9QBg9hUCZPvPmw@public.gmane.org \
--cc=ming.lei-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org \
--cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=oneukum-IBi9RG/b67k@public.gmane.org \
--cc=rafael.j.wysocki-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz@public.gmane.org \
--cc=tiwai-l3A5Bk7waGM@public.gmane.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;
as well as URLs for NNTP newsgroup(s).