Skip to content

Commit

Permalink
Staging: hv: storvsc_drv: Cleanup storvsc_drv_exit() function
Browse files Browse the repository at this point in the history
To conform to the Linux device model, the device should persist even
when there is no driver bound to it. Cleanup the storvsc_drv_exit() routine
keeping this in mind.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
K. Y. Srinivasan authored and Greg Kroah-Hartman committed May 17, 2011
1 parent 8553d75 commit 2bda87c
Showing 1 changed file with 1 addition and 29 deletions.
30 changes: 1 addition & 29 deletions drivers/staging/hv/storvsc_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -792,37 +792,9 @@ static int storvsc_drv_init(void)
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 hv_driver *drv = &storvsc_drv;
struct device *current_dev = NULL;
int ret;

while (1) {
current_dev = NULL;

/* Get the device */
ret = driver_for_each_device(&drv->driver, NULL,
(void *) &current_dev,
storvsc_drv_exit_cb);


if (current_dev == NULL)
break;

/* Initiate removal from the top-down */
device_unregister(current_dev);
}

vmbus_child_driver_unregister(&drv->driver);
return;
vmbus_child_driver_unregister(&storvsc_drv.driver);
}

static int __init storvsc_init(void)
Expand Down

0 comments on commit 2bda87c

Please sign in to comment.