Commit 779b4d17 authored by K. Y. Srinivasan's avatar K. Y. Srinivasan Committed by Greg Kroah-Hartman

Staging: hv: Get rid of the references to the priv element of struct hv_driver in net driver

In preparation for getting rid of the priv element from struct hv_driver,
get rid of the references to the priv element of struct
hv_driver in network driver.
Signed-off-by: default avatarK. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: default avatarHaiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: default avatarAbhishek Kane <v-abkane@microsoft.com>
Signed-off-by: default avatarHank Janssen <hjanssen@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 9f838864
...@@ -835,6 +835,9 @@ static void netvsc_receive(struct hv_device *device, ...@@ -835,6 +835,9 @@ static void netvsc_receive(struct hv_device *device,
int i, j; int i, j;
int count = 0, bytes_remain = 0; int count = 0, bytes_remain = 0;
unsigned long flags; unsigned long flags;
struct netvsc_driver *netvsc_drv =
drv_to_netvscdrv(device->device.driver);
LIST_HEAD(listHead); LIST_HEAD(listHead);
net_device = get_inbound_net_device(device); net_device = get_inbound_net_device(device);
...@@ -995,8 +998,7 @@ static void netvsc_receive(struct hv_device *device, ...@@ -995,8 +998,7 @@ static void netvsc_receive(struct hv_device *device,
} }
/* Pass it to the upper layer */ /* Pass it to the upper layer */
((struct netvsc_driver *)device->drv)-> netvsc_drv->recv_cb(device, netvsc_packet);
recv_cb(device, netvsc_packet);
netvsc_receive_completion(netvsc_packet-> netvsc_receive_completion(netvsc_packet->
completion.recv.recv_completion_ctx); completion.recv.recv_completion_ctx);
...@@ -1102,7 +1104,7 @@ static int netvsc_device_add(struct hv_device *device, void *additional_info) ...@@ -1102,7 +1104,7 @@ static int netvsc_device_add(struct hv_device *device, void *additional_info)
struct netvsc_device *net_device; struct netvsc_device *net_device;
struct hv_netvsc_packet *packet, *pos; struct hv_netvsc_packet *packet, *pos;
struct netvsc_driver *net_driver = struct netvsc_driver *net_driver =
(struct netvsc_driver *)device->drv; drv_to_netvscdrv(device->device.driver);
net_device = alloc_net_device(device); net_device = alloc_net_device(device);
if (!net_device) { if (!net_device) {
...@@ -1183,7 +1185,8 @@ static int netvsc_device_add(struct hv_device *device, void *additional_info) ...@@ -1183,7 +1185,8 @@ static int netvsc_device_add(struct hv_device *device, void *additional_info)
*/ */
int netvsc_initialize(struct hv_driver *drv) int netvsc_initialize(struct hv_driver *drv)
{ {
struct netvsc_driver *driver = (struct netvsc_driver *)drv; struct netvsc_driver *driver =
drv_to_netvscdrv(&drv->driver);
drv->name = driver_name; drv->name = driver_name;
memcpy(&drv->dev_type, &netvsc_device_type, sizeof(struct hv_guid)); memcpy(&drv->dev_type, &netvsc_device_type, sizeof(struct hv_guid));
......
...@@ -132,9 +132,8 @@ static void netvsc_xmit_completion(void *context) ...@@ -132,9 +132,8 @@ static void netvsc_xmit_completion(void *context)
static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net) static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net)
{ {
struct net_device_context *net_device_ctx = netdev_priv(net); struct net_device_context *net_device_ctx = netdev_priv(net);
struct hv_driver *drv = struct netvsc_driver *net_drv_obj =
drv_to_hv_drv(net_device_ctx->device_ctx->device.driver); drv_to_netvscdrv(net_device_ctx->device_ctx->device.driver);
struct netvsc_driver *net_drv_obj = drv->priv;
struct hv_netvsc_packet *packet; struct hv_netvsc_packet *packet;
int ret; int ret;
unsigned int i, num_pages; unsigned int i, num_pages;
...@@ -343,9 +342,8 @@ static void netvsc_send_garp(struct work_struct *w) ...@@ -343,9 +342,8 @@ static void netvsc_send_garp(struct work_struct *w)
static int netvsc_probe(struct device *device) static int netvsc_probe(struct device *device)
{ {
struct hv_driver *drv = struct netvsc_driver *net_drv_obj =
drv_to_hv_drv(device->driver); drv_to_netvscdrv(device->driver);
struct netvsc_driver *net_drv_obj = drv->priv;
struct hv_device *device_obj = device_to_hv_device(device); struct hv_device *device_obj = device_to_hv_device(device);
struct net_device *net = NULL; struct net_device *net = NULL;
struct net_device_context *net_device_ctx; struct net_device_context *net_device_ctx;
...@@ -413,9 +411,8 @@ static int netvsc_probe(struct device *device) ...@@ -413,9 +411,8 @@ static int netvsc_probe(struct device *device)
static int netvsc_remove(struct device *device) static int netvsc_remove(struct device *device)
{ {
struct hv_driver *drv = struct netvsc_driver *net_drv_obj =
drv_to_hv_drv(device->driver); drv_to_netvscdrv(device->driver);
struct netvsc_driver *net_drv_obj = drv->priv;
struct hv_device *device_obj = device_to_hv_device(device); struct hv_device *device_obj = device_to_hv_device(device);
struct net_device *net = dev_get_drvdata(&device_obj->device); struct net_device *net = dev_get_drvdata(&device_obj->device);
int ret; int ret;
...@@ -498,7 +495,6 @@ static int netvsc_drv_init(int (*drv_init)(struct hv_driver *drv)) ...@@ -498,7 +495,6 @@ static int netvsc_drv_init(int (*drv_init)(struct hv_driver *drv))
net_drv_obj->ring_buf_size = ring_size * PAGE_SIZE; net_drv_obj->ring_buf_size = ring_size * PAGE_SIZE;
net_drv_obj->recv_cb = netvsc_recv_callback; net_drv_obj->recv_cb = netvsc_recv_callback;
net_drv_obj->link_status_change = netvsc_linkstatus_callback; net_drv_obj->link_status_change = netvsc_linkstatus_callback;
drv->priv = net_drv_obj;
/* Callback to client driver to complete the initialization */ /* Callback to client driver to complete the initialization */
drv_init(&net_drv_obj->base); drv_init(&net_drv_obj->base);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment