Skip to contentSkip to conversation

Staging: hv: Cleanup hyperv_driver variable names

PATCH In review K. Y. Srinivasan 3 participants 6 messages Feb 26, 2011 – Mar 2, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 6/6 Staging: hv: Cleanup hyperv_driver variable names

The title says it all.

---
 drivers/staging/hv/blkvsc_drv.c  |   46 +++++++++++++++---------------
 drivers/staging/hv/netvsc_drv.c  |   44 +++++++++++++++---------------
 drivers/staging/hv/storvsc_drv.c |   36 ++++++++++++------------
 drivers/staging/hv/vmbus.h       |    4 +-
 drivers/staging/hv/vmbus_drv.c   |   56 +++++++++++++++++++-------------------
 5 files changed, 93 insertions(+), 93 deletions(-)
drivers/staging/hv/blkvsc_drv.c +23 -23
index ceba20c..c924920 100644
@@ -119,7 +119,7 @@ struct block_device_context {
 struct blkvsc_hyperv_driver {
 	/* !! These must be the first 2 fields !! */
 	/* FIXME this is a bug! */
-	struct hyperv_driver drv_ctx;
+	struct hyperv_driver drv;
 	struct storvsc_driver_object drv_obj;
 };
 
@@ -174,7 +174,7 @@ static const struct block_device_operations block_ops = {
 static int blkvsc_drv_init(int (*drv_init)(struct hyperv_driver *drv))
 {
 	struct storvsc_driver_object *storvsc_drv_obj = &g_blkvsc_drv.drv_obj;
-	struct hyperv_driver *drv_ctx = &g_blkvsc_drv.drv_ctx;
+	struct hyperv_driver *drv = &g_blkvsc_drv.drv;
 	int ret;
 
 	storvsc_drv_obj->ring_buffer_size = blkvsc_ringbuffer_size;
@@ -182,16 +182,16 @@ static int blkvsc_drv_init(int (*drv_init)(struct hyperv_driver *drv))
 	/* 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.class_id,
+	drv->driver.name = storvsc_drv_obj->base.name;
+	memcpy(&drv->class_id, &storvsc_drv_obj->base.class_id,
 	       sizeof(struct hv_guid));
 
-	drv_ctx->probe = blkvsc_probe;
-	drv_ctx->remove = blkvsc_remove;
-	drv_ctx->shutdown = blkvsc_shutdown;
+	drv->probe = blkvsc_probe;
+	drv->remove = blkvsc_remove;
+	drv->shutdown = blkvsc_shutdown;
 
 	/* The driver belongs to vmbus */
-	ret = vmbus_child_driver_register(drv_ctx);
+	ret = vmbus_child_driver_register(drv);
 
 	return ret;
 }
@@ -206,7 +206,7 @@ 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 hyperv_driver *drv_ctx = &g_blkvsc_drv.drv_ctx;
+	struct hyperv_driver *drv = &g_blkvsc_drv.drv;
 	struct device *current_dev;
 	int ret;
 
@@ -214,7 +214,7 @@ static void blkvsc_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,
 					     blkvsc_drv_exit_cb);
 
@@ -233,7 +233,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);
+	vmbus_child_driver_unregister(drv);
 
 	return;
 }
