aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/bluetooth/ath3k.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/bluetooth/ath3k.c')
-rw-r--r--drivers/bluetooth/ath3k.c46
1 files changed, 37 insertions, 9 deletions
diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c
index 11f467c00d0a..a12b923bbaca 100644
--- a/drivers/bluetooth/ath3k.c
+++ b/drivers/bluetooth/ath3k.c
@@ -91,6 +91,10 @@ static struct usb_device_id ath3k_table[] = {
91 { USB_DEVICE(0x0489, 0xe04e) }, 91 { USB_DEVICE(0x0489, 0xe04e) },
92 { USB_DEVICE(0x0489, 0xe056) }, 92 { USB_DEVICE(0x0489, 0xe056) },
93 { USB_DEVICE(0x0489, 0xe04d) }, 93 { USB_DEVICE(0x0489, 0xe04d) },
94 { USB_DEVICE(0x04c5, 0x1330) },
95 { USB_DEVICE(0x13d3, 0x3402) },
96 { USB_DEVICE(0x0cf3, 0x3121) },
97 { USB_DEVICE(0x0cf3, 0xe003) },
94 98
95 /* Atheros AR5BBU12 with sflash firmware */ 99 /* Atheros AR5BBU12 with sflash firmware */
96 { USB_DEVICE(0x0489, 0xE02C) }, 100 { USB_DEVICE(0x0489, 0xE02C) },
@@ -128,6 +132,10 @@ static struct usb_device_id ath3k_blist_tbl[] = {
128 { USB_DEVICE(0x0489, 0xe04e), .driver_info = BTUSB_ATH3012 }, 132 { USB_DEVICE(0x0489, 0xe04e), .driver_info = BTUSB_ATH3012 },
129 { USB_DEVICE(0x0489, 0xe056), .driver_info = BTUSB_ATH3012 }, 133 { USB_DEVICE(0x0489, 0xe056), .driver_info = BTUSB_ATH3012 },
130 { USB_DEVICE(0x0489, 0xe04d), .driver_info = BTUSB_ATH3012 }, 134 { USB_DEVICE(0x0489, 0xe04d), .driver_info = BTUSB_ATH3012 },
135 { USB_DEVICE(0x04c5, 0x1330), .driver_info = BTUSB_ATH3012 },
136 { USB_DEVICE(0x13d3, 0x3402), .driver_info = BTUSB_ATH3012 },
137 { USB_DEVICE(0x0cf3, 0x3121), .driver_info = BTUSB_ATH3012 },
138 { USB_DEVICE(0x0cf3, 0xe003), .driver_info = BTUSB_ATH3012 },
131 139
132 /* Atheros AR5BBU22 with sflash firmware */ 140 /* Atheros AR5BBU22 with sflash firmware */
133 { USB_DEVICE(0x0489, 0xE03C), .driver_info = BTUSB_ATH3012 }, 141 { USB_DEVICE(0x0489, 0xE03C), .driver_info = BTUSB_ATH3012 },
@@ -193,24 +201,44 @@ error:
193 201
194static int ath3k_get_state(struct usb_device *udev, unsigned char *state) 202static int ath3k_get_state(struct usb_device *udev, unsigned char *state)
195{ 203{
196 int pipe = 0; 204 int ret, pipe = 0;
205 char *buf;
206
207 buf = kmalloc(sizeof(*buf), GFP_KERNEL);
208 if (!buf)
209 return -ENOMEM;
197 210
198 pipe = usb_rcvctrlpipe(udev, 0); 211 pipe = usb_rcvctrlpipe(udev, 0);
199 return usb_control_msg(udev, pipe, ATH3K_GETSTATE, 212 ret = usb_control_msg(udev, pipe, ATH3K_GETSTATE,
200 USB_TYPE_VENDOR | USB_DIR_IN, 0, 0, 213 USB_TYPE_VENDOR | USB_DIR_IN, 0, 0,
201 state, 0x01, USB_CTRL_SET_TIMEOUT); 214 buf, sizeof(*buf), USB_CTRL_SET_TIMEOUT);
215
216 *state = *buf;
217 kfree(buf);
218
219 return ret;
202} 220}
203 221
204static int ath3k_get_version(struct usb_device *udev, 222static int ath3k_get_version(struct usb_device *udev,
205 struct ath3k_version *version) 223 struct ath3k_version *version)
206{ 224{
207 int pipe = 0; 225 int ret, pipe = 0;
226 struct ath3k_version *buf;
227 const int size = sizeof(*buf);
228
229 buf = kmalloc(size, GFP_KERNEL);
230 if (!buf)
231 return -ENOMEM;
208 232
209 pipe = usb_rcvctrlpipe(udev, 0); 233 pipe = usb_rcvctrlpipe(udev, 0);
210 return usb_control_msg(udev, pipe, ATH3K_GETVERSION, 234 ret = usb_control_msg(udev, pipe, ATH3K_GETVERSION,
211 USB_TYPE_VENDOR | USB_DIR_IN, 0, 0, version, 235 USB_TYPE_VENDOR | USB_DIR_IN, 0, 0,
212 sizeof(struct ath3k_version), 236 buf, size, USB_CTRL_SET_TIMEOUT);
213 USB_CTRL_SET_TIMEOUT); 237
238 memcpy(version, buf, size);
239 kfree(buf);
240
241 return ret;
214} 242}
215 243
216static int ath3k_load_fwfile(struct usb_device *udev, 244static int ath3k_load_fwfile(struct usb_device *udev,