aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/hv/storvsc_drv.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/hv/storvsc_drv.c')
-rw-r--r--drivers/staging/hv/storvsc_drv.c24
1 files changed, 7 insertions, 17 deletions
diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index 6f67e9bfebd..0297418e8a6 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -41,8 +41,6 @@ static int storvsc_ringbuffer_size = STORVSC_RING_BUFFER_SIZE;
41module_param(storvsc_ringbuffer_size, int, S_IRUGO); 41module_param(storvsc_ringbuffer_size, int, S_IRUGO);
42MODULE_PARM_DESC(storvsc_ringbuffer_size, "Ring buffer size (bytes)"); 42MODULE_PARM_DESC(storvsc_ringbuffer_size, "Ring buffer size (bytes)");
43 43
44static const char *driver_name = "storvsc";
45
46struct hv_host_device { 44struct hv_host_device {
47 struct hv_device *dev; 45 struct hv_device *dev;
48 struct kmem_cache *request_pool; 46 struct kmem_cache *request_pool;
@@ -718,6 +716,7 @@ static int storvsc_probe(struct hv_device *device)
718/* The one and only one */ 716/* The one and only one */
719 717
720static struct hv_driver storvsc_drv = { 718static struct hv_driver storvsc_drv = {
719 .name = "storvsc",
721 .id_table = id_table, 720 .id_table = id_table,
722 .probe = storvsc_probe, 721 .probe = storvsc_probe,
723 .remove = storvsc_remove, 722 .remove = storvsc_remove,
@@ -725,8 +724,6 @@ static struct hv_driver storvsc_drv = {
725 724
726static int __init storvsc_drv_init(void) 725static int __init storvsc_drv_init(void)
727{ 726{
728 int ret;
729 struct hv_driver *drv = &storvsc_drv;
730 u32 max_outstanding_req_per_channel; 727 u32 max_outstanding_req_per_channel;
731 728
732 /* 729 /*
@@ -735,29 +732,22 @@ static int __init storvsc_drv_init(void)
735 * the ring buffer indices) by the max request size (which is 732 * the ring buffer indices) by the max request size (which is
736 * vmbus_channel_packet_multipage_buffer + struct vstor_packet + u64) 733 * vmbus_channel_packet_multipage_buffer + struct vstor_packet + u64)
737 */ 734 */
738
739 max_outstanding_req_per_channel = 735 max_outstanding_req_per_channel =
740 ((storvsc_ringbuffer_size - PAGE_SIZE) / 736 ((storvsc_ringbuffer_size - PAGE_SIZE) /
741 ALIGN(MAX_MULTIPAGE_BUFFER_PACKET + 737 ALIGN(MAX_MULTIPAGE_BUFFER_PACKET +
742 sizeof(struct vstor_packet) + sizeof(u64), 738 sizeof(struct vstor_packet) + sizeof(u64),
743 sizeof(u64))); 739 sizeof(u64)));
744 740
745 if (max_outstanding_req_per_channel < 741 if (max_outstanding_req_per_channel <
746 STORVSC_MAX_IO_REQUESTS) 742 STORVSC_MAX_IO_REQUESTS)
747 return -1; 743 return -1;
748 744
749 drv->driver.name = driver_name; 745 return vmbus_driver_register(&storvsc_drv);
750
751
752 /* The driver belongs to vmbus */
753 ret = vmbus_child_driver_register(&drv->driver);
754
755 return ret;
756} 746}
757 747
758static void __exit storvsc_drv_exit(void) 748static void __exit storvsc_drv_exit(void)
759{ 749{
760 vmbus_child_driver_unregister(&storvsc_drv.driver); 750 vmbus_driver_unregister(&storvsc_drv);
761} 751}
762 752
763MODULE_LICENSE("GPL"); 753MODULE_LICENSE("GPL");