|
@@ -766,8 +766,6 @@ retry_request:
|
|
|
|
|
|
static DEF_SCSI_QCMD(storvsc_queuecommand)
|
|
|
|
|
|
-/* Static decl */
|
|
|
-static int storvsc_probe(struct hv_device *dev);
|
|
|
|
|
|
/* The one and only one */
|
|
|
static struct storvsc_driver g_storvsc_drv;
|
|
@@ -801,79 +799,10 @@ static struct scsi_host_template scsi_driver = {
|
|
|
};
|
|
|
|
|
|
|
|
|
-/*
|
|
|
- * storvsc_drv_init - StorVsc driver initialization.
|
|
|
- */
|
|
|
-static int storvsc_drv_init(void)
|
|
|
-{
|
|
|
- int ret;
|
|
|
- struct storvsc_driver *storvsc_drv_obj = &g_storvsc_drv;
|
|
|
- struct hv_driver *drv = &g_storvsc_drv.base;
|
|
|
-
|
|
|
- storvsc_drv_obj->ring_buffer_size = storvsc_ringbuffer_size;
|
|
|
-
|
|
|
- /* Callback to client driver to complete the initialization */
|
|
|
- storvsc_initialize(&storvsc_drv_obj->base);
|
|
|
-
|
|
|
- DPRINT_INFO(STORVSC_DRV,
|
|
|
- "max outstanding reqs %u",
|
|
|
- storvsc_drv_obj->max_outstanding_req_per_channel);
|
|
|
-
|
|
|
- if (storvsc_drv_obj->max_outstanding_req_per_channel <
|
|
|
- STORVSC_MAX_IO_REQUESTS)
|
|
|
- return -1;
|
|
|
-
|
|
|
- drv->driver.name = storvsc_drv_obj->base.name;
|
|
|
-
|
|
|
- drv->probe = storvsc_probe;
|
|
|
- drv->remove = storvsc_remove;
|
|
|
-
|
|
|
- /* The driver belongs to vmbus */
|
|
|
- ret = vmbus_child_driver_register(&drv->driver);
|
|
|
-
|
|
|
- return ret;
|
|
|
-}
|
|
|
-
|
|
|
-static int storvsc_drv_exit_cb(struct device *dev, void *data)
|
|
|
-{
|
|
|
- struct device **curr = (struct device **)data;
|
|
|
- *curr = dev;
|
|
|
- return 1; /* stop iterating */
|
|
|
-}
|
|
|
-
|
|
|
-static void storvsc_drv_exit(void)
|
|
|
-{
|
|
|
- struct storvsc_driver *storvsc_drv_obj = &g_storvsc_drv;
|
|
|
- struct hv_driver *drv = &g_storvsc_drv.base;
|
|
|
- struct device *current_dev = NULL;
|
|
|
- int ret;
|
|
|
-
|
|
|
- while (1) {
|
|
|
- current_dev = NULL;
|
|
|
-
|
|
|
- /* Get the device */
|
|
|
- ret = driver_for_each_device(&drv->driver, NULL,
|
|
|
- (void *) ¤t_dev,
|
|
|
- storvsc_drv_exit_cb);
|
|
|
-
|
|
|
-
|
|
|
- if (current_dev == NULL)
|
|
|
- break;
|
|
|
-
|
|
|
- /* Initiate removal from the top-down */
|
|
|
- device_unregister(current_dev);
|
|
|
- }
|
|
|
-
|
|
|
- if (storvsc_drv_obj->base.cleanup)
|
|
|
- storvsc_drv_obj->base.cleanup(&storvsc_drv_obj->base);
|
|
|
-
|
|
|
- vmbus_child_driver_unregister(&drv->driver);
|
|
|
- return;
|
|
|
-}
|
|
|
-
|
|
|
/*
|
|
|
* storvsc_probe - Add a new device for this driver
|
|
|
*/
|
|
|
+
|
|
|
static int storvsc_probe(struct hv_device *device)
|
|
|
{
|
|
|
int ret;
|
|
@@ -944,6 +873,76 @@ static int storvsc_probe(struct hv_device *device)
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
+/*
|
|
|
+ * storvsc_drv_init - StorVsc driver initialization.
|
|
|
+ */
|
|
|
+static int storvsc_drv_init(void)
|
|
|
+{
|
|
|
+ int ret;
|
|
|
+ struct storvsc_driver *storvsc_drv_obj = &g_storvsc_drv;
|
|
|
+ struct hv_driver *drv = &g_storvsc_drv.base;
|
|
|
+
|
|
|
+ storvsc_drv_obj->ring_buffer_size = storvsc_ringbuffer_size;
|
|
|
+
|
|
|
+ /* Callback to client driver to complete the initialization */
|
|
|
+ storvsc_initialize(&storvsc_drv_obj->base);
|
|
|
+
|
|
|
+ DPRINT_INFO(STORVSC_DRV,
|
|
|
+ "max outstanding reqs %u",
|
|
|
+ storvsc_drv_obj->max_outstanding_req_per_channel);
|
|
|
+
|
|
|
+ if (storvsc_drv_obj->max_outstanding_req_per_channel <
|
|
|
+ STORVSC_MAX_IO_REQUESTS)
|
|
|
+ return -1;
|
|
|
+
|
|
|
+ drv->driver.name = storvsc_drv_obj->base.name;
|
|
|
+
|
|
|
+ drv->probe = storvsc_probe;
|
|
|
+ drv->remove = storvsc_remove;
|
|
|
+
|
|
|
+ /* The driver belongs to vmbus */
|
|
|
+ ret = vmbus_child_driver_register(&drv->driver);
|
|
|
+
|
|
|
+ return ret;
|
|
|
+}
|
|
|
+
|
|
|
+static int storvsc_drv_exit_cb(struct device *dev, void *data)
|
|
|
+{
|
|
|
+ struct device **curr = (struct device **)data;
|
|
|
+ *curr = dev;
|
|
|
+ return 1; /* stop iterating */
|
|
|
+}
|
|
|
+
|
|
|
+static void storvsc_drv_exit(void)
|
|
|
+{
|
|
|
+ struct storvsc_driver *storvsc_drv_obj = &g_storvsc_drv;
|
|
|
+ struct hv_driver *drv = &g_storvsc_drv.base;
|
|
|
+ struct device *current_dev = NULL;
|
|
|
+ int ret;
|
|
|
+
|
|
|
+ while (1) {
|
|
|
+ current_dev = NULL;
|
|
|
+
|
|
|
+ /* Get the device */
|
|
|
+ ret = driver_for_each_device(&drv->driver, NULL,
|
|
|
+ (void *) ¤t_dev,
|
|
|
+ storvsc_drv_exit_cb);
|
|
|
+
|
|
|
+
|
|
|
+ if (current_dev == NULL)
|
|
|
+ break;
|
|
|
+
|
|
|
+ /* Initiate removal from the top-down */
|
|
|
+ device_unregister(current_dev);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (storvsc_drv_obj->base.cleanup)
|
|
|
+ storvsc_drv_obj->base.cleanup(&storvsc_drv_obj->base);
|
|
|
+
|
|
|
+ vmbus_child_driver_unregister(&drv->driver);
|
|
|
+ return;
|
|
|
+}
|
|
|
+
|
|
|
static int __init storvsc_init(void)
|
|
|
{
|
|
|
int ret;
|