Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Greg Kroah-Hartman <gregkh@suse.de>

+28 -36
+7 -8
drivers/staging/hv/vmbus.c
··· 202 202 /* 203 203 * VmbusInitialize - Main entry point 204 204 */ 205 - int VmbusInitialize(struct hv_driver *drv) 205 + int VmbusInitialize(struct hv_driver *driver) 206 206 { 207 - struct vmbus_driver *driver = (struct vmbus_driver *)drv; 208 207 int ret; 209 208 210 209 DPRINT_INFO(VMBUS, "+++++++ HV Driver version = %s +++++++", ··· 217 218 sizeof(struct vmbus_channel_packet_page_buffer), 218 219 sizeof(struct vmbus_channel_packet_multipage_buffer)); 219 220 220 - drv->name = gDriverName; 221 - memcpy(&drv->deviceType, &gVmbusDeviceType, sizeof(struct hv_guid)); 221 + driver->name = gDriverName; 222 + memcpy(&driver->deviceType, &gVmbusDeviceType, sizeof(struct hv_guid)); 222 223 223 224 /* Setup dispatch table */ 224 - driver->Base.OnDeviceAdd = VmbusOnDeviceAdd; 225 - driver->Base.OnDeviceRemove = VmbusOnDeviceRemove; 226 - driver->Base.OnCleanup = VmbusOnCleanup; 225 + driver->OnDeviceAdd = VmbusOnDeviceAdd; 226 + driver->OnDeviceRemove = VmbusOnDeviceRemove; 227 + driver->OnCleanup = VmbusOnCleanup; 227 228 228 229 /* Hypervisor initialization...setup hypercall page..etc */ 229 230 ret = hv_init(); 230 231 if (ret != 0) 231 232 DPRINT_ERR(VMBUS, "Unable to initialize the hypervisor - 0x%x", 232 233 ret); 233 - gDriver = drv; 234 + gDriver = driver; 234 235 235 236 return ret; 236 237 }
-7
drivers/staging/hv/vmbus_api.h
··· 115 115 void *Extension; 116 116 }; 117 117 118 - /* Vmbus driver object */ 119 - struct vmbus_driver { 120 - /* !! Must be the 1st field !! */ 121 - /* FIXME if ^, then someone is doing somthing stupid */ 122 - struct hv_driver Base; 123 - }; 124 - 125 118 int VmbusInitialize(struct hv_driver *drv); 126 119 int vmbus_on_isr(struct hv_driver *drv); 127 120 void vmbus_on_msg_dpc(struct hv_driver *drv);
+21 -21
drivers/staging/hv/vmbus_drv.c
··· 46 46 /* The driver field is not used in here. Instead, the bus field is */ 47 47 /* used to represent the driver */ 48 48 struct driver_context drv_ctx; 49 - struct vmbus_driver drv_obj; 49 + struct hv_driver drv_obj; 50 50 51 51 struct bus_type bus; 52 52 struct tasklet_struct msg_dpc; ··· 285 285 static int vmbus_bus_init(int (*drv_init)(struct hv_driver *drv)) 286 286 { 287 287 struct vmbus_driver_context *vmbus_drv_ctx = &g_vmbus_drv; 288 - struct vmbus_driver *vmbus_drv_obj = &g_vmbus_drv.drv_obj; 288 + struct hv_driver *driver = &g_vmbus_drv.drv_obj; 289 289 struct vm_device *dev_ctx = &g_vmbus_drv.device_ctx; 290 290 int ret; 291 291 unsigned int vector; 292 292 293 293 /* Call to bus driver to initialize */ 294 - ret = drv_init(&vmbus_drv_obj->Base); 294 + ret = drv_init(driver); 295 295 if (ret != 0) { 296 296 DPRINT_ERR(VMBUS_DRV, "Unable to initialize vmbus (%d)", ret); 297 297 goto cleanup; 298 298 } 299 299 300 300 /* Sanity checks */ 301 - if (!vmbus_drv_obj->Base.OnDeviceAdd) { 301 + if (!driver->OnDeviceAdd) { 302 302 DPRINT_ERR(VMBUS_DRV, "OnDeviceAdd() routine not set"); 303 303 ret = -1; 304 304 goto cleanup; 305 305 } 306 306 307 - vmbus_drv_ctx->bus.name = vmbus_drv_obj->Base.name; 307 + vmbus_drv_ctx->bus.name = driver->name; 308 308 309 309 /* Initialize the bus context */ 310 310 tasklet_init(&vmbus_drv_ctx->msg_dpc, vmbus_msg_dpc, 311 - (unsigned long)vmbus_drv_obj); 311 + (unsigned long)driver); 312 312 tasklet_init(&vmbus_drv_ctx->event_dpc, vmbus_event_dpc, 313 - (unsigned long)vmbus_drv_obj); 313 + (unsigned long)driver); 314 314 315 315 /* Now, register the bus driver with LDM */ 316 316 ret = bus_register(&vmbus_drv_ctx->bus); ··· 321 321 322 322 /* Get the interrupt resource */ 323 323 ret = request_irq(vmbus_irq, vmbus_isr, IRQF_SAMPLE_RANDOM, 324 - vmbus_drv_obj->Base.name, NULL); 324 + driver->name, NULL); 325 325 326 326 if (ret != 0) { 327 327 DPRINT_ERR(VMBUS_DRV, "ERROR - Unable to request IRQ %d", ··· 339 339 /* Call to bus driver to add the root device */ 340 340 memset(dev_ctx, 0, sizeof(struct vm_device)); 341 341 342 - ret = vmbus_drv_obj->Base.OnDeviceAdd(&dev_ctx->device_obj, &vector); 342 + ret = driver->OnDeviceAdd(&dev_ctx->device_obj, &vector); 343 343 if (ret != 0) { 344 344 DPRINT_ERR(VMBUS_DRV, 345 345 "ERROR - Unable to add vmbus root device"); ··· 393 393 */ 394 394 static void vmbus_bus_exit(void) 395 395 { 396 - struct vmbus_driver *vmbus_drv_obj = &g_vmbus_drv.drv_obj; 396 + struct hv_driver *driver = &g_vmbus_drv.drv_obj; 397 397 struct vmbus_driver_context *vmbus_drv_ctx = &g_vmbus_drv; 398 398 399 399 struct vm_device *dev_ctx = &g_vmbus_drv.device_ctx; 400 400 401 401 /* Remove the root device */ 402 - if (vmbus_drv_obj->Base.OnDeviceRemove) 403 - vmbus_drv_obj->Base.OnDeviceRemove(&dev_ctx->device_obj); 402 + if (driver->OnDeviceRemove) 403 + driver->OnDeviceRemove(&dev_ctx->device_obj); 404 404 405 - if (vmbus_drv_obj->Base.OnCleanup) 406 - vmbus_drv_obj->Base.OnCleanup(&vmbus_drv_obj->Base); 405 + if (driver->OnCleanup) 406 + driver->OnCleanup(driver); 407 407 408 408 /* Unregister the root bus device */ 409 409 device_unregister(&dev_ctx->device); ··· 678 678 struct vmbus_driver_context *vmbus_drv_ctx = 679 679 (struct vmbus_driver_context *)driver_ctx; 680 680 681 - device_ctx->device_obj.Driver = &vmbus_drv_ctx->drv_obj.Base; 681 + device_ctx->device_obj.Driver = &vmbus_drv_ctx->drv_obj; 682 682 DPRINT_INFO(VMBUS_DRV, 683 683 "device object (%p) set to driver object (%p)", 684 684 &device_ctx->device_obj, ··· 836 836 */ 837 837 static void vmbus_msg_dpc(unsigned long data) 838 838 { 839 - struct vmbus_driver *vmbus_drv_obj = (struct vmbus_driver *)data; 839 + struct hv_driver *driver = (struct hv_driver *)data; 840 840 841 841 /* Call to bus driver to handle interrupt */ 842 - vmbus_on_msg_dpc(&vmbus_drv_obj->Base); 842 + vmbus_on_msg_dpc(driver); 843 843 } 844 844 845 845 /* ··· 847 847 */ 848 848 static void vmbus_event_dpc(unsigned long data) 849 849 { 850 - struct vmbus_driver *vmbus_drv_obj = (struct vmbus_driver *)data; 850 + struct hv_driver *driver = (struct hv_driver *)data; 851 851 852 852 /* Call to bus driver to handle interrupt */ 853 - vmbus_on_event_dpc(&vmbus_drv_obj->Base); 853 + vmbus_on_event_dpc(driver); 854 854 } 855 855 856 856 static irqreturn_t vmbus_isr(int irq, void *dev_id) 857 857 { 858 - struct vmbus_driver *vmbus_driver_obj = &g_vmbus_drv.drv_obj; 858 + struct hv_driver *driver = &g_vmbus_drv.drv_obj; 859 859 int ret; 860 860 861 861 /* Call to bus driver to handle interrupt */ 862 - ret = vmbus_on_isr(&vmbus_driver_obj->Base); 862 + ret = vmbus_on_isr(driver); 863 863 864 864 /* Schedules a dpc if necessary */ 865 865 if (ret > 0) {