Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 236318
b: refs/heads/master
c: 150f939
h: refs/heads/master
v: v3
  • Loading branch information
K. Y. Srinivasan authored and Greg Kroah-Hartman committed Mar 7, 2011
1 parent ff7dc9b commit bebfbc2
Show file tree
Hide file tree
Showing 8 changed files with 104 additions and 119 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 06de23f788245414344316b02ccb1e6fdc21bf9a
refs/heads/master: 150f93989ef327698f64527b334a6d2129066704
43 changes: 20 additions & 23 deletions trunk/drivers/staging/hv/blkvsc_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,6 @@ struct block_device_context {

/* Per driver */
struct blkvsc_driver_context {
/* !! These must be the first 2 fields !! */
/* FIXME this is a bug! */
struct driver_context drv_ctx;
struct storvsc_driver_object drv_obj;
};

Expand Down Expand Up @@ -174,24 +171,24 @@ static const struct block_device_operations block_ops = {
static int blkvsc_drv_init(int (*drv_init)(struct hv_driver *drv))
{
struct storvsc_driver_object *storvsc_drv_obj = &g_blkvsc_drv.drv_obj;
struct driver_context *drv_ctx = &g_blkvsc_drv.drv_ctx;
struct hv_driver *drv = &g_blkvsc_drv.drv_obj.base;
int ret;

storvsc_drv_obj->ring_buffer_size = blkvsc_ringbuffer_size;

drv->priv = storvsc_drv_obj;

/* Callback to client driver to complete the initialization */
drv_init(&storvsc_drv_obj->base);

drv_ctx->driver.name = storvsc_drv_obj->base.name;
memcpy(&drv_ctx->class_id, &storvsc_drv_obj->base.dev_type,
sizeof(struct hv_guid));
drv->driver.name = storvsc_drv_obj->base.name;

drv_ctx->driver.probe = blkvsc_probe;
drv_ctx->driver.remove = blkvsc_remove;
drv_ctx->driver.shutdown = blkvsc_shutdown;
drv->driver.probe = blkvsc_probe;
drv->driver.remove = blkvsc_remove;
drv->driver.shutdown = blkvsc_shutdown;

/* The driver belongs to vmbus */
ret = vmbus_child_driver_register(&drv_ctx->driver);
ret = vmbus_child_driver_register(&drv->driver);

return ret;
}
Expand All @@ -206,15 +203,15 @@ static int blkvsc_drv_exit_cb(struct device *dev, void *data)
static void blkvsc_drv_exit(void)
{
struct storvsc_driver_object *storvsc_drv_obj = &g_blkvsc_drv.drv_obj;
struct driver_context *drv_ctx = &g_blkvsc_drv.drv_ctx;
struct hv_driver *drv = &g_blkvsc_drv.drv_obj.base;
struct device *current_dev;
int ret;

while (1) {
current_dev = NULL;

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

Expand All @@ -233,7 +230,7 @@ static void blkvsc_drv_exit(void)
if (storvsc_drv_obj->base.cleanup)
storvsc_drv_obj->base.cleanup(&storvsc_drv_obj->base);

vmbus_child_driver_unregister(&drv_ctx->driver);
vmbus_child_driver_unregister(&drv->driver);

return;
}
Expand All @@ -243,10 +240,10 @@ static void blkvsc_drv_exit(void)
*/
static int blkvsc_probe(struct device *device)
{
struct driver_context *driver_ctx =
driver_to_driver_context(device->driver);
struct hv_driver *drv =
drv_to_hv_drv(device->driver);
struct blkvsc_driver_context *blkvsc_drv_ctx =
(struct blkvsc_driver_context *)driver_ctx;
(struct blkvsc_driver_context *)drv->priv;
struct storvsc_driver_object *storvsc_drv_obj =
&blkvsc_drv_ctx->drv_obj;
struct vm_device *device_ctx = device_to_vm_device(device);
Expand Down Expand Up @@ -728,10 +725,10 @@ static int blkvsc_do_read_capacity16(struct block_device_context *blkdev)
*/
static int blkvsc_remove(struct device *device)
{
struct driver_context *driver_ctx =
driver_to_driver_context(device->driver);
struct hv_driver *drv =
drv_to_hv_drv(device->driver);
struct blkvsc_driver_context *blkvsc_drv_ctx =
(struct blkvsc_driver_context *)driver_ctx;
(struct blkvsc_driver_context *)drv->priv;
struct storvsc_driver_object *storvsc_drv_obj =
&blkvsc_drv_ctx->drv_obj;
struct vm_device *device_ctx = device_to_vm_device(device);
Expand Down Expand Up @@ -851,10 +848,10 @@ static int blkvsc_submit_request(struct blkvsc_request *blkvsc_req,
{
struct block_device_context *blkdev = blkvsc_req->dev;
struct vm_device *device_ctx = blkdev->device_ctx;
struct driver_context *driver_ctx =
driver_to_driver_context(device_ctx->device.driver);
struct hv_driver *drv =
drv_to_hv_drv(device_ctx->device.driver);
struct blkvsc_driver_context *blkvsc_drv_ctx =
(struct blkvsc_driver_context *)driver_ctx;
(struct blkvsc_driver_context *)drv->priv;
struct storvsc_driver_object *storvsc_drv_obj =
&blkvsc_drv_ctx->drv_obj;
struct hv_storvsc_request *storvsc_req;
Expand Down
32 changes: 15 additions & 17 deletions trunk/drivers/staging/hv/hv_mouse.c
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,6 @@ struct input_device_context {
};

struct mousevsc_driver_context {
struct driver_context drv_ctx;
struct mousevsc_drv_obj drv_obj;
};

Expand Down Expand Up @@ -823,10 +822,10 @@ static int mousevsc_probe(struct device *device)
{
int ret = 0;

struct driver_context *driver_ctx =
driver_to_driver_context(device->driver);
struct hv_driver *drv =
drv_to_hv_drv(device->driver);
struct mousevsc_driver_context *mousevsc_drv_ctx =
(struct mousevsc_driver_context *)driver_ctx;
(struct mousevsc_driver_context *)drv->priv;
struct mousevsc_drv_obj *mousevsc_drv_obj = &mousevsc_drv_ctx->drv_obj;

struct vm_device *device_ctx = device_to_vm_device(device);
Expand Down Expand Up @@ -854,10 +853,10 @@ static int mousevsc_remove(struct device *device)
{
int ret = 0;

struct driver_context *driver_ctx =
driver_to_driver_context(device->driver);
struct hv_driver *drv =
drv_to_hv_drv(device->driver);
struct mousevsc_driver_context *mousevsc_drv_ctx =
(struct mousevsc_driver_context *)driver_ctx;
(struct mousevsc_driver_context *)drv->priv;
struct mousevsc_drv_obj *mousevsc_drv_obj = &mousevsc_drv_ctx->drv_obj;

struct vm_device *device_ctx = device_to_vm_device(device);
Expand Down Expand Up @@ -958,7 +957,7 @@ static int mousevsc_drv_exit_cb(struct device *dev, void *data)
static void mousevsc_drv_exit(void)
{
struct mousevsc_drv_obj *mousevsc_drv_obj = &g_mousevsc_drv.drv_obj;
struct driver_context *drv_ctx = &g_mousevsc_drv.drv_ctx;
struct hv_driver *drv = &g_mousevsc_drv.drv_obj.Base;
int ret;

struct device *current_dev = NULL;
Expand All @@ -967,7 +966,7 @@ static void mousevsc_drv_exit(void)
current_dev = NULL;

/* Get the device */
ret = driver_for_each_device(&drv_ctx->driver, NULL,
ret = driver_for_each_device(&drv->driver, NULL,
(void *)&current_dev,
mousevsc_drv_exit_cb);
if (ret)
Expand All @@ -983,7 +982,7 @@ static void mousevsc_drv_exit(void)
if (mousevsc_drv_obj->Base.cleanup)
mousevsc_drv_obj->Base.cleanup(&mousevsc_drv_obj->Base);

vmbus_child_driver_unregister(&drv_ctx->driver);
vmbus_child_driver_unregister(&drv->driver);

return;
}
Expand All @@ -1010,22 +1009,21 @@ static int mouse_vsc_initialize(struct hv_driver *Driver)
static int __init mousevsc_init(void)
{
struct mousevsc_drv_obj *input_drv_obj = &g_mousevsc_drv.drv_obj;
struct driver_context *drv_ctx = &g_mousevsc_drv.drv_ctx;
struct hv_driver *drv = &g_mousevsc_drv.drv_obj.Base;

DPRINT_INFO(INPUTVSC_DRV, "Hyper-V Mouse driver initializing.");

/* Callback to client driver to complete the initialization */
mouse_vsc_initialize(&input_drv_obj->Base);

drv_ctx->driver.name = input_drv_obj->Base.name;
memcpy(&drv_ctx->class_id, &input_drv_obj->Base.dev_type,
sizeof(struct hv_guid));
drv->driver.name = input_drv_obj->Base.name;
drv->priv = input_drv_obj;

drv_ctx->driver.probe = mousevsc_probe;
drv_ctx->driver.remove = mousevsc_remove;
drv->driver.probe = mousevsc_probe;
drv->driver.remove = mousevsc_remove;

/* The driver belongs to vmbus */
vmbus_child_driver_register(&drv_ctx->driver);
vmbus_child_driver_register(&drv->driver);

return 0;
}
Expand Down
40 changes: 18 additions & 22 deletions trunk/drivers/staging/hv/netvsc_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@ struct net_device_context {
};

struct netvsc_driver_context {
/* !! These must be the first 2 fields !! */
/* Which is a bug FIXME! */
struct driver_context drv_ctx;
struct netvsc_driver drv_obj;
};

Expand Down Expand Up @@ -135,10 +132,10 @@ static void netvsc_xmit_completion(void *context)
static int netvsc_start_xmit(struct sk_buff *skb, struct net_device *net)
{
struct net_device_context *net_device_ctx = netdev_priv(net);
struct driver_context *driver_ctx =
driver_to_driver_context(net_device_ctx->device_ctx->device.driver);
struct hv_driver *drv =
drv_to_hv_drv(net_device_ctx->device_ctx->device.driver);
struct netvsc_driver_context *net_drv_ctx =
(struct netvsc_driver_context *)driver_ctx;
(struct netvsc_driver_context *)drv->priv;
struct netvsc_driver *net_drv_obj = &net_drv_ctx->drv_obj;
struct hv_netvsc_packet *packet;
int ret;
Expand Down Expand Up @@ -340,10 +337,10 @@ static const struct net_device_ops device_ops = {

static int netvsc_probe(struct device *device)
{
struct driver_context *driver_ctx =
driver_to_driver_context(device->driver);
struct hv_driver *drv =
drv_to_hv_drv(device->driver);
struct netvsc_driver_context *net_drv_ctx =
(struct netvsc_driver_context *)driver_ctx;
(struct netvsc_driver_context *)drv->priv;
struct netvsc_driver *net_drv_obj = &net_drv_ctx->drv_obj;
struct vm_device *device_ctx = device_to_vm_device(device);
struct hv_device *device_obj = &device_ctx->device_obj;
Expand Down Expand Up @@ -412,10 +409,10 @@ static int netvsc_probe(struct device *device)

static int netvsc_remove(struct device *device)
{
struct driver_context *driver_ctx =
driver_to_driver_context(device->driver);
struct hv_driver *drv =
drv_to_hv_drv(device->driver);
struct netvsc_driver_context *net_drv_ctx =
(struct netvsc_driver_context *)driver_ctx;
(struct netvsc_driver_context *)drv->priv;
struct netvsc_driver *net_drv_obj = &net_drv_ctx->drv_obj;
struct vm_device *device_ctx = device_to_vm_device(device);
struct net_device *net = dev_get_drvdata(&device_ctx->device);
Expand Down Expand Up @@ -462,15 +459,15 @@ static int netvsc_drv_exit_cb(struct device *dev, void *data)
static void netvsc_drv_exit(void)
{
struct netvsc_driver *netvsc_drv_obj = &g_netvsc_drv.drv_obj;
struct driver_context *drv_ctx = &g_netvsc_drv.drv_ctx;
struct hv_driver *drv = &g_netvsc_drv.drv_obj.base;
struct device *current_dev;
int ret;

while (1) {
current_dev = NULL;

/* Get the device */
ret = driver_for_each_device(&drv_ctx->driver, NULL,
ret = driver_for_each_device(&drv->driver, NULL,
&current_dev, netvsc_drv_exit_cb);
if (ret)
DPRINT_WARN(NETVSC_DRV,
Expand All @@ -489,33 +486,32 @@ static void netvsc_drv_exit(void)
if (netvsc_drv_obj->base.cleanup)
netvsc_drv_obj->base.cleanup(&netvsc_drv_obj->base);

vmbus_child_driver_unregister(&drv_ctx->driver);
vmbus_child_driver_unregister(&drv->driver);

return;
}

static int netvsc_drv_init(int (*drv_init)(struct hv_driver *drv))
{
struct netvsc_driver *net_drv_obj = &g_netvsc_drv.drv_obj;
struct driver_context *drv_ctx = &g_netvsc_drv.drv_ctx;
struct hv_driver *drv = &g_netvsc_drv.drv_obj.base;
int ret;

net_drv_obj->ring_buf_size = ring_size * PAGE_SIZE;
net_drv_obj->recv_cb = netvsc_recv_callback;
net_drv_obj->link_status_change = netvsc_linkstatus_callback;
drv->priv = net_drv_obj;

/* Callback to client driver to complete the initialization */
drv_init(&net_drv_obj->base);

drv_ctx->driver.name = net_drv_obj->base.name;
memcpy(&drv_ctx->class_id, &net_drv_obj->base.dev_type,
sizeof(struct hv_guid));
drv->driver.name = net_drv_obj->base.name;

drv_ctx->driver.probe = netvsc_probe;
drv_ctx->driver.remove = netvsc_remove;
drv->driver.probe = netvsc_probe;
drv->driver.remove = netvsc_remove;

/* The driver belongs to vmbus */
ret = vmbus_child_driver_register(&drv_ctx->driver);
ret = vmbus_child_driver_register(&drv->driver);

return ret;
}
Expand Down
Loading

0 comments on commit bebfbc2

Please sign in to comment.