@@ -243,12 +243,12 @@ static void blkvsc_drv_exit(void)
  */
 static int blkvsc_probe(struct device *device)
 {
-	struct hyperv_driver *driver_ctx =
+	struct hyperv_driver *drv =
 				driver_to_hyperv_driver(device->driver);
-	struct blkvsc_hyperv_driver *blkvsc_drv_ctx =
-				(struct blkvsc_hyperv_driver *)driver_ctx;
+	struct blkvsc_hyperv_driver *blkvsc_drv =
+				(struct blkvsc_hyperv_driver *)drv;
 	struct storvsc_driver_object *storvsc_drv_obj =
-				&blkvsc_drv_ctx->drv_obj;
+				&blkvsc_drv->drv_obj;
 	struct hyperv_device *device_obj = device_to_hyperv_device(device);
 
 	struct block_device_context *blkdev = NULL;
@@ -727,12 +727,12 @@ static int blkvsc_do_read_capacity16(struct block_device_context *blkdev)
  */
 static int blkvsc_remove(struct device *device)
 {
-	struct hyperv_driver *driver_ctx =
+	struct hyperv_driver *drv =
 				driver_to_hyperv_driver(device->driver);
-	struct blkvsc_hyperv_driver *blkvsc_drv_ctx =
-				(struct blkvsc_hyperv_driver *)driver_ctx;
+	struct blkvsc_hyperv_driver *blkvsc_drv =
+				(struct blkvsc_hyperv_driver *)drv;
 	struct storvsc_driver_object *storvsc_drv_obj =
-				&blkvsc_drv_ctx->drv_obj;
+				&blkvsc_drv->drv_obj;
 	struct hyperv_device *device_obj = device_to_hyperv_device(device);
 	struct block_device_context *blkdev = dev_get_drvdata(device);
 	unsigned long flags;
@@ -849,12 +849,12 @@ static int blkvsc_submit_request(struct blkvsc_request *blkvsc_req,
 {
 	struct block_device_context *blkdev = blkvsc_req->dev;
 	struct hyperv_device *device_obj = blkdev->device_obj;
-	struct hyperv_driver *driver_ctx =
+	struct hyperv_driver *drv =
 			driver_to_hyperv_driver(device_obj->device.driver);
-	struct blkvsc_hyperv_driver *blkvsc_drv_ctx =
-			(struct blkvsc_hyperv_driver *)driver_ctx;
+	struct blkvsc_hyperv_driver *blkvsc_drv =
+			(struct blkvsc_hyperv_driver *)drv;
 	struct storvsc_driver_object *storvsc_drv_obj =
-			&blkvsc_drv_ctx->drv_obj;
+			&blkvsc_drv->drv_obj;
 	struct hv_storvsc_request *storvsc_req;
 	int ret;
 
drivers/staging/hv/netvsc_drv.c +22 -22

105 lines not on this page · raw message

drivers/staging/hv/storvsc_drv.c +18 -18
index 659d385..28f6568 100644
@@ -67,7 +67,7 @@ struct storvsc_cmd_request {
 struct storvsc_hyperv_driver {
 	/* !! These must be the first 2 fields !! */
 	/* FIXME this is a bug... */
-	struct hyperv_driver drv_ctx;
+	struct hyperv_driver drv;
 	struct storvsc_driver_object drv_obj;
 };
 
@@ -139,7 +139,7 @@ static int storvsc_drv_init(int (*drv_init)(struct hyperv_driver *drv))
 {
 	int ret;
 	struct storvsc_driver_object *storvsc_drv_obj = &g_storvsc_drv.drv_obj;
-	struct hyperv_driver *drv_ctx = &g_storvsc_drv.drv_ctx;
+	struct hyperv_driver *drv = &g_storvsc_drv.drv;
 
 	storvsc_drv_obj->ring_buffer_size = storvsc_ringbuffer_size;
 
@@ -161,15 +161,15 @@ static int storvsc_drv_init(int (*drv_init)(struct hyperv_driver *drv))
 		return -1;
 	}
 
-	drv_ctx->driver.name = storvsc_drv_obj->base.name;
-	memcpy(&drv_ctx->class_id, &storvsc_drv_obj->base.class_id,
+	drv->driver.name = storvsc_drv_obj->base.name;
+	memcpy(&drv->class_id, &storvsc_drv_obj->base.class_id,
 	       sizeof(struct hv_guid));
 
-	drv_ctx->probe = storvsc_probe;
-	drv_ctx->remove = storvsc_remove;
+	drv->probe = storvsc_probe;
+	drv->remove = storvsc_remove;
 
 	/* The driver belongs to vmbus */
-	ret = vmbus_child_driver_register(drv_ctx);
+	ret = vmbus_child_driver_register(drv);
 
 	return ret;
 }
@@ -184,7 +184,7 @@ static int storvsc_drv_exit_cb(struct device *dev, void *data)
 static void storvsc_drv_exit(void)
 {
 	struct storvsc_driver_object *storvsc_drv_obj = &g_storvsc_drv.drv_obj;
-	struct hyperv_driver *drv_ctx = &g_storvsc_drv.drv_ctx;
+	struct hyperv_driver *drv = &g_storvsc_drv.drv;
 	struct device *current_dev = NULL;
 	int ret;
 
@@ -192,7 +192,7 @@ static void storvsc_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,
 					     storvsc_drv_exit_cb);
 
@@ -210,7 +210,7 @@ static void storvsc_drv_exit(void)
 	if (storvsc_drv_obj->base.cleanup)
 		storvsc_drv_obj->base.cleanup(&storvsc_drv_obj->base);
 
-	vmbus_child_driver_unregister(drv_ctx);
+	vmbus_child_driver_unregister(drv);
 	return;
 }
 
@@ -220,12 +220,12 @@ static void storvsc_drv_exit(void)
 static int storvsc_probe(struct device *device)
 {
 	int ret;
-	struct hyperv_driver *driver_ctx =
+	struct hyperv_driver *drv =
 				driver_to_hyperv_driver(device->driver);
-	struct storvsc_hyperv_driver *storvsc_drv_ctx =
-				(struct storvsc_hyperv_driver *)driver_ctx;
+	struct storvsc_hyperv_driver *storvsc_drv =
+				(struct storvsc_hyperv_driver *)drv;
 	struct storvsc_driver_object *storvsc_drv_obj =
-				&storvsc_drv_ctx->drv_obj;
+				&storvsc_drv->drv_obj;
 	struct hyperv_device *device_obj = device_to_hyperv_device(device);
 	struct Scsi_Host *host;
 	struct host_device_context *host_device_ctx;
@@ -304,10 +304,10 @@ static int storvsc_probe(struct device *device)
 static int storvsc_remove(struct device *device)
 {
 	int ret;
-	struct hyperv_driver *driver_ctx =
+	struct hyperv_driver *drv =
 			driver_to_hyperv_driver(device->driver);
 	struct storvsc_hyperv_driver *storvsc_drv_ctx =
-			(struct storvsc_hyperv_driver *)driver_ctx;
+			(struct storvsc_hyperv_driver *)drv;
 	struct storvsc_driver_object *storvsc_drv_obj =
 			&storvsc_drv_ctx->drv_obj;
 	struct hyperv_device *device_obj = device_to_hyperv_device(device);
@@ -601,10 +601,10 @@ static int storvsc_queuecommand_lck(struct scsi_cmnd *scmnd,
 	struct host_device_context *host_device_obj =
 		(struct host_device_context *)scmnd->device->host->hostdata;
 	struct hyperv_device *device_obj = host_device_obj->device_obj;
-	struct hyperv_driver *driver_ctx =
+	struct hyperv_driver *drv =
 		driver_to_hyperv_driver(device_obj->device.driver);
 	struct storvsc_hyperv_driver *storvsc_drv_ctx =
-		(struct storvsc_hyperv_driver *)driver_ctx;
+		(struct storvsc_hyperv_driver *)drv;
 	struct storvsc_driver_object *storvsc_drv_obj =
 		&storvsc_drv_ctx->drv_obj;
 	struct hv_storvsc_request *request;
drivers/staging/hv/vmbus.h +2 -2
index 617c3ed..65efb49 100644
@@ -77,8 +77,8 @@ driver_to_hyperv_driver(struct device_driver *d)
 
 
 /* Vmbus interface */
-int vmbus_child_driver_register(struct hyperv_driver *driver_ctx);
-void vmbus_child_driver_unregister(struct hyperv_driver *driver_ctx);
+int vmbus_child_driver_register(struct hyperv_driver *drv);
+void vmbus_child_driver_unregister(struct hyperv_driver *drv);
 
 extern struct completion hv_channel_ready;
 
drivers/staging/hv/vmbus_drv.c +28 -28

155 lines not on this page · raw message

Signature · 1 line
1.5.5.6
#1 lore raw
Quoted 2 lines · K. Y. Srinivasan

The title says it all.

For this patch the rename_rev.pl command is:

rename_rev.pl -nc -e 's/(drv|driver)_ctx/drv/g'

drivers/staging/hv/vmbus_drv.c struct vmbus_hyperv_driver { · line 48

Quoted 6 lines
drivers/staging/hv/vmbus_drv.c +0 -0
@@ -46,7 +46,7 @@ struct vmbus_hyperv_driver {
 	/* FIXME, this is a bug */
 	/* The driver field is not used in here. Instead, the bus field is */
 	/* used to represent the driver */
        ^^

This comment out of date now that we're using container_of().

drivers/staging/hv/vmbus_drv.c struct vmbus_hyperv_driver { · line 49

Quoted 2 lines
drivers/staging/hv/vmbus_drv.c +1 -1
-	struct hyperv_driver drv_ctx;
+	struct hyperv_driver dummy;
                             ^^^^^

Delete.

Quoted 5 lines
drivers/staging/hv/vmbus_drv.c +0 -1
@@ -849,18 +849,18 @@ static int vmbus_uevent(struct device *device, struct kobj_uevent_env *env)
 static int vmbus_match(struct device *device, struct device_driver *driver)
 {
 	int match = 0;
-	struct hyperv_driver *driver_ctx = driver_to_hyperv_driver(driver);

drivers/staging/hv/vmbus_drv.c static int vmbus_uevent(struct device *device, struct kobj_uevent_env *env) · line 859

Quoted 10 lines
drivers/staging/hv/vmbus_drv.c +3 -2
+	struct hyperv_driver *drv = driver_to_hyperv_driver(driver);
 	struct hyperv_device *device_obj = device_to_hyperv_device(device);
 
 	/* We found our driver ? */
-	if (memcmp(&device_obj->class_id, &driver_ctx->class_id,
+	if (memcmp(&device_obj->class_id, &drv->class_id,
 		   sizeof(struct hv_guid)) == 0) {
 		/*
-		 * !! NOTE: The driver_ctx is not a vmbus_drv_ctx. We typecast
+		 * !! NOTE: The drv is not a vmbus_drv_ctx. We typecast
                                                      ^^^^

Out of date.

regards,
dan carpenter

#2 lore raw
Quoted 18 lines

-----Original Message-----
From: Dan Carpenter [mailto:[email protected]]
Sent: Friday, February 25, 2011 10:41 PM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 6/6] Staging: hv: Cleanup hyperv_driver variable names

Quoted 2 lines · K. Y. Srinivasan

The title says it all.

For this patch the rename_rev.pl command is:

rename_rev.pl -nc -e 's/(drv|driver)_ctx/drv/g'

Quoted 8 lines

drivers/staging/hv/vmbus_drv.c struct vmbus_hyperv_driver { · line 48

Quoted 6 lines
drivers/staging/hv/vmbus_drv.c +0 -0
@@ -46,7 +46,7 @@ struct vmbus_hyperv_driver {
 	/* FIXME, this is a bug */
 	/* The driver field is not used in here. Instead, the bus field is */
 	/* used to represent the driver */
        ^^

This comment out of date now that we're using container_of().

This requirement is for a different reason. We had patch out last Wednesday To address this but was rejected by Greg for other reasons. What is happening here is that in the vmbus_match function we need to get at a certain field in a driver agnostic way. This hack solves the problem. It will be removed once this series goes in.

Quoted 5 lines

drivers/staging/hv/vmbus_drv.c struct vmbus_hyperv_driver { · line 49

Quoted 3 lines
drivers/staging/hv/vmbus_drv.c +1 -1
-	struct hyperv_driver drv_ctx;
+	struct hyperv_driver dummy;
                             ^^^^^

Delete.

This is the hack I talked about earlier. This will go away once this series goes in.

Quoted 18 lines

drivers/staging/hv/vmbus_drv.c static int vmbus_uevent(struct device *device, struct

Quoted 2 lines
drivers/staging/hv/vmbus_drv.c +0 -0
@@ -849,18 +849,18 @@ static int vmbus_uevent(struct device *device, struct

kobj_uevent_env *env)

Quoted 4 lines
drivers/staging/hv/vmbus_drv.c +0 -1
 static int vmbus_match(struct device *device, struct device_driver *driver)
 {
 	int match = 0;
-	struct hyperv_driver *driver_ctx = driver_to_hyperv_driver(driver);

drivers/staging/hv/vmbus_drv.c static int vmbus_uevent(struct device *device, struct kobj_uevent_env *env) · line 859

Quoted 10 lines
drivers/staging/hv/vmbus_drv.c +3 -2
+	struct hyperv_driver *drv = driver_to_hyperv_driver(driver);
 	struct hyperv_device *device_obj = device_to_hyperv_device(device);
 
 	/* We found our driver ? */
-	if (memcmp(&device_obj->class_id, &driver_ctx->class_id,
+	if (memcmp(&device_obj->class_id, &drv->class_id,
 		   sizeof(struct hv_guid)) == 0) {
 		/*
-		 * !! NOTE: The driver_ctx is not a vmbus_drv_ctx. We typecast
+		 * !! NOTE: The drv is not a vmbus_drv_ctx. We typecast
                                                      ^^^^
Quoted 1 line

Out of date.

This hack is still required. We will get rid of this shortly.

Regards,

K. Y

Quoted 3 lines

regards,
dan carpenter

#3 lore raw
In reply to K. Y. Srinivasan
Quoted 1 line · K. Y. Srinivasan

The title says it all.

That's a horrible changelog comment. So bad that I would rather see an empty message than this one. Seriously, it give no description, and makes us think that the whole patch is obvious, when it really isn't.

What did you change them to?
What did you change them from?
What was your motivation in changing them?
How were you feeling when the names changed?

Ok, maybe not the last one, but you get the idea.

thanks,

greg k-h

#4 lore raw
Quoted 18 lines

-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Monday, February 28, 2011 9:59 PM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Haiyang Zhang; Hank Janssen
Subject: Re: [PATCH 6/6] Staging: hv: Cleanup hyperv_driver variable names

Quoted 1 line · K. Y. Srinivasan

The title says it all.

That's a horrible changelog comment. So bad that I would rather see an empty message than this one. Seriously, it give no description, and makes us think that the whole patch is obvious, when it really isn't.

Quoted 6 lines

What did you change them to?
What did you change them from?
What was your motivation in changing them?
How were you feeling when the names changed?

Ok, maybe not the last one, but you get the idea.

Greg, these changes (patches 1 through 6) change so much in this
sub-system that until these changes go in, our cleanup efforts are stalled. That is the main reason I was so hasty in submitting these patches.
Clearly, I need to provide a better changelog comment; and I will. Looking at your other comments, I am wondering if the granularity I chose for breaking up the changes that had to be done is also a significant part of the problem. If it is ok with you, I could generate a patch that deals with all device related issues and a patch that deals with all driver related issues. These patches obviously will do more than one thing (however they will all be related); but at least they
won't have intermediate state that would be objectionable. Let me know.

Regards,

K. Y

#5 lore raw
Quoted 23 lines · KY Srinivasan
Quoted 23 lines

-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Monday, February 28, 2011 9:59 PM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Haiyang Zhang; Hank Janssen
Subject: Re: [PATCH 6/6] Staging: hv: Cleanup hyperv_driver variable names

Quoted 1 line · K. Y. Srinivasan

The title says it all.

That's a horrible changelog comment. So bad that I would rather see an empty message than this one. Seriously, it give no description, and makes us think that the whole patch is obvious, when it really isn't.

What did you change them to?
What did you change them from?
What was your motivation in changing them?
How were you feeling when the names changed?

Quoted 5 lines
Quoted 1 line

Ok, maybe not the last one, but you get the idea.

Greg, these changes (patches 1 through 6) change so much in this sub-system that until these changes go in, our cleanup efforts are stalled.

Ok, but that's not my issue, it's yours :)

And what's the rush?

Quoted 10 lines

That is the main reason I was so hasty in submitting these patches. Clearly, I need to provide a better changelog comment; and I will. Looking at your other comments, I am wondering if the granularity I chose for breaking up the changes that had to be done is also a significant part of the problem. If it is ok with you, I could generate a patch that deals with all device related issues and a patch that deals with all driver related issues. These patches obviously will do more than one thing (however they will all be related); but at least they won't have intermediate state that would be objectionable. Let me know.

Ick, no, you need to break these up into smaller pieces than just the 6 you did here, as you were still doing more than one thing per patch.

Please make them simpler, not more complex.

thanks,

greg k-h