};
struct storvsc_driver_context {
- /* !! These must be the first 2 fields !! */
- /* FIXME this is a bug... */
- struct driver_context drv_ctx;
struct storvsc_driver_object drv_obj;
};
{
int ret;
struct storvsc_driver_object *storvsc_drv_obj = &g_storvsc_drv.drv_obj;
- struct driver_context *drv_ctx = &g_storvsc_drv.drv_ctx;
+ struct hv_driver *drv = &g_storvsc_drv.drv_obj.base;
storvsc_drv_obj->ring_buffer_size = storvsc_ringbuffer_size;
/* Callback to client driver to complete the initialization */
drv_init(&storvsc_drv_obj->base);
+ drv->priv = storvsc_drv_obj;
+
DPRINT_INFO(STORVSC_DRV,
"request extension size %u, max outstanding reqs %u",
storvsc_drv_obj->request_ext_size,
return -1;
}
- drv_ctx->driver.name = storvsc_drv_obj->base.name;
- memcpy(&drv_ctx->class_id, &storvsc_drv_obj->base.dev_type,
- sizeof(struct hv_guid));
+ drv->driver.name = storvsc_drv_obj->base.name;
- drv_ctx->driver.probe = storvsc_probe;
- drv_ctx->driver.remove = storvsc_remove;
+ drv->driver.probe = storvsc_probe;
+ drv->driver.remove = storvsc_remove;
/* The driver belongs to vmbus */
- ret = vmbus_child_driver_register(&drv_ctx->driver);
+ ret = vmbus_child_driver_register(&drv->driver);
return ret;
}
static void storvsc_drv_exit(void)
{
struct storvsc_driver_object *storvsc_drv_obj = &g_storvsc_drv.drv_obj;
- struct driver_context *drv_ctx = &g_storvsc_drv.drv_ctx;
+ struct hv_driver *drv = &g_storvsc_drv.drv_obj.base;
struct device *current_dev = NULL;
int ret;
current_dev = NULL;
/* Get the device */
- ret = driver_for_each_device(&drv_ctx->driver, NULL,
+ ret = driver_for_each_device(&drv->driver, NULL,
(void *) ¤t_dev,
storvsc_drv_exit_cb);
if (storvsc_drv_obj->base.cleanup)
storvsc_drv_obj->base.cleanup(&storvsc_drv_obj->base);
- vmbus_child_driver_unregister(&drv_ctx->driver);
+ vmbus_child_driver_unregister(&drv->driver);
return;
}
static int storvsc_probe(struct device *device)
{
int ret;
- struct driver_context *driver_ctx =
- driver_to_driver_context(device->driver);
+ struct hv_driver *drv =
+ drv_to_hv_drv(device->driver);
struct storvsc_driver_context *storvsc_drv_ctx =
- (struct storvsc_driver_context *)driver_ctx;
+ (struct storvsc_driver_context *)drv->priv;
struct storvsc_driver_object *storvsc_drv_obj =
&storvsc_drv_ctx->drv_obj;
struct vm_device *device_ctx = device_to_vm_device(device);
static int storvsc_remove(struct device *device)
{
int ret;
- struct driver_context *driver_ctx =
- driver_to_driver_context(device->driver);
+ struct hv_driver *drv =
+ drv_to_hv_drv(device->driver);
struct storvsc_driver_context *storvsc_drv_ctx =
- (struct storvsc_driver_context *)driver_ctx;
+ (struct storvsc_driver_context *)drv->priv;
struct storvsc_driver_object *storvsc_drv_obj =
&storvsc_drv_ctx->drv_obj;
struct vm_device *device_ctx = device_to_vm_device(device);
struct host_device_context *host_device_ctx =
(struct host_device_context *)scmnd->device->host->hostdata;
struct vm_device *device_ctx = host_device_ctx->device_ctx;
- struct driver_context *driver_ctx =
- driver_to_driver_context(device_ctx->device.driver);
+ struct hv_driver *drv =
+ drv_to_hv_drv(device_ctx->device.driver);
struct storvsc_driver_context *storvsc_drv_ctx =
- (struct storvsc_driver_context *)driver_ctx;
+ (struct storvsc_driver_context *)drv->priv;
struct storvsc_driver_object *storvsc_drv_obj =
&storvsc_drv_ctx->drv_obj;
struct hv_storvsc_request *request;