[PATCH 364/510] Staging: hv: remove struct vmbus_driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxx>
Cc: Hank Janssen <hjanssen@xxxxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx>
---
 drivers/staging/hv/vmbus.c     |   15 ++++++-------
 drivers/staging/hv/vmbus_api.h |    7 ------
 drivers/staging/hv/vmbus_drv.c |   42 ++++++++++++++++++++--------------------
 3 files changed, 28 insertions(+), 36 deletions(-)

diff --git a/drivers/staging/hv/vmbus.c b/drivers/staging/hv/vmbus.c
index 7a7454c..650a975 100644
--- a/drivers/staging/hv/vmbus.c
+++ b/drivers/staging/hv/vmbus.c
@@ -202,9 +202,8 @@ int vmbus_on_isr(struct hv_driver *drv)
 /*
  * 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;
 
 	DPRINT_INFO(VMBUS, "+++++++ HV Driver version = %s +++++++",
@@ -218,20 +217,20 @@ int VmbusInitialize(struct hv_driver *drv)
 			sizeof(struct vmbus_channel_packet_page_buffer),
 			sizeof(struct vmbus_channel_packet_multipage_buffer));
 
-	drv->name = gDriverName;
-	memcpy(&drv->deviceType, &gVmbusDeviceType, sizeof(struct hv_guid));
+	driver->name = gDriverName;
+	memcpy(&driver->deviceType, &gVmbusDeviceType, sizeof(struct hv_guid));
 
 	/* Setup dispatch table */
-	driver->Base.OnDeviceAdd	= VmbusOnDeviceAdd;
-	driver->Base.OnDeviceRemove	= VmbusOnDeviceRemove;
-	driver->Base.OnCleanup		= VmbusOnCleanup;
+	driver->OnDeviceAdd	= VmbusOnDeviceAdd;
+	driver->OnDeviceRemove	= VmbusOnDeviceRemove;
+	driver->OnCleanup	= VmbusOnCleanup;
 
 	/* Hypervisor initialization...setup hypercall page..etc */
 	ret = hv_init();
 	if (ret != 0)
 		DPRINT_ERR(VMBUS, "Unable to initialize the hypervisor - 0x%x",
 				ret);
-	gDriver = drv;
+	gDriver = driver;
 
 	return ret;
 }
diff --git a/drivers/staging/hv/vmbus_api.h b/drivers/staging/hv/vmbus_api.h
index 6f3d59c..45c9b9a 100644
--- a/drivers/staging/hv/vmbus_api.h
+++ b/drivers/staging/hv/vmbus_api.h
@@ -115,13 +115,6 @@ struct hv_device {
 	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 vmbus_on_isr(struct hv_driver *drv);
 void vmbus_on_msg_dpc(struct hv_driver *drv);
diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c
index 4fa23c9..2d3cf0f 100644
--- a/drivers/staging/hv/vmbus_drv.c
+++ b/drivers/staging/hv/vmbus_drv.c
@@ -46,7 +46,7 @@ struct vmbus_driver_context {
 	/* The driver field is not used in here. Instead, the bus field is */
 	/* used to represent the driver */
 	struct driver_context drv_ctx;
-	struct vmbus_driver drv_obj;
+	struct hv_driver drv_obj;
 
 	struct bus_type bus;
 	struct tasklet_struct msg_dpc;
@@ -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))
 {
 	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;
 	int ret;
 	unsigned int vector;
 
 	/* Call to bus driver to initialize */
-	ret = drv_init(&vmbus_drv_obj->Base);
+	ret = drv_init(driver);
 	if (ret != 0) {
 		DPRINT_ERR(VMBUS_DRV, "Unable to initialize vmbus (%d)", ret);
 		goto cleanup;
 	}
 
 	/* Sanity checks */
-	if (!vmbus_drv_obj->Base.OnDeviceAdd) {
+	if (!driver->OnDeviceAdd) {
 		DPRINT_ERR(VMBUS_DRV, "OnDeviceAdd() routine not set");
 		ret = -1;
 		goto cleanup;
 	}
 
-	vmbus_drv_ctx->bus.name = vmbus_drv_obj->Base.name;
+	vmbus_drv_ctx->bus.name = driver->name;
 
 	/* Initialize the bus context */
 	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,
-		     (unsigned long)vmbus_drv_obj);
+		     (unsigned long)driver);
 
 	/* Now, register the bus driver with LDM */
 	ret = bus_register(&vmbus_drv_ctx->bus);
@@ -321,7 +321,7 @@ static int vmbus_bus_init(int (*drv_init)(struct hv_driver *drv))
 
 	/* Get the interrupt resource */
 	ret = request_irq(vmbus_irq, vmbus_isr, IRQF_SAMPLE_RANDOM,
-			  vmbus_drv_obj->Base.name, NULL);
+			  driver->name, NULL);
 
 	if (ret != 0) {
 		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))
 	/* Call to bus driver to add the root 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) {
 		DPRINT_ERR(VMBUS_DRV,
 			   "ERROR - Unable to add vmbus root device");
@@ -393,17 +393,17 @@ cleanup:
  */
 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 vm_device *dev_ctx = &g_vmbus_drv.device_ctx;
 
 	/* Remove the root device */
-	if (vmbus_drv_obj->Base.OnDeviceRemove)
-		vmbus_drv_obj->Base.OnDeviceRemove(&dev_ctx->device_obj);
+	if (driver->OnDeviceRemove)
+		driver->OnDeviceRemove(&dev_ctx->device_obj);
 
-	if (vmbus_drv_obj->Base.OnCleanup)
-		vmbus_drv_obj->Base.OnCleanup(&vmbus_drv_obj->Base);
+	if (driver->OnCleanup)
+		driver->OnCleanup(driver);
 
 	/* Unregister the root bus device */
 	device_unregister(&dev_ctx->device);
@@ -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 *)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,
 			    "device object (%p) set to driver object (%p)",
 			    &device_ctx->device_obj,
@@ -836,10 +836,10 @@ static void vmbus_device_release(struct device *device)
  */
 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 */
-	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)
  */
 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 */
-	vmbus_on_event_dpc(&vmbus_drv_obj->Base);
+	vmbus_on_event_dpc(driver);
 }
 
 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;
 
 	/* 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 */
 	if (ret > 0) {
-- 
1.7.3.2

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux