Commit 2ba6810b authored by Hank Janssen's avatar Hank Janssen Committed by Greg Kroah-Hartman

staging: hv: Convert camel case func params to lower case in hv_mouse

Change all camelcase function params to lower case in hv_mouse
Signed-off-by: default avatarAbhishek Kane <v-abkane@microsoft.com>
Signed-off-by: default avatarHank Janssen <hjanssen@microsoft.com>
Signed-off-by: default avatarHaiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: default avatarK. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 94e44cb5
...@@ -200,7 +200,7 @@ static void deviceinfo_callback(struct hv_device *dev, struct hv_input_dev_info ...@@ -200,7 +200,7 @@ static void deviceinfo_callback(struct hv_device *dev, struct hv_input_dev_info
static void inputreport_callback(struct hv_device *dev, void *packet, u32 len); static void inputreport_callback(struct hv_device *dev, void *packet, u32 len);
static void reportdesc_callback(struct hv_device *dev, void *packet, u32 len); static void reportdesc_callback(struct hv_device *dev, void *packet, u32 len);
static struct mousevsc_dev *alloc_input_device(struct hv_device *Device) static struct mousevsc_dev *alloc_input_device(struct hv_device *device)
{ {
struct mousevsc_dev *inputDevice; struct mousevsc_dev *inputDevice;
...@@ -215,26 +215,26 @@ static struct mousevsc_dev *alloc_input_device(struct hv_device *Device) ...@@ -215,26 +215,26 @@ static struct mousevsc_dev *alloc_input_device(struct hv_device *Device)
*/ */
atomic_cmpxchg(&inputDevice->RefCount, 0, 2); atomic_cmpxchg(&inputDevice->RefCount, 0, 2);
inputDevice->Device = Device; inputDevice->Device = device;
Device->ext = inputDevice; device->ext = inputDevice;
return inputDevice; return inputDevice;
} }
static void free_input_device(struct mousevsc_dev *Device) static void free_input_device(struct mousevsc_dev *device)
{ {
WARN_ON(atomic_read(&Device->RefCount) == 0); WARN_ON(atomic_read(&device->RefCount) == 0);
kfree(Device); kfree(device);
} }
/* /*
* Get the inputdevice object if exists and its refcount > 1 * Get the inputdevice object if exists and its refcount > 1
*/ */
static struct mousevsc_dev *get_input_device(struct hv_device *Device) static struct mousevsc_dev *get_input_device(struct hv_device *device)
{ {
struct mousevsc_dev *inputDevice; struct mousevsc_dev *inputDevice;
inputDevice = (struct mousevsc_dev *)Device->ext; inputDevice = (struct mousevsc_dev *)device->ext;
/* /*
* FIXME * FIXME
...@@ -256,11 +256,11 @@ static struct mousevsc_dev *get_input_device(struct hv_device *Device) ...@@ -256,11 +256,11 @@ static struct mousevsc_dev *get_input_device(struct hv_device *Device)
/* /*
* Get the inputdevice object iff exists and its refcount > 0 * Get the inputdevice object iff exists and its refcount > 0
*/ */
static struct mousevsc_dev *must_get_input_device(struct hv_device *Device) static struct mousevsc_dev *must_get_input_device(struct hv_device *device)
{ {
struct mousevsc_dev *inputDevice; struct mousevsc_dev *inputDevice;
inputDevice = (struct mousevsc_dev *)Device->ext; inputDevice = (struct mousevsc_dev *)device->ext;
if (inputDevice && atomic_read(&inputDevice->RefCount)) if (inputDevice && atomic_read(&inputDevice->RefCount))
atomic_inc(&inputDevice->RefCount); atomic_inc(&inputDevice->RefCount);
...@@ -270,11 +270,11 @@ static struct mousevsc_dev *must_get_input_device(struct hv_device *Device) ...@@ -270,11 +270,11 @@ static struct mousevsc_dev *must_get_input_device(struct hv_device *Device)
return inputDevice; return inputDevice;
} }
static void put_input_device(struct hv_device *Device) static void put_input_device(struct hv_device *device)
{ {
struct mousevsc_dev *inputDevice; struct mousevsc_dev *inputDevice;
inputDevice = (struct mousevsc_dev *)Device->ext; inputDevice = (struct mousevsc_dev *)device->ext;
atomic_dec(&inputDevice->RefCount); atomic_dec(&inputDevice->RefCount);
} }
...@@ -282,11 +282,11 @@ static void put_input_device(struct hv_device *Device) ...@@ -282,11 +282,11 @@ static void put_input_device(struct hv_device *Device)
/* /*
* Drop ref count to 1 to effectively disable get_input_device() * Drop ref count to 1 to effectively disable get_input_device()
*/ */
static struct mousevsc_dev *release_input_device(struct hv_device *Device) static struct mousevsc_dev *release_input_device(struct hv_device *device)
{ {
struct mousevsc_dev *inputDevice; struct mousevsc_dev *inputDevice;
inputDevice = (struct mousevsc_dev *)Device->ext; inputDevice = (struct mousevsc_dev *)device->ext;
/* Busy wait until the ref drop to 2, then set it to 1 */ /* Busy wait until the ref drop to 2, then set it to 1 */
while (atomic_cmpxchg(&inputDevice->RefCount, 2, 1) != 2) while (atomic_cmpxchg(&inputDevice->RefCount, 2, 1) != 2)
...@@ -296,82 +296,83 @@ static struct mousevsc_dev *release_input_device(struct hv_device *Device) ...@@ -296,82 +296,83 @@ static struct mousevsc_dev *release_input_device(struct hv_device *Device)
} }
/* /*
* Drop ref count to 0. No one can use InputDevice object. * Drop ref count to 0. No one can use input_device object.
*/ */
static struct mousevsc_dev *final_release_input_device(struct hv_device *Device) static struct mousevsc_dev *final_release_input_device(struct hv_device *device)
{ {
struct mousevsc_dev *inputDevice; struct mousevsc_dev *inputDevice;
inputDevice = (struct mousevsc_dev *)Device->ext; inputDevice = (struct mousevsc_dev *)device->ext;
/* Busy wait until the ref drop to 1, then set it to 0 */ /* Busy wait until the ref drop to 1, then set it to 0 */
while (atomic_cmpxchg(&inputDevice->RefCount, 1, 0) != 1) while (atomic_cmpxchg(&inputDevice->RefCount, 1, 0) != 1)
udelay(100); udelay(100);
Device->ext = NULL; device->ext = NULL;
return inputDevice; return inputDevice;
} }
static void mousevsc_on_send_completion(struct hv_device *Device, static void mousevsc_on_send_completion(struct hv_device *device,
struct vmpacket_descriptor *Packet) struct vmpacket_descriptor *packet)
{ {
struct mousevsc_dev *inputDevice; struct mousevsc_dev *inputDevice;
void *request; void *request;
inputDevice = must_get_input_device(Device); inputDevice = must_get_input_device(device);
if (!inputDevice) { if (!inputDevice) {
pr_err("unable to get input device...device being destroyed?"); pr_err("unable to get input device...device being destroyed?");
return; return;
} }
request = (void *)(unsigned long)Packet->trans_id; request = (void *)(unsigned long)packet->trans_id;
if (request == &inputDevice->ProtocolReq) { if (request == &inputDevice->ProtocolReq) {
/* FIXME */ /* FIXME */
/* Shouldn't we be doing something here? */ /* Shouldn't we be doing something here? */
} }
put_input_device(Device); put_input_device(device);
} }
static void mousevsc_on_receive_device_info(struct mousevsc_dev *InputDevice, static void mousevsc_on_receive_device_info(struct mousevsc_dev *input_device,
struct synthhid_device_info *DeviceInfo) struct synthhid_device_info *device_info)
{ {
int ret = 0; int ret = 0;
struct hid_descriptor *desc; struct hid_descriptor *desc;
struct mousevsc_prt_msg ack; struct mousevsc_prt_msg ack;
/* Assume success for now */ /* Assume success for now */
InputDevice->DeviceInfoStatus = 0; input_device->DeviceInfoStatus = 0;
/* Save the device attr */ /* Save the device attr */
memcpy(&InputDevice->hid_dev_info, &DeviceInfo->hid_dev_info, sizeof(struct hv_input_dev_info)); memcpy(&input_device->hid_dev_info, &device_info->hid_dev_info,
sizeof(struct hv_input_dev_info));
/* Save the hid desc */ /* Save the hid desc */
desc = &DeviceInfo->hid_descriptor; desc = &device_info->hid_descriptor;
WARN_ON(desc->bLength > 0); WARN_ON(desc->bLength > 0);
InputDevice->HidDesc = kzalloc(desc->bLength, GFP_KERNEL); input_device->HidDesc = kzalloc(desc->bLength, GFP_KERNEL);
if (!InputDevice->HidDesc) { if (!input_device->HidDesc) {
pr_err("unable to allocate hid descriptor - size %d", desc->bLength); pr_err("unable to allocate hid descriptor - size %d", desc->bLength);
goto Cleanup; goto Cleanup;
} }
memcpy(InputDevice->HidDesc, desc, desc->bLength); memcpy(input_device->HidDesc, desc, desc->bLength);
/* Save the report desc */ /* Save the report desc */
InputDevice->ReportDescSize = desc->desc[0].wDescriptorLength; input_device->ReportDescSize = desc->desc[0].wDescriptorLength;
InputDevice->ReportDesc = kzalloc(InputDevice->ReportDescSize, input_device->ReportDesc = kzalloc(input_device->ReportDescSize,
GFP_KERNEL); GFP_KERNEL);
if (!InputDevice->ReportDesc) { if (!input_device->ReportDesc) {
pr_err("unable to allocate report descriptor - size %d", pr_err("unable to allocate report descriptor - size %d",
InputDevice->ReportDescSize); input_device->ReportDescSize);
goto Cleanup; goto Cleanup;
} }
memcpy(InputDevice->ReportDesc, memcpy(input_device->ReportDesc,
((unsigned char *)desc) + desc->bLength, ((unsigned char *)desc) + desc->bLength,
desc->desc[0].wDescriptorLength); desc->desc[0].wDescriptorLength);
...@@ -385,7 +386,7 @@ static void mousevsc_on_receive_device_info(struct mousevsc_dev *InputDevice, ...@@ -385,7 +386,7 @@ static void mousevsc_on_receive_device_info(struct mousevsc_dev *InputDevice,
ack.ack.header.size = 1; ack.ack.header.size = 1;
ack.ack.reserved = 0; ack.ack.reserved = 0;
ret = vmbus_sendpacket(InputDevice->Device->channel, ret = vmbus_sendpacket(input_device->Device->channel,
&ack, &ack,
sizeof(struct pipe_prt_msg) - sizeof(unsigned char) + sizeof(struct pipe_prt_msg) - sizeof(unsigned char) +
sizeof(struct synthhid_device_info_ack), sizeof(struct synthhid_device_info_ack),
...@@ -398,59 +399,60 @@ static void mousevsc_on_receive_device_info(struct mousevsc_dev *InputDevice, ...@@ -398,59 +399,60 @@ static void mousevsc_on_receive_device_info(struct mousevsc_dev *InputDevice,
goto Cleanup; goto Cleanup;
} }
InputDevice->device_wait_condition = 1; input_device->device_wait_condition = 1;
wake_up(&InputDevice->DeviceInfoWaitEvent); wake_up(&input_device->DeviceInfoWaitEvent);
return; return;
Cleanup: Cleanup:
kfree(InputDevice->HidDesc); kfree(input_device->HidDesc);
InputDevice->HidDesc = NULL; input_device->HidDesc = NULL;
kfree(InputDevice->ReportDesc); kfree(input_device->ReportDesc);
InputDevice->ReportDesc = NULL; input_device->ReportDesc = NULL;
InputDevice->DeviceInfoStatus = -1; input_device->DeviceInfoStatus = -1;
InputDevice->device_wait_condition = 1; input_device->device_wait_condition = 1;
wake_up(&InputDevice->DeviceInfoWaitEvent); wake_up(&input_device->DeviceInfoWaitEvent);
} }
static void mousevsc_on_receive_input_report(struct mousevsc_dev *InputDevice, static void mousevsc_on_receive_input_report(struct mousevsc_dev *input_device,
struct synthhid_input_report *InputReport) struct synthhid_input_report *input_report)
{ {
struct mousevsc_drv_obj *inputDriver; struct mousevsc_drv_obj *inputDriver;
if (!InputDevice->bInitializeComplete) { if (!input_device->bInitializeComplete) {
pr_info("Initialization incomplete...ignoring InputReport msg"); pr_info("Initialization incomplete...ignoring input_report msg");
return; return;
} }
inputDriver = (struct mousevsc_drv_obj *)InputDevice->Device->drv; inputDriver = (struct mousevsc_drv_obj *)input_device->Device->drv;
inputreport_callback(InputDevice->Device, inputreport_callback(input_device->Device,
InputReport->buffer, input_report->buffer,
InputReport->header.size); input_report->header.size);
} }
static void mousevsc_on_receive(struct hv_device *Device, static void mousevsc_on_receive(struct hv_device *device,
struct vmpacket_descriptor *Packet) struct vmpacket_descriptor *packet)
{ {
struct pipe_prt_msg *pipeMsg; struct pipe_prt_msg *pipeMsg;
struct synthhid_msg *hidMsg; struct synthhid_msg *hidMsg;
struct mousevsc_dev *inputDevice; struct mousevsc_dev *inputDevice;
inputDevice = must_get_input_device(Device); inputDevice = must_get_input_device(device);
if (!inputDevice) { if (!inputDevice) {
pr_err("unable to get input device...device being destroyed?"); pr_err("unable to get input device...device being destroyed?");
return; return;
} }
pipeMsg = (struct pipe_prt_msg *)((unsigned long)Packet + (Packet->offset8 << 3)); pipeMsg = (struct pipe_prt_msg *)((unsigned long)packet +
(packet->offset8 << 3));
if (pipeMsg->type != PipeMessageData) { if (pipeMsg->type != PipeMessageData) {
pr_err("unknown pipe msg type - type %d len %d", pr_err("unknown pipe msg type - type %d len %d",
pipeMsg->type, pipeMsg->size); pipeMsg->type, pipeMsg->size);
put_input_device(Device); put_input_device(device);
return ; return ;
} }
...@@ -486,14 +488,14 @@ static void mousevsc_on_receive(struct hv_device *Device, ...@@ -486,14 +488,14 @@ static void mousevsc_on_receive(struct hv_device *Device,
break; break;
} }
put_input_device(Device); put_input_device(device);
} }
static void mousevsc_on_channel_callback(void *Context) static void mousevsc_on_channel_callback(void *context)
{ {
const int packetSize = 0x100; const int packetSize = 0x100;
int ret = 0; int ret = 0;
struct hv_device *device = (struct hv_device *)Context; struct hv_device *device = (struct hv_device *)context;
struct mousevsc_dev *inputDevice; struct mousevsc_dev *inputDevice;
u32 bytesRecvd; u32 bytesRecvd;
...@@ -578,14 +580,14 @@ static void mousevsc_on_channel_callback(void *Context) ...@@ -578,14 +580,14 @@ static void mousevsc_on_channel_callback(void *Context)
return; return;
} }
static int mousevsc_connect_to_vsp(struct hv_device *Device) static int mousevsc_connect_to_vsp(struct hv_device *device)
{ {
int ret = 0; int ret = 0;
struct mousevsc_dev *inputDevice; struct mousevsc_dev *inputDevice;
struct mousevsc_prt_msg *request; struct mousevsc_prt_msg *request;
struct mousevsc_prt_msg *response; struct mousevsc_prt_msg *response;
inputDevice = get_input_device(Device); inputDevice = get_input_device(device);
if (!inputDevice) { if (!inputDevice) {
pr_err("unable to get input device...device being destroyed?"); pr_err("unable to get input device...device being destroyed?");
...@@ -611,7 +613,7 @@ static int mousevsc_connect_to_vsp(struct hv_device *Device) ...@@ -611,7 +613,7 @@ static int mousevsc_connect_to_vsp(struct hv_device *Device)
pr_info("synthhid protocol request..."); pr_info("synthhid protocol request...");
ret = vmbus_sendpacket(Device->channel, request, ret = vmbus_sendpacket(device->channel, request,
sizeof(struct pipe_prt_msg) - sizeof(struct pipe_prt_msg) -
sizeof(unsigned char) + sizeof(unsigned char) +
sizeof(struct synthhid_protocol_request), sizeof(struct synthhid_protocol_request),
...@@ -656,20 +658,20 @@ static int mousevsc_connect_to_vsp(struct hv_device *Device) ...@@ -656,20 +658,20 @@ static int mousevsc_connect_to_vsp(struct hv_device *Device)
ret = -1; ret = -1;
Cleanup: Cleanup:
put_input_device(Device); put_input_device(device);
return ret; return ret;
} }
static int mousevsc_on_device_add(struct hv_device *Device, static int mousevsc_on_device_add(struct hv_device *device,
void *AdditionalInfo) void *additional_info)
{ {
int ret = 0; int ret = 0;
struct mousevsc_dev *inputDevice; struct mousevsc_dev *inputDevice;
struct mousevsc_drv_obj *inputDriver; struct mousevsc_drv_obj *inputDriver;
struct hv_input_dev_info dev_info; struct hv_input_dev_info dev_info;
inputDevice = alloc_input_device(Device); inputDevice = alloc_input_device(device);
if (!inputDevice) { if (!inputDevice) {
ret = -1; ret = -1;
...@@ -679,13 +681,13 @@ static int mousevsc_on_device_add(struct hv_device *Device, ...@@ -679,13 +681,13 @@ static int mousevsc_on_device_add(struct hv_device *Device,
inputDevice->bInitializeComplete = false; inputDevice->bInitializeComplete = false;
/* Open the channel */ /* Open the channel */
ret = vmbus_open(Device->channel, ret = vmbus_open(device->channel,
INPUTVSC_SEND_RING_BUFFER_SIZE, INPUTVSC_SEND_RING_BUFFER_SIZE,
INPUTVSC_RECV_RING_BUFFER_SIZE, INPUTVSC_RECV_RING_BUFFER_SIZE,
NULL, NULL,
0, 0,
mousevsc_on_channel_callback, mousevsc_on_channel_callback,
Device device
); );
if (ret != 0) { if (ret != 0) {
...@@ -696,12 +698,12 @@ static int mousevsc_on_device_add(struct hv_device *Device, ...@@ -696,12 +698,12 @@ static int mousevsc_on_device_add(struct hv_device *Device,
pr_info("InputVsc channel open: %d", ret); pr_info("InputVsc channel open: %d", ret);
ret = mousevsc_connect_to_vsp(Device); ret = mousevsc_connect_to_vsp(device);
if (ret != 0) { if (ret != 0) {
pr_err("unable to connect channel: %d", ret); pr_err("unable to connect channel: %d", ret);
vmbus_close(Device->channel); vmbus_close(device->channel);
free_input_device(inputDevice); free_input_device(inputDevice);
return ret; return ret;
} }
...@@ -714,14 +716,14 @@ static int mousevsc_on_device_add(struct hv_device *Device, ...@@ -714,14 +716,14 @@ static int mousevsc_on_device_add(struct hv_device *Device,
strcpy(dev_info.name, "Microsoft Vmbus HID-compliant Mouse"); strcpy(dev_info.name, "Microsoft Vmbus HID-compliant Mouse");
/* Send the device info back up */ /* Send the device info back up */
deviceinfo_callback(Device, &dev_info); deviceinfo_callback(device, &dev_info);
/* Send the report desc back up */ /* Send the report desc back up */
/* workaround SA-167 */ /* workaround SA-167 */
if (inputDevice->ReportDesc[14] == 0x25) if (inputDevice->ReportDesc[14] == 0x25)
inputDevice->ReportDesc[14] = 0x29; inputDevice->ReportDesc[14] = 0x29;
reportdesc_callback(Device, inputDevice->ReportDesc, reportdesc_callback(device, inputDevice->ReportDesc,
inputDevice->ReportDescSize); inputDevice->ReportDescSize);
inputDevice->bInitializeComplete = true; inputDevice->bInitializeComplete = true;
...@@ -730,15 +732,15 @@ static int mousevsc_on_device_add(struct hv_device *Device, ...@@ -730,15 +732,15 @@ static int mousevsc_on_device_add(struct hv_device *Device,
return ret; return ret;
} }
static int mousevsc_on_device_remove(struct hv_device *Device) static int mousevsc_on_device_remove(struct hv_device *device)
{ {
struct mousevsc_dev *inputDevice; struct mousevsc_dev *inputDevice;
int ret = 0; int ret = 0;
pr_info("disabling input device (%p)...", pr_info("disabling input device (%p)...",
Device->ext); device->ext);
inputDevice = release_input_device(Device); inputDevice = release_input_device(device);
/* /*
...@@ -753,14 +755,14 @@ static int mousevsc_on_device_remove(struct hv_device *Device) ...@@ -753,14 +755,14 @@ static int mousevsc_on_device_remove(struct hv_device *Device)
udelay(100); udelay(100);
} }
pr_info("removing input device (%p)...", Device->ext); pr_info("removing input device (%p)...", device->ext);
inputDevice = final_release_input_device(Device); inputDevice = final_release_input_device(device);
pr_info("input device (%p) safe to remove", inputDevice); pr_info("input device (%p) safe to remove", inputDevice);
/* Close the channel */ /* Close the channel */
vmbus_close(Device->channel); vmbus_close(device->channel);
free_input_device(inputDevice); free_input_device(inputDevice);
...@@ -979,14 +981,14 @@ static void mousevsc_drv_exit(void) ...@@ -979,14 +981,14 @@ static void mousevsc_drv_exit(void)
return; return;
} }
static int mouse_vsc_initialize(struct hv_driver *Driver) static int mouse_vsc_initialize(struct hv_driver *driver)
{ {
struct mousevsc_drv_obj *inputDriver = struct mousevsc_drv_obj *inputDriver =
(struct mousevsc_drv_obj *)Driver; (struct mousevsc_drv_obj *)driver;
int ret = 0; int ret = 0;
Driver->name = driver_name; driver->name = driver_name;
memcpy(&Driver->dev_type, &mouse_guid, memcpy(&driver->dev_type, &mouse_guid,
sizeof(struct hv_guid)); sizeof(struct hv_guid));
/* Setup the dispatch table */ /* Setup the dispatch table */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment