Staging: hv: hv_mouse: remove deviceinfo_callback function
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / drivers / staging / hv / hv_mouse.c
blob8c4ae37ac65acdf1e48eab7c6ee2b0f43110a665
1 /*
2 * Copyright (c) 2009, Citrix Systems, Inc.
3 * Copyright (c) 2010, Microsoft Corporation.
4 * Copyright (c) 2011, Novell Inc.
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
15 #include <linux/init.h>
16 #include <linux/module.h>
17 #include <linux/delay.h>
18 #include <linux/device.h>
19 #include <linux/workqueue.h>
20 #include <linux/sched.h>
21 #include <linux/wait.h>
22 #include <linux/input.h>
23 #include <linux/hid.h>
24 #include <linux/hiddev.h>
26 #include "hyperv.h"
30 * Data types
32 struct hv_input_dev_info {
33 unsigned short vendor;
34 unsigned short product;
35 unsigned short version;
36 char name[128];
39 /* The maximum size of a synthetic input message. */
40 #define SYNTHHID_MAX_INPUT_REPORT_SIZE 16
43 * Current version
45 * History:
46 * Beta, RC < 2008/1/22 1,0
47 * RC > 2008/1/22 2,0
49 #define SYNTHHID_INPUT_VERSION_MAJOR 2
50 #define SYNTHHID_INPUT_VERSION_MINOR 0
51 #define SYNTHHID_INPUT_VERSION (SYNTHHID_INPUT_VERSION_MINOR | \
52 (SYNTHHID_INPUT_VERSION_MAJOR << 16))
55 #pragma pack(push, 1)
57 * Message types in the synthetic input protocol
59 enum synthhid_msg_type {
60 SynthHidProtocolRequest,
61 SynthHidProtocolResponse,
62 SynthHidInitialDeviceInfo,
63 SynthHidInitialDeviceInfoAck,
64 SynthHidInputReport,
65 SynthHidMax
69 * Basic message structures.
71 struct synthhid_msg_hdr {
72 enum synthhid_msg_type type;
73 u32 size;
76 struct synthhid_msg {
77 struct synthhid_msg_hdr header;
78 char data[1]; /* Enclosed message */
81 union synthhid_version {
82 struct {
83 u16 minor_version;
84 u16 major_version;
86 u32 version;
90 * Protocol messages
92 struct synthhid_protocol_request {
93 struct synthhid_msg_hdr header;
94 union synthhid_version version_requested;
97 struct synthhid_protocol_response {
98 struct synthhid_msg_hdr header;
99 union synthhid_version version_requested;
100 unsigned char approved;
103 struct synthhid_device_info {
104 struct synthhid_msg_hdr header;
105 struct hv_input_dev_info hid_dev_info;
106 struct hid_descriptor hid_descriptor;
109 struct synthhid_device_info_ack {
110 struct synthhid_msg_hdr header;
111 unsigned char reserved;
114 struct synthhid_input_report {
115 struct synthhid_msg_hdr header;
116 char buffer[1];
119 #pragma pack(pop)
121 #define INPUTVSC_SEND_RING_BUFFER_SIZE (10*PAGE_SIZE)
122 #define INPUTVSC_RECV_RING_BUFFER_SIZE (10*PAGE_SIZE)
124 #define NBITS(x) (((x)/BITS_PER_LONG)+1)
126 enum pipe_prot_msg_type {
127 PipeMessageInvalid = 0,
128 PipeMessageData,
129 PipeMessageMaximum
133 struct pipe_prt_msg {
134 enum pipe_prot_msg_type type;
135 u32 size;
136 char data[1];
140 * Data types
142 struct mousevsc_prt_msg {
143 enum pipe_prot_msg_type type;
144 u32 size;
145 union {
146 struct synthhid_protocol_request request;
147 struct synthhid_protocol_response response;
148 struct synthhid_device_info_ack ack;
153 * Represents an mousevsc device
155 struct mousevsc_dev {
156 struct hv_device *device;
157 /* 0 indicates the device is being destroyed */
158 atomic_t ref_count;
159 int num_outstanding_req;
160 unsigned char init_complete;
161 struct mousevsc_prt_msg protocol_req;
162 struct mousevsc_prt_msg protocol_resp;
163 /* Synchronize the request/response if needed */
164 wait_queue_head_t protocol_wait_event;
165 wait_queue_head_t dev_info_wait_event;
166 int protocol_wait_condition;
167 int device_wait_condition;
168 int dev_info_status;
170 struct hid_descriptor *hid_desc;
171 unsigned char *report_desc;
172 u32 report_desc_size;
173 struct hv_input_dev_info hid_dev_info;
176 struct input_device_context {
177 struct hv_device *device_ctx;
178 struct hid_device *hid_device;
179 struct hv_input_dev_info device_info;
180 int connected;
183 static void inputreport_callback(struct hv_device *dev, void *packet, u32 len);
184 static void reportdesc_callback(struct hv_device *dev, void *packet, u32 len);
186 static struct mousevsc_dev *alloc_input_device(struct hv_device *device)
188 struct mousevsc_dev *input_dev;
190 input_dev = kzalloc(sizeof(struct mousevsc_dev), GFP_KERNEL);
192 if (!input_dev)
193 return NULL;
196 * Set to 2 to allow both inbound and outbound traffics
197 * (ie get_input_device() and must_get_input_device()) to proceed.
199 atomic_cmpxchg(&input_dev->ref_count, 0, 2);
201 input_dev->device = device;
202 device->ext = input_dev;
204 return input_dev;
207 static void free_input_device(struct mousevsc_dev *device)
209 WARN_ON(atomic_read(&device->ref_count) == 0);
210 kfree(device);
214 * Get the inputdevice object if exists and its refcount > 1
216 static struct mousevsc_dev *get_input_device(struct hv_device *device)
218 struct mousevsc_dev *input_dev;
220 input_dev = (struct mousevsc_dev *)device->ext;
223 * FIXME
224 * This sure isn't a valid thing to print for debugging, no matter
225 * what the intention is...
227 * printk(KERN_ERR "-------------------------> REFCOUNT = %d",
228 * input_dev->ref_count);
231 if (input_dev && atomic_read(&input_dev->ref_count) > 1)
232 atomic_inc(&input_dev->ref_count);
233 else
234 input_dev = NULL;
236 return input_dev;
240 * Get the inputdevice object iff exists and its refcount > 0
242 static struct mousevsc_dev *must_get_input_device(struct hv_device *device)
244 struct mousevsc_dev *input_dev;
246 input_dev = (struct mousevsc_dev *)device->ext;
248 if (input_dev && atomic_read(&input_dev->ref_count))
249 atomic_inc(&input_dev->ref_count);
250 else
251 input_dev = NULL;
253 return input_dev;
256 static void put_input_device(struct hv_device *device)
258 struct mousevsc_dev *input_dev;
260 input_dev = (struct mousevsc_dev *)device->ext;
262 atomic_dec(&input_dev->ref_count);
266 * Drop ref count to 1 to effectively disable get_input_device()
268 static struct mousevsc_dev *release_input_device(struct hv_device *device)
270 struct mousevsc_dev *input_dev;
272 input_dev = (struct mousevsc_dev *)device->ext;
274 /* Busy wait until the ref drop to 2, then set it to 1 */
275 while (atomic_cmpxchg(&input_dev->ref_count, 2, 1) != 2)
276 udelay(100);
278 return input_dev;
282 * Drop ref count to 0. No one can use input_device object.
284 static struct mousevsc_dev *final_release_input_device(struct hv_device *device)
286 struct mousevsc_dev *input_dev;
288 input_dev = (struct mousevsc_dev *)device->ext;
290 /* Busy wait until the ref drop to 1, then set it to 0 */
291 while (atomic_cmpxchg(&input_dev->ref_count, 1, 0) != 1)
292 udelay(100);
294 device->ext = NULL;
295 return input_dev;
298 static void mousevsc_on_send_completion(struct hv_device *device,
299 struct vmpacket_descriptor *packet)
301 struct mousevsc_dev *input_dev;
302 void *request;
304 input_dev = must_get_input_device(device);
305 if (!input_dev) {
306 pr_err("unable to get input device...device being destroyed?");
307 return;
310 request = (void *)(unsigned long)packet->trans_id;
312 if (request == &input_dev->protocol_req) {
313 /* FIXME */
314 /* Shouldn't we be doing something here? */
317 put_input_device(device);
320 static void mousevsc_on_receive_device_info(struct mousevsc_dev *input_device,
321 struct synthhid_device_info *device_info)
323 int ret = 0;
324 struct hid_descriptor *desc;
325 struct mousevsc_prt_msg ack;
327 /* Assume success for now */
328 input_device->dev_info_status = 0;
330 /* Save the device attr */
331 memcpy(&input_device->hid_dev_info, &device_info->hid_dev_info,
332 sizeof(struct hv_input_dev_info));
334 /* Save the hid desc */
335 desc = &device_info->hid_descriptor;
336 WARN_ON(desc->bLength > 0);
338 input_device->hid_desc = kzalloc(desc->bLength, GFP_KERNEL);
340 if (!input_device->hid_desc) {
341 pr_err("unable to allocate hid descriptor - size %d", desc->bLength);
342 goto cleanup;
345 memcpy(input_device->hid_desc, desc, desc->bLength);
347 /* Save the report desc */
348 input_device->report_desc_size = desc->desc[0].wDescriptorLength;
349 input_device->report_desc = kzalloc(input_device->report_desc_size,
350 GFP_KERNEL);
352 if (!input_device->report_desc) {
353 pr_err("unable to allocate report descriptor - size %d",
354 input_device->report_desc_size);
355 goto cleanup;
358 memcpy(input_device->report_desc,
359 ((unsigned char *)desc) + desc->bLength,
360 desc->desc[0].wDescriptorLength);
362 /* Send the ack */
363 memset(&ack, 0, sizeof(struct mousevsc_prt_msg));
365 ack.type = PipeMessageData;
366 ack.size = sizeof(struct synthhid_device_info_ack);
368 ack.ack.header.type = SynthHidInitialDeviceInfoAck;
369 ack.ack.header.size = 1;
370 ack.ack.reserved = 0;
372 ret = vmbus_sendpacket(input_device->device->channel,
373 &ack,
374 sizeof(struct pipe_prt_msg) - sizeof(unsigned char) +
375 sizeof(struct synthhid_device_info_ack),
376 (unsigned long)&ack,
377 VM_PKT_DATA_INBAND,
378 VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
379 if (ret != 0) {
380 pr_err("unable to send synthhid device info ack - ret %d",
381 ret);
382 goto cleanup;
385 input_device->device_wait_condition = 1;
386 wake_up(&input_device->dev_info_wait_event);
388 return;
390 cleanup:
391 kfree(input_device->hid_desc);
392 input_device->hid_desc = NULL;
394 kfree(input_device->report_desc);
395 input_device->report_desc = NULL;
397 input_device->dev_info_status = -1;
398 input_device->device_wait_condition = 1;
399 wake_up(&input_device->dev_info_wait_event);
402 static void mousevsc_on_receive_input_report(struct mousevsc_dev *input_device,
403 struct synthhid_input_report *input_report)
405 struct hv_driver *input_drv;
407 if (!input_device->init_complete) {
408 pr_info("Initialization incomplete...ignoring input_report msg");
409 return;
412 input_drv = drv_to_hv_drv(input_device->device->device.driver);
414 inputreport_callback(input_device->device,
415 input_report->buffer,
416 input_report->header.size);
419 static void mousevsc_on_receive(struct hv_device *device,
420 struct vmpacket_descriptor *packet)
422 struct pipe_prt_msg *pipe_msg;
423 struct synthhid_msg *hid_msg;
424 struct mousevsc_dev *input_dev;
426 input_dev = must_get_input_device(device);
427 if (!input_dev) {
428 pr_err("unable to get input device...device being destroyed?");
429 return;
432 pipe_msg = (struct pipe_prt_msg *)((unsigned long)packet +
433 (packet->offset8 << 3));
435 if (pipe_msg->type != PipeMessageData) {
436 pr_err("unknown pipe msg type - type %d len %d",
437 pipe_msg->type, pipe_msg->size);
438 put_input_device(device);
439 return ;
442 hid_msg = (struct synthhid_msg *)&pipe_msg->data[0];
444 switch (hid_msg->header.type) {
445 case SynthHidProtocolResponse:
446 memcpy(&input_dev->protocol_resp, pipe_msg,
447 pipe_msg->size + sizeof(struct pipe_prt_msg) -
448 sizeof(unsigned char));
449 input_dev->protocol_wait_condition = 1;
450 wake_up(&input_dev->protocol_wait_event);
451 break;
453 case SynthHidInitialDeviceInfo:
454 WARN_ON(pipe_msg->size >= sizeof(struct hv_input_dev_info));
457 * Parse out the device info into device attr,
458 * hid desc and report desc
460 mousevsc_on_receive_device_info(input_dev,
461 (struct synthhid_device_info *)&pipe_msg->data[0]);
462 break;
463 case SynthHidInputReport:
464 mousevsc_on_receive_input_report(input_dev,
465 (struct synthhid_input_report *)&pipe_msg->data[0]);
467 break;
468 default:
469 pr_err("unsupported hid msg type - type %d len %d",
470 hid_msg->header.type, hid_msg->header.size);
471 break;
474 put_input_device(device);
477 static void mousevsc_on_channel_callback(void *context)
479 const int packetSize = 0x100;
480 int ret = 0;
481 struct hv_device *device = (struct hv_device *)context;
482 struct mousevsc_dev *input_dev;
484 u32 bytes_recvd;
485 u64 req_id;
486 unsigned char packet[0x100];
487 struct vmpacket_descriptor *desc;
488 unsigned char *buffer = packet;
489 int bufferlen = packetSize;
491 input_dev = must_get_input_device(device);
493 if (!input_dev) {
494 pr_err("unable to get input device...device being destroyed?");
495 return;
498 do {
499 ret = vmbus_recvpacket_raw(device->channel, buffer,
500 bufferlen, &bytes_recvd, &req_id);
502 if (ret == 0) {
503 if (bytes_recvd > 0) {
504 desc = (struct vmpacket_descriptor *)buffer;
506 switch (desc->type) {
507 case VM_PKT_COMP:
508 mousevsc_on_send_completion(
509 device, desc);
510 break;
512 case VM_PKT_DATA_INBAND:
513 mousevsc_on_receive(
514 device, desc);
515 break;
517 default:
518 pr_err("unhandled packet type %d, tid %llx len %d\n",
519 desc->type,
520 req_id,
521 bytes_recvd);
522 break;
525 /* reset */
526 if (bufferlen > packetSize) {
527 kfree(buffer);
529 buffer = packet;
530 bufferlen = packetSize;
532 } else {
534 * pr_debug("nothing else to read...");
535 * reset
537 if (bufferlen > packetSize) {
538 kfree(buffer);
540 buffer = packet;
541 bufferlen = packetSize;
543 break;
545 } else if (ret == -ENOBUFS) {
546 /* Handle large packet */
547 bufferlen = bytes_recvd;
548 buffer = kzalloc(bytes_recvd, GFP_KERNEL);
550 if (buffer == NULL) {
551 buffer = packet;
552 bufferlen = packetSize;
554 /* Try again next time around */
555 pr_err("unable to allocate buffer of size %d!",
556 bytes_recvd);
557 break;
560 } while (1);
562 put_input_device(device);
564 return;
567 static int mousevsc_connect_to_vsp(struct hv_device *device)
569 int ret = 0;
570 struct mousevsc_dev *input_dev;
571 struct mousevsc_prt_msg *request;
572 struct mousevsc_prt_msg *response;
574 input_dev = get_input_device(device);
576 if (!input_dev) {
577 pr_err("unable to get input device...device being destroyed?");
578 return -1;
581 init_waitqueue_head(&input_dev->protocol_wait_event);
582 init_waitqueue_head(&input_dev->dev_info_wait_event);
584 request = &input_dev->protocol_req;
587 * Now, initiate the vsc/vsp initialization protocol on the open channel
589 memset(request, 0, sizeof(struct mousevsc_prt_msg));
591 request->type = PipeMessageData;
592 request->size = sizeof(struct synthhid_protocol_request);
594 request->request.header.type = SynthHidProtocolRequest;
595 request->request.header.size = sizeof(unsigned long);
596 request->request.version_requested.version = SYNTHHID_INPUT_VERSION;
598 pr_info("synthhid protocol request...");
600 ret = vmbus_sendpacket(device->channel, request,
601 sizeof(struct pipe_prt_msg) -
602 sizeof(unsigned char) +
603 sizeof(struct synthhid_protocol_request),
604 (unsigned long)request,
605 VM_PKT_DATA_INBAND,
606 VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
607 if (ret != 0) {
608 pr_err("unable to send synthhid protocol request.");
609 goto cleanup;
612 input_dev->protocol_wait_condition = 0;
613 wait_event_timeout(input_dev->protocol_wait_event,
614 input_dev->protocol_wait_condition, msecs_to_jiffies(1000));
615 if (input_dev->protocol_wait_condition == 0) {
616 ret = -ETIMEDOUT;
617 goto cleanup;
620 response = &input_dev->protocol_resp;
622 if (!response->response.approved) {
623 pr_err("synthhid protocol request failed (version %d)",
624 SYNTHHID_INPUT_VERSION);
625 ret = -1;
626 goto cleanup;
629 input_dev->device_wait_condition = 0;
630 wait_event_timeout(input_dev->dev_info_wait_event,
631 input_dev->device_wait_condition, msecs_to_jiffies(1000));
632 if (input_dev->device_wait_condition == 0) {
633 ret = -ETIMEDOUT;
634 goto cleanup;
638 * We should have gotten the device attr, hid desc and report
639 * desc at this point
641 if (!input_dev->dev_info_status)
642 pr_info("**** input channel up and running!! ****");
643 else
644 ret = -1;
646 cleanup:
647 put_input_device(device);
649 return ret;
652 static int mousevsc_on_device_add(struct hv_device *device,
653 void *additional_info)
655 int ret = 0;
656 struct mousevsc_dev *input_dev;
657 struct hv_driver *input_drv;
658 struct hv_input_dev_info dev_info;
659 struct input_device_context *input_device_ctx;
661 input_dev = alloc_input_device(device);
663 if (!input_dev) {
664 ret = -1;
665 goto cleanup;
668 input_dev->init_complete = false;
670 /* Open the channel */
671 ret = vmbus_open(device->channel,
672 INPUTVSC_SEND_RING_BUFFER_SIZE,
673 INPUTVSC_RECV_RING_BUFFER_SIZE,
674 NULL,
676 mousevsc_on_channel_callback,
677 device
680 if (ret != 0) {
681 pr_err("unable to open channel: %d", ret);
682 free_input_device(input_dev);
683 return -1;
686 pr_info("InputVsc channel open: %d", ret);
688 ret = mousevsc_connect_to_vsp(device);
690 if (ret != 0) {
691 pr_err("unable to connect channel: %d", ret);
693 vmbus_close(device->channel);
694 free_input_device(input_dev);
695 return ret;
698 input_drv = drv_to_hv_drv(input_dev->device->device.driver);
700 dev_info.vendor = input_dev->hid_dev_info.vendor;
701 dev_info.product = input_dev->hid_dev_info.product;
702 dev_info.version = input_dev->hid_dev_info.version;
703 strcpy(dev_info.name, "Microsoft Vmbus HID-compliant Mouse");
705 /* Send the device info back up */
706 input_device_ctx = dev_get_drvdata(&device->device);
707 memcpy(&input_device_ctx->device_info, &dev_info,
708 sizeof(struct hv_input_dev_info));
710 /* Send the report desc back up */
711 /* workaround SA-167 */
712 if (input_dev->report_desc[14] == 0x25)
713 input_dev->report_desc[14] = 0x29;
715 reportdesc_callback(device, input_dev->report_desc,
716 input_dev->report_desc_size);
718 input_dev->init_complete = true;
720 cleanup:
721 return ret;
724 static int mousevsc_on_device_remove(struct hv_device *device)
726 struct mousevsc_dev *input_dev;
727 int ret = 0;
729 pr_info("disabling input device (%p)...",
730 device->ext);
732 input_dev = release_input_device(device);
736 * At this point, all outbound traffic should be disable. We only
737 * allow inbound traffic (responses) to proceed
739 * so that outstanding requests can be completed.
741 while (input_dev->num_outstanding_req) {
742 pr_info("waiting for %d requests to complete...",
743 input_dev->num_outstanding_req);
745 udelay(100);
748 pr_info("removing input device (%p)...", device->ext);
750 input_dev = final_release_input_device(device);
752 pr_info("input device (%p) safe to remove", input_dev);
754 /* Close the channel */
755 vmbus_close(device->channel);
757 free_input_device(input_dev);
759 return ret;
763 static void inputreport_callback(struct hv_device *dev, void *packet, u32 len)
765 int ret = 0;
767 struct input_device_context *input_dev_ctx =
768 dev_get_drvdata(&dev->device);
770 ret = hid_input_report(input_dev_ctx->hid_device,
771 HID_INPUT_REPORT, packet, len, 1);
773 DPRINT_DBG(INPUTVSC_DRV, "hid_input_report (ret %d)", ret);
776 static int mousevsc_hid_open(struct hid_device *hid)
778 return 0;
781 static void mousevsc_hid_close(struct hid_device *hid)
785 static int mousevsc_probe(struct hv_device *dev)
787 int ret = 0;
789 struct input_device_context *input_dev_ctx;
791 input_dev_ctx = kmalloc(sizeof(struct input_device_context),
792 GFP_KERNEL);
794 dev_set_drvdata(&dev->device, input_dev_ctx);
796 /* Call to the vsc driver to add the device */
797 ret = mousevsc_on_device_add(dev, NULL);
799 if (ret != 0) {
800 DPRINT_ERR(INPUTVSC_DRV, "unable to add input vsc device");
802 return -1;
805 return 0;
808 static int mousevsc_remove(struct hv_device *dev)
810 int ret = 0;
812 struct input_device_context *input_dev_ctx;
814 input_dev_ctx = kmalloc(sizeof(struct input_device_context),
815 GFP_KERNEL);
817 dev_set_drvdata(&dev->device, input_dev_ctx);
819 if (input_dev_ctx->connected) {
820 hidinput_disconnect(input_dev_ctx->hid_device);
821 input_dev_ctx->connected = 0;
825 * Call to the vsc driver to let it know that the device
826 * is being removed
828 ret = mousevsc_on_device_remove(dev);
830 if (ret != 0) {
831 DPRINT_ERR(INPUTVSC_DRV,
832 "unable to remove vsc device (ret %d)", ret);
835 kfree(input_dev_ctx);
837 return ret;
840 static void reportdesc_callback(struct hv_device *dev, void *packet, u32 len)
842 struct input_device_context *input_device_ctx =
843 dev_get_drvdata(&dev->device);
844 struct hid_device *hid_dev;
846 /* hid_debug = -1; */
847 hid_dev = kmalloc(sizeof(struct hid_device), GFP_KERNEL);
849 if (hid_parse_report(hid_dev, packet, len)) {
850 DPRINT_INFO(INPUTVSC_DRV, "Unable to call hd_parse_report");
851 return;
854 if (hid_dev) {
855 DPRINT_INFO(INPUTVSC_DRV, "hid_device created");
857 hid_dev->ll_driver->open = mousevsc_hid_open;
858 hid_dev->ll_driver->close = mousevsc_hid_close;
860 hid_dev->bus = BUS_VIRTUAL;
861 hid_dev->vendor = input_device_ctx->device_info.vendor;
862 hid_dev->product = input_device_ctx->device_info.product;
863 hid_dev->version = input_device_ctx->device_info.version;
864 hid_dev->dev = dev->device;
866 sprintf(hid_dev->name, "%s",
867 input_device_ctx->device_info.name);
870 * HJ Do we want to call it with a 0
872 if (!hidinput_connect(hid_dev, 0)) {
873 hid_dev->claimed |= HID_CLAIMED_INPUT;
875 input_device_ctx->connected = 1;
877 DPRINT_INFO(INPUTVSC_DRV,
878 "HID device claimed by input\n");
881 if (!hid_dev->claimed) {
882 DPRINT_ERR(INPUTVSC_DRV,
883 "HID device not claimed by "
884 "input or hiddev\n");
887 input_device_ctx->hid_device = hid_dev;
890 kfree(hid_dev);
893 static const struct hv_vmbus_device_id id_table[] = {
894 /* Mouse guid */
895 { VMBUS_DEVICE(0x9E, 0xB6, 0xA8, 0xCF, 0x4A, 0x5B, 0xc0, 0x4c,
896 0xB9, 0x8B, 0x8B, 0xA1, 0xA1, 0xF3, 0xF9, 0x5A) },
897 { },
901 * The mouse driver is not functional; do not auto-load it.
903 /* MODULE_DEVICE_TABLE(vmbus, id_table); */
905 static struct hv_driver mousevsc_drv = {
906 .name = "mousevsc",
907 .id_table = id_table,
908 .probe = mousevsc_probe,
909 .remove = mousevsc_remove,
912 static int __init mousevsc_init(void)
914 return vmbus_driver_register(&mousevsc_drv);
917 static void __exit mousevsc_exit(void)
919 vmbus_driver_unregister(&mousevsc_drv);
922 MODULE_LICENSE("GPL");
923 MODULE_VERSION(HV_DRV_VERSION);
924 module_init(mousevsc_init);
925 module_exit(mousevsc_exit);