Singed Off: Milind Dumbare hci_usb.c | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) Index: linux-2.6.15-pre3/drivers/bluetooth/hci_usb.c =================================================================== --- linux-2.6.15-pre3.orig/drivers/bluetooth/hci_usb.c 2006-08-02 08:44:42.000000000 -0500 +++ linux-2.6.15-pre3/drivers/bluetooth/hci_usb.c 2006-08-02 09:15:22.000000000 -0500 @@ -46,6 +46,9 @@ #include #include #include +#include +#include + #include @@ -133,6 +136,13 @@ { } /* Terminating entry */ }; +static int hci_usb_notify_reboot(struct notifier_block *this, + unsigned long code ,void *x); + +static struct notifier_block hci_usb_reboot_notifier = { + .notifier_call = hci_usb_notify_reboot, + }; + static struct _urb *_urb_alloc(int isoc, gfp_t gfp) { struct _urb *_urb = kmalloc(sizeof(struct _urb) + @@ -1053,10 +1063,15 @@ static int __init hci_usb_init(void) { - int err; + int err, ret; BT_INFO("HCI USB driver ver %s", VERSION); + ret = register_reboot_notifier(&hci_usb_reboot_notifier); + if(ret) + BT_ERR("Could not register to reboot notifier list"); + + if ((err = usb_register(&hci_usb_driver)) < 0) BT_ERR("Failed to register HCI USB driver"); @@ -1068,6 +1083,21 @@ usb_deregister(&hci_usb_driver); } +static int hci_usb_notify_reboot(struct notifier_block *this, + unsigned long event ,void *unused) +{ + switch(event) { + /*FIXME*/ + case SYS_RESTART: + case SYS_HALT: + case SYS_POWER_OFF: + default: + hci_usb_exit(); + break; + } + + return NOTIFY_DONE; +} module_init(hci_usb_init); module_exit(hci_usb_exit);