Change all camelcase function names to lower case in hv_mouse
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: K. Y. Srinivasan <[email protected]>
---
drivers/staging/hv/hv_mouse.c | 92 ++++++++++++++++++++++-------------------
1 files changed, 49 insertions(+), 43 deletions(-)
diff --git a/drivers/staging/hv/hv_mouse.c b/drivers/staging/hv/hv_mouse.c
index 50147f8..084ba3b 100644
--- a/drivers/staging/hv/hv_mouse.c
+++ b/drivers/staging/hv/hv_mouse.c
@@ -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 reportdesc_callback(struct hv_device *dev, void *packet, u32 len);
-static struct mousevsc_dev *AllocInputDevice(struct hv_device *Device)
+static struct mousevsc_dev *alloc_input_device(struct hv_device *Device)
{
struct mousevsc_dev *inputDevice;
@@ -211,7 +211,7 @@ static struct mousevsc_dev *AllocInputDevice(struct hv_device *Device)
/*
* Set to 2 to allow both inbound and outbound traffics
- * (ie GetInputDevice() and MustGetInputDevice()) to proceed.
+ * (ie get_input_device() and must_get_input_device()) to proceed.
*/
atomic_cmpxchg(&inputDevice->RefCount, 0, 2);
@@ -221,7 +221,7 @@ static struct mousevsc_dev *AllocInputDevice(struct hv_device *Device)
return inputDevice;
}
-static void FreeInputDevice(struct mousevsc_dev *Device)
+static void free_input_device(struct mousevsc_dev *Device)
{
WARN_ON(atomic_read(&Device->RefCount) == 0);
kfree(Device);
@@ -230,7 +230,7 @@ static void FreeInputDevice(struct mousevsc_dev *Device)
/*
* Get the inputdevice object if exists and its refcount > 1
*/
-static struct mousevsc_dev *GetInputDevice(struct hv_device *Device)
+static struct mousevsc_dev *get_input_device(struct hv_device *Device)
{
struct mousevsc_dev *inputDevice;
@@ -256,7 +256,7 @@ static struct mousevsc_dev *GetInputDevice(struct hv_device *Device)
/*
* Get the inputdevice object iff exists and its refcount > 0
*/
-static struct mousevsc_dev *MustGetInputDevice(struct hv_device *Device)
+static struct mousevsc_dev *must_get_input_device(struct hv_device *Device)
{
struct mousevsc_dev *inputDevice;
@@ -270,7 +270,7 @@ static struct mousevsc_dev *MustGetInputDevice(struct hv_device *Device)
return inputDevice;
}
-static void PutInputDevice(struct hv_device *Device)
+static void put_input_device(struct hv_device *Device)
{
struct mousevsc_dev *inputDevice;
@@ -280,9 +280,9 @@ static void PutInputDevice(struct hv_device *Device)
}
/*
- * Drop ref count to 1 to effectively disable GetInputDevice()
+ * Drop ref count to 1 to effectively disable get_input_device()
*/
-static struct mousevsc_dev *ReleaseInputDevice(struct hv_device *Device)
+static struct mousevsc_dev *release_input_device(struct hv_device *Device)
{
struct mousevsc_dev *inputDevice;
@@ -298,7 +298,7 @@ static struct mousevsc_dev *ReleaseInputDevice(struct hv_device *Device)
/*
* Drop ref count to 0. No one can use InputDevice object.
*/
-static struct mousevsc_dev *FinalReleaseInputDevice(struct hv_device *Device)
+static struct mousevsc_dev *final_release_input_device(struct hv_device *Device)
{
struct mousevsc_dev *inputDevice;
@@ -312,12 +312,13 @@ static struct mousevsc_dev *FinalReleaseInputDevice(struct hv_device *Device)
return inputDevice;
}
-static void MousevscOnSendCompletion(struct hv_device *Device, struct vmpacket_descriptor *Packet)
+static void mousevsc_on_send_completion(struct hv_device *Device,
+ struct vmpacket_descriptor *Packet)
{
struct mousevsc_dev *inputDevice;
void *request;
- inputDevice = MustGetInputDevice(Device);
+ inputDevice = must_get_input_device(Device);
if (!inputDevice) {
pr_err("unable to get input device...device being destroyed?");
return;
@@ -330,10 +331,11 @@ static void MousevscOnSendCompletion(struct hv_device *Device, struct vmpacket_d
/* Shouldn't we be doing something here? */
}
- PutInputDevice(Device);
+ put_input_device(Device);
}
-static void MousevscOnReceiveDeviceInfo(struct mousevsc_dev *InputDevice, struct synthhid_device_info *DeviceInfo)
+static void mousevsc_on_receive_device_info(struct mousevsc_dev *InputDevice,
+ struct synthhid_device_info *DeviceInfo)
{
int ret = 0;
struct hid_descriptor *desc;
@@ -413,7 +415,8 @@ Cleanup:
wake_up(&InputDevice->DeviceInfoWaitEvent);
}
-static void MousevscOnReceiveInputReport(struct mousevsc_dev *InputDevice, struct synthhid_input_report *InputReport)
+static void mousevsc_on_receive_input_report(struct mousevsc_dev *InputDevice,
+ struct synthhid_input_report *InputReport)
{
struct mousevsc_drv_obj *inputDriver;
@@ -429,13 +432,14 @@ static void MousevscOnReceiveInputReport(struct mousevsc_dev *InputDevice, struc
InputReport->header.size);
}
-static void MousevscOnReceive(struct hv_device *Device, struct vmpacket_descriptor *Packet)
+static void mousevsc_on_receive(struct hv_device *Device,
+ struct vmpacket_descriptor *Packet)
{
struct pipe_prt_msg *pipeMsg;
struct synthhid_msg *hidMsg;
struct mousevsc_dev *inputDevice;
- inputDevice = MustGetInputDevice(Device);
+ inputDevice = must_get_input_device(Device);
if (!inputDevice) {
pr_err("unable to get input device...device being destroyed?");
return;
@@ -446,7 +450,7 @@ static void MousevscOnReceive(struct hv_device *Device, struct vmpacket_descript
if (pipeMsg->type != PipeMessageData) {
pr_err("unknown pipe msg type - type %d len %d",
pipeMsg->type, pipeMsg->size);
- PutInputDevice(Device);
+ put_input_device(Device);
return ;
}
@@ -468,11 +472,11 @@ static void MousevscOnReceive(struct hv_device *Device, struct vmpacket_descript
* Parse out the device info into device attr,
* hid desc and report desc
*/
- MousevscOnReceiveDeviceInfo(inputDevice,
+ mousevsc_on_receive_device_info(inputDevice,
(struct synthhid_device_info *)&pipeMsg->data[0]);
break;
case SynthHidInputReport:
- MousevscOnReceiveInputReport(inputDevice,
+ mousevsc_on_receive_input_report(inputDevice,
(struct synthhid_input_report *)&pipeMsg->data[0]);
break;
@@ -482,10 +486,10 @@ static void MousevscOnReceive(struct hv_device *Device, struct vmpacket_descript
break;
}
- PutInputDevice(Device);
+ put_input_device(Device);
}
-static void MousevscOnChannelCallback(void *Context)
+static void mousevsc_on_channel_callback(void *Context)
{
const int packetSize = 0x100;
int ret = 0;
@@ -499,7 +503,7 @@ static void MousevscOnChannelCallback(void *Context)
unsigned char *buffer = packet;
int bufferlen = packetSize;
- inputDevice = MustGetInputDevice(device);
+ inputDevice = must_get_input_device(device);
if (!inputDevice) {
pr_err("unable to get input device...device being destroyed?");
@@ -515,12 +519,13 @@ static void MousevscOnChannelCallback(void *Context)
switch (desc->type) {
case VM_PKT_COMP:
- MousevscOnSendCompletion(device,
- desc);
+ mousevsc_on_send_completion(
+ device, desc);
break;
case VM_PKT_DATA_INBAND:
- MousevscOnReceive(device, desc);
+ mousevsc_on_receive(
+ device, desc);
break;
default:
@@ -568,19 +573,19 @@ static void MousevscOnChannelCallback(void *Context)
}
} while (1);
- PutInputDevice(device);
+ put_input_device(device);
return;
}
-static int MousevscConnectToVsp(struct hv_device *Device)
+static int mousevsc_connect_to_vsp(struct hv_device *Device)
{
int ret = 0;
struct mousevsc_dev *inputDevice;
struct mousevsc_prt_msg *request;
struct mousevsc_prt_msg *response;
- inputDevice = GetInputDevice(Device);
+ inputDevice = get_input_device(Device);
if (!inputDevice) {
pr_err("unable to get input device...device being destroyed?");
@@ -651,19 +656,20 @@ static int MousevscConnectToVsp(struct hv_device *Device)
ret = -1;
Cleanup:
- PutInputDevice(Device);
+ put_input_device(Device);
return ret;
}
-static int MousevscOnDeviceAdd(struct hv_device *Device, void *AdditionalInfo)
+static int mousevsc_on_device_add(struct hv_device *Device,
+ void *AdditionalInfo)
{
int ret = 0;
struct mousevsc_dev *inputDevice;
struct mousevsc_drv_obj *inputDriver;
struct hv_input_dev_info dev_info;
- inputDevice = AllocInputDevice(Device);
+ inputDevice = alloc_input_device(Device);
if (!inputDevice) {
ret = -1;
@@ -678,25 +684,25 @@ static int MousevscOnDeviceAdd(struct hv_device *Device, void *AdditionalInfo)
INPUTVSC_RECV_RING_BUFFER_SIZE,
NULL,
0,
- MousevscOnChannelCallback,
+ mousevsc_on_channel_callback,
Device
);
if (ret != 0) {
pr_err("unable to open channel: %d", ret);
- FreeInputDevice(inputDevice);
+ free_input_device(inputDevice);
return -1;
}
pr_info("InputVsc channel open: %d", ret);
- ret = MousevscConnectToVsp(Device);
+ ret = mousevsc_connect_to_vsp(Device);
if (ret != 0) {
pr_err("unable to connect channel: %d", ret);
vmbus_close(Device->channel);
- FreeInputDevice(inputDevice);
+ free_input_device(inputDevice);
return ret;
}
@@ -724,7 +730,7 @@ Cleanup:
return ret;
}
-static int MousevscOnDeviceRemove(struct hv_device *Device)
+static int mousevsc_on_device_remove(struct hv_device *Device)
{
struct mousevsc_dev *inputDevice;
int ret = 0;
@@ -732,7 +738,7 @@ static int MousevscOnDeviceRemove(struct hv_device *Device)
pr_info("disabling input device (%p)...",
Device->ext);
- inputDevice = ReleaseInputDevice(Device);
+ inputDevice = release_input_device(Device);
/*
@@ -749,19 +755,19 @@ static int MousevscOnDeviceRemove(struct hv_device *Device)
pr_info("removing input device (%p)...", Device->ext);
- inputDevice = FinalReleaseInputDevice(Device);
+ inputDevice = final_release_input_device(Device);
pr_info("input device (%p) safe to remove", inputDevice);
/* Close the channel */
vmbus_close(Device->channel);
- FreeInputDevice(inputDevice);
+ free_input_device(inputDevice);
return ret;
}
-static void MousevscOnCleanup(struct hv_driver *drv)
+static void mousevsc_on_cleanup(struct hv_driver *drv)
{
}
@@ -984,9 +990,9 @@ static int mouse_vsc_initialize(struct hv_driver *Driver)
sizeof(struct hv_guid));
/* Setup the dispatch table */
- inputDriver->Base.dev_add = MousevscOnDeviceAdd;
- inputDriver->Base.dev_rm = MousevscOnDeviceRemove;
- inputDriver->Base.cleanup = MousevscOnCleanup;
+ inputDriver->Base.dev_add = mousevsc_on_device_add;
+ inputDriver->Base.dev_rm = mousevsc_on_device_remove;
+ inputDriver->Base.cleanup = mousevsc_on_cleanup;
return ret;
}
--
1.7.1
Change camelcase members of mousevsc_drv_obj to lower case in hv_mouse.
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: K. Y. Srinivasan <[email protected]>
---
drivers/staging/hv/hv_mouse.c | 26 +++++++++++++-------------
1 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/drivers/staging/hv/hv_mouse.c b/drivers/staging/hv/hv_mouse.c
index 3b0390d..ce88868 100644
--- a/drivers/staging/hv/hv_mouse.c
+++ b/drivers/staging/hv/hv_mouse.c
@@ -46,7 +46,7 @@ struct hv_input_dev_info {
/* Represents the input vsc driver */
/* FIXME - can be removed entirely */
struct mousevsc_drv_obj {
- struct hv_driver Base;
+ struct hv_driver base;
};
@@ -836,7 +836,7 @@ static int mousevsc_probe(struct device *device)
dev_set_drvdata(device, input_dev_ctx);
/* Call to the vsc driver to add the device */
- ret = mousevsc_drv_obj->Base.dev_add(device_obj, NULL);
+ ret = mousevsc_drv_obj->base.dev_add(device_obj, NULL);
if (ret != 0) {
DPRINT_ERR(INPUTVSC_DRV, "unable to add input vsc device");
@@ -868,14 +868,14 @@ static int mousevsc_remove(struct device *device)
input_dev_ctx->connected = 0;
}
- if (!mousevsc_drv_obj->Base.dev_rm)
+ if (!mousevsc_drv_obj->base.dev_rm)
return -1;
/*
* Call to the vsc driver to let it know that the device
* is being removed
*/
- ret = mousevsc_drv_obj->Base.dev_rm(device_obj);
+ ret = mousevsc_drv_obj->base.dev_rm(device_obj);
if (ret != 0) {
DPRINT_ERR(INPUTVSC_DRV,
@@ -951,7 +951,7 @@ static int mousevsc_drv_exit_cb(struct device *dev, void *data)
static void mousevsc_drv_exit(void)
{
struct mousevsc_drv_obj *mousevsc_drv_obj = &g_mousevsc_drv;
- struct hv_driver *drv = &g_mousevsc_drv.Base;
+ struct hv_driver *drv = &g_mousevsc_drv.base;
int ret;
struct device *current_dev = NULL;
@@ -973,8 +973,8 @@ static void mousevsc_drv_exit(void)
device_unregister(current_dev);
}
- if (mousevsc_drv_obj->Base.cleanup)
- mousevsc_drv_obj->Base.cleanup(&mousevsc_drv_obj->Base);
+ if (mousevsc_drv_obj->base.cleanup)
+ mousevsc_drv_obj->base.cleanup(&mousevsc_drv_obj->base);
vmbus_child_driver_unregister(&drv->driver);
@@ -992,9 +992,9 @@ static int mouse_vsc_initialize(struct hv_driver *driver)
sizeof(struct hv_guid));
/* Setup the dispatch table */
- inputDriver->Base.dev_add = mousevsc_on_device_add;
- inputDriver->Base.dev_rm = mousevsc_on_device_remove;
- inputDriver->Base.cleanup = mousevsc_on_cleanup;
+ inputDriver->base.dev_add = mousevsc_on_device_add;
+ inputDriver->base.dev_rm = mousevsc_on_device_remove;
+ inputDriver->base.cleanup = mousevsc_on_cleanup;
return ret;
}
@@ -1003,14 +1003,14 @@ static int mouse_vsc_initialize(struct hv_driver *driver)
static int __init mousevsc_init(void)
{
struct mousevsc_drv_obj *input_drv_obj = &g_mousevsc_drv;
- struct hv_driver *drv = &g_mousevsc_drv.Base;
+ struct hv_driver *drv = &g_mousevsc_drv.base;
DPRINT_INFO(INPUTVSC_DRV, "Hyper-V Mouse driver initializing.");
/* Callback to client driver to complete the initialization */
- mouse_vsc_initialize(&input_drv_obj->Base);
+ mouse_vsc_initialize(&input_drv_obj->base);
- drv->driver.name = input_drv_obj->Base.name;
+ drv->driver.name = input_drv_obj->base.name;
drv->priv = input_drv_obj;
drv->driver.probe = mousevsc_probe;
--
1.7.1
Change all camelcase function params to lower case in hv_mouse
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: K. Y. Srinivasan <[email protected]>
---
drivers/staging/hv/hv_mouse.c | 172 +++++++++++++++++++++--------------------
1 files changed, 87 insertions(+), 85 deletions(-)
diff --git a/drivers/staging/hv/hv_mouse.c b/drivers/staging/hv/hv_mouse.c
index 084ba3b..3b0390d 100644
--- a/drivers/staging/hv/hv_mouse.c
+++ b/drivers/staging/hv/hv_mouse.c
@@ -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 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;
@@ -215,26 +215,26 @@ static struct mousevsc_dev *alloc_input_device(struct hv_device *Device)
*/
atomic_cmpxchg(&inputDevice->RefCount, 0, 2);
- inputDevice->Device = Device;
- Device->ext = inputDevice;
+ inputDevice->Device = device;
+ device->ext = 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);
- kfree(Device);
+ WARN_ON(atomic_read(&device->RefCount) == 0);
+ kfree(device);
}
/*
* 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;
- inputDevice = (struct mousevsc_dev *)Device->ext;
+ inputDevice = (struct mousevsc_dev *)device->ext;
/*
* FIXME
@@ -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
*/
-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;
- inputDevice = (struct mousevsc_dev *)Device->ext;
+ inputDevice = (struct mousevsc_dev *)device->ext;
if (inputDevice && atomic_read(&inputDevice->RefCount))
atomic_inc(&inputDevice->RefCount);
@@ -270,11 +270,11 @@ static struct mousevsc_dev *must_get_input_device(struct hv_device *Device)
return inputDevice;
}
-static void put_input_device(struct hv_device *Device)
+static void put_input_device(struct hv_device *device)
{
struct mousevsc_dev *inputDevice;
- inputDevice = (struct mousevsc_dev *)Device->ext;
+ inputDevice = (struct mousevsc_dev *)device->ext;
atomic_dec(&inputDevice->RefCount);
}
@@ -282,11 +282,11 @@ static void put_input_device(struct hv_device *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;
- 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 */
while (atomic_cmpxchg(&inputDevice->RefCount, 2, 1) != 2)
@@ -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;
- 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 */
while (atomic_cmpxchg(&inputDevice->RefCount, 1, 0) != 1)
udelay(100);
- Device->ext = NULL;
+ device->ext = NULL;
return inputDevice;
}
-static void mousevsc_on_send_completion(struct hv_device *Device,
- struct vmpacket_descriptor *Packet)
+static void mousevsc_on_send_completion(struct hv_device *device,
+ struct vmpacket_descriptor *packet)
{
struct mousevsc_dev *inputDevice;
void *request;
- inputDevice = must_get_input_device(Device);
+ inputDevice = must_get_input_device(device);
if (!inputDevice) {
pr_err("unable to get input device...device being destroyed?");
return;
}
- request = (void *)(unsigned long)Packet->trans_id;
+ request = (void *)(unsigned long)packet->trans_id;
if (request == &inputDevice->ProtocolReq) {
/* FIXME */
/* 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,
- struct synthhid_device_info *DeviceInfo)
+static void mousevsc_on_receive_device_info(struct mousevsc_dev *input_device,
+ struct synthhid_device_info *device_info)
{
int ret = 0;
struct hid_descriptor *desc;
struct mousevsc_prt_msg ack;
/* Assume success for now */
- InputDevice->DeviceInfoStatus = 0;
+ input_device->DeviceInfoStatus = 0;
/* 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 */
- desc = &DeviceInfo->hid_descriptor;
+ desc = &device_info->hid_descriptor;
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);
goto Cleanup;
}
- memcpy(InputDevice->HidDesc, desc, desc->bLength);
+ memcpy(input_device->HidDesc, desc, desc->bLength);
/* Save the report desc */
- InputDevice->ReportDescSize = desc->desc[0].wDescriptorLength;
- InputDevice->ReportDesc = kzalloc(InputDevice->ReportDescSize,
+ input_device->ReportDescSize = desc->desc[0].wDescriptorLength;
+ input_device->ReportDesc = kzalloc(input_device->ReportDescSize,
GFP_KERNEL);
- if (!InputDevice->ReportDesc) {
+ if (!input_device->ReportDesc) {
pr_err("unable to allocate report descriptor - size %d",
- InputDevice->ReportDescSize);
+ input_device->ReportDescSize);
goto Cleanup;
}
- memcpy(InputDevice->ReportDesc,
+ memcpy(input_device->ReportDesc,
((unsigned char *)desc) + desc->bLength,
desc->desc[0].wDescriptorLength);
@@ -385,7 +386,7 @@ static void mousevsc_on_receive_device_info(struct mousevsc_dev *InputDevice,
ack.ack.header.size = 1;
ack.ack.reserved = 0;
- ret = vmbus_sendpacket(InputDevice->Device->channel,
+ ret = vmbus_sendpacket(input_device->Device->channel,
&ack,
sizeof(struct pipe_prt_msg) - sizeof(unsigned char) +
sizeof(struct synthhid_device_info_ack),
@@ -398,59 +399,60 @@ static void mousevsc_on_receive_device_info(struct mousevsc_dev *InputDevice,
goto Cleanup;
}
- InputDevice->device_wait_condition = 1;
- wake_up(&InputDevice->DeviceInfoWaitEvent);
+ input_device->device_wait_condition = 1;
+ wake_up(&input_device->DeviceInfoWaitEvent);
return;
Cleanup:
- kfree(InputDevice->HidDesc);
- InputDevice->HidDesc = NULL;
+ kfree(input_device->HidDesc);
+ input_device->HidDesc = NULL;
- kfree(InputDevice->ReportDesc);
- InputDevice->ReportDesc = NULL;
+ kfree(input_device->ReportDesc);
+ input_device->ReportDesc = NULL;
- InputDevice->DeviceInfoStatus = -1;
- InputDevice->device_wait_condition = 1;
- wake_up(&InputDevice->DeviceInfoWaitEvent);
+ input_device->DeviceInfoStatus = -1;
+ input_device->device_wait_condition = 1;
+ wake_up(&input_device->DeviceInfoWaitEvent);
}
-static void mousevsc_on_receive_input_report(struct mousevsc_dev *InputDevice,
- struct synthhid_input_report *InputReport)
+static void mousevsc_on_receive_input_report(struct mousevsc_dev *input_device,
+ struct synthhid_input_report *input_report)
{
struct mousevsc_drv_obj *inputDriver;
- if (!InputDevice->bInitializeComplete) {
- pr_info("Initialization incomplete...ignoring InputReport msg");
+ if (!input_device->bInitializeComplete) {
+ pr_info("Initialization incomplete...ignoring input_report msg");
return;
}
- inputDriver = (struct mousevsc_drv_obj *)InputDevice->Device->drv;
+ inputDriver = (struct mousevsc_drv_obj *)input_device->Device->drv;
- inputreport_callback(InputDevice->Device,
- InputReport->buffer,
- InputReport->header.size);
+ inputreport_callback(input_device->Device,
+ input_report->buffer,
+ input_report->header.size);
}
-static void mousevsc_on_receive(struct hv_device *Device,
- struct vmpacket_descriptor *Packet)
+static void mousevsc_on_receive(struct hv_device *device,
+ struct vmpacket_descriptor *packet)
{
struct pipe_prt_msg *pipeMsg;
struct synthhid_msg *hidMsg;
struct mousevsc_dev *inputDevice;
- inputDevice = must_get_input_device(Device);
+ inputDevice = must_get_input_device(device);
if (!inputDevice) {
pr_err("unable to get input device...device being destroyed?");
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) {
pr_err("unknown pipe msg type - type %d len %d",
pipeMsg->type, pipeMsg->size);
- put_input_device(Device);
+ put_input_device(device);
return ;
}
@@ -486,14 +488,14 @@ static void mousevsc_on_receive(struct hv_device *Device,
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;
int ret = 0;
- struct hv_device *device = (struct hv_device *)Context;
+ struct hv_device *device = (struct hv_device *)context;
struct mousevsc_dev *inputDevice;
u32 bytesRecvd;
@@ -578,14 +580,14 @@ static void mousevsc_on_channel_callback(void *Context)
return;
}
-static int mousevsc_connect_to_vsp(struct hv_device *Device)
+static int mousevsc_connect_to_vsp(struct hv_device *device)
{
int ret = 0;
struct mousevsc_dev *inputDevice;
struct mousevsc_prt_msg *request;
struct mousevsc_prt_msg *response;
- inputDevice = get_input_device(Device);
+ inputDevice = get_input_device(device);
if (!inputDevice) {
pr_err("unable to get input device...device being destroyed?");
@@ -611,7 +613,7 @@ static int mousevsc_connect_to_vsp(struct hv_device *Device)
pr_info("synthhid protocol request...");
- ret = vmbus_sendpacket(Device->channel, request,
+ ret = vmbus_sendpacket(device->channel, request,
sizeof(struct pipe_prt_msg) -
sizeof(unsigned char) +
sizeof(struct synthhid_protocol_request),
@@ -656,20 +658,20 @@ static int mousevsc_connect_to_vsp(struct hv_device *Device)
ret = -1;
Cleanup:
- put_input_device(Device);
+ put_input_device(device);
return ret;
}
-static int mousevsc_on_device_add(struct hv_device *Device,
- void *AdditionalInfo)
+static int mousevsc_on_device_add(struct hv_device *device,
+ void *additional_info)
{
int ret = 0;
struct mousevsc_dev *inputDevice;
struct mousevsc_drv_obj *inputDriver;
struct hv_input_dev_info dev_info;
- inputDevice = alloc_input_device(Device);
+ inputDevice = alloc_input_device(device);
if (!inputDevice) {
ret = -1;
@@ -679,13 +681,13 @@ static int mousevsc_on_device_add(struct hv_device *Device,
inputDevice->bInitializeComplete = false;
/* Open the channel */
- ret = vmbus_open(Device->channel,
+ ret = vmbus_open(device->channel,
INPUTVSC_SEND_RING_BUFFER_SIZE,
INPUTVSC_RECV_RING_BUFFER_SIZE,
NULL,
0,
mousevsc_on_channel_callback,
- Device
+ device
);
if (ret != 0) {
@@ -696,12 +698,12 @@ static int mousevsc_on_device_add(struct hv_device *Device,
pr_info("InputVsc channel open: %d", ret);
- ret = mousevsc_connect_to_vsp(Device);
+ ret = mousevsc_connect_to_vsp(device);
if (ret != 0) {
pr_err("unable to connect channel: %d", ret);
- vmbus_close(Device->channel);
+ vmbus_close(device->channel);
free_input_device(inputDevice);
return ret;
}
@@ -714,14 +716,14 @@ static int mousevsc_on_device_add(struct hv_device *Device,
strcpy(dev_info.name, "Microsoft Vmbus HID-compliant Mouse");
/* Send the device info back up */
- deviceinfo_callback(Device, &dev_info);
+ deviceinfo_callback(device, &dev_info);
/* Send the report desc back up */
/* workaround SA-167 */
if (inputDevice->ReportDesc[14] == 0x25)
inputDevice->ReportDesc[14] = 0x29;
- reportdesc_callback(Device, inputDevice->ReportDesc,
+ reportdesc_callback(device, inputDevice->ReportDesc,
inputDevice->ReportDescSize);
inputDevice->bInitializeComplete = true;
@@ -730,15 +732,15 @@ Cleanup:
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;
int ret = 0;
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)
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);
/* Close the channel */
- vmbus_close(Device->channel);
+ vmbus_close(device->channel);
free_input_device(inputDevice);
@@ -979,14 +981,14 @@ static void mousevsc_drv_exit(void)
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 *)Driver;
+ (struct mousevsc_drv_obj *)driver;
int ret = 0;
- Driver->name = driver_name;
- memcpy(&Driver->dev_type, &mouse_guid,
+ driver->name = driver_name;
+ memcpy(&driver->dev_type, &mouse_guid,
sizeof(struct hv_guid));
/* Setup the dispatch table */
--
1.7.1
Convert all camelcase variables inside of all remaining functions to lower
case in hv_mouse.
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: K. Y. Srinivasan <[email protected]>
---
drivers/staging/hv/hv_mouse.c | 225 +++++++++++++++++++++--------------------
1 files changed, 113 insertions(+), 112 deletions(-)
diff --git a/drivers/staging/hv/hv_mouse.c b/drivers/staging/hv/hv_mouse.c
index 1edcdf7..23b69c1 100644
--- a/drivers/staging/hv/hv_mouse.c
+++ b/drivers/staging/hv/hv_mouse.c
@@ -202,23 +202,23 @@ static void reportdesc_callback(struct hv_device *dev, void *packet, u32 len);
static struct mousevsc_dev *alloc_input_device(struct hv_device *device)
{
- struct mousevsc_dev *inputDevice;
+ struct mousevsc_dev *input_dev;
- inputDevice = kzalloc(sizeof(struct mousevsc_dev), GFP_KERNEL);
+ input_dev = kzalloc(sizeof(struct mousevsc_dev), GFP_KERNEL);
- if (!inputDevice)
+ if (!input_dev)
return NULL;
/*
* Set to 2 to allow both inbound and outbound traffics
* (ie get_input_device() and must_get_input_device()) to proceed.
*/
- atomic_cmpxchg(&inputDevice->ref_count, 0, 2);
+ atomic_cmpxchg(&input_dev->ref_count, 0, 2);
- inputDevice->device = device;
- device->ext = inputDevice;
+ input_dev->device = device;
+ device->ext = input_dev;
- return inputDevice;
+ return input_dev;
}
static void free_input_device(struct mousevsc_dev *device)
@@ -232,9 +232,9 @@ static void free_input_device(struct mousevsc_dev *device)
*/
static struct mousevsc_dev *get_input_device(struct hv_device *device)
{
- struct mousevsc_dev *inputDevice;
+ struct mousevsc_dev *input_dev;
- inputDevice = (struct mousevsc_dev *)device->ext;
+ input_dev = (struct mousevsc_dev *)device->ext;
/*
* FIXME
@@ -242,15 +242,15 @@ static struct mousevsc_dev *get_input_device(struct hv_device *device)
* what the intention is...
*
* printk(KERN_ERR "-------------------------> REFCOUNT = %d",
- * inputDevice->ref_count);
+ * input_dev->ref_count);
*/
- if (inputDevice && atomic_read(&inputDevice->ref_count) > 1)
- atomic_inc(&inputDevice->ref_count);
+ if (input_dev && atomic_read(&input_dev->ref_count) > 1)
+ atomic_inc(&input_dev->ref_count);
else
- inputDevice = NULL;
+ input_dev = NULL;
- return inputDevice;
+ return input_dev;
}
/*
@@ -258,25 +258,25 @@ static struct mousevsc_dev *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 *input_dev;
- inputDevice = (struct mousevsc_dev *)device->ext;
+ input_dev = (struct mousevsc_dev *)device->ext;
- if (inputDevice && atomic_read(&inputDevice->ref_count))
- atomic_inc(&inputDevice->ref_count);
+ if (input_dev && atomic_read(&input_dev->ref_count))
+ atomic_inc(&input_dev->ref_count);
else
- inputDevice = NULL;
+ input_dev = NULL;
- return inputDevice;
+ return input_dev;
}
static void put_input_device(struct hv_device *device)
{
- struct mousevsc_dev *inputDevice;
+ struct mousevsc_dev *input_dev;
- inputDevice = (struct mousevsc_dev *)device->ext;
+ input_dev = (struct mousevsc_dev *)device->ext;
- atomic_dec(&inputDevice->ref_count);
+ atomic_dec(&input_dev->ref_count);
}
/*
@@ -284,15 +284,15 @@ static void put_input_device(struct hv_device *device)
*/
static struct mousevsc_dev *release_input_device(struct hv_device *device)
{
- struct mousevsc_dev *inputDevice;
+ struct mousevsc_dev *input_dev;
- inputDevice = (struct mousevsc_dev *)device->ext;
+ input_dev = (struct mousevsc_dev *)device->ext;
/* Busy wait until the ref drop to 2, then set it to 1 */
- while (atomic_cmpxchg(&inputDevice->ref_count, 2, 1) != 2)
+ while (atomic_cmpxchg(&input_dev->ref_count, 2, 1) != 2)
udelay(100);
- return inputDevice;
+ return input_dev;
}
/*
@@ -300,33 +300,33 @@ static struct mousevsc_dev *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 *input_dev;
- inputDevice = (struct mousevsc_dev *)device->ext;
+ input_dev = (struct mousevsc_dev *)device->ext;
/* Busy wait until the ref drop to 1, then set it to 0 */
- while (atomic_cmpxchg(&inputDevice->ref_count, 1, 0) != 1)
+ while (atomic_cmpxchg(&input_dev->ref_count, 1, 0) != 1)
udelay(100);
device->ext = NULL;
- return inputDevice;
+ return input_dev;
}
static void mousevsc_on_send_completion(struct hv_device *device,
struct vmpacket_descriptor *packet)
{
- struct mousevsc_dev *inputDevice;
+ struct mousevsc_dev *input_dev;
void *request;
- inputDevice = must_get_input_device(device);
- if (!inputDevice) {
+ input_dev = must_get_input_device(device);
+ if (!input_dev) {
pr_err("unable to get input device...device being destroyed?");
return;
}
request = (void *)(unsigned long)packet->trans_id;
- if (request == &inputDevice->protocol_req) {
+ if (request == &input_dev->protocol_req) {
/* FIXME */
/* Shouldn't we be doing something here? */
}
@@ -419,14 +419,14 @@ Cleanup:
static void mousevsc_on_receive_input_report(struct mousevsc_dev *input_device,
struct synthhid_input_report *input_report)
{
- struct mousevsc_drv_obj *inputDriver;
+ struct mousevsc_drv_obj *input_drv;
if (!input_device->init_complete) {
pr_info("Initialization incomplete...ignoring input_report msg");
return;
}
- inputDriver = (struct mousevsc_drv_obj *)input_device->device->drv;
+ input_drv = (struct mousevsc_drv_obj *)input_device->device->drv;
inputreport_callback(input_device->device,
input_report->buffer,
@@ -436,55 +436,55 @@ static void mousevsc_on_receive_input_report(struct mousevsc_dev *input_device,
static void mousevsc_on_receive(struct hv_device *device,
struct vmpacket_descriptor *packet)
{
- struct pipe_prt_msg *pipeMsg;
- struct synthhid_msg *hidMsg;
- struct mousevsc_dev *inputDevice;
+ struct pipe_prt_msg *pipe_msg;
+ struct synthhid_msg *hid_msg;
+ struct mousevsc_dev *input_dev;
- inputDevice = must_get_input_device(device);
- if (!inputDevice) {
+ input_dev = must_get_input_device(device);
+ if (!input_dev) {
pr_err("unable to get input device...device being destroyed?");
return;
}
- pipeMsg = (struct pipe_prt_msg *)((unsigned long)packet +
+ pipe_msg = (struct pipe_prt_msg *)((unsigned long)packet +
(packet->offset8 << 3));
- if (pipeMsg->type != PipeMessageData) {
+ if (pipe_msg->type != PipeMessageData) {
pr_err("unknown pipe msg type - type %d len %d",
- pipeMsg->type, pipeMsg->size);
+ pipe_msg->type, pipe_msg->size);
put_input_device(device);
return ;
}
- hidMsg = (struct synthhid_msg *)&pipeMsg->data[0];
+ hid_msg = (struct synthhid_msg *)&pipe_msg->data[0];
- switch (hidMsg->header.type) {
+ switch (hid_msg->header.type) {
case SynthHidProtocolResponse:
- memcpy(&inputDevice->protocol_resp, pipeMsg,
- pipeMsg->size + sizeof(struct pipe_prt_msg) -
+ memcpy(&input_dev->protocol_resp, pipe_msg,
+ pipe_msg->size + sizeof(struct pipe_prt_msg) -
sizeof(unsigned char));
- inputDevice->protocol_wait_condition = 1;
- wake_up(&inputDevice->protocol_wait_event);
+ input_dev->protocol_wait_condition = 1;
+ wake_up(&input_dev->protocol_wait_event);
break;
case SynthHidInitialDeviceInfo:
- WARN_ON(pipeMsg->size >= sizeof(struct hv_input_dev_info));
+ WARN_ON(pipe_msg->size >= sizeof(struct hv_input_dev_info));
/*
* Parse out the device info into device attr,
* hid desc and report desc
*/
- mousevsc_on_receive_device_info(inputDevice,
- (struct synthhid_device_info *)&pipeMsg->data[0]);
+ mousevsc_on_receive_device_info(input_dev,
+ (struct synthhid_device_info *)&pipe_msg->data[0]);
break;
case SynthHidInputReport:
- mousevsc_on_receive_input_report(inputDevice,
- (struct synthhid_input_report *)&pipeMsg->data[0]);
+ mousevsc_on_receive_input_report(input_dev,
+ (struct synthhid_input_report *)&pipe_msg->data[0]);
break;
default:
pr_err("unsupported hid msg type - type %d len %d",
- hidMsg->header.type, hidMsg->header.size);
+ hid_msg->header.type, hid_msg->header.size);
break;
}
@@ -496,27 +496,28 @@ static void mousevsc_on_channel_callback(void *context)
const int packetSize = 0x100;
int ret = 0;
struct hv_device *device = (struct hv_device *)context;
- struct mousevsc_dev *inputDevice;
+ struct mousevsc_dev *input_dev;
- u32 bytesRecvd;
- u64 requestId;
+ u32 bytes_recvd;
+ u64 req_id;
unsigned char packet[packetSize];
struct vmpacket_descriptor *desc;
unsigned char *buffer = packet;
int bufferlen = packetSize;
- inputDevice = must_get_input_device(device);
+ input_dev = must_get_input_device(device);
- if (!inputDevice) {
+ if (!input_dev) {
pr_err("unable to get input device...device being destroyed?");
return;
}
do {
- ret = vmbus_recvpacket_raw(device->channel, buffer, bufferlen, &bytesRecvd, &requestId);
+ ret = vmbus_recvpacket_raw(device->channel, buffer,
+ bufferlen, &bytes_recvd, &req_id);
if (ret == 0) {
- if (bytesRecvd > 0) {
+ if (bytes_recvd > 0) {
desc = (struct vmpacket_descriptor *)buffer;
switch (desc->type) {
@@ -533,8 +534,8 @@ static void mousevsc_on_channel_callback(void *context)
default:
pr_err("unhandled packet type %d, tid %llx len %d\n",
desc->type,
- requestId,
- bytesRecvd);
+ req_id,
+ bytes_recvd);
break;
}
@@ -560,8 +561,8 @@ static void mousevsc_on_channel_callback(void *context)
}
} else if (ret == -2) {
/* Handle large packet */
- bufferlen = bytesRecvd;
- buffer = kzalloc(bytesRecvd, GFP_KERNEL);
+ bufferlen = bytes_recvd;
+ buffer = kzalloc(bytes_recvd, GFP_KERNEL);
if (buffer == NULL) {
buffer = packet;
@@ -569,7 +570,7 @@ static void mousevsc_on_channel_callback(void *context)
/* Try again next time around */
pr_err("unable to allocate buffer of size %d!",
- bytesRecvd);
+ bytes_recvd);
break;
}
}
@@ -583,21 +584,21 @@ static void mousevsc_on_channel_callback(void *context)
static int mousevsc_connect_to_vsp(struct hv_device *device)
{
int ret = 0;
- struct mousevsc_dev *inputDevice;
+ struct mousevsc_dev *input_dev;
struct mousevsc_prt_msg *request;
struct mousevsc_prt_msg *response;
- inputDevice = get_input_device(device);
+ input_dev = get_input_device(device);
- if (!inputDevice) {
+ if (!input_dev) {
pr_err("unable to get input device...device being destroyed?");
return -1;
}
- init_waitqueue_head(&inputDevice->protocol_wait_event);
- init_waitqueue_head(&inputDevice->dev_info_wait_event);
+ init_waitqueue_head(&input_dev->protocol_wait_event);
+ init_waitqueue_head(&input_dev->dev_info_wait_event);
- request = &inputDevice->protocol_req;
+ request = &input_dev->protocol_req;
/*
* Now, initiate the vsc/vsp initialization protocol on the open channel
@@ -625,15 +626,15 @@ static int mousevsc_connect_to_vsp(struct hv_device *device)
goto Cleanup;
}
- inputDevice->protocol_wait_condition = 0;
- wait_event_timeout(inputDevice->protocol_wait_event,
- inputDevice->protocol_wait_condition, msecs_to_jiffies(1000));
- if (inputDevice->protocol_wait_condition == 0) {
+ input_dev->protocol_wait_condition = 0;
+ wait_event_timeout(input_dev->protocol_wait_event,
+ input_dev->protocol_wait_condition, msecs_to_jiffies(1000));
+ if (input_dev->protocol_wait_condition == 0) {
ret = -ETIMEDOUT;
goto Cleanup;
}
- response = &inputDevice->protocol_resp;
+ response = &input_dev->protocol_resp;
if (!response->response.approved) {
pr_err("synthhid protocol request failed (version %d)",
@@ -642,10 +643,10 @@ static int mousevsc_connect_to_vsp(struct hv_device *device)
goto Cleanup;
}
- inputDevice->device_wait_condition = 0;
- wait_event_timeout(inputDevice->dev_info_wait_event,
- inputDevice->device_wait_condition, msecs_to_jiffies(1000));
- if (inputDevice->device_wait_condition == 0) {
+ input_dev->device_wait_condition = 0;
+ wait_event_timeout(input_dev->dev_info_wait_event,
+ input_dev->device_wait_condition, msecs_to_jiffies(1000));
+ if (input_dev->device_wait_condition == 0) {
ret = -ETIMEDOUT;
goto Cleanup;
}
@@ -654,7 +655,7 @@ static int mousevsc_connect_to_vsp(struct hv_device *device)
* We should have gotten the device attr, hid desc and report
* desc at this point
*/
- if (!inputDevice->dev_info_status)
+ if (!input_dev->dev_info_status)
pr_info("**** input channel up and running!! ****");
else
ret = -1;
@@ -669,18 +670,18 @@ static int mousevsc_on_device_add(struct hv_device *device,
void *additional_info)
{
int ret = 0;
- struct mousevsc_dev *inputDevice;
- struct mousevsc_drv_obj *inputDriver;
+ struct mousevsc_dev *input_dev;
+ struct mousevsc_drv_obj *input_drv;
struct hv_input_dev_info dev_info;
- inputDevice = alloc_input_device(device);
+ input_dev = alloc_input_device(device);
- if (!inputDevice) {
+ if (!input_dev) {
ret = -1;
goto Cleanup;
}
- inputDevice->init_complete = false;
+ input_dev->init_complete = false;
/* Open the channel */
ret = vmbus_open(device->channel,
@@ -694,7 +695,7 @@ static int mousevsc_on_device_add(struct hv_device *device,
if (ret != 0) {
pr_err("unable to open channel: %d", ret);
- free_input_device(inputDevice);
+ free_input_device(input_dev);
return -1;
}
@@ -706,15 +707,15 @@ static int mousevsc_on_device_add(struct hv_device *device,
pr_err("unable to connect channel: %d", ret);
vmbus_close(device->channel);
- free_input_device(inputDevice);
+ free_input_device(input_dev);
return ret;
}
- inputDriver = (struct mousevsc_drv_obj *)inputDevice->device->drv;
+ input_drv = (struct mousevsc_drv_obj *)input_dev->device->drv;
- dev_info.vendor = inputDevice->hid_dev_info.vendor;
- dev_info.product = inputDevice->hid_dev_info.product;
- dev_info.version = inputDevice->hid_dev_info.version;
+ dev_info.vendor = input_dev->hid_dev_info.vendor;
+ dev_info.product = input_dev->hid_dev_info.product;
+ dev_info.version = input_dev->hid_dev_info.version;
strcpy(dev_info.name, "Microsoft Vmbus HID-compliant Mouse");
/* Send the device info back up */
@@ -722,13 +723,13 @@ static int mousevsc_on_device_add(struct hv_device *device,
/* Send the report desc back up */
/* workaround SA-167 */
- if (inputDevice->report_desc[14] == 0x25)
- inputDevice->report_desc[14] = 0x29;
+ if (input_dev->report_desc[14] == 0x25)
+ input_dev->report_desc[14] = 0x29;
- reportdesc_callback(device, inputDevice->report_desc,
- inputDevice->report_desc_size);
+ reportdesc_callback(device, input_dev->report_desc,
+ input_dev->report_desc_size);
- inputDevice->init_complete = true;
+ input_dev->init_complete = true;
Cleanup:
return ret;
@@ -736,13 +737,13 @@ Cleanup:
static int mousevsc_on_device_remove(struct hv_device *device)
{
- struct mousevsc_dev *inputDevice;
+ struct mousevsc_dev *input_dev;
int ret = 0;
pr_info("disabling input device (%p)...",
device->ext);
- inputDevice = release_input_device(device);
+ input_dev = release_input_device(device);
/*
@@ -751,23 +752,23 @@ static int mousevsc_on_device_remove(struct hv_device *device)
*
* so that outstanding requests can be completed.
*/
- while (inputDevice->num_outstanding_req) {
+ while (input_dev->num_outstanding_req) {
pr_info("waiting for %d requests to complete...",
- inputDevice->num_outstanding_req);
+ input_dev->num_outstanding_req);
udelay(100);
}
pr_info("removing input device (%p)...", device->ext);
- inputDevice = final_release_input_device(device);
+ input_dev = final_release_input_device(device);
- pr_info("input device (%p) safe to remove", inputDevice);
+ pr_info("input device (%p) safe to remove", input_dev);
/* Close the channel */
vmbus_close(device->channel);
- free_input_device(inputDevice);
+ free_input_device(input_dev);
return ret;
}
@@ -986,7 +987,7 @@ static void mousevsc_drv_exit(void)
static int mouse_vsc_initialize(struct hv_driver *driver)
{
- struct mousevsc_drv_obj *inputDriver =
+ struct mousevsc_drv_obj *input_drv =
(struct mousevsc_drv_obj *)driver;
int ret = 0;
@@ -995,9 +996,9 @@ static int mouse_vsc_initialize(struct hv_driver *driver)
sizeof(struct hv_guid));
/* Setup the dispatch table */
- inputDriver->base.dev_add = mousevsc_on_device_add;
- inputDriver->base.dev_rm = mousevsc_on_device_remove;
- inputDriver->base.cleanup = mousevsc_on_cleanup;
+ input_drv->base.dev_add = mousevsc_on_device_add;
+ input_drv->base.dev_rm = mousevsc_on_device_remove;
+ input_drv->base.cleanup = mousevsc_on_cleanup;
return ret;
}
--
1.7.1
Change camelcase members of struct mousevsc_dev to lower case in hv_mouse
Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: K. Y. Srinivasan <[email protected]>
---
drivers/staging/hv/hv_mouse.c | 127 +++++++++++++++++++++--------------------
1 files changed, 65 insertions(+), 62 deletions(-)
diff --git a/drivers/staging/hv/hv_mouse.c b/drivers/staging/hv/hv_mouse.c
index ce88868..1edcdf7 100644
--- a/drivers/staging/hv/hv_mouse.c
+++ b/drivers/staging/hv/hv_mouse.c
@@ -167,23 +167,23 @@ struct mousevsc_prt_msg {
* 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;
};
@@ -213,9 +213,9 @@ static struct mousevsc_dev *alloc_input_device(struct hv_device *device)
* 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;
@@ -223,7 +223,7 @@ static struct mousevsc_dev *alloc_input_device(struct hv_device *device)
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);
}
@@ -242,11 +242,11 @@ static struct mousevsc_dev *get_input_device(struct hv_device *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;
@@ -262,8 +262,8 @@ static struct mousevsc_dev *must_get_input_device(struct hv_device *device)
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;
@@ -276,7 +276,7 @@ static void put_input_device(struct hv_device *device)
inputDevice = (struct mousevsc_dev *)device->ext;
- atomic_dec(&inputDevice->RefCount);
+ atomic_dec(&inputDevice->ref_count);
}
/*
@@ -289,7 +289,7 @@ static struct mousevsc_dev *release_input_device(struct hv_device *device)
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;
@@ -305,7 +305,7 @@ static struct mousevsc_dev *final_release_input_device(struct hv_device *device)
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;
@@ -326,7 +326,7 @@ static void mousevsc_on_send_completion(struct hv_device *device,
request = (void *)(unsigned long)packet->trans_id;
- if (request == &inputDevice->ProtocolReq) {
+ if (request == &inputDevice->protocol_req) {
/* FIXME */
/* Shouldn't we be doing something here? */
}
@@ -342,7 +342,7 @@ static void mousevsc_on_receive_device_info(struct mousevsc_dev *input_device,
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,
@@ -352,27 +352,27 @@ static void mousevsc_on_receive_device_info(struct mousevsc_dev *input_device,
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);
@@ -386,7 +386,7 @@ static void mousevsc_on_receive_device_info(struct mousevsc_dev *input_device,
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),
@@ -400,20 +400,20 @@ static void mousevsc_on_receive_device_info(struct mousevsc_dev *input_device,
}
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,
@@ -421,14 +421,14 @@ 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);
}
@@ -460,11 +460,11 @@ static void mousevsc_on_receive(struct hv_device *device,
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:
@@ -594,10 +594,10 @@ static int mousevsc_connect_to_vsp(struct hv_device *device)
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
@@ -626,13 +626,14 @@ static int mousevsc_connect_to_vsp(struct hv_device *device)
}
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)",
@@ -642,7 +643,8 @@ static int mousevsc_connect_to_vsp(struct hv_device *device)
}
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;
@@ -652,7 +654,7 @@ static int mousevsc_connect_to_vsp(struct hv_device *device)
* 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;
@@ -678,7 +680,7 @@ static int mousevsc_on_device_add(struct hv_device *device,
goto Cleanup;
}
- inputDevice->bInitializeComplete = false;
+ inputDevice->init_complete = false;
/* Open the channel */
ret = vmbus_open(device->channel,
@@ -708,7 +710,7 @@ static int mousevsc_on_device_add(struct hv_device *device,
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;
@@ -720,13 +722,13 @@ static int mousevsc_on_device_add(struct hv_device *device,
/* 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;
@@ -749,8 +751,9 @@ static int mousevsc_on_device_remove(struct hv_device *device)
*
* 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);
}
--
1.7.1