diff options
-rw-r--r-- | drivers/staging/hv/blkvsc_drv.c | 16 | ||||
-rw-r--r-- | drivers/staging/hv/hv_mouse.c | 19 | ||||
-rw-r--r-- | drivers/staging/hv/netvsc_drv.c | 24 | ||||
-rw-r--r-- | drivers/staging/hv/storvsc_drv.c | 24 | ||||
-rw-r--r-- | drivers/staging/hv/vmbus.h | 12 | ||||
-rw-r--r-- | drivers/staging/hv/vmbus_api.h | 2 | ||||
-rw-r--r-- | drivers/staging/hv/vmbus_drv.c | 77 |
7 files changed, 73 insertions, 101 deletions
diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c index 0f9fb05d234..6e02f1b0c46 100644 --- a/drivers/staging/hv/blkvsc_drv.c +++ b/drivers/staging/hv/blkvsc_drv.c | |||
@@ -95,7 +95,7 @@ struct blkvsc_request { | |||
95 | /* Per device structure */ | 95 | /* Per device structure */ |
96 | struct block_device_context { | 96 | struct block_device_context { |
97 | /* point back to our device context */ | 97 | /* point back to our device context */ |
98 | struct vm_device *device_ctx; | 98 | struct hv_device *device_ctx; |
99 | struct kmem_cache *request_pool; | 99 | struct kmem_cache *request_pool; |
100 | spinlock_t lock; | 100 | spinlock_t lock; |
101 | struct gendisk *gd; | 101 | struct gendisk *gd; |
@@ -240,8 +240,7 @@ static int blkvsc_probe(struct device *device) | |||
240 | drv_to_hv_drv(device->driver); | 240 | drv_to_hv_drv(device->driver); |
241 | struct storvsc_driver_object *storvsc_drv_obj = | 241 | struct storvsc_driver_object *storvsc_drv_obj = |
242 | drv->priv; | 242 | drv->priv; |
243 | struct vm_device *device_ctx = device_to_vm_device(device); | 243 | struct hv_device *device_obj = device_to_hv_device(device); |
244 | struct hv_device *device_obj = &device_ctx->device_obj; | ||
245 | 244 | ||
246 | struct block_device_context *blkdev = NULL; | 245 | struct block_device_context *blkdev = NULL; |
247 | struct storvsc_device_info device_info; | 246 | struct storvsc_device_info device_info; |
@@ -273,7 +272,7 @@ static int blkvsc_probe(struct device *device) | |||
273 | /* ASSERT(sizeof(struct blkvsc_request_group) <= */ | 272 | /* ASSERT(sizeof(struct blkvsc_request_group) <= */ |
274 | /* sizeof(struct blkvsc_request)); */ | 273 | /* sizeof(struct blkvsc_request)); */ |
275 | 274 | ||
276 | blkdev->request_pool = kmem_cache_create(dev_name(&device_ctx->device), | 275 | blkdev->request_pool = kmem_cache_create(dev_name(&device_obj->device), |
277 | sizeof(struct blkvsc_request) + | 276 | sizeof(struct blkvsc_request) + |
278 | storvsc_drv_obj->request_ext_size, 0, | 277 | storvsc_drv_obj->request_ext_size, 0, |
279 | SLAB_HWCACHE_ALIGN, NULL); | 278 | SLAB_HWCACHE_ALIGN, NULL); |
@@ -290,7 +289,7 @@ static int blkvsc_probe(struct device *device) | |||
290 | goto Cleanup; | 289 | goto Cleanup; |
291 | } | 290 | } |
292 | 291 | ||
293 | blkdev->device_ctx = device_ctx; | 292 | blkdev->device_ctx = device_obj; |
294 | /* this identified the device 0 or 1 */ | 293 | /* this identified the device 0 or 1 */ |
295 | blkdev->target = device_info.target_id; | 294 | blkdev->target = device_info.target_id; |
296 | /* this identified the ide ctrl 0 or 1 */ | 295 | /* this identified the ide ctrl 0 or 1 */ |
@@ -723,8 +722,7 @@ static int blkvsc_remove(struct device *device) | |||
723 | drv_to_hv_drv(device->driver); | 722 | drv_to_hv_drv(device->driver); |
724 | struct storvsc_driver_object *storvsc_drv_obj = | 723 | struct storvsc_driver_object *storvsc_drv_obj = |
725 | drv->priv; | 724 | drv->priv; |
726 | struct vm_device *device_ctx = device_to_vm_device(device); | 725 | struct hv_device *device_obj = device_to_hv_device(device); |
727 | struct hv_device *device_obj = &device_ctx->device_obj; | ||
728 | struct block_device_context *blkdev = dev_get_drvdata(device); | 726 | struct block_device_context *blkdev = dev_get_drvdata(device); |
729 | unsigned long flags; | 727 | unsigned long flags; |
730 | int ret; | 728 | int ret; |
@@ -839,7 +837,7 @@ static int blkvsc_submit_request(struct blkvsc_request *blkvsc_req, | |||
839 | void (*request_completion)(struct hv_storvsc_request *)) | 837 | void (*request_completion)(struct hv_storvsc_request *)) |
840 | { | 838 | { |
841 | struct block_device_context *blkdev = blkvsc_req->dev; | 839 | struct block_device_context *blkdev = blkvsc_req->dev; |
842 | struct vm_device *device_ctx = blkdev->device_ctx; | 840 | struct hv_device *device_ctx = blkdev->device_ctx; |
843 | struct hv_driver *drv = | 841 | struct hv_driver *drv = |
844 | drv_to_hv_drv(device_ctx->device.driver); | 842 | drv_to_hv_drv(device_ctx->device.driver); |
845 | struct storvsc_driver_object *storvsc_drv_obj = | 843 | struct storvsc_driver_object *storvsc_drv_obj = |
@@ -884,7 +882,7 @@ static int blkvsc_submit_request(struct blkvsc_request *blkvsc_req, | |||
884 | storvsc_req->sense_buffer = blkvsc_req->sense_buffer; | 882 | storvsc_req->sense_buffer = blkvsc_req->sense_buffer; |
885 | storvsc_req->sense_buffer_size = SCSI_SENSE_BUFFERSIZE; | 883 | storvsc_req->sense_buffer_size = SCSI_SENSE_BUFFERSIZE; |
886 | 884 | ||
887 | ret = storvsc_drv_obj->on_io_request(&blkdev->device_ctx->device_obj, | 885 | ret = storvsc_drv_obj->on_io_request(blkdev->device_ctx, |
888 | &blkvsc_req->request); | 886 | &blkvsc_req->request); |
889 | if (ret == 0) | 887 | if (ret == 0) |
890 | blkdev->num_outstanding_reqs++; | 888 | blkdev->num_outstanding_reqs++; |
diff --git a/drivers/staging/hv/hv_mouse.c b/drivers/staging/hv/hv_mouse.c index 6c5c00da8e7..8f94f433961 100644 --- a/drivers/staging/hv/hv_mouse.c +++ b/drivers/staging/hv/hv_mouse.c | |||
@@ -771,7 +771,7 @@ static void MousevscOnCleanup(struct hv_driver *drv) | |||
771 | * Data types | 771 | * Data types |
772 | */ | 772 | */ |
773 | struct input_device_context { | 773 | struct input_device_context { |
774 | struct vm_device *device_ctx; | 774 | struct hv_device *device_ctx; |
775 | struct hid_device *hid_device; | 775 | struct hid_device *hid_device; |
776 | struct hv_input_dev_info device_info; | 776 | struct hv_input_dev_info device_info; |
777 | int connected; | 777 | int connected; |
@@ -782,9 +782,8 @@ static struct mousevsc_drv_obj g_mousevsc_drv; | |||
782 | 782 | ||
783 | static void deviceinfo_callback(struct hv_device *dev, struct hv_input_dev_info *info) | 783 | static void deviceinfo_callback(struct hv_device *dev, struct hv_input_dev_info *info) |
784 | { | 784 | { |
785 | struct vm_device *device_ctx = to_vm_device(dev); | ||
786 | struct input_device_context *input_device_ctx = | 785 | struct input_device_context *input_device_ctx = |
787 | dev_get_drvdata(&device_ctx->device); | 786 | dev_get_drvdata(&dev->device); |
788 | 787 | ||
789 | memcpy(&input_device_ctx->device_info, info, | 788 | memcpy(&input_device_ctx->device_info, info, |
790 | sizeof(struct hv_input_dev_info)); | 789 | sizeof(struct hv_input_dev_info)); |
@@ -796,9 +795,8 @@ static void inputreport_callback(struct hv_device *dev, void *packet, u32 len) | |||
796 | { | 795 | { |
797 | int ret = 0; | 796 | int ret = 0; |
798 | 797 | ||
799 | struct vm_device *device_ctx = to_vm_device(dev); | ||
800 | struct input_device_context *input_dev_ctx = | 798 | struct input_device_context *input_dev_ctx = |
801 | dev_get_drvdata(&device_ctx->device); | 799 | dev_get_drvdata(&dev->device); |
802 | 800 | ||
803 | ret = hid_input_report(input_dev_ctx->hid_device, | 801 | ret = hid_input_report(input_dev_ctx->hid_device, |
804 | HID_INPUT_REPORT, packet, len, 1); | 802 | HID_INPUT_REPORT, packet, len, 1); |
@@ -823,8 +821,7 @@ static int mousevsc_probe(struct device *device) | |||
823 | drv_to_hv_drv(device->driver); | 821 | drv_to_hv_drv(device->driver); |
824 | struct mousevsc_drv_obj *mousevsc_drv_obj = drv->priv; | 822 | struct mousevsc_drv_obj *mousevsc_drv_obj = drv->priv; |
825 | 823 | ||
826 | struct vm_device *device_ctx = device_to_vm_device(device); | 824 | struct hv_device *device_obj = device_to_hv_device(device); |
827 | struct hv_device *device_obj = &device_ctx->device_obj; | ||
828 | struct input_device_context *input_dev_ctx; | 825 | struct input_device_context *input_dev_ctx; |
829 | 826 | ||
830 | input_dev_ctx = kmalloc(sizeof(struct input_device_context), | 827 | input_dev_ctx = kmalloc(sizeof(struct input_device_context), |
@@ -852,8 +849,7 @@ static int mousevsc_remove(struct device *device) | |||
852 | drv_to_hv_drv(device->driver); | 849 | drv_to_hv_drv(device->driver); |
853 | struct mousevsc_drv_obj *mousevsc_drv_obj = drv->priv; | 850 | struct mousevsc_drv_obj *mousevsc_drv_obj = drv->priv; |
854 | 851 | ||
855 | struct vm_device *device_ctx = device_to_vm_device(device); | 852 | struct hv_device *device_obj = device_to_hv_device(device); |
856 | struct hv_device *device_obj = &device_ctx->device_obj; | ||
857 | struct input_device_context *input_dev_ctx; | 853 | struct input_device_context *input_dev_ctx; |
858 | 854 | ||
859 | input_dev_ctx = kmalloc(sizeof(struct input_device_context), | 855 | input_dev_ctx = kmalloc(sizeof(struct input_device_context), |
@@ -887,9 +883,8 @@ static int mousevsc_remove(struct device *device) | |||
887 | 883 | ||
888 | static void reportdesc_callback(struct hv_device *dev, void *packet, u32 len) | 884 | static void reportdesc_callback(struct hv_device *dev, void *packet, u32 len) |
889 | { | 885 | { |
890 | struct vm_device *device_ctx = to_vm_device(dev); | ||
891 | struct input_device_context *input_device_ctx = | 886 | struct input_device_context *input_device_ctx = |
892 | dev_get_drvdata(&device_ctx->device); | 887 | dev_get_drvdata(&dev->device); |
893 | struct hid_device *hid_dev; | 888 | struct hid_device *hid_dev; |
894 | 889 | ||
895 | /* hid_debug = -1; */ | 890 | /* hid_debug = -1; */ |
@@ -910,7 +905,7 @@ static void reportdesc_callback(struct hv_device *dev, void *packet, u32 len) | |||
910 | hid_dev->vendor = input_device_ctx->device_info.vendor; | 905 | hid_dev->vendor = input_device_ctx->device_info.vendor; |
911 | hid_dev->product = input_device_ctx->device_info.product; | 906 | hid_dev->product = input_device_ctx->device_info.product; |
912 | hid_dev->version = input_device_ctx->device_info.version; | 907 | hid_dev->version = input_device_ctx->device_info.version; |
913 | hid_dev->dev = device_ctx->device; | 908 | hid_dev->dev = dev->device; |
914 | 909 | ||
915 | sprintf(hid_dev->name, "%s", | 910 | sprintf(hid_dev->name, "%s", |
916 | input_device_ctx->device_info.name); | 911 | input_device_ctx->device_info.name); |
diff --git a/drivers/staging/hv/netvsc_drv.c b/drivers/staging/hv/netvsc_drv.c index f0d258cc583..2d40f5f86b2 100644 --- a/drivers/staging/hv/netvsc_drv.c +++ b/drivers/staging/hv/netvsc_drv.c | |||
@@ -44,7 +44,7 @@ | |||
44 | 44 | ||
45 | struct net_device_context { | 45 | struct net_device_context { |
46 | /* point back to our device context */ | 46 | /* point back to our device context */ |
47 | struct vm_device *device_ctx; | 47 | struct hv_device *device_ctx; |
48 | unsigned long avail; | 48 | unsigned long avail; |
49 | }; | 49 | }; |
50 | 50 | ||
@@ -70,7 +70,7 @@ static void netvsc_set_multicast_list(struct net_device *net) | |||
70 | static int netvsc_open(struct net_device *net) | 70 | static int netvsc_open(struct net_device *net) |
71 | { | 71 | { |
72 | struct net_device_context *net_device_ctx = netdev_priv(net); | 72 | struct net_device_context *net_device_ctx = netdev_priv(net); |
73 | struct hv_device *device_obj = &net_device_ctx->device_ctx->device_obj; | 73 | struct hv_device *device_obj = net_device_ctx->device_ctx; |
74 | int ret = 0; | 74 | int ret = 0; |
75 | 75 | ||
76 | if (netif_carrier_ok(net)) { | 76 | if (netif_carrier_ok(net)) { |
@@ -93,7 +93,7 @@ static int netvsc_open(struct net_device *net) | |||
93 | static int netvsc_close(struct net_device *net) | 93 | static int netvsc_close(struct net_device *net) |
94 | { | 94 | { |
95 | struct net_device_context *net_device_ctx = netdev_priv(net); | 95 | struct net_device_context *net_device_ctx = netdev_priv(net); |
96 | struct hv_device *device_obj = &net_device_ctx->device_ctx->device_obj; | 96 | struct hv_device *device_obj = net_device_ctx->device_ctx; |
97 | int ret; | 97 | int ret; |
98 | 98 | ||
99 | netif_stop_queue(net); | 99 | netif_stop_queue(net); |
@@ -190,7 +190,7 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net) | |||
190 | packet->completion.send.send_completion_ctx = packet; | 190 | packet->completion.send.send_completion_ctx = packet; |
191 | packet->completion.send.send_completion_tid = (unsigned long)skb; | 191 | packet->completion.send.send_completion_tid = (unsigned long)skb; |
192 | 192 | ||
193 | ret = net_drv_obj->send(&net_device_ctx->device_ctx->device_obj, | 193 | ret = net_drv_obj->send(net_device_ctx->device_ctx, |
194 | packet); | 194 | packet); |
195 | if (ret == 0) { | 195 | if (ret == 0) { |
196 | net->stats.tx_bytes += skb->len; | 196 | net->stats.tx_bytes += skb->len; |
@@ -218,8 +218,7 @@ static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net) | |||
218 | static void netvsc_linkstatus_callback(struct hv_device *device_obj, | 218 | static void netvsc_linkstatus_callback(struct hv_device *device_obj, |
219 | unsigned int status) | 219 | unsigned int status) |
220 | { | 220 | { |
221 | struct vm_device *device_ctx = to_vm_device(device_obj); | 221 | struct net_device *net = dev_get_drvdata(&device_obj->device); |
222 | struct net_device *net = dev_get_drvdata(&device_ctx->device); | ||
223 | 222 | ||
224 | if (!net) { | 223 | if (!net) { |
225 | DPRINT_ERR(NETVSC_DRV, "got link status but net device " | 224 | DPRINT_ERR(NETVSC_DRV, "got link status but net device " |
@@ -244,8 +243,7 @@ static void netvsc_linkstatus_callback(struct hv_device *device_obj, | |||
244 | static int netvsc_recv_callback(struct hv_device *device_obj, | 243 | static int netvsc_recv_callback(struct hv_device *device_obj, |
245 | struct hv_netvsc_packet *packet) | 244 | struct hv_netvsc_packet *packet) |
246 | { | 245 | { |
247 | struct vm_device *device_ctx = to_vm_device(device_obj); | 246 | struct net_device *net = dev_get_drvdata(&device_obj->device); |
248 | struct net_device *net = dev_get_drvdata(&device_ctx->device); | ||
249 | struct sk_buff *skb; | 247 | struct sk_buff *skb; |
250 | void *data; | 248 | void *data; |
251 | int i; | 249 | int i; |
@@ -335,8 +333,7 @@ static int netvsc_probe(struct device *device) | |||
335 | struct hv_driver *drv = | 333 | struct hv_driver *drv = |
336 | drv_to_hv_drv(device->driver); | 334 | drv_to_hv_drv(device->driver); |
337 | struct netvsc_driver *net_drv_obj = drv->priv; | 335 | struct netvsc_driver *net_drv_obj = drv->priv; |
338 | struct vm_device *device_ctx = device_to_vm_device(device); | 336 | struct hv_device *device_obj = device_to_hv_device(device); |
339 | struct hv_device *device_obj = &device_ctx->device_obj; | ||
340 | struct net_device *net = NULL; | 337 | struct net_device *net = NULL; |
341 | struct net_device_context *net_device_ctx; | 338 | struct net_device_context *net_device_ctx; |
342 | struct netvsc_device_info device_info; | 339 | struct netvsc_device_info device_info; |
@@ -353,7 +350,7 @@ static int netvsc_probe(struct device *device) | |||
353 | netif_carrier_off(net); | 350 | netif_carrier_off(net); |
354 | 351 | ||
355 | net_device_ctx = netdev_priv(net); | 352 | net_device_ctx = netdev_priv(net); |
356 | net_device_ctx->device_ctx = device_ctx; | 353 | net_device_ctx->device_ctx = device_obj; |
357 | net_device_ctx->avail = ring_size; | 354 | net_device_ctx->avail = ring_size; |
358 | dev_set_drvdata(device, net); | 355 | dev_set_drvdata(device, net); |
359 | 356 | ||
@@ -405,9 +402,8 @@ static int netvsc_remove(struct device *device) | |||
405 | struct hv_driver *drv = | 402 | struct hv_driver *drv = |
406 | drv_to_hv_drv(device->driver); | 403 | drv_to_hv_drv(device->driver); |
407 | struct netvsc_driver *net_drv_obj = drv->priv; | 404 | struct netvsc_driver *net_drv_obj = drv->priv; |
408 | struct vm_device *device_ctx = device_to_vm_device(device); | 405 | struct hv_device *device_obj = device_to_hv_device(device); |
409 | struct net_device *net = dev_get_drvdata(&device_ctx->device); | 406 | struct net_device *net = dev_get_drvdata(&device_obj->device); |
410 | struct hv_device *device_obj = &device_ctx->device_obj; | ||
411 | int ret; | 407 | int ret; |
412 | 408 | ||
413 | if (net == NULL) { | 409 | if (net == NULL) { |
diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c index 972273461cb..e6462a2fe9a 100644 --- a/drivers/staging/hv/storvsc_drv.c +++ b/drivers/staging/hv/storvsc_drv.c | |||
@@ -42,7 +42,7 @@ struct host_device_context { | |||
42 | /* must be 1st field | 42 | /* must be 1st field |
43 | * FIXME this is a bug */ | 43 | * FIXME this is a bug */ |
44 | /* point back to our device context */ | 44 | /* point back to our device context */ |
45 | struct vm_device *device_ctx; | 45 | struct hv_device *device_ctx; |
46 | struct kmem_cache *request_pool; | 46 | struct kmem_cache *request_pool; |
47 | unsigned int port; | 47 | unsigned int port; |
48 | unsigned char path; | 48 | unsigned char path; |
@@ -216,8 +216,7 @@ static int storvsc_probe(struct device *device) | |||
216 | struct hv_driver *drv = | 216 | struct hv_driver *drv = |
217 | drv_to_hv_drv(device->driver); | 217 | drv_to_hv_drv(device->driver); |
218 | struct storvsc_driver_object *storvsc_drv_obj = drv->priv; | 218 | struct storvsc_driver_object *storvsc_drv_obj = drv->priv; |
219 | struct vm_device *device_ctx = device_to_vm_device(device); | 219 | struct hv_device *device_obj = device_to_hv_device(device); |
220 | struct hv_device *device_obj = &device_ctx->device_obj; | ||
221 | struct Scsi_Host *host; | 220 | struct Scsi_Host *host; |
222 | struct host_device_context *host_device_ctx; | 221 | struct host_device_context *host_device_ctx; |
223 | struct storvsc_device_info device_info; | 222 | struct storvsc_device_info device_info; |
@@ -238,10 +237,10 @@ static int storvsc_probe(struct device *device) | |||
238 | memset(host_device_ctx, 0, sizeof(struct host_device_context)); | 237 | memset(host_device_ctx, 0, sizeof(struct host_device_context)); |
239 | 238 | ||
240 | host_device_ctx->port = host->host_no; | 239 | host_device_ctx->port = host->host_no; |
241 | host_device_ctx->device_ctx = device_ctx; | 240 | host_device_ctx->device_ctx = device_obj; |
242 | 241 | ||
243 | host_device_ctx->request_pool = | 242 | host_device_ctx->request_pool = |
244 | kmem_cache_create(dev_name(&device_ctx->device), | 243 | kmem_cache_create(dev_name(&device_obj->device), |
245 | sizeof(struct storvsc_cmd_request) + | 244 | sizeof(struct storvsc_cmd_request) + |
246 | storvsc_drv_obj->request_ext_size, 0, | 245 | storvsc_drv_obj->request_ext_size, 0, |
247 | SLAB_HWCACHE_ALIGN, NULL); | 246 | SLAB_HWCACHE_ALIGN, NULL); |
@@ -298,8 +297,7 @@ static int storvsc_remove(struct device *device) | |||
298 | struct hv_driver *drv = | 297 | struct hv_driver *drv = |
299 | drv_to_hv_drv(device->driver); | 298 | drv_to_hv_drv(device->driver); |
300 | struct storvsc_driver_object *storvsc_drv_obj = drv->priv; | 299 | struct storvsc_driver_object *storvsc_drv_obj = drv->priv; |
301 | struct vm_device *device_ctx = device_to_vm_device(device); | 300 | struct hv_device *device_obj = device_to_hv_device(device); |
302 | struct hv_device *device_obj = &device_ctx->device_obj; | ||
303 | struct Scsi_Host *host = dev_get_drvdata(device); | 301 | struct Scsi_Host *host = dev_get_drvdata(device); |
304 | struct host_device_context *host_device_ctx = | 302 | struct host_device_context *host_device_ctx = |
305 | (struct host_device_context *)host->hostdata; | 303 | (struct host_device_context *)host->hostdata; |
@@ -589,7 +587,7 @@ static int storvsc_queuecommand_lck(struct scsi_cmnd *scmnd, | |||
589 | int ret; | 587 | int ret; |
590 | struct host_device_context *host_device_ctx = | 588 | struct host_device_context *host_device_ctx = |
591 | (struct host_device_context *)scmnd->device->host->hostdata; | 589 | (struct host_device_context *)scmnd->device->host->hostdata; |
592 | struct vm_device *device_ctx = host_device_ctx->device_ctx; | 590 | struct hv_device *device_ctx = host_device_ctx->device_ctx; |
593 | struct hv_driver *drv = | 591 | struct hv_driver *drv = |
594 | drv_to_hv_drv(device_ctx->device.driver); | 592 | drv_to_hv_drv(device_ctx->device.driver); |
595 | struct storvsc_driver_object *storvsc_drv_obj = drv->priv; | 593 | struct storvsc_driver_object *storvsc_drv_obj = drv->priv; |
@@ -737,7 +735,7 @@ static int storvsc_queuecommand_lck(struct scsi_cmnd *scmnd, | |||
737 | 735 | ||
738 | retry_request: | 736 | retry_request: |
739 | /* Invokes the vsc to start an IO */ | 737 | /* Invokes the vsc to start an IO */ |
740 | ret = storvsc_drv_obj->on_io_request(&device_ctx->device_obj, | 738 | ret = storvsc_drv_obj->on_io_request(device_ctx, |
741 | &cmd_request->request); | 739 | &cmd_request->request); |
742 | if (ret == -1) { | 740 | if (ret == -1) { |
743 | /* no more space */ | 741 | /* no more space */ |
@@ -824,18 +822,18 @@ static int storvsc_host_reset_handler(struct scsi_cmnd *scmnd) | |||
824 | int ret; | 822 | int ret; |
825 | struct host_device_context *host_device_ctx = | 823 | struct host_device_context *host_device_ctx = |
826 | (struct host_device_context *)scmnd->device->host->hostdata; | 824 | (struct host_device_context *)scmnd->device->host->hostdata; |
827 | struct vm_device *device_ctx = host_device_ctx->device_ctx; | 825 | struct hv_device *device_ctx = host_device_ctx->device_ctx; |
828 | 826 | ||
829 | DPRINT_INFO(STORVSC_DRV, "sdev (%p) dev obj (%p) - host resetting...", | 827 | DPRINT_INFO(STORVSC_DRV, "sdev (%p) dev obj (%p) - host resetting...", |
830 | scmnd->device, &device_ctx->device_obj); | 828 | scmnd->device, device_ctx); |
831 | 829 | ||
832 | /* Invokes the vsc to reset the host/bus */ | 830 | /* Invokes the vsc to reset the host/bus */ |
833 | ret = stor_vsc_on_host_reset(&device_ctx->device_obj); | 831 | ret = stor_vsc_on_host_reset(device_ctx); |
834 | if (ret != 0) | 832 | if (ret != 0) |
835 | return ret; | 833 | return ret; |
836 | 834 | ||
837 | DPRINT_INFO(STORVSC_DRV, "sdev (%p) dev obj (%p) - host reseted", | 835 | DPRINT_INFO(STORVSC_DRV, "sdev (%p) dev obj (%p) - host reseted", |
838 | scmnd->device, &device_ctx->device_obj); | 836 | scmnd->device, device_ctx); |
839 | 837 | ||
840 | return ret; | 838 | return ret; |
841 | } | 839 | } |
diff --git a/drivers/staging/hv/vmbus.h b/drivers/staging/hv/vmbus.h index ab296bb0b03..73087f26bec 100644 --- a/drivers/staging/hv/vmbus.h +++ b/drivers/staging/hv/vmbus.h | |||
@@ -29,19 +29,11 @@ | |||
29 | #include "vmbus_api.h" | 29 | #include "vmbus_api.h" |
30 | 30 | ||
31 | 31 | ||
32 | struct vm_device { | ||
33 | struct hv_device device_obj; | ||
34 | struct device device; | ||
35 | }; | ||
36 | 32 | ||
37 | static inline struct vm_device *to_vm_device(struct hv_device *d) | ||
38 | { | ||
39 | return container_of(d, struct vm_device, device_obj); | ||
40 | } | ||
41 | 33 | ||
42 | static inline struct vm_device *device_to_vm_device(struct device *d) | 34 | static inline struct hv_device *device_to_hv_device(struct device *d) |
43 | { | 35 | { |
44 | return container_of(d, struct vm_device, device); | 36 | return container_of(d, struct hv_device, device); |
45 | } | 37 | } |
46 | 38 | ||
47 | static inline struct hv_driver *drv_to_hv_drv(struct device_driver *d) | 39 | static inline struct hv_driver *drv_to_hv_drv(struct device_driver *d) |
diff --git a/drivers/staging/hv/vmbus_api.h b/drivers/staging/hv/vmbus_api.h index 4c5a38e349b..f0d96eba701 100644 --- a/drivers/staging/hv/vmbus_api.h +++ b/drivers/staging/hv/vmbus_api.h | |||
@@ -128,6 +128,8 @@ struct hv_device { | |||
128 | /* the device instance id of this device */ | 128 | /* the device instance id of this device */ |
129 | struct hv_guid dev_instance; | 129 | struct hv_guid dev_instance; |
130 | 130 | ||
131 | struct device device; | ||
132 | |||
131 | struct vmbus_channel *channel; | 133 | struct vmbus_channel *channel; |
132 | 134 | ||
133 | /* Device extension; */ | 135 | /* Device extension; */ |
diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c index 81936622152..159dfdaec0f 100644 --- a/drivers/staging/hv/vmbus_drv.c +++ b/drivers/staging/hv/vmbus_drv.c | |||
@@ -49,7 +49,7 @@ struct vmbus_driver_context { | |||
49 | struct tasklet_struct event_dpc; | 49 | struct tasklet_struct event_dpc; |
50 | 50 | ||
51 | /* The bus root device */ | 51 | /* The bus root device */ |
52 | struct vm_device device_ctx; | 52 | struct hv_device device_ctx; |
53 | }; | 53 | }; |
54 | 54 | ||
55 | static int vmbus_match(struct device *device, struct device_driver *driver); | 55 | static int vmbus_match(struct device *device, struct device_driver *driver); |
@@ -349,12 +349,12 @@ static ssize_t vmbus_show_device_attr(struct device *dev, | |||
349 | struct device_attribute *dev_attr, | 349 | struct device_attribute *dev_attr, |
350 | char *buf) | 350 | char *buf) |
351 | { | 351 | { |
352 | struct vm_device *device_ctx = device_to_vm_device(dev); | 352 | struct hv_device *device_ctx = device_to_hv_device(dev); |
353 | struct hv_device_info device_info; | 353 | struct hv_device_info device_info; |
354 | 354 | ||
355 | memset(&device_info, 0, sizeof(struct hv_device_info)); | 355 | memset(&device_info, 0, sizeof(struct hv_device_info)); |
356 | 356 | ||
357 | get_channel_info(&device_ctx->device_obj, &device_info); | 357 | get_channel_info(device_ctx, &device_info); |
358 | 358 | ||
359 | if (!strcmp(dev_attr->attr.name, "class_id")) { | 359 | if (!strcmp(dev_attr->attr.name, "class_id")) { |
360 | return sprintf(buf, "{%02x%02x%02x%02x-%02x%02x-%02x%02x-" | 360 | return sprintf(buf, "{%02x%02x%02x%02x-%02x%02x-%02x%02x-" |
@@ -459,7 +459,7 @@ static int vmbus_bus_init(void) | |||
459 | { | 459 | { |
460 | struct vmbus_driver_context *vmbus_drv_ctx = &vmbus_drv; | 460 | struct vmbus_driver_context *vmbus_drv_ctx = &vmbus_drv; |
461 | struct hv_driver *driver = &vmbus_drv.drv_obj; | 461 | struct hv_driver *driver = &vmbus_drv.drv_obj; |
462 | struct vm_device *dev_ctx = &vmbus_drv.device_ctx; | 462 | struct hv_device *dev_ctx = &vmbus_drv.device_ctx; |
463 | int ret; | 463 | int ret; |
464 | unsigned int vector; | 464 | unsigned int vector; |
465 | 465 | ||
@@ -530,9 +530,9 @@ static int vmbus_bus_init(void) | |||
530 | DPRINT_INFO(VMBUS_DRV, "irq 0x%x vector 0x%x", vmbus_irq, vector); | 530 | DPRINT_INFO(VMBUS_DRV, "irq 0x%x vector 0x%x", vmbus_irq, vector); |
531 | 531 | ||
532 | /* Call to bus driver to add the root device */ | 532 | /* Call to bus driver to add the root device */ |
533 | memset(dev_ctx, 0, sizeof(struct vm_device)); | 533 | memset(dev_ctx, 0, sizeof(struct hv_device)); |
534 | 534 | ||
535 | ret = driver->dev_add(&dev_ctx->device_obj, &vector); | 535 | ret = driver->dev_add(dev_ctx, &vector); |
536 | if (ret != 0) { | 536 | if (ret != 0) { |
537 | DPRINT_ERR(VMBUS_DRV, | 537 | DPRINT_ERR(VMBUS_DRV, |
538 | "ERROR - Unable to add vmbus root device"); | 538 | "ERROR - Unable to add vmbus root device"); |
@@ -585,11 +585,11 @@ static void vmbus_bus_exit(void) | |||
585 | struct hv_driver *driver = &vmbus_drv.drv_obj; | 585 | struct hv_driver *driver = &vmbus_drv.drv_obj; |
586 | struct vmbus_driver_context *vmbus_drv_ctx = &vmbus_drv; | 586 | struct vmbus_driver_context *vmbus_drv_ctx = &vmbus_drv; |
587 | 587 | ||
588 | struct vm_device *dev_ctx = &vmbus_drv.device_ctx; | 588 | struct hv_device *dev_ctx = &vmbus_drv.device_ctx; |
589 | 589 | ||
590 | /* Remove the root device */ | 590 | /* Remove the root device */ |
591 | if (driver->dev_rm) | 591 | if (driver->dev_rm) |
592 | driver->dev_rm(&dev_ctx->device_obj); | 592 | driver->dev_rm(dev_ctx); |
593 | 593 | ||
594 | if (driver->cleanup) | 594 | if (driver->cleanup) |
595 | driver->cleanup(driver); | 595 | driver->cleanup(driver); |
@@ -664,12 +664,11 @@ struct hv_device *vmbus_child_device_create(struct hv_guid *type, | |||
664 | struct hv_guid *instance, | 664 | struct hv_guid *instance, |
665 | struct vmbus_channel *channel) | 665 | struct vmbus_channel *channel) |
666 | { | 666 | { |
667 | struct vm_device *child_device_ctx; | ||
668 | struct hv_device *child_device_obj; | 667 | struct hv_device *child_device_obj; |
669 | 668 | ||
670 | /* Allocate the new child device */ | 669 | /* Allocate the new child device */ |
671 | child_device_ctx = kzalloc(sizeof(struct vm_device), GFP_KERNEL); | 670 | child_device_obj = kzalloc(sizeof(struct hv_device), GFP_KERNEL); |
672 | if (!child_device_ctx) { | 671 | if (!child_device_obj) { |
673 | DPRINT_ERR(VMBUS_DRV, | 672 | DPRINT_ERR(VMBUS_DRV, |
674 | "unable to allocate device_context for child device"); | 673 | "unable to allocate device_context for child device"); |
675 | return NULL; | 674 | return NULL; |
@@ -680,7 +679,7 @@ struct hv_device *vmbus_child_device_create(struct hv_guid *type, | |||
680 | "%02x%02x%02x%02x%02x%02x%02x%02x}," | 679 | "%02x%02x%02x%02x%02x%02x%02x%02x}," |
681 | "id {%02x%02x%02x%02x-%02x%02x-%02x%02x-" | 680 | "id {%02x%02x%02x%02x-%02x%02x-%02x%02x-" |
682 | "%02x%02x%02x%02x%02x%02x%02x%02x}", | 681 | "%02x%02x%02x%02x%02x%02x%02x%02x}", |
683 | &child_device_ctx->device, | 682 | &child_device_obj->device, |
684 | type->data[3], type->data[2], type->data[1], type->data[0], | 683 | type->data[3], type->data[2], type->data[1], type->data[0], |
685 | type->data[5], type->data[4], type->data[7], type->data[6], | 684 | type->data[5], type->data[4], type->data[7], type->data[6], |
686 | type->data[8], type->data[9], type->data[10], type->data[11], | 685 | type->data[8], type->data[9], type->data[10], type->data[11], |
@@ -694,7 +693,6 @@ struct hv_device *vmbus_child_device_create(struct hv_guid *type, | |||
694 | instance->data[12], instance->data[13], | 693 | instance->data[12], instance->data[13], |
695 | instance->data[14], instance->data[15]); | 694 | instance->data[14], instance->data[15]); |
696 | 695 | ||
697 | child_device_obj = &child_device_ctx->device_obj; | ||
698 | child_device_obj->channel = channel; | 696 | child_device_obj->channel = channel; |
699 | memcpy(&child_device_obj->dev_type, type, sizeof(struct hv_guid)); | 697 | memcpy(&child_device_obj->dev_type, type, sizeof(struct hv_guid)); |
700 | memcpy(&child_device_obj->dev_instance, instance, | 698 | memcpy(&child_device_obj->dev_instance, instance, |
@@ -711,39 +709,36 @@ int vmbus_child_device_register(struct hv_device *root_device_obj, | |||
711 | struct hv_device *child_device_obj) | 709 | struct hv_device *child_device_obj) |
712 | { | 710 | { |
713 | int ret = 0; | 711 | int ret = 0; |
714 | struct vm_device *root_device_ctx = | 712 | |
715 | to_vm_device(root_device_obj); | ||
716 | struct vm_device *child_device_ctx = | ||
717 | to_vm_device(child_device_obj); | ||
718 | static atomic_t device_num = ATOMIC_INIT(0); | 713 | static atomic_t device_num = ATOMIC_INIT(0); |
719 | 714 | ||
720 | DPRINT_DBG(VMBUS_DRV, "child device (%p) registering", | 715 | DPRINT_DBG(VMBUS_DRV, "child device (%p) registering", |
721 | child_device_ctx); | 716 | child_device_obj); |
722 | 717 | ||
723 | /* Set the device name. Otherwise, device_register() will fail. */ | 718 | /* Set the device name. Otherwise, device_register() will fail. */ |
724 | dev_set_name(&child_device_ctx->device, "vmbus_0_%d", | 719 | dev_set_name(&child_device_obj->device, "vmbus_0_%d", |
725 | atomic_inc_return(&device_num)); | 720 | atomic_inc_return(&device_num)); |
726 | 721 | ||
727 | /* The new device belongs to this bus */ | 722 | /* The new device belongs to this bus */ |
728 | child_device_ctx->device.bus = &vmbus_drv.bus; /* device->dev.bus; */ | 723 | child_device_obj->device.bus = &vmbus_drv.bus; /* device->dev.bus; */ |
729 | child_device_ctx->device.parent = &root_device_ctx->device; | 724 | child_device_obj->device.parent = &root_device_obj->device; |
730 | child_device_ctx->device.release = vmbus_device_release; | 725 | child_device_obj->device.release = vmbus_device_release; |
731 | 726 | ||
732 | /* | 727 | /* |
733 | * Register with the LDM. This will kick off the driver/device | 728 | * Register with the LDM. This will kick off the driver/device |
734 | * binding...which will eventually call vmbus_match() and vmbus_probe() | 729 | * binding...which will eventually call vmbus_match() and vmbus_probe() |
735 | */ | 730 | */ |
736 | ret = device_register(&child_device_ctx->device); | 731 | ret = device_register(&child_device_obj->device); |
737 | 732 | ||
738 | /* vmbus_probe() error does not get propergate to device_register(). */ | 733 | /* vmbus_probe() error does not get propergate to device_register(). */ |
739 | ret = child_device_ctx->device_obj.probe_error; | 734 | ret = child_device_obj->probe_error; |
740 | 735 | ||
741 | if (ret) | 736 | if (ret) |
742 | DPRINT_ERR(VMBUS_DRV, "unable to register child device (%p)", | 737 | DPRINT_ERR(VMBUS_DRV, "unable to register child device (%p)", |
743 | &child_device_ctx->device); | 738 | &child_device_obj->device); |
744 | else | 739 | else |
745 | DPRINT_INFO(VMBUS_DRV, "child device (%p) registered", | 740 | DPRINT_INFO(VMBUS_DRV, "child device (%p) registered", |
746 | &child_device_ctx->device); | 741 | &child_device_obj->device); |
747 | 742 | ||
748 | return ret; | 743 | return ret; |
749 | } | 744 | } |
@@ -754,19 +749,18 @@ int vmbus_child_device_register(struct hv_device *root_device_obj, | |||
754 | */ | 749 | */ |
755 | void vmbus_child_device_unregister(struct hv_device *device_obj) | 750 | void vmbus_child_device_unregister(struct hv_device *device_obj) |
756 | { | 751 | { |
757 | struct vm_device *device_ctx = to_vm_device(device_obj); | ||
758 | 752 | ||
759 | DPRINT_INFO(VMBUS_DRV, "unregistering child device (%p)", | 753 | DPRINT_INFO(VMBUS_DRV, "unregistering child device (%p)", |
760 | &device_ctx->device); | 754 | &device_obj->device); |
761 | 755 | ||
762 | /* | 756 | /* |
763 | * Kick off the process of unregistering the device. | 757 | * Kick off the process of unregistering the device. |
764 | * This will call vmbus_remove() and eventually vmbus_device_release() | 758 | * This will call vmbus_remove() and eventually vmbus_device_release() |
765 | */ | 759 | */ |
766 | device_unregister(&device_ctx->device); | 760 | device_unregister(&device_obj->device); |
767 | 761 | ||
768 | DPRINT_INFO(VMBUS_DRV, "child device (%p) unregistered", | 762 | DPRINT_INFO(VMBUS_DRV, "child device (%p) unregistered", |
769 | &device_ctx->device); | 763 | &device_obj->device); |
770 | } | 764 | } |
771 | 765 | ||
772 | /* | 766 | /* |
@@ -778,8 +772,7 @@ void vmbus_child_device_unregister(struct hv_device *device_obj) | |||
778 | */ | 772 | */ |
779 | static int vmbus_uevent(struct device *device, struct kobj_uevent_env *env) | 773 | static int vmbus_uevent(struct device *device, struct kobj_uevent_env *env) |
780 | { | 774 | { |
781 | struct vm_device *device_ctx = device_to_vm_device(device); | 775 | struct hv_device *dev = device_to_hv_device(device); |
782 | struct hv_device *dev = &device_ctx->device_obj; | ||
783 | int ret; | 776 | int ret; |
784 | 777 | ||
785 | DPRINT_INFO(VMBUS_DRV, "generating uevent - VMBUS_DEVICE_CLASS_GUID={" | 778 | DPRINT_INFO(VMBUS_DRV, "generating uevent - VMBUS_DEVICE_CLASS_GUID={" |
@@ -852,17 +845,17 @@ static int vmbus_match(struct device *device, struct device_driver *driver) | |||
852 | { | 845 | { |
853 | int match = 0; | 846 | int match = 0; |
854 | struct hv_driver *drv = drv_to_hv_drv(driver); | 847 | struct hv_driver *drv = drv_to_hv_drv(driver); |
855 | struct vm_device *device_ctx = device_to_vm_device(device); | 848 | struct hv_device *device_ctx = device_to_hv_device(device); |
856 | 849 | ||
857 | /* We found our driver ? */ | 850 | /* We found our driver ? */ |
858 | if (memcmp(&device_ctx->device_obj.dev_type, &drv->dev_type, | 851 | if (memcmp(&device_ctx->dev_type, &drv->dev_type, |
859 | sizeof(struct hv_guid)) == 0) { | 852 | sizeof(struct hv_guid)) == 0) { |
860 | 853 | ||
861 | device_ctx->device_obj.drv = drv->priv; | 854 | device_ctx->drv = drv->priv; |
862 | DPRINT_INFO(VMBUS_DRV, | 855 | DPRINT_INFO(VMBUS_DRV, |
863 | "device object (%p) set to driver object (%p)", | 856 | "device object (%p) set to driver object (%p)", |
864 | &device_ctx->device_obj, | 857 | &device_ctx, |
865 | device_ctx->device_obj.drv); | 858 | device_ctx->drv); |
866 | 859 | ||
867 | match = 1; | 860 | match = 1; |
868 | } | 861 | } |
@@ -878,7 +871,7 @@ static int vmbus_match(struct device *device, struct device_driver *driver) | |||
878 | */ | 871 | */ |
879 | static void vmbus_probe_failed_cb(struct work_struct *context) | 872 | static void vmbus_probe_failed_cb(struct work_struct *context) |
880 | { | 873 | { |
881 | struct vm_device *device_ctx = (struct vm_device *)context; | 874 | struct hv_device *device_ctx = (struct hv_device *)context; |
882 | 875 | ||
883 | /* | 876 | /* |
884 | * Kick off the process of unregistering the device. | 877 | * Kick off the process of unregistering the device. |
@@ -897,13 +890,11 @@ static int vmbus_probe(struct device *child_device) | |||
897 | int ret = 0; | 890 | int ret = 0; |
898 | struct hv_driver *drv = | 891 | struct hv_driver *drv = |
899 | drv_to_hv_drv(child_device->driver); | 892 | drv_to_hv_drv(child_device->driver); |
900 | struct vm_device *device_ctx = | 893 | struct hv_device *dev = device_to_hv_device(child_device); |
901 | device_to_vm_device(child_device); | ||
902 | struct hv_device *dev = &device_ctx->device_obj; | ||
903 | 894 | ||
904 | /* Let the specific open-source driver handles the probe if it can */ | 895 | /* Let the specific open-source driver handles the probe if it can */ |
905 | if (drv->driver.probe) { | 896 | if (drv->driver.probe) { |
906 | ret = device_ctx->device_obj.probe_error = | 897 | ret = dev->probe_error = |
907 | drv->driver.probe(child_device); | 898 | drv->driver.probe(child_device); |
908 | if (ret != 0) { | 899 | if (ret != 0) { |
909 | DPRINT_ERR(VMBUS_DRV, "probe() failed for device %s " | 900 | DPRINT_ERR(VMBUS_DRV, "probe() failed for device %s " |
@@ -1006,7 +997,7 @@ static void vmbus_bus_release(struct device *device) | |||
1006 | */ | 997 | */ |
1007 | static void vmbus_device_release(struct device *device) | 998 | static void vmbus_device_release(struct device *device) |
1008 | { | 999 | { |
1009 | struct vm_device *device_ctx = device_to_vm_device(device); | 1000 | struct hv_device *device_ctx = device_to_hv_device(device); |
1010 | 1001 | ||
1011 | kfree(device_ctx); | 1002 | kfree(device_ctx); |
1012 | 1003 | ||