.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * |
---|
3 | 4 | * Generic Bluetooth SDIO driver |
---|
4 | 5 | * |
---|
5 | 6 | * Copyright (C) 2007 Cambridge Silicon Radio Ltd. |
---|
6 | 7 | * Copyright (C) 2007 Marcel Holtmann <marcel@holtmann.org> |
---|
7 | | - * |
---|
8 | | - * |
---|
9 | | - * This program is free software; you can redistribute it and/or modify |
---|
10 | | - * it under the terms of the GNU General Public License as published by |
---|
11 | | - * the Free Software Foundation; either version 2 of the License, or |
---|
12 | | - * (at your option) any later version. |
---|
13 | | - * |
---|
14 | | - * This program is distributed in the hope that it will be useful, |
---|
15 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
16 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
17 | | - * GNU General Public License for more details. |
---|
18 | | - * |
---|
19 | | - * You should have received a copy of the GNU General Public License |
---|
20 | | - * along with this program; if not, write to the Free Software |
---|
21 | | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
22 | | - * |
---|
23 | 8 | */ |
---|
24 | 9 | |
---|
25 | 10 | #include <linux/kernel.h> |
---|
.. | .. |
---|
160 | 145 | |
---|
161 | 146 | data->hdev->stat.byte_rx += len; |
---|
162 | 147 | |
---|
163 | | - hci_skb_pkt_type(skb) = hdr[3]; |
---|
164 | | - |
---|
165 | | - err = hci_recv_frame(data->hdev, skb); |
---|
166 | | - if (err < 0) |
---|
167 | | - return err; |
---|
| 148 | + switch (hdr[3]) { |
---|
| 149 | + case HCI_EVENT_PKT: |
---|
| 150 | + case HCI_ACLDATA_PKT: |
---|
| 151 | + case HCI_SCODATA_PKT: |
---|
| 152 | + case HCI_ISODATA_PKT: |
---|
| 153 | + hci_skb_pkt_type(skb) = hdr[3]; |
---|
| 154 | + err = hci_recv_frame(data->hdev, skb); |
---|
| 155 | + if (err < 0) |
---|
| 156 | + return err; |
---|
| 157 | + break; |
---|
| 158 | + default: |
---|
| 159 | + kfree_skb(skb); |
---|
| 160 | + return -EINVAL; |
---|
| 161 | + } |
---|
168 | 162 | |
---|
169 | 163 | sdio_writeb(data->func, 0x00, REG_PC_RRT, NULL); |
---|
170 | 164 | |
---|
.. | .. |
---|
293 | 287 | tuple = tuple->next; |
---|
294 | 288 | } |
---|
295 | 289 | |
---|
296 | | - /* BCM43341 devices soldered onto the PCB (non-removable) use an |
---|
297 | | - * uart connection for bluetooth, ignore the BT SDIO interface. |
---|
| 290 | + /* Broadcom devices soldered onto the PCB (non-removable) use an |
---|
| 291 | + * UART connection for Bluetooth, ignore the BT SDIO interface. |
---|
298 | 292 | */ |
---|
299 | 293 | if (func->vendor == SDIO_VENDOR_ID_BROADCOM && |
---|
300 | | - func->device == SDIO_DEVICE_ID_BROADCOM_43341 && |
---|
301 | | - !mmc_card_is_removable(func->card->host)) |
---|
302 | | - return -ENODEV; |
---|
| 294 | + !mmc_card_is_removable(func->card->host)) { |
---|
| 295 | + switch (func->device) { |
---|
| 296 | + case SDIO_DEVICE_ID_BROADCOM_43341: |
---|
| 297 | + case SDIO_DEVICE_ID_BROADCOM_43430: |
---|
| 298 | + case SDIO_DEVICE_ID_BROADCOM_4356: |
---|
| 299 | + return -ENODEV; |
---|
| 300 | + } |
---|
| 301 | + } |
---|
303 | 302 | |
---|
304 | 303 | data = devm_kzalloc(&func->dev, sizeof(*data), GFP_KERNEL); |
---|
305 | 304 | if (!data) |
---|
.. | .. |
---|
356 | 355 | if (!data) |
---|
357 | 356 | return; |
---|
358 | 357 | |
---|
| 358 | + cancel_work_sync(&data->work); |
---|
359 | 359 | hdev = data->hdev; |
---|
360 | 360 | |
---|
361 | 361 | sdio_set_drvdata(func, NULL); |
---|
.. | .. |
---|
372 | 372 | .id_table = btsdio_table, |
---|
373 | 373 | }; |
---|
374 | 374 | |
---|
375 | | -static int __init btsdio_init(void) |
---|
376 | | -{ |
---|
377 | | - BT_INFO("Generic Bluetooth SDIO driver ver %s", VERSION); |
---|
378 | | - |
---|
379 | | - return sdio_register_driver(&btsdio_driver); |
---|
380 | | -} |
---|
381 | | - |
---|
382 | | -static void __exit btsdio_exit(void) |
---|
383 | | -{ |
---|
384 | | - sdio_unregister_driver(&btsdio_driver); |
---|
385 | | -} |
---|
386 | | - |
---|
387 | | -module_init(btsdio_init); |
---|
388 | | -module_exit(btsdio_exit); |
---|
| 375 | +module_sdio_driver(btsdio_driver); |
---|
389 | 376 | |
---|
390 | 377 | MODULE_AUTHOR("Marcel Holtmann <marcel@holtmann.org>"); |
---|
391 | 378 | MODULE_DESCRIPTION("Generic Bluetooth SDIO driver ver " VERSION); |
---|