Commit a69a6691 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Staging: hv: remove struct vmbus_driver

It's only a wrapper for the struct hv_driver structure, so just use that
instead, as there are no other fields left in it at the moment.

Cc: Haiyang Zhang <haiyangz@microsoft.com>
Cc: Hank Janssen <hjanssen@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 98293a27
...@@ -202,9 +202,8 @@ int vmbus_on_isr(struct hv_driver *drv) ...@@ -202,9 +202,8 @@ int vmbus_on_isr(struct hv_driver *drv)
/* /*
* VmbusInitialize - Main entry point * VmbusInitialize - Main entry point
*/ */
int VmbusInitialize(struct hv_driver *drv) int VmbusInitialize(struct hv_driver *driver)
{ {
struct vmbus_driver *driver = (struct vmbus_driver *)drv;
int ret; int ret;
DPRINT_INFO(VMBUS, "+++++++ HV Driver version = %s +++++++", DPRINT_INFO(VMBUS, "+++++++ HV Driver version = %s +++++++",
...@@ -218,20 +217,20 @@ int VmbusInitialize(struct hv_driver *drv) ...@@ -218,20 +217,20 @@ int VmbusInitialize(struct hv_driver *drv)
sizeof(struct vmbus_channel_packet_page_buffer), sizeof(struct vmbus_channel_packet_page_buffer),
sizeof(struct vmbus_channel_packet_multipage_buffer)); sizeof(struct vmbus_channel_packet_multipage_buffer));
drv->name = gDriverName; driver->name = gDriverName;
memcpy(&drv->deviceType, &gVmbusDeviceType, sizeof(struct hv_guid)); memcpy(&driver->deviceType, &gVmbusDeviceType, sizeof(struct hv_guid));
/* Setup dispatch table */ /* Setup dispatch table */
driver->Base.OnDeviceAdd = VmbusOnDeviceAdd; driver->OnDeviceAdd = VmbusOnDeviceAdd;
driver->Base.OnDeviceRemove = VmbusOnDeviceRemove; driver->OnDeviceRemove = VmbusOnDeviceRemove;
driver->Base.OnCleanup = VmbusOnCleanup; driver->OnCleanup = VmbusOnCleanup;
/* Hypervisor initialization...setup hypercall page..etc */ /* Hypervisor initialization...setup hypercall page..etc */
ret = hv_init(); ret = hv_init();
if (ret != 0) if (ret != 0)
DPRINT_ERR(VMBUS, "Unable to initialize the hypervisor - 0x%x", DPRINT_ERR(VMBUS, "Unable to initialize the hypervisor - 0x%x",
ret); ret);
gDriver = drv; gDriver = driver;
return ret; return ret;
} }
...@@ -115,13 +115,6 @@ struct hv_device { ...@@ -115,13 +115,6 @@ struct hv_device {
void *Extension; void *Extension;
}; };
/* Vmbus driver object */
struct vmbus_driver {
/* !! Must be the 1st field !! */
/* FIXME if ^, then someone is doing somthing stupid */
struct hv_driver Base;
};
int VmbusInitialize(struct hv_driver *drv); int VmbusInitialize(struct hv_driver *drv);
int vmbus_on_isr(struct hv_driver *drv); int vmbus_on_isr(struct hv_driver *drv);
void vmbus_on_msg_dpc(struct hv_driver *drv); void vmbus_on_msg_dpc(struct hv_driver *drv);
......
...@@ -46,7 +46,7 @@ struct vmbus_driver_context { ...@@ -46,7 +46,7 @@ struct vmbus_driver_context {
/* The driver field is not used in here. Instead, the bus field is */ /* The driver field is not used in here. Instead, the bus field is */
/* used to represent the driver */ /* used to represent the driver */
struct driver_context drv_ctx; struct driver_context drv_ctx;
struct vmbus_driver drv_obj; struct hv_driver drv_obj;
struct bus_type bus; struct bus_type bus;
struct tasklet_struct msg_dpc; struct tasklet_struct msg_dpc;
...@@ -285,32 +285,32 @@ static ssize_t vmbus_show_device_attr(struct device *dev, ...@@ -285,32 +285,32 @@ static ssize_t vmbus_show_device_attr(struct device *dev,
static int vmbus_bus_init(int (*drv_init)(struct hv_driver *drv)) static int vmbus_bus_init(int (*drv_init)(struct hv_driver *drv))
{ {
struct vmbus_driver_context *vmbus_drv_ctx = &g_vmbus_drv; struct vmbus_driver_context *vmbus_drv_ctx = &g_vmbus_drv;
struct vmbus_driver *vmbus_drv_obj = &g_vmbus_drv.drv_obj; struct hv_driver *driver = &g_vmbus_drv.drv_obj;
struct vm_device *dev_ctx = &g_vmbus_drv.device_ctx; struct vm_device *dev_ctx = &g_vmbus_drv.device_ctx;
int ret; int ret;
unsigned int vector; unsigned int vector;
/* Call to bus driver to initialize */ /* Call to bus driver to initialize */
ret = drv_init(&vmbus_drv_obj->Base); ret = drv_init(driver);
if (ret != 0) { if (ret != 0) {
DPRINT_ERR(VMBUS_DRV, "Unable to initialize vmbus (%d)", ret); DPRINT_ERR(VMBUS_DRV, "Unable to initialize vmbus (%d)", ret);
goto cleanup; goto cleanup;
} }
/* Sanity checks */ /* Sanity checks */
if (!vmbus_drv_obj->Base.OnDeviceAdd) { if (!driver->OnDeviceAdd) {
DPRINT_ERR(VMBUS_DRV, "OnDeviceAdd() routine not set"); DPRINT_ERR(VMBUS_DRV, "OnDeviceAdd() routine not set");
ret = -1; ret = -1;
goto cleanup; goto cleanup;
} }
vmbus_drv_ctx->bus.name = vmbus_drv_obj->Base.name; vmbus_drv_ctx->bus.name = driver->name;
/* Initialize the bus context */ /* Initialize the bus context */
tasklet_init(&vmbus_drv_ctx->msg_dpc, vmbus_msg_dpc, tasklet_init(&vmbus_drv_ctx->msg_dpc, vmbus_msg_dpc,
(unsigned long)vmbus_drv_obj); (unsigned long)driver);
tasklet_init(&vmbus_drv_ctx->event_dpc, vmbus_event_dpc, tasklet_init(&vmbus_drv_ctx->event_dpc, vmbus_event_dpc,
(unsigned long)vmbus_drv_obj); (unsigned long)driver);
/* Now, register the bus driver with LDM */ /* Now, register the bus driver with LDM */
ret = bus_register(&vmbus_drv_ctx->bus); ret = bus_register(&vmbus_drv_ctx->bus);
...@@ -321,7 +321,7 @@ static int vmbus_bus_init(int (*drv_init)(struct hv_driver *drv)) ...@@ -321,7 +321,7 @@ static int vmbus_bus_init(int (*drv_init)(struct hv_driver *drv))
/* Get the interrupt resource */ /* Get the interrupt resource */
ret = request_irq(vmbus_irq, vmbus_isr, IRQF_SAMPLE_RANDOM, ret = request_irq(vmbus_irq, vmbus_isr, IRQF_SAMPLE_RANDOM,
vmbus_drv_obj->Base.name, NULL); driver->name, NULL);
if (ret != 0) { if (ret != 0) {
DPRINT_ERR(VMBUS_DRV, "ERROR - Unable to request IRQ %d", DPRINT_ERR(VMBUS_DRV, "ERROR - Unable to request IRQ %d",
...@@ -339,7 +339,7 @@ static int vmbus_bus_init(int (*drv_init)(struct hv_driver *drv)) ...@@ -339,7 +339,7 @@ static int vmbus_bus_init(int (*drv_init)(struct hv_driver *drv))
/* Call to bus driver to add the root device */ /* Call to bus driver to add the root device */
memset(dev_ctx, 0, sizeof(struct vm_device)); memset(dev_ctx, 0, sizeof(struct vm_device));
ret = vmbus_drv_obj->Base.OnDeviceAdd(&dev_ctx->device_obj, &vector); ret = driver->OnDeviceAdd(&dev_ctx->device_obj, &vector);
if (ret != 0) { if (ret != 0) {
DPRINT_ERR(VMBUS_DRV, DPRINT_ERR(VMBUS_DRV,
"ERROR - Unable to add vmbus root device"); "ERROR - Unable to add vmbus root device");
...@@ -393,17 +393,17 @@ static int vmbus_bus_init(int (*drv_init)(struct hv_driver *drv)) ...@@ -393,17 +393,17 @@ static int vmbus_bus_init(int (*drv_init)(struct hv_driver *drv))
*/ */
static void vmbus_bus_exit(void) static void vmbus_bus_exit(void)
{ {
struct vmbus_driver *vmbus_drv_obj = &g_vmbus_drv.drv_obj; struct hv_driver *driver = &g_vmbus_drv.drv_obj;
struct vmbus_driver_context *vmbus_drv_ctx = &g_vmbus_drv; struct vmbus_driver_context *vmbus_drv_ctx = &g_vmbus_drv;
struct vm_device *dev_ctx = &g_vmbus_drv.device_ctx; struct vm_device *dev_ctx = &g_vmbus_drv.device_ctx;
/* Remove the root device */ /* Remove the root device */
if (vmbus_drv_obj->Base.OnDeviceRemove) if (driver->OnDeviceRemove)
vmbus_drv_obj->Base.OnDeviceRemove(&dev_ctx->device_obj); driver->OnDeviceRemove(&dev_ctx->device_obj);
if (vmbus_drv_obj->Base.OnCleanup) if (driver->OnCleanup)
vmbus_drv_obj->Base.OnCleanup(&vmbus_drv_obj->Base); driver->OnCleanup(driver);
/* Unregister the root bus device */ /* Unregister the root bus device */
device_unregister(&dev_ctx->device); device_unregister(&dev_ctx->device);
...@@ -678,7 +678,7 @@ static int vmbus_match(struct device *device, struct device_driver *driver) ...@@ -678,7 +678,7 @@ static int vmbus_match(struct device *device, struct device_driver *driver)
struct vmbus_driver_context *vmbus_drv_ctx = struct vmbus_driver_context *vmbus_drv_ctx =
(struct vmbus_driver_context *)driver_ctx; (struct vmbus_driver_context *)driver_ctx;
device_ctx->device_obj.Driver = &vmbus_drv_ctx->drv_obj.Base; device_ctx->device_obj.Driver = &vmbus_drv_ctx->drv_obj;
DPRINT_INFO(VMBUS_DRV, DPRINT_INFO(VMBUS_DRV,
"device object (%p) set to driver object (%p)", "device object (%p) set to driver object (%p)",
&device_ctx->device_obj, &device_ctx->device_obj,
...@@ -836,10 +836,10 @@ static void vmbus_device_release(struct device *device) ...@@ -836,10 +836,10 @@ static void vmbus_device_release(struct device *device)
*/ */
static void vmbus_msg_dpc(unsigned long data) static void vmbus_msg_dpc(unsigned long data)
{ {
struct vmbus_driver *vmbus_drv_obj = (struct vmbus_driver *)data; struct hv_driver *driver = (struct hv_driver *)data;
/* Call to bus driver to handle interrupt */ /* Call to bus driver to handle interrupt */
vmbus_on_msg_dpc(&vmbus_drv_obj->Base); vmbus_on_msg_dpc(driver);
} }
/* /*
...@@ -847,19 +847,19 @@ static void vmbus_msg_dpc(unsigned long data) ...@@ -847,19 +847,19 @@ static void vmbus_msg_dpc(unsigned long data)
*/ */
static void vmbus_event_dpc(unsigned long data) static void vmbus_event_dpc(unsigned long data)
{ {
struct vmbus_driver *vmbus_drv_obj = (struct vmbus_driver *)data; struct hv_driver *driver = (struct hv_driver *)data;
/* Call to bus driver to handle interrupt */ /* Call to bus driver to handle interrupt */
vmbus_on_event_dpc(&vmbus_drv_obj->Base); vmbus_on_event_dpc(driver);
} }
static irqreturn_t vmbus_isr(int irq, void *dev_id) static irqreturn_t vmbus_isr(int irq, void *dev_id)
{ {
struct vmbus_driver *vmbus_driver_obj = &g_vmbus_drv.drv_obj; struct hv_driver *driver = &g_vmbus_drv.drv_obj;
int ret; int ret;
/* Call to bus driver to handle interrupt */ /* Call to bus driver to handle interrupt */
ret = vmbus_on_isr(&vmbus_driver_obj->Base); ret = vmbus_on_isr(driver);
/* Schedules a dpc if necessary */ /* Schedules a dpc if necessary */
if (ret > 0) { if (ret > 0) {
......
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