Staging: hv: Rename struct device_context and re-arrange the fields inside
authorHaiyang Zhang <haiyangz@microsoft.com>
Wed, 17 Feb 2010 20:58:47 +0000 (20:58 +0000)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 4 Mar 2010 00:42:37 +0000 (16:42 -0800)
Rename struct device_context and re-arrange the fields inside.

Rename struct device_context to struct vm_device, and move struct device
field to the end according to Document/driver-model standard.

Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/hv/blkvsc_drv.c
drivers/staging/hv/netvsc_drv.c
drivers/staging/hv/storvsc_drv.c
drivers/staging/hv/vmbus.h
drivers/staging/hv/vmbus_drv.c

index 635692d59954379ec290619e1002ca869f7e049a..1d1a46f524d2d9478e096d42edb439a478da2d65 100644 (file)
@@ -93,7 +93,7 @@ struct blkvsc_request {
 /* Per device structure */
 struct block_device_context {
        /* point back to our device context */
-       struct device_context *device_ctx;
+       struct vm_device *device_ctx;
        struct kmem_cache *request_pool;
        spinlock_t lock;
        struct gendisk *gd;
@@ -255,7 +255,7 @@ static int blkvsc_probe(struct device *device)
                                (struct blkvsc_driver_context *)driver_ctx;
        struct storvsc_driver_object *storvsc_drv_obj =
                                &blkvsc_drv_ctx->drv_obj;
-       struct device_context *device_ctx = device_to_device_context(device);
+       struct vm_device *device_ctx = device_to_vm_device(device);
        struct hv_device *device_obj = &device_ctx->device_obj;
 
        struct block_device_context *blkdev = NULL;
@@ -746,7 +746,7 @@ static int blkvsc_remove(struct device *device)
                                (struct blkvsc_driver_context *)driver_ctx;
        struct storvsc_driver_object *storvsc_drv_obj =
                                &blkvsc_drv_ctx->drv_obj;
-       struct device_context *device_ctx = device_to_device_context(device);
+       struct vm_device *device_ctx = device_to_vm_device(device);
        struct hv_device *device_obj = &device_ctx->device_obj;
        struct block_device_context *blkdev = dev_get_drvdata(device);
        unsigned long flags;
@@ -866,7 +866,7 @@ static int blkvsc_submit_request(struct blkvsc_request *blkvsc_req,
                        void (*request_completion)(struct hv_storvsc_request *))
 {
        struct block_device_context *blkdev = blkvsc_req->dev;
-       struct device_context *device_ctx = blkdev->device_ctx;
+       struct vm_device *device_ctx = blkdev->device_ctx;
        struct driver_context *driver_ctx =
                        driver_to_driver_context(device_ctx->device.driver);
        struct blkvsc_driver_context *blkvsc_drv_ctx =
index 0a780671cefe3da2abf5f1e9a4497f0538b27b71..1af3dcbafd6554507c7da8f01618cf6ead2271f8 100644 (file)
@@ -41,7 +41,7 @@
 
 struct net_device_context {
        /* point back to our device context */
-       struct device_context *device_ctx;
+       struct vm_device *device_ctx;
        struct net_device_stats stats;
 };
 
@@ -271,7 +271,7 @@ retry_send:
 static void netvsc_linkstatus_callback(struct hv_device *device_obj,
                                       unsigned int status)
 {
-       struct device_context *device_ctx = to_device_context(device_obj);
+       struct vm_device *device_ctx = to_vm_device(device_obj);
        struct net_device *net = dev_get_drvdata(&device_ctx->device);
 
        DPRINT_ENTER(NETVSC_DRV);
@@ -298,7 +298,7 @@ static void netvsc_linkstatus_callback(struct hv_device *device_obj,
 static int netvsc_recv_callback(struct hv_device *device_obj,
                                struct hv_netvsc_packet *packet)
 {
-       struct device_context *device_ctx = to_device_context(device_obj);
+       struct vm_device *device_ctx = to_vm_device(device_obj);
        struct net_device *net = dev_get_drvdata(&device_ctx->device);
        struct net_device_context *net_device_ctx;
        struct sk_buff *skb;
@@ -390,7 +390,7 @@ static int netvsc_probe(struct device *device)
        struct netvsc_driver_context *net_drv_ctx =
                (struct netvsc_driver_context *)driver_ctx;
        struct netvsc_driver *net_drv_obj = &net_drv_ctx->drv_obj;
-       struct device_context *device_ctx = device_to_device_context(device);
+       struct vm_device *device_ctx = device_to_vm_device(device);
        struct hv_device *device_obj = &device_ctx->device_obj;
        struct net_device *net = NULL;
        struct net_device_context *net_device_ctx;
@@ -462,7 +462,7 @@ static int netvsc_remove(struct device *device)
        struct netvsc_driver_context *net_drv_ctx =
                (struct netvsc_driver_context *)driver_ctx;
        struct netvsc_driver *net_drv_obj = &net_drv_ctx->drv_obj;
-       struct device_context *device_ctx = device_to_device_context(device);
+       struct vm_device *device_ctx = device_to_vm_device(device);
        struct net_device *net = dev_get_drvdata(&device_ctx->device);
        struct hv_device *device_obj = &device_ctx->device_obj;
        int ret;
index a10fa0ea98e5a96da724932f8ee5733422caba98..3988f4bec1cef29b830e3d9b43dbc2992aee0415 100644 (file)
@@ -41,7 +41,7 @@ struct host_device_context {
        /* must be 1st field
         * FIXME this is a bug */
        /* point back to our device context */
-       struct device_context *device_ctx;
+       struct vm_device *device_ctx;
        struct kmem_cache *request_pool;
        unsigned int port;
        unsigned char path;
@@ -234,7 +234,7 @@ static int storvsc_probe(struct device *device)
                                (struct storvsc_driver_context *)driver_ctx;
        struct storvsc_driver_object *storvsc_drv_obj =
                                &storvsc_drv_ctx->drv_obj;
-       struct device_context *device_ctx = device_to_device_context(device);
+       struct vm_device *device_ctx = device_to_vm_device(device);
        struct hv_device *device_obj = &device_ctx->device_obj;
        struct Scsi_Host *host;
        struct host_device_context *host_device_ctx;
@@ -330,7 +330,7 @@ static int storvsc_remove(struct device *device)
                        (struct storvsc_driver_context *)driver_ctx;
        struct storvsc_driver_object *storvsc_drv_obj =
                        &storvsc_drv_ctx->drv_obj;
-       struct device_context *device_ctx = device_to_device_context(device);
+       struct vm_device *device_ctx = device_to_vm_device(device);
        struct hv_device *device_obj = &device_ctx->device_obj;
        struct Scsi_Host *host = dev_get_drvdata(device);
        struct host_device_context *host_device_ctx =
@@ -631,7 +631,7 @@ static int storvsc_queuecommand(struct scsi_cmnd *scmnd,
        int ret;
        struct host_device_context *host_device_ctx =
                (struct host_device_context *)scmnd->device->host->hostdata;
-       struct device_context *device_ctx = host_device_ctx->device_ctx;
+       struct vm_device *device_ctx = host_device_ctx->device_ctx;
        struct driver_context *driver_ctx =
                driver_to_driver_context(device_ctx->device.driver);
        struct storvsc_driver_context *storvsc_drv_ctx =
@@ -870,7 +870,7 @@ static int storvsc_host_reset_handler(struct scsi_cmnd *scmnd)
        int ret;
        struct host_device_context *host_device_ctx =
                (struct host_device_context *)scmnd->device->host->hostdata;
-       struct device_context *device_ctx = host_device_ctx->device_ctx;
+       struct vm_device *device_ctx = host_device_ctx->device_ctx;
 
        DPRINT_ENTER(STORVSC_DRV);
 
index ae0a896eb39258032ac3ac25fd8843036011ea6e..6404b8424beff4e8373fff95b476933f453f2c17 100644 (file)
@@ -43,23 +43,23 @@ struct driver_context {
        void (*shutdown)(struct device *);
 };
 
-struct device_context {
+struct vm_device {
        struct work_struct probe_failed_work_item;
        struct hv_guid class_id;
        struct hv_guid device_id;
        int probe_error;
-       struct device device;
        struct hv_device device_obj;
+       struct device device;
 };
 
-static inline struct device_context *to_device_context(struct hv_device *d)
+static inline struct vm_device *to_vm_device(struct hv_device *d)
 {
-       return container_of(d, struct device_context, device_obj);
+       return container_of(d, struct vm_device, device_obj);
 }
 
-static inline struct device_context *device_to_device_context(struct device *d)
+static inline struct vm_device *device_to_vm_device(struct device *d)
 {
-       return container_of(d, struct device_context, device);
+       return container_of(d, struct vm_device, device);
 }
 
 static inline struct driver_context *driver_to_driver_context(struct device_driver *d)
index 92d70cd881bafc09908a7f9dff6ce796cefdcab8..de8729d6820cf0ce2052164931729cbe40cb274f 100644 (file)
@@ -48,7 +48,7 @@ struct vmbus_driver_context {
        struct tasklet_struct event_dpc;
 
        /* The bus root device */
-       struct device_context device_ctx;
+       struct vm_device device_ctx;
 };
 
 static int vmbus_match(struct device *device, struct device_driver *driver);
@@ -136,7 +136,7 @@ static ssize_t vmbus_show_device_attr(struct device *dev,
                                      struct device_attribute *dev_attr,
                                      char *buf)
 {
-       struct device_context *device_ctx = device_to_device_context(dev);
+       struct vm_device *device_ctx = device_to_vm_device(dev);
        struct hv_device_info device_info;
 
        memset(&device_info, 0, sizeof(struct hv_device_info));
@@ -246,7 +246,7 @@ static int vmbus_bus_init(int (*drv_init)(struct hv_driver *drv))
 {
        struct vmbus_driver_context *vmbus_drv_ctx = &g_vmbus_drv;
        struct vmbus_driver *vmbus_drv_obj = &g_vmbus_drv.drv_obj;
-       struct device_context *dev_ctx = &g_vmbus_drv.device_ctx;
+       struct vm_device *dev_ctx = &g_vmbus_drv.device_ctx;
        int ret;
        unsigned int vector;
 
@@ -308,7 +308,7 @@ static int vmbus_bus_init(int (*drv_init)(struct hv_driver *drv))
        DPRINT_INFO(VMBUS_DRV, "irq 0x%x vector 0x%x", vmbus_irq, vector);
 
        /* Call to bus driver to add the root device */
-       memset(dev_ctx, 0, sizeof(struct device_context));
+       memset(dev_ctx, 0, sizeof(struct vm_device));
 
        ret = vmbus_drv_obj->Base.OnDeviceAdd(&dev_ctx->device_obj, &vector);
        if (ret != 0) {
@@ -369,7 +369,7 @@ static void vmbus_bus_exit(void)
        struct vmbus_driver *vmbus_drv_obj = &g_vmbus_drv.drv_obj;
        struct vmbus_driver_context *vmbus_drv_ctx = &g_vmbus_drv;
 
-       struct device_context *dev_ctx = &g_vmbus_drv.device_ctx;
+       struct vm_device *dev_ctx = &g_vmbus_drv.device_ctx;
 
        DPRINT_ENTER(VMBUS_DRV);
 
@@ -472,13 +472,13 @@ static struct hv_device *vmbus_child_device_create(struct hv_guid *type,
                                                   struct hv_guid *instance,
                                                   void *context)
 {
-       struct device_context *child_device_ctx;
+       struct vm_device *child_device_ctx;
        struct hv_device *child_device_obj;
 
        DPRINT_ENTER(VMBUS_DRV);
 
        /* Allocate the new child device */
-       child_device_ctx = kzalloc(sizeof(struct device_context), GFP_KERNEL);
+       child_device_ctx = kzalloc(sizeof(struct vm_device), GFP_KERNEL);
        if (!child_device_ctx) {
                DPRINT_ERR(VMBUS_DRV,
                        "unable to allocate device_context for child device");
@@ -527,10 +527,10 @@ static int vmbus_child_device_register(struct hv_device *root_device_obj,
                                       struct hv_device *child_device_obj)
 {
        int ret = 0;
-       struct device_context *root_device_ctx =
-                               to_device_context(root_device_obj);
-       struct device_context *child_device_ctx =
-                               to_device_context(child_device_obj);
+       struct vm_device *root_device_ctx =
+                               to_vm_device(root_device_obj);
+       struct vm_device *child_device_ctx =
+                               to_vm_device(child_device_obj);
        static atomic_t device_num = ATOMIC_INIT(0);
 
        DPRINT_ENTER(VMBUS_DRV);
@@ -573,7 +573,7 @@ static int vmbus_child_device_register(struct hv_device *root_device_obj,
  */
 static void vmbus_child_device_unregister(struct hv_device *device_obj)
 {
-       struct device_context *device_ctx = to_device_context(device_obj);
+       struct vm_device *device_ctx = to_vm_device(device_obj);
 
        DPRINT_ENTER(VMBUS_DRV);
 
@@ -611,7 +611,7 @@ static void vmbus_child_device_destroy(struct hv_device *device_obj)
  */
 static int vmbus_uevent(struct device *device, struct kobj_uevent_env *env)
 {
-       struct device_context *device_ctx = device_to_device_context(device);
+       struct vm_device *device_ctx = device_to_vm_device(device);
        int ret;
 
        DPRINT_ENTER(VMBUS_DRV);
@@ -688,7 +688,7 @@ static int vmbus_match(struct device *device, struct device_driver *driver)
 {
        int match = 0;
        struct driver_context *driver_ctx = driver_to_driver_context(driver);
-       struct device_context *device_ctx = device_to_device_context(device);
+       struct vm_device *device_ctx = device_to_vm_device(device);
 
        DPRINT_ENTER(VMBUS_DRV);
 
@@ -725,7 +725,7 @@ static int vmbus_match(struct device *device, struct device_driver *driver)
  */
 static void vmbus_probe_failed_cb(struct work_struct *context)
 {
-       struct device_context *device_ctx = (struct device_context *)context;
+       struct vm_device *device_ctx = (struct vm_device *)context;
 
        DPRINT_ENTER(VMBUS_DRV);
 
@@ -747,8 +747,8 @@ static int vmbus_probe(struct device *child_device)
        int ret = 0;
        struct driver_context *driver_ctx =
                        driver_to_driver_context(child_device->driver);
-       struct device_context *device_ctx =
-                       device_to_device_context(child_device);
+       struct vm_device *device_ctx =
+                       device_to_vm_device(child_device);
 
        DPRINT_ENTER(VMBUS_DRV);
 
@@ -872,7 +872,7 @@ static void vmbus_bus_release(struct device *device)
  */
 static void vmbus_device_release(struct device *device)
 {
-       struct device_context *device_ctx = device_to_device_context(device);
+       struct vm_device *device_ctx = device_to_vm_device(device);
 
        DPRINT_ENTER(VMBUS_DRV);