* Represents an mousevsc device
*/
struct mousevsc_dev {
- struct hv_device *Device;
+ struct hv_device *device;
/* 0 indicates the device is being destroyed */
- atomic_t RefCount;
- int NumOutstandingRequests;
- unsigned char bInitializeComplete;
- struct mousevsc_prt_msg ProtocolReq;
- struct mousevsc_prt_msg ProtocolResp;
+ atomic_t ref_count;
+ int num_outstanding_req;
+ unsigned char init_complete;
+ struct mousevsc_prt_msg protocol_req;
+ struct mousevsc_prt_msg protocol_resp;
/* Synchronize the request/response if needed */
- wait_queue_head_t ProtocolWaitEvent;
- wait_queue_head_t DeviceInfoWaitEvent;
+ wait_queue_head_t protocol_wait_event;
+ wait_queue_head_t dev_info_wait_event;
int protocol_wait_condition;
int device_wait_condition;
- int DeviceInfoStatus;
+ int dev_info_status;
- struct hid_descriptor *HidDesc;
- unsigned char *ReportDesc;
- u32 ReportDescSize;
+ struct hid_descriptor *hid_desc;
+ unsigned char *report_desc;
+ u32 report_desc_size;
struct hv_input_dev_info hid_dev_info;
};
* Set to 2 to allow both inbound and outbound traffics
* (ie get_input_device() and must_get_input_device()) to proceed.
*/
- atomic_cmpxchg(&inputDevice->RefCount, 0, 2);
+ atomic_cmpxchg(&inputDevice->ref_count, 0, 2);
- inputDevice->Device = device;
+ inputDevice->device = device;
device->ext = inputDevice;
return inputDevice;
static void free_input_device(struct mousevsc_dev *device)
{
- WARN_ON(atomic_read(&device->RefCount) == 0);
+ WARN_ON(atomic_read(&device->ref_count) == 0);
kfree(device);
}
* what the intention is...
*
* printk(KERN_ERR "-------------------------> REFCOUNT = %d",
- * inputDevice->RefCount);
+ * inputDevice->ref_count);
*/
- if (inputDevice && atomic_read(&inputDevice->RefCount) > 1)
- atomic_inc(&inputDevice->RefCount);
+ if (inputDevice && atomic_read(&inputDevice->ref_count) > 1)
+ atomic_inc(&inputDevice->ref_count);
else
inputDevice = NULL;
inputDevice = (struct mousevsc_dev *)device->ext;
- if (inputDevice && atomic_read(&inputDevice->RefCount))
- atomic_inc(&inputDevice->RefCount);
+ if (inputDevice && atomic_read(&inputDevice->ref_count))
+ atomic_inc(&inputDevice->ref_count);
else
inputDevice = NULL;
inputDevice = (struct mousevsc_dev *)device->ext;
- atomic_dec(&inputDevice->RefCount);
+ atomic_dec(&inputDevice->ref_count);
}
/*
inputDevice = (struct mousevsc_dev *)device->ext;
/* 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->ref_count, 2, 1) != 2)
udelay(100);
return inputDevice;
inputDevice = (struct mousevsc_dev *)device->ext;
/* 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->ref_count, 1, 0) != 1)
udelay(100);
device->ext = NULL;
request = (void *)(unsigned long)packet->trans_id;
- if (request == &inputDevice->ProtocolReq) {
+ if (request == &inputDevice->protocol_req) {
/* FIXME */
/* Shouldn't we be doing something here? */
}
struct mousevsc_prt_msg ack;
/* Assume success for now */
- input_device->DeviceInfoStatus = 0;
+ input_device->dev_info_status = 0;
/* Save the device attr */
memcpy(&input_device->hid_dev_info, &device_info->hid_dev_info,
desc = &device_info->hid_descriptor;
WARN_ON(desc->bLength > 0);
- input_device->HidDesc = kzalloc(desc->bLength, GFP_KERNEL);
+ input_device->hid_desc = kzalloc(desc->bLength, GFP_KERNEL);
- if (!input_device->HidDesc) {
+ if (!input_device->hid_desc) {
pr_err("unable to allocate hid descriptor - size %d", desc->bLength);
goto Cleanup;
}
- memcpy(input_device->HidDesc, desc, desc->bLength);
+ memcpy(input_device->hid_desc, desc, desc->bLength);
/* Save the report desc */
- input_device->ReportDescSize = desc->desc[0].wDescriptorLength;
- input_device->ReportDesc = kzalloc(input_device->ReportDescSize,
+ input_device->report_desc_size = desc->desc[0].wDescriptorLength;
+ input_device->report_desc = kzalloc(input_device->report_desc_size,
GFP_KERNEL);
- if (!input_device->ReportDesc) {
+ if (!input_device->report_desc) {
pr_err("unable to allocate report descriptor - size %d",
- input_device->ReportDescSize);
+ input_device->report_desc_size);
goto Cleanup;
}
- memcpy(input_device->ReportDesc,
+ memcpy(input_device->report_desc,
((unsigned char *)desc) + desc->bLength,
desc->desc[0].wDescriptorLength);
ack.ack.header.size = 1;
ack.ack.reserved = 0;
- ret = vmbus_sendpacket(input_device->Device->channel,
+ ret = vmbus_sendpacket(input_device->device->channel,
&ack,
sizeof(struct pipe_prt_msg) - sizeof(unsigned char) +
sizeof(struct synthhid_device_info_ack),
}
input_device->device_wait_condition = 1;
- wake_up(&input_device->DeviceInfoWaitEvent);
+ wake_up(&input_device->dev_info_wait_event);
return;
Cleanup:
- kfree(input_device->HidDesc);
- input_device->HidDesc = NULL;
+ kfree(input_device->hid_desc);
+ input_device->hid_desc = NULL;
- kfree(input_device->ReportDesc);
- input_device->ReportDesc = NULL;
+ kfree(input_device->report_desc);
+ input_device->report_desc = NULL;
- input_device->DeviceInfoStatus = -1;
+ input_device->dev_info_status = -1;
input_device->device_wait_condition = 1;
- wake_up(&input_device->DeviceInfoWaitEvent);
+ wake_up(&input_device->dev_info_wait_event);
}
static void mousevsc_on_receive_input_report(struct mousevsc_dev *input_device,
{
struct mousevsc_drv_obj *inputDriver;
- if (!input_device->bInitializeComplete) {
+ if (!input_device->init_complete) {
pr_info("Initialization incomplete...ignoring input_report msg");
return;
}
- inputDriver = (struct mousevsc_drv_obj *)input_device->Device->drv;
+ inputDriver = (struct mousevsc_drv_obj *)input_device->device->drv;
- inputreport_callback(input_device->Device,
+ inputreport_callback(input_device->device,
input_report->buffer,
input_report->header.size);
}
switch (hidMsg->header.type) {
case SynthHidProtocolResponse:
- memcpy(&inputDevice->ProtocolResp, pipeMsg,
+ memcpy(&inputDevice->protocol_resp, pipeMsg,
pipeMsg->size + sizeof(struct pipe_prt_msg) -
sizeof(unsigned char));
inputDevice->protocol_wait_condition = 1;
- wake_up(&inputDevice->ProtocolWaitEvent);
+ wake_up(&inputDevice->protocol_wait_event);
break;
case SynthHidInitialDeviceInfo:
return -1;
}
- init_waitqueue_head(&inputDevice->ProtocolWaitEvent);
- init_waitqueue_head(&inputDevice->DeviceInfoWaitEvent);
+ init_waitqueue_head(&inputDevice->protocol_wait_event);
+ init_waitqueue_head(&inputDevice->dev_info_wait_event);
- request = &inputDevice->ProtocolReq;
+ request = &inputDevice->protocol_req;
/*
* Now, initiate the vsc/vsp initialization protocol on the open channel
}
inputDevice->protocol_wait_condition = 0;
- wait_event_timeout(inputDevice->ProtocolWaitEvent, inputDevice->protocol_wait_condition, msecs_to_jiffies(1000));
+ wait_event_timeout(inputDevice->protocol_wait_event,
+ inputDevice->protocol_wait_condition, msecs_to_jiffies(1000));
if (inputDevice->protocol_wait_condition == 0) {
ret = -ETIMEDOUT;
goto Cleanup;
}
- response = &inputDevice->ProtocolResp;
+ response = &inputDevice->protocol_resp;
if (!response->response.approved) {
pr_err("synthhid protocol request failed (version %d)",
}
inputDevice->device_wait_condition = 0;
- wait_event_timeout(inputDevice->DeviceInfoWaitEvent, inputDevice->device_wait_condition, msecs_to_jiffies(1000));
+ wait_event_timeout(inputDevice->dev_info_wait_event,
+ inputDevice->device_wait_condition, msecs_to_jiffies(1000));
if (inputDevice->device_wait_condition == 0) {
ret = -ETIMEDOUT;
goto Cleanup;
* We should have gotten the device attr, hid desc and report
* desc at this point
*/
- if (!inputDevice->DeviceInfoStatus)
+ if (!inputDevice->dev_info_status)
pr_info("**** input channel up and running!! ****");
else
ret = -1;
goto Cleanup;
}
- inputDevice->bInitializeComplete = false;
+ inputDevice->init_complete = false;
/* Open the channel */
ret = vmbus_open(device->channel,
return ret;
}
- inputDriver = (struct mousevsc_drv_obj *)inputDevice->Device->drv;
+ inputDriver = (struct mousevsc_drv_obj *)inputDevice->device->drv;
dev_info.vendor = inputDevice->hid_dev_info.vendor;
dev_info.product = inputDevice->hid_dev_info.product;
/* Send the report desc back up */
/* workaround SA-167 */
- if (inputDevice->ReportDesc[14] == 0x25)
- inputDevice->ReportDesc[14] = 0x29;
+ if (inputDevice->report_desc[14] == 0x25)
+ inputDevice->report_desc[14] = 0x29;
- reportdesc_callback(device, inputDevice->ReportDesc,
- inputDevice->ReportDescSize);
+ reportdesc_callback(device, inputDevice->report_desc,
+ inputDevice->report_desc_size);
- inputDevice->bInitializeComplete = true;
+ inputDevice->init_complete = true;
Cleanup:
return ret;
*
* so that outstanding requests can be completed.
*/
- while (inputDevice->NumOutstandingRequests) {
- pr_info("waiting for %d requests to complete...", inputDevice->NumOutstandingRequests);
+ while (inputDevice->num_outstanding_req) {
+ pr_info("waiting for %d requests to complete...",
+ inputDevice->num_outstanding_req);
udelay(100);
}