blob: 8ab26dec5f6e8ccdd1a9c796f4c66ebdd13a63c7 [file] [log] [blame]
Thomas Gleixner1a59d1b82019-05-27 08:55:05 +02001// SPDX-License-Identifier: GPL-2.0-or-later
Linus Torvalds1da177e2005-04-16 15:20:36 -07002/*
Linus Torvalds1da177e2005-04-16 15:20:36 -07003 *
Marcel Holtmann4aa769b2005-08-09 20:27:37 -07004 * Bluetooth virtual HCI driver
5 *
Marcel Holtmann9c724352006-07-06 15:45:23 +02006 * Copyright (C) 2000-2001 Qualcomm Incorporated
7 * Copyright (C) 2002-2003 Maxim Krasnyansky <maxk@qualcomm.com>
8 * Copyright (C) 2004-2006 Marcel Holtmann <marcel@holtmann.org>
Linus Torvalds1da177e2005-04-16 15:20:36 -07009 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070010
Linus Torvalds1da177e2005-04-16 15:20:36 -070011#include <linux/module.h>
Marcel Holtmann23424c02013-09-02 10:41:39 -070012#include <asm/unaligned.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070013
Linus Torvalds1da177e2005-04-16 15:20:36 -070014#include <linux/kernel.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070015#include <linux/init.h>
Marcel Holtmann4aa769b2005-08-09 20:27:37 -070016#include <linux/slab.h>
17#include <linux/types.h>
18#include <linux/errno.h>
19#include <linux/sched.h>
20#include <linux/poll.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070021
22#include <linux/skbuff.h>
23#include <linux/miscdevice.h>
24
Linus Torvalds1da177e2005-04-16 15:20:36 -070025#include <net/bluetooth/bluetooth.h>
26#include <net/bluetooth/hci_core.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070027
Marcel Holtmann82a30cf2014-07-03 01:35:10 +020028#define VERSION "1.5"
Marcel Holtmann4aa769b2005-08-09 20:27:37 -070029
Andrei Emeltchenko36acbb12011-11-14 12:42:48 +020030static bool amp;
31
Marcel Holtmann4aa769b2005-08-09 20:27:37 -070032struct vhci_data {
33 struct hci_dev *hdev;
34
Marcel Holtmann4aa769b2005-08-09 20:27:37 -070035 wait_queue_head_t read_wait;
36 struct sk_buff_head readq;
Marcel Holtmann23424c02013-09-02 10:41:39 -070037
Takashi Iwaic7c999c2016-04-14 17:32:19 +020038 struct mutex open_mutex;
Marcel Holtmann23424c02013-09-02 10:41:39 -070039 struct delayed_work open_timeout;
Marcel Holtmann4aa769b2005-08-09 20:27:37 -070040};
41
Marcel Holtmann4aa769b2005-08-09 20:27:37 -070042static int vhci_open_dev(struct hci_dev *hdev)
Linus Torvalds1da177e2005-04-16 15:20:36 -070043{
Linus Torvalds1da177e2005-04-16 15:20:36 -070044 return 0;
45}
46
Marcel Holtmann4aa769b2005-08-09 20:27:37 -070047static int vhci_close_dev(struct hci_dev *hdev)
Linus Torvalds1da177e2005-04-16 15:20:36 -070048{
David Herrmann155961e2012-02-09 21:58:32 +010049 struct vhci_data *data = hci_get_drvdata(hdev);
Linus Torvalds1da177e2005-04-16 15:20:36 -070050
Marcel Holtmann9c724352006-07-06 15:45:23 +020051 skb_queue_purge(&data->readq);
Marcel Holtmann4aa769b2005-08-09 20:27:37 -070052
Linus Torvalds1da177e2005-04-16 15:20:36 -070053 return 0;
54}
55
Marcel Holtmann4aa769b2005-08-09 20:27:37 -070056static int vhci_flush(struct hci_dev *hdev)
Linus Torvalds1da177e2005-04-16 15:20:36 -070057{
David Herrmann155961e2012-02-09 21:58:32 +010058 struct vhci_data *data = hci_get_drvdata(hdev);
Linus Torvalds1da177e2005-04-16 15:20:36 -070059
Marcel Holtmann9c724352006-07-06 15:45:23 +020060 skb_queue_purge(&data->readq);
Linus Torvalds1da177e2005-04-16 15:20:36 -070061
Marcel Holtmann4aa769b2005-08-09 20:27:37 -070062 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -070063}
64
Marcel Holtmann7bd8f092013-10-11 06:19:18 -070065static int vhci_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
Linus Torvalds1da177e2005-04-16 15:20:36 -070066{
Marcel Holtmann60298772013-10-11 07:01:04 -070067 struct vhci_data *data = hci_get_drvdata(hdev);
Linus Torvalds1da177e2005-04-16 15:20:36 -070068
Marcel Holtmann618e8bc2015-11-05 07:33:56 +010069 memcpy(skb_push(skb, 1), &hci_skb_pkt_type(skb), 1);
Marcel Holtmann9c724352006-07-06 15:45:23 +020070 skb_queue_tail(&data->readq, skb);
Linus Torvalds1da177e2005-04-16 15:20:36 -070071
Marcel Holtmann9c724352006-07-06 15:45:23 +020072 wake_up_interruptible(&data->read_wait);
Marcel Holtmann23424c02013-09-02 10:41:39 -070073 return 0;
74}
Linus Torvalds1da177e2005-04-16 15:20:36 -070075
Takashi Iwaic7c999c2016-04-14 17:32:19 +020076static int __vhci_create_device(struct vhci_data *data, __u8 opcode)
Marcel Holtmann23424c02013-09-02 10:41:39 -070077{
78 struct hci_dev *hdev;
79 struct sk_buff *skb;
Marcel Holtmann82a30cf2014-07-03 01:35:10 +020080 __u8 dev_type;
81
Takashi Iwaic7c999c2016-04-14 17:32:19 +020082 if (data->hdev)
83 return -EBADFD;
84
Marcel Holtmannca8bee52016-07-05 14:30:14 +020085 /* bits 0-1 are dev_type (Primary or AMP) */
Marcel Holtmann82a30cf2014-07-03 01:35:10 +020086 dev_type = opcode & 0x03;
87
Marcel Holtmannca8bee52016-07-05 14:30:14 +020088 if (dev_type != HCI_PRIMARY && dev_type != HCI_AMP)
Marcel Holtmann82a30cf2014-07-03 01:35:10 +020089 return -EINVAL;
90
Marcel Holtmann0ad184e2014-07-04 17:23:35 +020091 /* bits 2-5 are reserved (must be zero) */
92 if (opcode & 0x3c)
Marcel Holtmann82a30cf2014-07-03 01:35:10 +020093 return -EINVAL;
Marcel Holtmann23424c02013-09-02 10:41:39 -070094
95 skb = bt_skb_alloc(4, GFP_KERNEL);
96 if (!skb)
97 return -ENOMEM;
98
99 hdev = hci_alloc_dev();
100 if (!hdev) {
101 kfree_skb(skb);
102 return -ENOMEM;
103 }
104
105 data->hdev = hdev;
106
107 hdev->bus = HCI_VIRTUAL;
108 hdev->dev_type = dev_type;
109 hci_set_drvdata(hdev, data);
110
111 hdev->open = vhci_open_dev;
112 hdev->close = vhci_close_dev;
113 hdev->flush = vhci_flush;
114 hdev->send = vhci_send_frame;
115
Marcel Holtmann0ad184e2014-07-04 17:23:35 +0200116 /* bit 6 is for external configuration */
117 if (opcode & 0x40)
118 set_bit(HCI_QUIRK_EXTERNAL_CONFIG, &hdev->quirks);
119
Marcel Holtmann82a30cf2014-07-03 01:35:10 +0200120 /* bit 7 is for raw device */
121 if (opcode & 0x80)
122 set_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks);
123
Marcel Holtmann23424c02013-09-02 10:41:39 -0700124 if (hci_register_dev(hdev) < 0) {
125 BT_ERR("Can't register HCI device");
126 hci_free_dev(hdev);
127 data->hdev = NULL;
128 kfree_skb(skb);
129 return -EBUSY;
130 }
131
Marcel Holtmann618e8bc2015-11-05 07:33:56 +0100132 hci_skb_pkt_type(skb) = HCI_VENDOR_PKT;
Marcel Holtmann23424c02013-09-02 10:41:39 -0700133
Johannes Berg634fef62017-06-16 14:29:24 +0200134 skb_put_u8(skb, 0xff);
135 skb_put_u8(skb, opcode);
Marcel Holtmann23424c02013-09-02 10:41:39 -0700136 put_unaligned_le16(hdev->id, skb_put(skb, 2));
137 skb_queue_tail(&data->readq, skb);
138
139 wake_up_interruptible(&data->read_wait);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700140 return 0;
141}
142
Takashi Iwaic7c999c2016-04-14 17:32:19 +0200143static int vhci_create_device(struct vhci_data *data, __u8 opcode)
144{
145 int err;
146
147 mutex_lock(&data->open_mutex);
148 err = __vhci_create_device(data, opcode);
149 mutex_unlock(&data->open_mutex);
150
151 return err;
152}
153
Marcel Holtmann9c724352006-07-06 15:45:23 +0200154static inline ssize_t vhci_get_user(struct vhci_data *data,
Al Viro512b2262014-08-23 11:28:14 -0400155 struct iov_iter *from)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700156{
Al Viro512b2262014-08-23 11:28:14 -0400157 size_t len = iov_iter_count(from);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700158 struct sk_buff *skb;
Marcel Holtmann82a30cf2014-07-03 01:35:10 +0200159 __u8 pkt_type, opcode;
Marcel Holtmann23424c02013-09-02 10:41:39 -0700160 int ret;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700161
Marcel Holtmann5bc00b52013-12-28 21:57:14 -0800162 if (len < 2 || len > HCI_MAX_FRAME_SIZE)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700163 return -EINVAL;
164
Marcel Holtmann5bc00b52013-12-28 21:57:14 -0800165 skb = bt_skb_alloc(len, GFP_KERNEL);
Marcel Holtmann4aa769b2005-08-09 20:27:37 -0700166 if (!skb)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700167 return -ENOMEM;
Marcel Holtmann4aa769b2005-08-09 20:27:37 -0700168
Al Virocbbd26b2016-11-01 22:09:04 -0400169 if (!copy_from_iter_full(skb_put(skb, len), len, from)) {
Al Viro512b2262014-08-23 11:28:14 -0400170 kfree_skb(skb);
171 return -EFAULT;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700172 }
173
Marcel Holtmann23424c02013-09-02 10:41:39 -0700174 pkt_type = *((__u8 *) skb->data);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700175 skb_pull(skb, 1);
176
Marcel Holtmann23424c02013-09-02 10:41:39 -0700177 switch (pkt_type) {
178 case HCI_EVENT_PKT:
179 case HCI_ACLDATA_PKT:
180 case HCI_SCODATA_PKT:
Luiz Augusto von Dentzf92a8cb2020-01-15 13:02:16 -0800181 case HCI_ISODATA_PKT:
Marcel Holtmann23424c02013-09-02 10:41:39 -0700182 if (!data->hdev) {
183 kfree_skb(skb);
184 return -ENODEV;
185 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700186
Marcel Holtmann618e8bc2015-11-05 07:33:56 +0100187 hci_skb_pkt_type(skb) = pkt_type;
Marcel Holtmann23424c02013-09-02 10:41:39 -0700188
Marcel Holtmanne1a26172013-10-10 16:52:43 -0700189 ret = hci_recv_frame(data->hdev, skb);
Marcel Holtmann23424c02013-09-02 10:41:39 -0700190 break;
191
192 case HCI_VENDOR_PKT:
Jiri Slaby373a32c2016-03-19 11:05:18 +0100193 cancel_delayed_work_sync(&data->open_timeout);
194
Marcel Holtmann82a30cf2014-07-03 01:35:10 +0200195 opcode = *((__u8 *) skb->data);
Marcel Holtmann23424c02013-09-02 10:41:39 -0700196 skb_pull(skb, 1);
197
198 if (skb->len > 0) {
199 kfree_skb(skb);
200 return -EINVAL;
201 }
202
203 kfree_skb(skb);
204
Marcel Holtmann82a30cf2014-07-03 01:35:10 +0200205 ret = vhci_create_device(data, opcode);
Marcel Holtmann23424c02013-09-02 10:41:39 -0700206 break;
207
208 default:
209 kfree_skb(skb);
210 return -EINVAL;
211 }
212
Marcel Holtmann5bc00b52013-12-28 21:57:14 -0800213 return (ret < 0) ? ret : len;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700214}
215
Marcel Holtmann9c724352006-07-06 15:45:23 +0200216static inline ssize_t vhci_put_user(struct vhci_data *data,
Marcel Holtmann23424c02013-09-02 10:41:39 -0700217 struct sk_buff *skb,
218 char __user *buf, int count)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700219{
Linus Torvalds1da177e2005-04-16 15:20:36 -0700220 char __user *ptr = buf;
Marcel Holtmann23424c02013-09-02 10:41:39 -0700221 int len;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700222
Marcel Holtmann4aa769b2005-08-09 20:27:37 -0700223 len = min_t(unsigned int, skb->len, count);
224
Linus Torvalds1da177e2005-04-16 15:20:36 -0700225 if (copy_to_user(ptr, skb->data, len))
226 return -EFAULT;
Marcel Holtmann4aa769b2005-08-09 20:27:37 -0700227
Marcel Holtmann23424c02013-09-02 10:41:39 -0700228 if (!data->hdev)
229 return len;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700230
Marcel Holtmann9c724352006-07-06 15:45:23 +0200231 data->hdev->stat.byte_tx += len;
Marcel Holtmann4aa769b2005-08-09 20:27:37 -0700232
Marcel Holtmann618e8bc2015-11-05 07:33:56 +0100233 switch (hci_skb_pkt_type(skb)) {
Marcel Holtmann0d48d932005-08-09 20:30:28 -0700234 case HCI_COMMAND_PKT:
Marcel Holtmann9c724352006-07-06 15:45:23 +0200235 data->hdev->stat.cmd_tx++;
Marcel Holtmann0d48d932005-08-09 20:30:28 -0700236 break;
Marcel Holtmann0d48d932005-08-09 20:30:28 -0700237 case HCI_ACLDATA_PKT:
Marcel Holtmann9c724352006-07-06 15:45:23 +0200238 data->hdev->stat.acl_tx++;
Marcel Holtmann0d48d932005-08-09 20:30:28 -0700239 break;
Marcel Holtmann0d48d932005-08-09 20:30:28 -0700240 case HCI_SCODATA_PKT:
Gustavo F. Padovan4f7ac182010-05-01 16:15:34 -0300241 data->hdev->stat.sco_tx++;
Marcel Holtmann0d48d932005-08-09 20:30:28 -0700242 break;
Peter Senna Tschudin2c24d452012-09-07 17:24:47 +0200243 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700244
Marcel Holtmann23424c02013-09-02 10:41:39 -0700245 return len;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700246}
247
Marcel Holtmann9c724352006-07-06 15:45:23 +0200248static ssize_t vhci_read(struct file *file,
Marcel Holtmann23424c02013-09-02 10:41:39 -0700249 char __user *buf, size_t count, loff_t *pos)
Marcel Holtmann4aa769b2005-08-09 20:27:37 -0700250{
Marcel Holtmann9c724352006-07-06 15:45:23 +0200251 struct vhci_data *data = file->private_data;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700252 struct sk_buff *skb;
253 ssize_t ret = 0;
254
Linus Torvalds1da177e2005-04-16 15:20:36 -0700255 while (count) {
Marcel Holtmann9c724352006-07-06 15:45:23 +0200256 skb = skb_dequeue(&data->readq);
Marcel Holtmann4db75892009-06-08 14:13:57 +0200257 if (skb) {
258 ret = vhci_put_user(data, skb, buf, count);
259 if (ret < 0)
260 skb_queue_head(&data->readq, skb);
261 else
262 kfree_skb(skb);
263 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700264 }
265
Marcel Holtmann4db75892009-06-08 14:13:57 +0200266 if (file->f_flags & O_NONBLOCK) {
267 ret = -EAGAIN;
268 break;
269 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700270
Marcel Holtmann4db75892009-06-08 14:13:57 +0200271 ret = wait_event_interruptible(data->read_wait,
Marcel Holtmann23424c02013-09-02 10:41:39 -0700272 !skb_queue_empty(&data->readq));
Marcel Holtmann4db75892009-06-08 14:13:57 +0200273 if (ret < 0)
274 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700275 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700276
277 return ret;
278}
279
Al Viro512b2262014-08-23 11:28:14 -0400280static ssize_t vhci_write(struct kiocb *iocb, struct iov_iter *from)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700281{
Marcel Holtmann5bc00b52013-12-28 21:57:14 -0800282 struct file *file = iocb->ki_filp;
Marcel Holtmann9c724352006-07-06 15:45:23 +0200283 struct vhci_data *data = file->private_data;
Marcel Holtmann4aa769b2005-08-09 20:27:37 -0700284
Al Viro512b2262014-08-23 11:28:14 -0400285 return vhci_get_user(data, from);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700286}
287
Al Viroafc9a422017-07-03 06:39:46 -0400288static __poll_t vhci_poll(struct file *file, poll_table *wait)
Marcel Holtmann4aa769b2005-08-09 20:27:37 -0700289{
Marcel Holtmann9c724352006-07-06 15:45:23 +0200290 struct vhci_data *data = file->private_data;
Marcel Holtmann4aa769b2005-08-09 20:27:37 -0700291
Marcel Holtmann9c724352006-07-06 15:45:23 +0200292 poll_wait(file, &data->read_wait, wait);
Marcel Holtmann4aa769b2005-08-09 20:27:37 -0700293
Marcel Holtmann9c724352006-07-06 15:45:23 +0200294 if (!skb_queue_empty(&data->readq))
Linus Torvaldsa9a08842018-02-11 14:34:03 -0800295 return EPOLLIN | EPOLLRDNORM;
Marcel Holtmann4aa769b2005-08-09 20:27:37 -0700296
Linus Torvaldsa9a08842018-02-11 14:34:03 -0800297 return EPOLLOUT | EPOLLWRNORM;
Marcel Holtmann4aa769b2005-08-09 20:27:37 -0700298}
299
Marcel Holtmann23424c02013-09-02 10:41:39 -0700300static void vhci_open_timeout(struct work_struct *work)
301{
302 struct vhci_data *data = container_of(work, struct vhci_data,
303 open_timeout.work);
304
Marcel Holtmannca8bee52016-07-05 14:30:14 +0200305 vhci_create_device(data, amp ? HCI_AMP : HCI_PRIMARY);
Marcel Holtmann23424c02013-09-02 10:41:39 -0700306}
307
Marcel Holtmann4aa769b2005-08-09 20:27:37 -0700308static int vhci_open(struct inode *inode, struct file *file)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700309{
Marcel Holtmann9c724352006-07-06 15:45:23 +0200310 struct vhci_data *data;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700311
Marcel Holtmann9c724352006-07-06 15:45:23 +0200312 data = kzalloc(sizeof(struct vhci_data), GFP_KERNEL);
313 if (!data)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700314 return -ENOMEM;
315
Marcel Holtmann9c724352006-07-06 15:45:23 +0200316 skb_queue_head_init(&data->readq);
317 init_waitqueue_head(&data->read_wait);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700318
Takashi Iwaic7c999c2016-04-14 17:32:19 +0200319 mutex_init(&data->open_mutex);
Marcel Holtmann23424c02013-09-02 10:41:39 -0700320 INIT_DELAYED_WORK(&data->open_timeout, vhci_open_timeout);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700321
Marcel Holtmann9c724352006-07-06 15:45:23 +0200322 file->private_data = data;
David Herrmann0dea0142012-03-28 11:48:42 +0200323 nonseekable_open(inode, file);
Marcel Holtmann4aa769b2005-08-09 20:27:37 -0700324
Marcel Holtmann23424c02013-09-02 10:41:39 -0700325 schedule_delayed_work(&data->open_timeout, msecs_to_jiffies(1000));
326
David Herrmann0dea0142012-03-28 11:48:42 +0200327 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700328}
329
Marcel Holtmann4aa769b2005-08-09 20:27:37 -0700330static int vhci_release(struct inode *inode, struct file *file)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700331{
Marcel Holtmann9c724352006-07-06 15:45:23 +0200332 struct vhci_data *data = file->private_data;
Jiri Slaby373a32c2016-03-19 11:05:18 +0100333 struct hci_dev *hdev;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700334
Marcel Holtmann23424c02013-09-02 10:41:39 -0700335 cancel_delayed_work_sync(&data->open_timeout);
336
Jiri Slaby373a32c2016-03-19 11:05:18 +0100337 hdev = data->hdev;
338
Marcel Holtmann23424c02013-09-02 10:41:39 -0700339 if (hdev) {
340 hci_unregister_dev(hdev);
341 hci_free_dev(hdev);
342 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700343
Jiri Slaby13407372016-03-19 11:49:43 +0100344 skb_queue_purge(&data->readq);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700345 file->private_data = NULL;
David Herrmannbf18c712012-01-07 15:47:14 +0100346 kfree(data);
Marcel Holtmann4aa769b2005-08-09 20:27:37 -0700347
Linus Torvalds1da177e2005-04-16 15:20:36 -0700348 return 0;
349}
350
Arjan van de Ven2b8693c2007-02-12 00:55:32 -0800351static const struct file_operations vhci_fops = {
Marcel Holtmannfed4c252009-12-03 18:07:28 +0100352 .owner = THIS_MODULE,
Marcel Holtmann4aa769b2005-08-09 20:27:37 -0700353 .read = vhci_read,
Al Viro512b2262014-08-23 11:28:14 -0400354 .write_iter = vhci_write,
Marcel Holtmann4aa769b2005-08-09 20:27:37 -0700355 .poll = vhci_poll,
Marcel Holtmann4aa769b2005-08-09 20:27:37 -0700356 .open = vhci_open,
357 .release = vhci_release,
Arnd Bergmann6038f372010-08-15 18:52:59 +0200358 .llseek = no_llseek,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700359};
360
Prasanna Karthik4eeab592015-06-02 10:50:15 +0000361static struct miscdevice vhci_miscdev = {
Marcel Holtmannac284942009-06-07 18:09:57 +0200362 .name = "vhci",
363 .fops = &vhci_fops,
Lucas De Marchib075dd42014-02-18 02:19:26 -0300364 .minor = VHCI_MINOR,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700365};
PrasannaKumar Muralidharand6a38c02016-08-25 22:30:50 +0530366module_misc_device(vhci_miscdev);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700367
Andrei Emeltchenko36acbb12011-11-14 12:42:48 +0200368module_param(amp, bool, 0644);
369MODULE_PARM_DESC(amp, "Create AMP controller device");
370
Marcel Holtmann63fbd242008-08-18 13:23:53 +0200371MODULE_AUTHOR("Marcel Holtmann <marcel@holtmann.org>");
Marcel Holtmann4aa769b2005-08-09 20:27:37 -0700372MODULE_DESCRIPTION("Bluetooth virtual HCI driver ver " VERSION);
373MODULE_VERSION(VERSION);
374MODULE_LICENSE("GPL");
Marcel Holtmannbfacbb92013-08-26 22:02:38 -0700375MODULE_ALIAS("devname:vhci");
Lucas De Marchib075dd42014-02-18 02:19:26 -0300376MODULE_ALIAS_MISCDEV(VHCI_MINOR);