public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [Ubuntu PATCH] bluetooth/hci_usb: Fix failures for suspend/resume
@ 2006-06-15 20:00 Randy Dunlap
  2006-06-16  9:32 ` Marcel Holtmann
  0 siblings, 1 reply; 3+ messages in thread
From: Randy Dunlap @ 2006-06-15 20:00 UTC (permalink / raw)
  To: lkml; +Cc: akpm, marcel, maxk

[UBUNTU:bluetooth] Fix failures for suspend/resume

http://www.kernel.org/git/?p=linux/kernel/git/bcollins/ubuntu-dapper.git;a=commitdiff;h=58db2683478e24009dbae33ea76beafe47b356bb

Plus whitespace cleanups by Randy Dunlap.

Signed-Off-By: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Ben Collins <bcollins@ubuntu.com>
---
 drivers/bluetooth/hci_usb.c |   57 ++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 57 insertions(+)

--- linux-2617-rc6g7.orig/drivers/bluetooth/hci_usb.c
+++ linux-2617-rc6g7/drivers/bluetooth/hci_usb.c
@@ -1043,9 +1043,66 @@ static void hci_usb_disconnect(struct us
 	hci_free_dev(hdev);
 }
 
+static int hci_usb_suspend(struct usb_interface *intf, pm_message_t message)
+{
+	struct hci_usb *husb = usb_get_intfdata(intf);
+	int i;
+	unsigned long flags;
+	struct list_head killed;
+
+	if (!husb || intf == husb->isoc_iface)
+		return 0;
+
+	INIT_LIST_HEAD(&killed);
+
+	for (i = 0; i < 4; i++) {
+		struct _urb_queue *q = &husb->pending_q[i];
+		struct _urb *_urb, *_tmp;
+		while ((_urb = _urb_dequeue(q))) {
+			/* reset queue since _urb_dequeue sets it to NULL */
+			_urb->queue = q;
+			usb_kill_urb(&_urb->urb);
+			list_add(&_urb->list, &killed);
+		}
+		spin_lock_irqsave(&q->lock, flags);
+		list_for_each_entry_safe(_urb, _tmp, &killed, list) {
+			list_move_tail(&_urb->list, &q->head);
+		}
+		spin_unlock_irqrestore(&q->lock, flags);
+	}
+	return 0;
+}
+
+static int hci_usb_resume(struct usb_interface *intf)
+{
+	struct hci_usb *husb = usb_get_intfdata(intf);
+	int i, err = 0;
+	unsigned long flags;
+
+	if (!husb || intf == husb->isoc_iface)
+		return 0;
+
+	for (i = 0; i < 4; i++) {
+		struct _urb_queue *q = &husb->pending_q[i];
+		struct _urb *_urb;
+		spin_lock_irqsave(&q->lock, flags);
+		list_for_each_entry(_urb, &q->head, list) {
+			err = usb_submit_urb(&_urb->urb, GFP_ATOMIC);
+			if (err)
+				break;
+		}
+		spin_unlock_irqrestore(&q->lock, flags);
+		if (err)
+			return -EIO;
+	}
+	return 0;
+}
+
 static struct usb_driver hci_usb_driver = {
 	.name		= "hci_usb",
 	.probe		= hci_usb_probe,
+	.suspend	= hci_usb_suspend,
+	.resume		= hci_usb_resume,
 	.disconnect	= hci_usb_disconnect,
 	.id_table	= bluetooth_ids,
 };




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

* Re: [Ubuntu PATCH] bluetooth/hci_usb: Fix failures for suspend/resume
  2006-06-15 20:00 [Ubuntu PATCH] bluetooth/hci_usb: Fix failures for suspend/resume Randy Dunlap
@ 2006-06-16  9:32 ` Marcel Holtmann
  2006-06-20  3:27   ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: Marcel Holtmann @ 2006-06-16  9:32 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: lkml, akpm, maxk

Hi Randy,

> [UBUNTU:bluetooth] Fix failures for suspend/resume
> 
> http://www.kernel.org/git/?p=linux/kernel/git/bcollins/ubuntu-dapper.git;a=commitdiff;h=58db2683478e24009dbae33ea76beafe47b356bb
> 
> Plus whitespace cleanups by Randy Dunlap.

this one is in my queue, but I missed the merge window.

Regards

Marcel



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

* Re: [Ubuntu PATCH] bluetooth/hci_usb: Fix failures for suspend/resume
  2006-06-16  9:32 ` Marcel Holtmann
@ 2006-06-20  3:27   ` Andrew Morton
  0 siblings, 0 replies; 3+ messages in thread
From: Andrew Morton @ 2006-06-20  3:27 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: randy.dunlap, linux-kernel, maxk

On Fri, 16 Jun 2006 11:32:15 +0200
Marcel Holtmann <marcel@holtmann.org> wrote:

> Hi Randy,
> 
> > [UBUNTU:bluetooth] Fix failures for suspend/resume
> > 
> > http://www.kernel.org/git/?p=linux/kernel/git/bcollins/ubuntu-dapper.git;a=commitdiff;h=58db2683478e24009dbae33ea76beafe47b356bb
> > 
> > Plus whitespace cleanups by Randy Dunlap.
> 
> this one is in my queue, but I missed the merge window.
> 

I hope your version has the CONFIG_PM wrappers..

Where's your queue?

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

end of thread, other threads:[~2006-06-20  3:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-15 20:00 [Ubuntu PATCH] bluetooth/hci_usb: Fix failures for suspend/resume Randy Dunlap
2006-06-16  9:32 ` Marcel Holtmann
2006-06-20  3:27   ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox