From c3eae82a844bb33e8182c7ee81828516b51ad642 Mon Sep 17 00:00:00 2001 From: Paul Fertser Date: Sat, 29 Oct 2011 21:52:49 +0400 Subject: Bluetooth: ath3k: output firmware filename when request_firmware failed This makes it much easier for the users to understand why the driver refuses to load when the firmware is unavailable. Signed-off-by: Paul Fertser Signed-off-by: Gustavo F. Padovan --- drivers/bluetooth/ath3k.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'drivers/bluetooth/ath3k.c') diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c index db7cb8111fb..39b25ac51c1 100644 --- a/drivers/bluetooth/ath3k.c +++ b/drivers/bluetooth/ath3k.c @@ -30,6 +30,7 @@ #include #define VERSION "1.0" +#define ATH3K_FIRMWARE "ath3k-1.fw" #define ATH3K_DNLOAD 0x01 #define ATH3K_GETSTATE 0x05 @@ -400,9 +401,15 @@ static int ath3k_probe(struct usb_interface *intf, return 0; } - if (request_firmware(&firmware, "ath3k-1.fw", &udev->dev) < 0) { - BT_ERR("Error loading firmware"); - return -EIO; + ret = request_firmware(&firmware, ATH3K_FIRMWARE, &udev->dev); + if (ret < 0) { + if (ret == -ENOENT) + BT_ERR("Firmware file \"%s\" not found", + ATH3K_FIRMWARE); + else + BT_ERR("Firmware file \"%s\" request failed (err=%d)", + ATH3K_FIRMWARE, ret); + return ret; } ret = ath3k_load_firmware(udev, firmware); @@ -441,4 +448,4 @@ MODULE_AUTHOR("Atheros Communications"); MODULE_DESCRIPTION("Atheros AR30xx firmware driver"); MODULE_VERSION(VERSION); MODULE_LICENSE("GPL"); -MODULE_FIRMWARE("ath3k-1.fw"); +MODULE_FIRMWARE(ATH3K_FIRMWARE); -- cgit v1.2.3-70-g09d2 From 52a1020e80beece986002f673eca24dae6255b55 Mon Sep 17 00:00:00 2001 From: David Herrmann Date: Tue, 25 Oct 2011 12:09:52 +0200 Subject: Bluetooth: ath3k: Use GFP_KERNEL instead of GFP_ATOMIC We are allowed to sleep here so no need to use GFP_ATOMIC. The caller (ath3k_probe) calls request_firmware() which definitely sleeps. Hence, we should avoid using GFP_ATOMIC. Signed-off-by: David Herrmann Signed-off-by: Gustavo F. Padovan --- drivers/bluetooth/ath3k.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/bluetooth/ath3k.c') diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c index 39b25ac51c1..1622772f802 100644 --- a/drivers/bluetooth/ath3k.c +++ b/drivers/bluetooth/ath3k.c @@ -106,7 +106,7 @@ static int ath3k_load_firmware(struct usb_device *udev, pipe = usb_sndctrlpipe(udev, 0); - send_buf = kmalloc(BULK_SIZE, GFP_ATOMIC); + send_buf = kmalloc(BULK_SIZE, GFP_KERNEL); if (!send_buf) { BT_ERR("Can't allocate memory chunk for firmware"); return -ENOMEM; @@ -177,7 +177,7 @@ static int ath3k_load_fwfile(struct usb_device *udev, count = firmware->size; - send_buf = kmalloc(BULK_SIZE, GFP_ATOMIC); + send_buf = kmalloc(BULK_SIZE, GFP_KERNEL); if (!send_buf) { BT_ERR("Can't allocate memory chunk for firmware"); return -ENOMEM; -- cgit v1.2.3-70-g09d2 From 93f1508cffc3d578c2b7bbbf298dc52326b80777 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 18 Nov 2011 09:47:34 -0800 Subject: USB: convert drivers/bluetooth/* to use module_usb_driver() This converts the drivers in drivers/bluetooth/* to use the module_usb_driver() macro which makes the code smaller and a bit simpler. Added bonus is that it removes some unneeded kernel log messages about drivers loading and/or unloading. Cc: Marcel Holtmann Cc: "Gustavo F. Padovan" Signed-off-by: Greg Kroah-Hartman --- drivers/bluetooth/ath3k.c | 14 +------------- drivers/bluetooth/bcm203x.c | 21 +-------------------- drivers/bluetooth/bfusb.c | 21 +-------------------- drivers/bluetooth/bpa10x.c | 15 +-------------- drivers/bluetooth/btusb.c | 15 +-------------- 5 files changed, 5 insertions(+), 81 deletions(-) (limited to 'drivers/bluetooth/ath3k.c') diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c index 106beb194f3..cf77a9a2bfa 100644 --- a/drivers/bluetooth/ath3k.c +++ b/drivers/bluetooth/ath3k.c @@ -423,19 +423,7 @@ static struct usb_driver ath3k_driver = { .id_table = ath3k_table, }; -static int __init ath3k_init(void) -{ - BT_INFO("Atheros AR30xx firmware driver ver %s", VERSION); - return usb_register(&ath3k_driver); -} - -static void __exit ath3k_exit(void) -{ - usb_deregister(&ath3k_driver); -} - -module_init(ath3k_init); -module_exit(ath3k_exit); +module_usb_driver(ath3k_driver); MODULE_AUTHOR("Atheros Communications"); MODULE_DESCRIPTION("Atheros AR30xx firmware driver"); diff --git a/drivers/bluetooth/bcm203x.c b/drivers/bluetooth/bcm203x.c index 54952ab800b..1e742a50e2c 100644 --- a/drivers/bluetooth/bcm203x.c +++ b/drivers/bluetooth/bcm203x.c @@ -281,26 +281,7 @@ static struct usb_driver bcm203x_driver = { .id_table = bcm203x_table, }; -static int __init bcm203x_init(void) -{ - int err; - - BT_INFO("Broadcom Blutonium firmware driver ver %s", VERSION); - - err = usb_register(&bcm203x_driver); - if (err < 0) - BT_ERR("Failed to register USB driver"); - - return err; -} - -static void __exit bcm203x_exit(void) -{ - usb_deregister(&bcm203x_driver); -} - -module_init(bcm203x_init); -module_exit(bcm203x_exit); +module_usb_driver(bcm203x_driver); MODULE_AUTHOR("Marcel Holtmann "); MODULE_DESCRIPTION("Broadcom Blutonium firmware driver ver " VERSION); diff --git a/drivers/bluetooth/bfusb.c b/drivers/bluetooth/bfusb.c index 61b591470a9..e64a290a1b9 100644 --- a/drivers/bluetooth/bfusb.c +++ b/drivers/bluetooth/bfusb.c @@ -764,26 +764,7 @@ static struct usb_driver bfusb_driver = { .id_table = bfusb_table, }; -static int __init bfusb_init(void) -{ - int err; - - BT_INFO("BlueFRITZ! USB driver ver %s", VERSION); - - err = usb_register(&bfusb_driver); - if (err < 0) - BT_ERR("Failed to register BlueFRITZ! USB driver"); - - return err; -} - -static void __exit bfusb_exit(void) -{ - usb_deregister(&bfusb_driver); -} - -module_init(bfusb_init); -module_exit(bfusb_exit); +module_usb_driver(bfusb_driver); MODULE_AUTHOR("Marcel Holtmann "); MODULE_DESCRIPTION("BlueFRITZ! USB driver ver " VERSION); diff --git a/drivers/bluetooth/bpa10x.c b/drivers/bluetooth/bpa10x.c index 751b338d904..62831603de5 100644 --- a/drivers/bluetooth/bpa10x.c +++ b/drivers/bluetooth/bpa10x.c @@ -521,20 +521,7 @@ static struct usb_driver bpa10x_driver = { .id_table = bpa10x_table, }; -static int __init bpa10x_init(void) -{ - BT_INFO("Digianswer Bluetooth USB driver ver %s", VERSION); - - return usb_register(&bpa10x_driver); -} - -static void __exit bpa10x_exit(void) -{ - usb_deregister(&bpa10x_driver); -} - -module_init(bpa10x_init); -module_exit(bpa10x_exit); +module_usb_driver(bpa10x_driver); MODULE_AUTHOR("Marcel Holtmann "); MODULE_DESCRIPTION("Digianswer Bluetooth USB driver ver " VERSION); diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index f9b726091ad..b0e6d8d5b96 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c @@ -1220,20 +1220,7 @@ static struct usb_driver btusb_driver = { .supports_autosuspend = 1, }; -static int __init btusb_init(void) -{ - BT_INFO("Generic Bluetooth USB driver ver %s", VERSION); - - return usb_register(&btusb_driver); -} - -static void __exit btusb_exit(void) -{ - usb_deregister(&btusb_driver); -} - -module_init(btusb_init); -module_exit(btusb_exit); +module_usb_driver(btusb_driver); module_param(ignore_dga, bool, 0644); MODULE_PARM_DESC(ignore_dga, "Ignore devices with id 08fd:0001"); -- cgit v1.2.3-70-g09d2