Commit c2e138a6 authored by K. Y. Srinivasan's avatar K. Y. Srinivasan Committed by Greg Kroah-Hartman

Staging: hv: Get rid of the references to the priv element of struct hv_driver in hv_mouse.c

In preparation for getting rid of the priv element from struct hv_driver,
get rid of the references to the priv element of struct hv_driver
in hv_mouse.c
Signed-off-by: default avatarK. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: default avatarHaiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: default avatarAbhishek Kane <v-abkane@microsoft.com>
Signed-off-by: default avatarHank Janssen <hjanssen@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 786930b3
...@@ -52,6 +52,13 @@ struct mousevsc_drv_obj { ...@@ -52,6 +52,13 @@ struct mousevsc_drv_obj {
}; };
static inline
struct mousevsc_drv_obj *drv_to_mousedrv(struct device_driver *d)
{
struct hv_driver *hvdrv = drv_to_hv_drv(d);
return container_of(hvdrv, struct mousevsc_drv_obj, base);
}
/* The maximum size of a synthetic input message. */ /* The maximum size of a synthetic input message. */
#define SYNTHHID_MAX_INPUT_REPORT_SIZE 16 #define SYNTHHID_MAX_INPUT_REPORT_SIZE 16
...@@ -428,7 +435,7 @@ static void mousevsc_on_receive_input_report(struct mousevsc_dev *input_device, ...@@ -428,7 +435,7 @@ static void mousevsc_on_receive_input_report(struct mousevsc_dev *input_device,
return; return;
} }
input_drv = (struct mousevsc_drv_obj *)input_device->device->drv; input_drv = drv_to_mousedrv(input_device->device->device.driver);
inputreport_callback(input_device->device, inputreport_callback(input_device->device,
input_report->buffer, input_report->buffer,
...@@ -713,7 +720,7 @@ static int mousevsc_on_device_add(struct hv_device *device, ...@@ -713,7 +720,7 @@ static int mousevsc_on_device_add(struct hv_device *device,
return ret; return ret;
} }
input_drv = (struct mousevsc_drv_obj *)input_dev->device->drv; input_drv = drv_to_mousedrv(input_dev->device->device.driver);
dev_info.vendor = input_dev->hid_dev_info.vendor; dev_info.vendor = input_dev->hid_dev_info.vendor;
dev_info.product = input_dev->hid_dev_info.product; dev_info.product = input_dev->hid_dev_info.product;
...@@ -829,9 +836,8 @@ static int mousevsc_probe(struct device *device) ...@@ -829,9 +836,8 @@ static int mousevsc_probe(struct device *device)
{ {
int ret = 0; int ret = 0;
struct hv_driver *drv = struct mousevsc_drv_obj *mousevsc_drv_obj =
drv_to_hv_drv(device->driver); drv_to_mousedrv(device->driver);
struct mousevsc_drv_obj *mousevsc_drv_obj = drv->priv;
struct hv_device *device_obj = device_to_hv_device(device); struct hv_device *device_obj = device_to_hv_device(device);
struct input_device_context *input_dev_ctx; struct input_device_context *input_dev_ctx;
...@@ -857,9 +863,8 @@ static int mousevsc_remove(struct device *device) ...@@ -857,9 +863,8 @@ static int mousevsc_remove(struct device *device)
{ {
int ret = 0; int ret = 0;
struct hv_driver *drv = struct mousevsc_drv_obj *mousevsc_drv_obj =
drv_to_hv_drv(device->driver); drv_to_mousedrv(device->driver);
struct mousevsc_drv_obj *mousevsc_drv_obj = drv->priv;
struct hv_device *device_obj = device_to_hv_device(device); struct hv_device *device_obj = device_to_hv_device(device);
struct input_device_context *input_dev_ctx; struct input_device_context *input_dev_ctx;
...@@ -1017,7 +1022,6 @@ static int __init mousevsc_init(void) ...@@ -1017,7 +1022,6 @@ static int __init mousevsc_init(void)
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; drv->driver.probe = mousevsc_probe;
drv->driver.remove = mousevsc_remove; drv->driver.remove = mousevsc_remove;
......
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