Skip to contentSkip to conversation

Staging: hv: Simplify root device management

PATCH In review K. Y. Srinivasan 5 participants 38 messages Mar 10, 2011 – Mar 14, 2011 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [PATCH 00/21] Staging: hv: Cleanup vmbus driver

#1 lore raw

PATCH 1/21 Staging: hv: Simplify root device management

As part of simplifying root device management, get rid of the hv_driver object from vmbus_driver_context.

---
 drivers/staging/hv/vmbus_drv.c |   41 ++++++++++-----------------------------
 1 files changed, 11 insertions(+), 30 deletions(-)
drivers/staging/hv/vmbus_drv.c +11 -30
index 159dfda..884a4c6 100644
@@ -42,7 +42,6 @@
 
 /* Main vmbus driver data structure */
 struct vmbus_driver_context {
-	struct hv_driver drv_obj;
 
 	struct bus_type bus;
 	struct tasklet_struct msg_dpc;
@@ -458,7 +457,6 @@ static ssize_t vmbus_show_device_attr(struct device *dev,
 static int vmbus_bus_init(void)
 {
 	struct vmbus_driver_context *vmbus_drv_ctx = &vmbus_drv;
-	struct hv_driver *driver = &vmbus_drv.drv_obj;
 	struct hv_device *dev_ctx = &vmbus_drv.device_ctx;
 	int ret;
 	unsigned int vector;
@@ -474,13 +472,6 @@ static int vmbus_bus_init(void)
 			sizeof(struct vmbus_channel_packet_page_buffer),
 			sizeof(struct vmbus_channel_packet_multipage_buffer));
 
-	driver->name = driver_name;
-	memcpy(&driver->dev_type, &device_type, sizeof(struct hv_guid));
-
-	/* Setup dispatch table */
-	driver->dev_add	= vmbus_dev_add;
-	driver->dev_rm	= vmbus_dev_rm;
-	driver->cleanup	= vmbus_cleanup;
 
 	/* Hypervisor initialization...setup hypercall page..etc */
 	ret = hv_init();
@@ -490,22 +481,16 @@ static int vmbus_bus_init(void)
 		goto cleanup;
 	}
 
-	/* Sanity checks */
-	if (!driver->dev_add) {
-		DPRINT_ERR(VMBUS_DRV, "OnDeviceAdd() routine not set");
-		ret = -1;
-		goto cleanup;
-	}
 
-	vmbus_drv_ctx->bus.name = driver->name;
+	vmbus_drv_ctx->bus.name = driver_name;
 
 	/* Initialize the bus context */
 	tasklet_init(&vmbus_drv_ctx->msg_dpc, vmbus_msg_dpc,
-		     (unsigned long)driver);
+		     (unsigned long)NULL);
 	tasklet_init(&vmbus_drv_ctx->event_dpc, vmbus_event_dpc,
-		     (unsigned long)driver);
+		     (unsigned long)NULL);
 
-	/* Now, register the bus driver with LDM */
+	/* Now, register the bus  with LDM */
 	ret = bus_register(&vmbus_drv_ctx->bus);
 	if (ret) {
 		ret = -1;
@@ -514,7 +499,7 @@ static int vmbus_bus_init(void)
 
 	/* Get the interrupt resource */
 	ret = request_irq(vmbus_irq, vmbus_isr, IRQF_SAMPLE_RANDOM,
-			  driver->name, NULL);
+			  driver_name, NULL);
 
 	if (ret != 0) {
 		DPRINT_ERR(VMBUS_DRV, "ERROR - Unable to request IRQ %d",
@@ -529,10 +514,10 @@ static int vmbus_bus_init(void)
 
 	DPRINT_INFO(VMBUS_DRV, "irq 0x%x vector 0x%x", vmbus_irq, vector);
 
-	/* Call to bus driver to add the root device */
+	/* Add the root device */
 	memset(dev_ctx, 0, sizeof(struct hv_device));
 
-	ret = driver->dev_add(dev_ctx, &vector);
+	ret = vmbus_dev_add(dev_ctx, &vector);
 	if (ret != 0) {
 		DPRINT_ERR(VMBUS_DRV,
 			   "ERROR - Unable to add vmbus root device");
@@ -555,7 +540,7 @@ static int vmbus_bus_init(void)
 	/* Setup the device dispatch table */
 	dev_ctx->device.release = vmbus_bus_release;
 
-	/* Setup the bus as root device */
+	/* register the  root device */
 	ret = device_register(&dev_ctx->device);
 	if (ret) {
 		DPRINT_ERR(VMBUS_DRV,
@@ -582,17 +567,14 @@ cleanup:
  */
 static void vmbus_bus_exit(void)
 {
-	struct hv_driver *driver = &vmbus_drv.drv_obj;
 	struct vmbus_driver_context *vmbus_drv_ctx = &vmbus_drv;
 
 	struct hv_device *dev_ctx = &vmbus_drv.device_ctx;
 
 	/* Remove the root device */
-	if (driver->dev_rm)
-		driver->dev_rm(dev_ctx);
+	vmbus_dev_rm(dev_ctx);
 
-	if (driver->cleanup)
-		driver->cleanup(driver);
+	vmbus_cleanup(NULL);
 
 	/* Unregister the root bus device */
 	device_unregister(&dev_ctx->device);
@@ -1026,11 +1008,10 @@ static void vmbus_event_dpc(unsigned long data)
 
 static irqreturn_t vmbus_isr(int irq, void *dev_id)
 {
-	struct hv_driver *driver = &vmbus_drv.drv_obj;
 	int ret;
 
 	/* Call to bus driver to handle interrupt */
-	ret = vmbus_on_isr(driver);
+	ret = vmbus_on_isr(NULL);
 
 	/* Schedules a dpc if necessary */
 	if (ret > 0) {
Signature · 1 line
1.5.5.6
#2 lore raw

PATCH 2/21 Staging: hv: Change the signature for vmbus_cleanup()

In reply to a message not in the archive

As part of geting rid of hv_driver object from vmbus_driver_context, change the signature of vmbus_cleanup() function. Note that while vmbus_cleanup() was passed a pointer to hv_driver, this argument was unused.

---
 drivers/staging/hv/vmbus_drv.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
drivers/staging/hv/vmbus_drv.c +2 -3
index 884a4c6..95654b1 100644
@@ -190,9 +190,8 @@ static int vmbus_dev_rm(struct hv_device *dev)
 /*
  * vmbus_cleanup - Perform any cleanup when the driver is removed
  */
-static void vmbus_cleanup(struct hv_driver *drv)
+static void vmbus_cleanup(void)
 {
-	/* struct vmbus_driver *driver = (struct vmbus_driver *)drv; */
 
 	hv_cleanup();
 }
@@ -574,7 +573,7 @@ static void vmbus_bus_exit(void)
 	/* Remove the root device */
 	vmbus_dev_rm(dev_ctx);
 
-	vmbus_cleanup(NULL);
+	vmbus_cleanup();
 
 	/* Unregister the root bus device */
 	device_unregister(&dev_ctx->device);
Signature · 1 line
1.5.5.6
#3 lore raw

PATCH 3/21 Staging: hv: Get rid of the function vmbus_msg_dpc()

In reply to a message not in the archive

vmbus_msg_dpc() was a wrapper adding no additional value; get rid of this function.

---
 drivers/staging/hv/vmbus_drv.c |   15 ++-------------
 1 files changed, 2 insertions(+), 13 deletions(-)
drivers/staging/hv/vmbus_drv.c +2 -13
index 95654b1..7e67933 100644
@@ -56,7 +56,6 @@ static int vmbus_probe(struct device *device);
 static int vmbus_remove(struct device *device);
 static void vmbus_shutdown(struct device *device);
 static int vmbus_uevent(struct device *device, struct kobj_uevent_env *env);
-static void vmbus_msg_dpc(unsigned long data);
 static void vmbus_event_dpc(unsigned long data);
 
 static irqreturn_t vmbus_isr(int irq, void *dev_id);
@@ -214,7 +213,7 @@ static void vmbus_onmessage_work(struct work_struct *work)
 /*
  * vmbus_on_msg_dpc - DPC routine to handle messages from the hypervisior
  */
-static void vmbus_on_msg_dpc(struct hv_driver *drv)
+static void vmbus_on_msg_dpc(unsigned long data)
 {
 	int cpu = smp_processor_id();
 	void *page_addr = hv_context.synic_message_page[cpu];
@@ -484,7 +483,7 @@ static int vmbus_bus_init(void)
 	vmbus_drv_ctx->bus.name = driver_name;
 
 	/* Initialize the bus context */
-	tasklet_init(&vmbus_drv_ctx->msg_dpc, vmbus_msg_dpc,
+	tasklet_init(&vmbus_drv_ctx->msg_dpc, vmbus_on_msg_dpc,
 		     (unsigned long)NULL);
 	tasklet_init(&vmbus_drv_ctx->event_dpc, vmbus_event_dpc,
 		     (unsigned long)NULL);
@@ -985,16 +984,6 @@ static void vmbus_device_release(struct device *device)
 	/* !!DO NOT REFERENCE device_ctx anymore at this point!! */
 }
 
-/*
- * vmbus_msg_dpc - Tasklet routine to handle hypervisor messages
- */
-static void vmbus_msg_dpc(unsigned long data)
-{
-	struct hv_driver *driver = (struct hv_driver *)data;
-
-	/* Call to bus driver to handle interrupt */
-	vmbus_on_msg_dpc(driver);
-}
 
 /*
  * vmbus_event_dpc - Tasklet routine to handle hypervisor events
Signature · 1 line
1.5.5.6
#4 lore raw

PATCH 4/21 Staging: hv: Eliminate vmbus_event_dpc()

In reply to a message not in the archive

vmbus_event_dpc() was a wrapper function not adding any value; get rid of it.

---
 drivers/staging/hv/connection.c    |    2 +-
 drivers/staging/hv/vmbus_drv.c     |   11 +----------
 drivers/staging/hv/vmbus_private.h |    2 +-
 3 files changed, 3 insertions(+), 12 deletions(-)
drivers/staging/hv/connection.c +1 -1
index f7df479..fd589e3 100644
@@ -285,7 +285,7 @@ static void process_chn_event(void *context)
 /*
  * vmbus_on_event - Handler for events
  */
-void vmbus_on_event(void)
+void vmbus_on_event(unsigned long data)
 {
 	int dword;
 	int maxdword = MAX_NUM_CHANNELS_SUPPORTED >> 5;
drivers/staging/hv/vmbus_drv.c +1 -10
index 7e67933..4b4483b 100644
@@ -56,7 +56,6 @@ static int vmbus_probe(struct device *device);
 static int vmbus_remove(struct device *device);
 static void vmbus_shutdown(struct device *device);
 static int vmbus_uevent(struct device *device, struct kobj_uevent_env *env);
-static void vmbus_event_dpc(unsigned long data);
 
 static irqreturn_t vmbus_isr(int irq, void *dev_id);
 
@@ -485,7 +484,7 @@ static int vmbus_bus_init(void)
 	/* Initialize the bus context */
 	tasklet_init(&vmbus_drv_ctx->msg_dpc, vmbus_on_msg_dpc,
 		     (unsigned long)NULL);
-	tasklet_init(&vmbus_drv_ctx->event_dpc, vmbus_event_dpc,
+	tasklet_init(&vmbus_drv_ctx->event_dpc, vmbus_on_event,
 		     (unsigned long)NULL);
 
 	/* Now, register the bus  with LDM */
@@ -985,14 +984,6 @@ static void vmbus_device_release(struct device *device)
 }
 
 
-/*
- * vmbus_event_dpc - Tasklet routine to handle hypervisor events
- */
-static void vmbus_event_dpc(unsigned long data)
-{
-	/* Call to bus driver to handle interrupt */
-	vmbus_on_event();
-}
 
 static irqreturn_t vmbus_isr(int irq, void *dev_id)
 {
drivers/staging/hv/vmbus_private.h +1 -1
index 9f505c4..1b88b6f 100644
@@ -129,7 +129,7 @@ int vmbus_post_msg(void *buffer, size_t buflen);
 
 int vmbus_set_event(u32 child_relid);
 
-void vmbus_on_event(void);
+void vmbus_on_event(unsigned long data);
 
 
 #endif /* _VMBUS_PRIVATE_H_ */
Signature · 1 line
1.5.5.6
#5 lore raw

PATCH 5/21 Staging: hv: Change the signature for vmbus_on_isr()

In reply to a message not in the archive

As part of getting getting rid of the hv_driver object from vmbus_driver_context, change the signature for vmbus_on_isr. Note that the argument to vmbus_on_isr() is not used.

---
 drivers/staging/hv/vmbus_drv.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
drivers/staging/hv/vmbus_drv.c +2 -3
index 4b4483b..8e8a408 100644
@@ -258,7 +258,7 @@ static void vmbus_on_msg_dpc(unsigned long data)
 /*
  * vmbus_on_isr - ISR routine
  */
-static int vmbus_on_isr(struct hv_driver *drv)
+static int vmbus_on_isr(void)
 {
 	int ret = 0;
 	int cpu = smp_processor_id();
@@ -989,8 +989,7 @@ static irqreturn_t vmbus_isr(int irq, void *dev_id)
 {
 	int ret;
 
-	/* Call to bus driver to handle interrupt */
-	ret = vmbus_on_isr(NULL);
+	ret = vmbus_on_isr();
 
 	/* Schedules a dpc if necessary */
 	if (ret > 0) {
Signature · 1 line
1.5.5.6
#6 lore raw

PATCH 6/21 Staging: hv: Get rid of vmbus_dev_rm() function

In reply to a message not in the archive

Get rid of the vmbus_dev_rm() function by inlining the necessary code.

---
 drivers/staging/hv/vmbus_drv.c |   17 +++--------------
 1 files changed, 3 insertions(+), 14 deletions(-)
drivers/staging/hv/vmbus_drv.c +3 -14
index 8e8a408..11c69c5 100644
@@ -172,18 +172,6 @@ static int vmbus_dev_add(struct hv_device *dev, void *info)
 	return ret;
 }
 
-/*
- * vmbus_dev_rm - Callback when the root bus device is removed
- */
-static int vmbus_dev_rm(struct hv_device *dev)
-{
-	int ret = 0;
-
-	vmbus_release_unattached_channels();
-	vmbus_disconnect();
-	on_each_cpu(hv_synic_cleanup, NULL, 1);
-	return ret;
-}
 
 /*
  * vmbus_cleanup - Perform any cleanup when the driver is removed
@@ -568,8 +556,9 @@ static void vmbus_bus_exit(void)
 
 	struct hv_device *dev_ctx = &vmbus_drv.device_ctx;
 
-	/* Remove the root device */
-	vmbus_dev_rm(dev_ctx);
+	vmbus_release_unattached_channels();
+	vmbus_disconnect();
+	on_each_cpu(hv_synic_cleanup, NULL, 1);
 
 	vmbus_cleanup();
 
Signature · 1 line
1.5.5.6
#7 lore raw

PATCH 7/21 Staging: hv: Get rid of vmbus_cleanup() function

In reply to a message not in the archive

Get rid of the vmbus_cleanup() function by inlining the necessary code.

---
 drivers/staging/hv/vmbus_drv.c |   11 +----------
 1 files changed, 1 insertions(+), 10 deletions(-)
drivers/staging/hv/vmbus_drv.c +1 -10
index 11c69c5..e078c59 100644
@@ -173,15 +173,6 @@ static int vmbus_dev_add(struct hv_device *dev, void *info)
 }
 
 
-/*
- * vmbus_cleanup - Perform any cleanup when the driver is removed
- */
-static void vmbus_cleanup(void)
-{
-
-	hv_cleanup();
-}
-
 struct onmessage_work_context {
 	struct work_struct work;
 	struct hv_message msg;
@@ -560,7 +551,7 @@ static void vmbus_bus_exit(void)
 	vmbus_disconnect();
 	on_each_cpu(hv_synic_cleanup, NULL, 1);
 
-	vmbus_cleanup();
+	hv_cleanup();
 
 	/* Unregister the root bus device */
 	device_unregister(&dev_ctx->device);
Signature · 1 line
1.5.5.6
#8 lore raw

PATCH 8/21 Staging: hv: Change the signature for vmbus_child_device_register()

In reply to a message not in the archive

In preparation for getting rid of the vmbus_child_dev_add() function, modify the signature of vmbus_child_device_register(). Note that the root device is a global variable.

---
 drivers/staging/hv/vmbus_drv.c     |    7 +++----
 drivers/staging/hv/vmbus_private.h |    3 +--
 2 files changed, 4 insertions(+), 6 deletions(-)
drivers/staging/hv/vmbus_drv.c +3 -4
index e078c59..0b91eda 100644
@@ -144,7 +144,7 @@ static struct hv_device *vmbus_device; /* vmbus root device */
  */
 int vmbus_child_dev_add(struct hv_device *child_dev)
 {
-	return vmbus_child_device_register(vmbus_device, child_dev);
+	return vmbus_child_device_register(child_dev);
 }
 
 /*
@@ -664,8 +664,7 @@ struct hv_device *vmbus_child_device_create(struct hv_guid *type,
 /*
  * vmbus_child_device_register - Register the child device on the specified bus
  */
-int vmbus_child_device_register(struct hv_device *root_device_obj,
-				struct hv_device *child_device_obj)
+int vmbus_child_device_register(struct hv_device *child_device_obj)
 {
 	int ret = 0;
 
@@ -680,7 +679,7 @@ int vmbus_child_device_register(struct hv_device *root_device_obj,
 
 	/* The new device belongs to this bus */
 	child_device_obj->device.bus = &vmbus_drv.bus; /* device->dev.bus; */
-	child_device_obj->device.parent = &root_device_obj->device;
+	child_device_obj->device.parent = &vmbus_device->device;
 	child_device_obj->device.release = vmbus_device_release;
 
 	/*
drivers/staging/hv/vmbus_private.h +1 -2
index 1b88b6f..c176773 100644
@@ -108,8 +108,7 @@ struct hv_device *vmbus_child_device_create(struct hv_guid *type,
 					 struct vmbus_channel *channel);
 
 int vmbus_child_dev_add(struct hv_device *device);
-int vmbus_child_device_register(struct hv_device *root_device_obj,
-				struct hv_device *child_device_obj);
+int vmbus_child_device_register(struct hv_device *child_device_obj);
 void vmbus_child_device_unregister(struct hv_device *device_obj);
 
 /* static void */
Signature · 1 line
1.5.5.6
#9 lore raw

PATCH 9/21 Staging: hv: Get rid of vmbus_child_dev_add()

In reply to a message not in the archive

The function vmbus_child_dev_add() is a wrapper that can be eliminated; get rid of it.

---
 drivers/staging/hv/channel_mgmt.c  |    2 +-
 drivers/staging/hv/vmbus_drv.c     |    9 +--------
 drivers/staging/hv/vmbus_private.h |    1 -
 3 files changed, 2 insertions(+), 10 deletions(-)
drivers/staging/hv/channel_mgmt.c +1 -1
index 0781c0e..3368809 100644
@@ -408,7 +408,7 @@ static void vmbus_process_offer(struct work_struct *work)
 	 * binding which eventually invokes the device driver's AddDevice()
 	 * method.
 	 */
-	ret = vmbus_child_dev_add(newchannel->device_obj);
+	ret = vmbus_child_device_register(newchannel->device_obj);
 	if (ret != 0) {
 		DPRINT_ERR(VMBUS,
 			   "unable to add child device object (relid %d)",
drivers/staging/hv/vmbus_drv.c +1 -8
index 0b91eda..b473f46 100644
@@ -139,13 +139,6 @@ static const struct hv_guid device_id = {
 
 static struct hv_device *vmbus_device; /* vmbus root device */
 
-/*
- * vmbus_child_dev_add - Registers the child device with the vmbus
- */
-int vmbus_child_dev_add(struct hv_device *child_dev)
-{
-	return vmbus_child_device_register(child_dev);
-}
 
 /*
  * vmbus_dev_add - Callback when the root bus device is added
@@ -662,7 +655,7 @@ struct hv_device *vmbus_child_device_create(struct hv_guid *type,
 }
 
 /*
- * vmbus_child_device_register - Register the child device on the specified bus
+ * vmbus_child_device_register - Register the child device
  */
 int vmbus_child_device_register(struct hv_device *child_device_obj)
 {
drivers/staging/hv/vmbus_private.h +0 -1
index c176773..ca050a4 100644
@@ -107,7 +107,6 @@ struct hv_device *vmbus_child_device_create(struct hv_guid *type,
 					 struct hv_guid *instance,
 					 struct vmbus_channel *channel);
 
-int vmbus_child_dev_add(struct hv_device *device);
 int vmbus_child_device_register(struct hv_device *child_device_obj);
 void vmbus_child_device_unregister(struct hv_device *device_obj);
 
Signature · 1 line
1.5.5.6
#10 lore raw

PATCH 10/21 Staging: hv: Cleanup root device handling

In reply to a message not in the archive

Now we can complete the cleanup of the root device management. Use the preferred APIs for creating and managing the root device. As part of this cleanup get rid of the root device object from vmbus_driver_context.

---
 drivers/staging/hv/vmbus_drv.c |  126 ++++++----------------------------------
 1 files changed, 18 insertions(+), 108 deletions(-)
drivers/staging/hv/vmbus_drv.c +18 -108
index b473f46..8b9394a 100644
@@ -19,6 +19,7 @@
  *   Hank Janssen  <[email protected]>
  */
 #include <linux/init.h>
+#include <linux/err.h>
 #include <linux/module.h>
 #include <linux/device.h>
 #include <linux/irq.h>
@@ -40,6 +41,8 @@
 #define VMBUS_IRQ		0x5
 #define VMBUS_IRQ_VECTOR	IRQ5_VECTOR
 
+static struct device *root_dev; /* Root device */
+
 /* Main vmbus driver data structure */
 struct vmbus_driver_context {
 
@@ -47,8 +50,6 @@ struct vmbus_driver_context {
 	struct tasklet_struct msg_dpc;
 	struct tasklet_struct event_dpc;
 
-	/* The bus root device */
-	struct hv_device device_ctx;
 };
 
 static int vmbus_match(struct device *device, struct device_driver *driver);
@@ -60,7 +61,6 @@ static int vmbus_uevent(struct device *device, struct kobj_uevent_env *env);
 static irqreturn_t vmbus_isr(int irq, void *dev_id);
 
 static void vmbus_device_release(struct device *device);
-static void vmbus_bus_release(struct device *device);
 
 static ssize_t vmbus_show_device_attr(struct device *dev,
 				      struct device_attribute *dev_attr,
@@ -117,54 +117,6 @@ static struct vmbus_driver_context vmbus_drv = {
 
 static const char *driver_name = "hyperv";
 
-/*
- * Windows vmbus does not defined this.
- * We defined this to be consistent with other devices
- */
-/* {c5295816-f63a-4d5f-8d1a-4daf999ca185} */
-static const struct hv_guid device_type = {
-	.data = {
-		0x16, 0x58, 0x29, 0xc5, 0x3a, 0xf6, 0x5f, 0x4d,
-		0x8d, 0x1a, 0x4d, 0xaf, 0x99, 0x9c, 0xa1, 0x85
-	}
-};
-
-/* {ac3760fc-9adf-40aa-9427-a70ed6de95c5} */
-static const struct hv_guid device_id = {
-	.data = {
-		0xfc, 0x60, 0x37, 0xac, 0xdf, 0x9a, 0xaa, 0x40,
-		0x94, 0x27, 0xa7, 0x0e, 0xd6, 0xde, 0x95, 0xc5
-	}
-};
-
-static struct hv_device *vmbus_device; /* vmbus root device */
-
-
-/*
- * vmbus_dev_add - Callback when the root bus device is added
- */
-static int vmbus_dev_add(struct hv_device *dev, void *info)
-{
-	u32 *irqvector = info;
-	int ret;
-
-	vmbus_device = dev;
-
-	memcpy(&vmbus_device->dev_type, &device_type, sizeof(struct hv_guid));
-	memcpy(&vmbus_device->dev_instance, &device_id,
-	       sizeof(struct hv_guid));
-
-	/* strcpy(dev->name, "vmbus"); */
-	/* SynIC setup... */
-	on_each_cpu(hv_synic_init, (void *)irqvector, 1);
-
-	/* Connect to VMBus in the root partition */
-	ret = vmbus_connect();
-
-	/* VmbusSendEvent(device->localPortId+1); */
-	return ret;
-}
-
 
 struct onmessage_work_context {
 	struct work_struct work;
@@ -416,17 +368,14 @@ static ssize_t vmbus_show_device_attr(struct device *dev,
  *
  * Here, we
  *	- initialize the vmbus driver context
- *	- setup various driver entry points
  *	- invoke the vmbus hv main init routine
  *	- get the irq resource
- *	- invoke the vmbus to add the vmbus root device
  *	- setup the vmbus root device
  *	- retrieve the channel offers
  */
 static int vmbus_bus_init(void)
 {
 	struct vmbus_driver_context *vmbus_drv_ctx = &vmbus_drv;
-	struct hv_device *dev_ctx = &vmbus_drv.device_ctx;
 	int ret;
 	unsigned int vector;
 
@@ -483,45 +432,34 @@ static int vmbus_bus_init(void)
 
 	DPRINT_INFO(VMBUS_DRV, "irq 0x%x vector 0x%x", vmbus_irq, vector);
 
-	/* Add the root device */
-	memset(dev_ctx, 0, sizeof(struct hv_device));
+	/* Register the root device */
+	root_dev = root_device_register(driver_name);
 
-	ret = vmbus_dev_add(dev_ctx, &vector);
-	if (ret != 0) {
+	if (IS_ERR(root_dev)) {
 		DPRINT_ERR(VMBUS_DRV,
-			   "ERROR - Unable to add vmbus root device");
+			   "ERROR - Unable to register vmbus root device");
 
 		free_irq(vmbus_irq, NULL);
-
 		bus_unregister(&vmbus_drv_ctx->bus);
 
-		ret = -1;
+		ret = PTR_ERR(root_dev);
 		goto cleanup;
 	}
-	/* strcpy(dev_ctx->device.bus_id, dev_ctx->device_obj.name); */
-	dev_set_name(&dev_ctx->device, "vmbus_0_0");
-
-	/* No need to bind a driver to the root device. */
-	dev_ctx->device.parent = NULL;
-	/* NULL; vmbus_remove() does not get invoked */
-	dev_ctx->device.bus = &vmbus_drv_ctx->bus;
 
-	/* Setup the device dispatch table */
-	dev_ctx->device.release = vmbus_bus_release;
-
-	/* register the  root device */
-	ret = device_register(&dev_ctx->device);
+	/*
+	 * Notify the hypervisor of our irq and
+	 * connect to the host.
+	 */
+	on_each_cpu(hv_synic_init, (void *)&vector, 1);
+	ret = vmbus_connect();
 	if (ret) {
-		DPRINT_ERR(VMBUS_DRV,
-			   "ERROR - Unable to register vmbus root device");
-
+		root_device_unregister(root_dev);
 		free_irq(vmbus_irq, NULL);
 		bus_unregister(&vmbus_drv_ctx->bus);
-
-		ret = -1;
 		goto cleanup;
 	}
 
+
 	vmbus_request_offers();
 	wait_for_completion(&hv_channel_ready);
 
@@ -538,7 +476,6 @@ static void vmbus_bus_exit(void)
 {
 	struct vmbus_driver_context *vmbus_drv_ctx = &vmbus_drv;
 
-	struct hv_device *dev_ctx = &vmbus_drv.device_ctx;
 
 	vmbus_release_unattached_channels();
 	vmbus_disconnect();
@@ -547,7 +484,7 @@ static void vmbus_bus_exit(void)
 	hv_cleanup();
 
 	/* Unregister the root bus device */
-	device_unregister(&dev_ctx->device);
+	root_device_unregister(root_dev);
 
 	bus_unregister(&vmbus_drv_ctx->bus);
 
@@ -672,7 +609,7 @@ int vmbus_child_device_register(struct hv_device *child_device_obj)
 
 	/* The new device belongs to this bus */
 	child_device_obj->device.bus = &vmbus_drv.bus; /* device->dev.bus; */
-	child_device_obj->device.parent = &vmbus_device->device;
+	child_device_obj->device.parent = root_dev;
 	child_device_obj->device.release = vmbus_device_release;
 
 	/*
@@ -873,14 +810,6 @@ static int vmbus_remove(struct device *child_device)
 	int ret;
 	struct hv_driver *drv;
 
-	/* Special case root bus device */
-	if (child_device->parent == NULL) {
-		/*
-		 * No-op since it is statically defined and handle in
-		 * vmbus_bus_exit()
-		 */
-		return 0;
-	}
 
 	if (child_device->driver) {
 		drv = drv_to_hv_drv(child_device->driver);
@@ -909,14 +838,6 @@ static void vmbus_shutdown(struct device *child_device)
 {
 	struct hv_driver *drv;
 
-	/* Special case root bus device */
-	if (child_device->parent == NULL) {
-		/*
-		 * No-op since it is statically defined and handle in
-		 * vmbus_bus_exit()
-		 */
-		return;
-	}
 
 	/* The device may not be attached yet */
 	if (!child_device->driver)
@@ -931,17 +852,6 @@ static void vmbus_shutdown(struct device *child_device)
 	return;
 }
 
-/*
- * vmbus_bus_release - Final callback release of the vmbus root device
- */
-static void vmbus_bus_release(struct device *device)
-{
-	/* FIXME */
-	/* Empty release functions are a bug, or a major sign
-	 * of a problem design, this MUST BE FIXED! */
-	dev_err(device, "%s needs to be fixed!\n", __func__);
-	WARN_ON(1);
-}
 
 /*
  * vmbus_device_release - Final callback release of the vmbus child device
Signature · 1 line
1.5.5.6
#11 lore raw

Re: [PATCH 10/21] Staging: hv: Cleanup root device handling

Quoted 4 lines · K. Y. Srinivasan

Now we can complete the cleanup of the root device management. Use the preferred APIs for creating and managing the root device. As part of this cleanup get rid of the root device object from vmbus_driver_context.

I don't understand, what is the "root device"?

The hyper-v "bus controller"?

Quoted 23 lines
---
 drivers/staging/hv/vmbus_drv.c |  126 ++++++----------------------------------
 1 files changed, 18 insertions(+), 108 deletions(-)
drivers/staging/hv/vmbus_drv.c +1 -0
index b473f46..8b9394a 100644
@@ -19,6 +19,7 @@
  *   Hank Janssen  <[email protected]>
  */
 #include <linux/init.h>
+#include <linux/err.h>
 #include <linux/module.h>
 #include <linux/device.h>
 #include <linux/irq.h>

drivers/staging/hv/vmbus_drv.c line 44

Quoted 4 lines
drivers/staging/hv/vmbus_drv.c +1 -0
@@ -40,6 +41,8 @@
 #define VMBUS_IRQ		0x5
 #define VMBUS_IRQ_VECTOR	IRQ5_VECTOR
 
+static struct device *root_dev; /* Root device */

This shouldn't be a "raw" struct device, should it? It should be of a type that shows exactly what it is. Is it a hyper_v device that talks on the bus?

Or is it a "platform" device that controls all of the devices on the bus, and as such should be the "root" device of the bus tree?

confused,

greg k-h

#12 lore raw

RE: [PATCH 10/21] Staging: hv: Cleanup root device handling

Quoted 11 lines

-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Monday, March 14, 2011 3:34 PM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Haiyang Zhang; Mike Sterling; Abhishek Kane (Mindtree Consulting PVT LTD)
Subject: Re: [PATCH 10/21] Staging: hv: Cleanup root device handling

Quoted 7 lines
Quoted 4 lines · K. Y. Srinivasan

Now we can complete the cleanup of the root device management. Use the preferred APIs for creating and managing the root device. As part of this cleanup get rid of the root device object from vmbus_driver_context.

I don't understand, what is the "root device"?

This would be the device under /sys/devices that all other hyperv devices would be grouped under. This notion of the root device existed in the existing code; however its creation and management was unnecessarily complicated.

Regards,

K. Y

Quoted 41 lines

The hyper-v "bus controller"?

Quoted 23 lines
---
 drivers/staging/hv/vmbus_drv.c |  126 ++++++----------------------------------
 1 files changed, 18 insertions(+), 108 deletions(-)
drivers/staging/hv/vmbus_drv.c +1 -0
index b473f46..8b9394a 100644
@@ -19,6 +19,7 @@
  *   Hank Janssen  <[email protected]>
  */
 #include <linux/init.h>
+#include <linux/err.h>
 #include <linux/module.h>
 #include <linux/device.h>
 #include <linux/irq.h>

drivers/staging/hv/vmbus_drv.c line 44

Quoted 4 lines
drivers/staging/hv/vmbus_drv.c +1 -0
@@ -40,6 +41,8 @@
 #define VMBUS_IRQ		0x5
 #define VMBUS_IRQ_VECTOR	IRQ5_VECTOR
 
+static struct device *root_dev; /* Root device */

This shouldn't be a "raw" struct device, should it? It should be of a type that shows exactly what it is. Is it a hyper_v device that talks on the bus?

Or is it a "platform" device that controls all of the devices on the bus, and as such should be the "root" device of the bus tree?

confused,

greg k-h

#13 lore raw

Re: [PATCH 10/21] Staging: hv: Cleanup root device handling

Quoted 17 lines · KY Srinivasan
Quoted 17 lines

-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Monday, March 14, 2011 3:34 PM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Haiyang Zhang; Mike Sterling; Abhishek Kane (Mindtree Consulting PVT LTD)
Subject: Re: [PATCH 10/21] Staging: hv: Cleanup root device handling

Quoted 4 lines · K. Y. Srinivasan

Now we can complete the cleanup of the root device management. Use the preferred APIs for creating and managing the root device. As part of this cleanup get rid of the root device object from vmbus_driver_context.

Quoted 7 lines
Quoted 1 line

I don't understand, what is the "root device"?

This would be the device under /sys/devices that all other hyperv devices would be grouped under. This notion of the root device existed in the existing code; however its creation and management was unnecessarily complicated.

But that is what your new pci device should be, not a separate one. Why not use that instead?

Actually, how are things looking then? You have a pci device, with no children, yet the root device has the children devices? That doesn't really make sense now does it?

thanks,

greg k-h

#14 lore raw

RE: [PATCH 10/21] Staging: hv: Cleanup root device handling

Quoted 38 lines

-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Monday, March 14, 2011 3:59 PM
To: KY Srinivasan
Cc: Greg KH; [email protected]; [email protected]; [email protected]; Haiyang Zhang; Mike Sterling; Abhishek Kane (Mindtree Consulting PVT LTD)
Subject: Re: [PATCH 10/21] Staging: hv: Cleanup root device handling

Quoted 8 lines · KY Srinivasan
Quoted 8 lines

-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Monday, March 14, 2011 3:34 PM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Haiyang Zhang;

Mike

Quoted 9 lines
Quoted 9 lines

Sterling; Abhishek Kane (Mindtree Consulting PVT LTD)
Subject: Re: [PATCH 10/21] Staging: hv: Cleanup root device handling

Quoted 4 lines · K. Y. Srinivasan

Now we can complete the cleanup of the root device management. Use the preferred APIs for creating and managing the root device. As part of this cleanup get rid of the root device object from vmbus_driver_context.

Quoted 7 lines
Quoted 1 line

I don't understand, what is the "root device"?

This would be the device under /sys/devices that all other hyperv devices would be grouped under. This notion of the root device existed in the existing code; however its creation and management was unnecessarily complicated.

Quoted 6 lines

But that is what your new pci device should be, not a separate one. Why not use that instead?

Actually, how are things looking then? You have a pci device, with no children, yet the root device has the children devices? That doesn't really make sense now does it?

Good point. I will cleanup the patches and send you the updated ones shortly.

Regards,

K. Y

#15 lore raw

PATCH 11/21 Staging: hv: Make vmbus driver a platform pci driver

In reply to a message not in the archive

Make vmbus driver a platform pci driver. This is in preparation to cleaning up irq allocation for this driver.

---
 drivers/staging/hv/vmbus_drv.c |   63 +++++++++++++++++++++++-----------------
 1 files changed, 36 insertions(+), 27 deletions(-)
drivers/staging/hv/vmbus_drv.c +36 -27
index 8b9394a..e4855ac 100644
@@ -43,6 +43,8 @@
 
 static struct device *root_dev; /* Root device */
 
+struct pci_dev *hv_pci_dev;
+
 /* Main vmbus driver data structure */
 struct vmbus_driver_context {
 
@@ -887,36 +889,24 @@ static irqreturn_t vmbus_isr(int irq, void *dev_id)
 	}
 }
 
-static struct dmi_system_id __initdata microsoft_hv_dmi_table[] = {
-	{
-		.ident = "Hyper-V",
-		.matches = {
-			DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
-			DMI_MATCH(DMI_PRODUCT_NAME, "Virtual Machine"),
-			DMI_MATCH(DMI_BOARD_NAME, "Virtual Machine"),
-		},
-	},
-	{ },
-};
-MODULE_DEVICE_TABLE(dmi, microsoft_hv_dmi_table);
 
-static int __init vmbus_init(void)
+
+static int __devinit hv_pci_probe(struct pci_dev *pdev,
+				const struct pci_device_id *ent)
 {
-	DPRINT_INFO(VMBUS_DRV,
-		"Vmbus initializing.... current log level 0x%x (%x,%x)",
-		vmbus_loglevel, HIWORD(vmbus_loglevel), LOWORD(vmbus_loglevel));
-	/* Todo: it is used for loglevel, to be ported to new kernel. */
+	int err;
 
-	if (!dmi_check_system(microsoft_hv_dmi_table))
-		return -ENODEV;
+	hv_pci_dev = pdev;
 
-	return vmbus_bus_init();
-}
+	err = pci_enable_device(pdev);
+	if (err)
+		return err;
 
-static void __exit vmbus_exit(void)
-{
-	vmbus_bus_exit();
-	/* Todo: it is used for loglevel, to be ported to new kernel. */
+	err = vmbus_bus_init();
+	if (err)
+		pci_disable_device(pdev);
+
+	return err;
 }
 
 /*
@@ -931,10 +921,29 @@ static const struct pci_device_id microsoft_hv_pci_table[] = {
 };
 MODULE_DEVICE_TABLE(pci, microsoft_hv_pci_table);
 
+static struct pci_driver platform_driver = {
+	.name =           "hv-platform-pci",
+	.probe =          hv_pci_probe,
+	.id_table =       microsoft_hv_pci_table,
+};
+
+static int __init hv_pci_init(void)
+{
+	return pci_register_driver(&platform_driver);
+}
+
+static void __exit hv_pci_exit(void)
+{
+	vmbus_bus_exit();
+	pci_unregister_driver(&platform_driver);
+}
+
+
+
 MODULE_LICENSE("GPL");
 MODULE_VERSION(HV_DRV_VERSION);
 module_param(vmbus_irq, int, S_IRUGO);
 module_param(vmbus_loglevel, int, S_IRUGO);
 
-module_init(vmbus_init);
-module_exit(vmbus_exit);
+module_init(hv_pci_init);
+module_exit(hv_pci_exit);
Signature · 1 line
1.5.5.6
#16 lore raw

Re: [PATCH 11/21] Staging: hv: Make vmbus driver a platform pci driver

Quoted 3 lines · K. Y. Srinivasan

Make vmbus driver a platform pci driver. This is in preparation to cleaning up irq allocation for this driver.

The idea is nice, but the nameing is a bit confusing.

We have "platform drivers" which are much different from what you are doing here, you are just creating a "normal" pci driver.

Very minor comments below.

Quoted 29 lines
---
 drivers/staging/hv/vmbus_drv.c |   63 +++++++++++++++++++++++-----------------
 1 files changed, 36 insertions(+), 27 deletions(-)
drivers/staging/hv/vmbus_drv.c +2 -2
index 8b9394a..e4855ac 100644
@@ -43,6 +43,8 @@
 
 static struct device *root_dev; /* Root device */
 
+struct pci_dev *hv_pci_dev;
+
 /* Main vmbus driver data structure */
 struct vmbus_driver_context {
 
@@ -887,36 +889,24 @@ static irqreturn_t vmbus_isr(int irq, void *dev_id)
 	}
 }
 
-static struct dmi_system_id __initdata microsoft_hv_dmi_table[] = {
-	{

drivers/staging/hv/vmbus_drv.c static irqreturn_t vmbus_isr(int irq, void *dev_id) · line 901

Quoted 10 lines
drivers/staging/hv/vmbus_drv.c +0 -10
-		.ident = "Hyper-V",
-		.matches = {
-			DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
-			DMI_MATCH(DMI_PRODUCT_NAME, "Virtual Machine"),
-			DMI_MATCH(DMI_BOARD_NAME, "Virtual Machine"),
-		},
-	},
-	{ },
-};
-MODULE_DEVICE_TABLE(dmi, microsoft_hv_dmi_table);

You're sure it's safe to delete this now and just rely on the PCI ids, right? For some wierd reason I thought we needed both to catch all types of systems, but I can't remember why.

Quoted 35 lines
drivers/staging/hv/vmbus_drv.c +13 -13
-static int __init vmbus_init(void)
+
+static int __devinit hv_pci_probe(struct pci_dev *pdev,
+				const struct pci_device_id *ent)
 {
-	DPRINT_INFO(VMBUS_DRV,
-		"Vmbus initializing.... current log level 0x%x (%x,%x)",
-		vmbus_loglevel, HIWORD(vmbus_loglevel), LOWORD(vmbus_loglevel));
-	/* Todo: it is used for loglevel, to be ported to new kernel. */
+	int err;
 
-	if (!dmi_check_system(microsoft_hv_dmi_table))
-		return -ENODEV;
+	hv_pci_dev = pdev;
 
-	return vmbus_bus_init();
-}
+	err = pci_enable_device(pdev);
+	if (err)
+		return err;
 
-static void __exit vmbus_exit(void)
-{
-	vmbus_bus_exit();
-	/* Todo: it is used for loglevel, to be ported to new kernel. */
+	err = vmbus_bus_init();
+	if (err)
+		pci_disable_device(pdev);
+
+	return err;
 }
 
 /*

drivers/staging/hv/vmbus_drv.c static const struct pci_device_id microsoft_hv_pci_table[] = { · line 924

Quoted 4 lines
drivers/staging/hv/vmbus_drv.c +1 -0
@@ -931,10 +921,29 @@ static const struct pci_device_id microsoft_hv_pci_table[] = {
 };
 MODULE_DEVICE_TABLE(pci, microsoft_hv_pci_table);
 
+static struct pci_driver platform_driver = {

"hv_bus_driver"?

drivers/staging/hv/vmbus_drv.c static const struct pci_device_id microsoft_hv_pci_table[] = { · line 925

Quoted 1 line
drivers/staging/hv/vmbus_drv.c +1 -0
+	.name =           "hv-platform-pci",

How about "hv_bus" as a name, as that's what this really is. It's a "bus adapter", like USB, Firewire, and all sorts of other bus controllers.

Quoted 28 lines
drivers/staging/hv/vmbus_drv.c +19 -2
+	.probe =          hv_pci_probe,
+	.id_table =       microsoft_hv_pci_table,
+};
+
+static int __init hv_pci_init(void)
+{
+	return pci_register_driver(&platform_driver);
+}
+
+static void __exit hv_pci_exit(void)
+{
+	vmbus_bus_exit();
+	pci_unregister_driver(&platform_driver);
+}
+
+
+
 MODULE_LICENSE("GPL");
 MODULE_VERSION(HV_DRV_VERSION);
 module_param(vmbus_irq, int, S_IRUGO);
 module_param(vmbus_loglevel, int, S_IRUGO);
 
-module_init(vmbus_init);
-module_exit(vmbus_exit);
+module_init(hv_pci_init);
+module_exit(hv_pci_exit);
Signature · 1 line
1.5.5.6
#17 lore raw

RE: [PATCH 11/21] Staging: hv: Make vmbus driver a platform pci driver

Quoted 57 lines

-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Thursday, March 10, 2011 5:21 PM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; Haiyang Zhang; Mike Sterling; Abhishek Kane (Mindtree Consulting PVT LTD); Hank Janssen
Subject: Re: [PATCH 11/21] Staging: hv: Make vmbus driver a platform pci driver

Quoted 3 lines · K. Y. Srinivasan

Make vmbus driver a platform pci driver. This is in preparation to cleaning up irq allocation for this driver.

The idea is nice, but the nameing is a bit confusing.

We have "platform drivers" which are much different from what you are doing here, you are just creating a "normal" pci driver.

Very minor comments below.

Quoted 8 lines
---
 drivers/staging/hv/vmbus_drv.c |   63 +++++++++++++++++++++++-------------

----

Quoted 16 lines
 1 files changed, 36 insertions(+), 27 deletions(-)
drivers/staging/hv/vmbus_drv.c +2 -0
index 8b9394a..e4855ac 100644
@@ -43,6 +43,8 @@
 
 static struct device *root_dev; /* Root device */
 
+struct pci_dev *hv_pci_dev;
+
 /* Main vmbus driver data structure */
 struct vmbus_driver_context {
 

drivers/staging/hv/vmbus_drv.c static irqreturn_t vmbus_isr(int irq, void *dev_id) · line 894

Quoted 8 lines
drivers/staging/hv/vmbus_drv.c +0 -5
@@ -887,36 +889,24 @@ static irqreturn_t vmbus_isr(int irq, void *dev_id)
 	}
 }
 
-static struct dmi_system_id __initdata microsoft_hv_dmi_table[] = {
-	{
-		.ident = "Hyper-V",
-		.matches = {
-			DMI_MATCH(DMI_SYS_VENDOR, "Microsoft

Corporation"),

Quoted 11 lines

drivers/staging/hv/vmbus_drv.c static irqreturn_t vmbus_isr(int irq, void *dev_id) · line 901

Quoted 7 lines
drivers/staging/hv/vmbus_drv.c +0 -7
-			DMI_MATCH(DMI_PRODUCT_NAME, "Virtual Machine"),
-			DMI_MATCH(DMI_BOARD_NAME, "Virtual Machine"),
-		},
-	},
-	{ },
-};
-MODULE_DEVICE_TABLE(dmi, microsoft_hv_dmi_table);

You're sure it's safe to delete this now and just rely on the PCI ids, right? For some wierd reason I thought we needed both to catch all types of systems, but I can't remember why.

I have tested this; I don't think we need the dmi table.

Quoted 43 lines

drivers/staging/hv/vmbus_drv.c static irqreturn_t vmbus_isr(int irq, void *dev_id)

Quoted 10 lines
drivers/staging/hv/vmbus_drv.c +3 -4
-static int __init vmbus_init(void)
+
+static int __devinit hv_pci_probe(struct pci_dev *pdev,
+				const struct pci_device_id *ent)
 {
-	DPRINT_INFO(VMBUS_DRV,
-		"Vmbus initializing.... current log level 0x%x (%x,%x)",
-		vmbus_loglevel, HIWORD(vmbus_loglevel),

LOWORD(vmbus_loglevel));

drivers/staging/hv/vmbus_drv.c static const struct pci_device_id

Quoted 26 lines
drivers/staging/hv/vmbus_drv.c +10 -9
-	/* Todo: it is used for loglevel, to be ported to new kernel. */
+	int err;
 
-	if (!dmi_check_system(microsoft_hv_dmi_table))
-		return -ENODEV;
+	hv_pci_dev = pdev;
 
-	return vmbus_bus_init();
-}
+	err = pci_enable_device(pdev);
+	if (err)
+		return err;
 
-static void __exit vmbus_exit(void)
-{
-	vmbus_bus_exit();
-	/* Todo: it is used for loglevel, to be ported to new kernel. */
+	err = vmbus_bus_init();
+	if (err)
+		pci_disable_device(pdev);
+
+	return err;
 }
 
 /*
@@ -931,10 +921,29 @@ static const struct pci_device_id

microsoft_hv_pci_table[] = {

drivers/staging/hv/vmbus_drv.c static const struct pci_device_id microsoft_hv_pci_table[] = { · line 924

Quoted 4 lines
drivers/staging/hv/vmbus_drv.c +1 -0
 };
 MODULE_DEVICE_TABLE(pci, microsoft_hv_pci_table);
 
+static struct pci_driver platform_driver = {
Quoted 7 lines

"hv_bus_driver"?

drivers/staging/hv/vmbus_drv.c static const struct pci_device_id microsoft_hv_pci_table[] = { · line 925

Quoted 1 line
drivers/staging/hv/vmbus_drv.c +1 -0
+	.name =           "hv-platform-pci",

How about "hv_bus" as a name, as that's what this really is. It's a "bus adapter", like USB, Firewire, and all sorts of other bus controllers.

Sure; I will make these changes. Would you mind if I submit these name changes as a separate patch.

Regards,

K. Y

#18 lore raw

Re: [PATCH 11/21] Staging: hv: Make vmbus driver a platform pci driver

Quoted 68 lines · KY Srinivasan
Quoted 57 lines

-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Thursday, March 10, 2011 5:21 PM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; Haiyang Zhang; Mike Sterling; Abhishek Kane (Mindtree Consulting PVT LTD); Hank Janssen
Subject: Re: [PATCH 11/21] Staging: hv: Make vmbus driver a platform pci driver

Quoted 3 lines · K. Y. Srinivasan

Make vmbus driver a platform pci driver. This is in preparation to cleaning up irq allocation for this driver.

The idea is nice, but the nameing is a bit confusing.

We have "platform drivers" which are much different from what you are doing here, you are just creating a "normal" pci driver.

Very minor comments below.

Quoted 8 lines
---
 drivers/staging/hv/vmbus_drv.c |   63 +++++++++++++++++++++++-------------

----

Quoted 16 lines
 1 files changed, 36 insertions(+), 27 deletions(-)
drivers/staging/hv/vmbus_drv.c +2 -0
index 8b9394a..e4855ac 100644
@@ -43,6 +43,8 @@
 
 static struct device *root_dev; /* Root device */
 
+struct pci_dev *hv_pci_dev;
+
 /* Main vmbus driver data structure */
 struct vmbus_driver_context {
 

drivers/staging/hv/vmbus_drv.c static irqreturn_t vmbus_isr(int irq, void *dev_id) · line 894

Quoted 8 lines
drivers/staging/hv/vmbus_drv.c +0 -5
@@ -887,36 +889,24 @@ static irqreturn_t vmbus_isr(int irq, void *dev_id)
 	}
 }
 
-static struct dmi_system_id __initdata microsoft_hv_dmi_table[] = {
-	{
-		.ident = "Hyper-V",
-		.matches = {
-			DMI_MATCH(DMI_SYS_VENDOR, "Microsoft

Corporation"),

Quoted 11 lines

drivers/staging/hv/vmbus_drv.c static irqreturn_t vmbus_isr(int irq, void *dev_id) · line 901

Quoted 7 lines
drivers/staging/hv/vmbus_drv.c +0 -7
-			DMI_MATCH(DMI_PRODUCT_NAME, "Virtual Machine"),
-			DMI_MATCH(DMI_BOARD_NAME, "Virtual Machine"),
-		},
-	},
-	{ },
-};
-MODULE_DEVICE_TABLE(dmi, microsoft_hv_dmi_table);

You're sure it's safe to delete this now and just rely on the PCI ids, right? For some wierd reason I thought we needed both to catch all types of systems, but I can't remember why.

Quoted 1 line

I have tested this; I don't think we need the dmi table.

Ok, if you are sure, that's fine with me.

Quoted 5 lines
Quoted 3 lines

How about "hv_bus" as a name, as that's what this really is. It's a "bus adapter", like USB, Firewire, and all sorts of other bus controllers.

Sure; I will make these changes. Would you mind if I submit these name changes as a separate patch.

How about just redo this patch? I haven't reviewed the others yet, so you might want to wait a day to see if I don't like any of them either :)

Quoted 4 lines

Regards,

K. Y

#19 lore raw

RE: [PATCH 11/21] Staging: hv: Make vmbus driver a platform pci driver

Quoted 91 lines

-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Thursday, March 10, 2011 5:33 PM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; Haiyang Zhang; Mike Sterling; Abhishek Kane (Mindtree Consulting PVT LTD); Hank Janssen
Subject: Re: [PATCH 11/21] Staging: hv: Make vmbus driver a platform pci driver

Quoted 10 lines · KY Srinivasan
Quoted 10 lines

-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Thursday, March 10, 2011 5:21 PM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; Haiyang Zhang; Mike Sterling; Abhishek Kane (Mindtree Consulting PVT LTD); Hank Janssen
Subject: Re: [PATCH 11/21] Staging: hv: Make vmbus driver a platform pci

driver

Quoted 14 lines
Quoted 14 lines · K. Y. Srinivasan
Quoted 3 lines

Make vmbus driver a platform pci driver. This is in preparation to cleaning up irq allocation for this driver.

The idea is nice, but the nameing is a bit confusing.

We have "platform drivers" which are much different from what you are doing here, you are just creating a "normal" pci driver.

Very minor comments below.

Quoted 1 line
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
---
 drivers/staging/hv/vmbus_drv.c |   63 +++++++++++++++++++++++--------

-----

Quoted 4 lines
Quoted 4 lines

----

Review

Quoted 3 lines
 1 files changed, 36 insertions(+), 27 deletions(-)
(quoted diff) +0 -0

b/drivers/staging/hv/vmbus_drv.c

Quoted 33 lines
Quoted 22 lines
Quoted 13 lines

index 8b9394a..e4855ac 100644

drivers/staging/hv/vmbus_drv.c +2 -0
@@ -43,6 +43,8 @@
 
 static struct device *root_dev; /* Root device */
 
+struct pci_dev *hv_pci_dev;
+
 /* Main vmbus driver data structure */
 struct vmbus_driver_context {
 

drivers/staging/hv/vmbus_drv.c static irqreturn_t vmbus_isr(int irq, void *dev_id) · line 894

Quoted 8 lines
drivers/staging/hv/vmbus_drv.c +0 -5
@@ -887,36 +889,24 @@ static irqreturn_t vmbus_isr(int irq, void *dev_id)
 	}
 }
 
-static struct dmi_system_id __initdata microsoft_hv_dmi_table[] = {
-	{
-		.ident = "Hyper-V",
-		.matches = {
-			DMI_MATCH(DMI_SYS_VENDOR, "Microsoft

Corporation"),

Quoted 11 lines

drivers/staging/hv/vmbus_drv.c static irqreturn_t vmbus_isr(int irq, void *dev_id) · line 901

Quoted 7 lines
drivers/staging/hv/vmbus_drv.c +0 -7
-			DMI_MATCH(DMI_PRODUCT_NAME, "Virtual Machine"),
-			DMI_MATCH(DMI_BOARD_NAME, "Virtual Machine"),
-		},
-	},
-	{ },
-};
-MODULE_DEVICE_TABLE(dmi, microsoft_hv_dmi_table);

You're sure it's safe to delete this now and just rely on the PCI ids, right? For some wierd reason I thought we needed both to catch all types of systems, but I can't remember why.

Quoted 1 line

I have tested this; I don't think we need the dmi table.

Ok, if you are sure, that's fine with me.

Quoted 4 lines
Quoted 3 lines

How about "hv_bus" as a name, as that's what this really is. It's a "bus adapter", like USB, Firewire, and all sorts of other bus controllers.

Quoted 6 lines
Quoted 1 line

Sure; I will make these changes. Would you mind if I submit these name

changes as a separate patch.

How about just redo this patch? I haven't reviewed the others yet, so you might want to wait a day to see if I don't like any of them either :)

Ok; I will wait for the reviews.

Regards,

K. Y

#20 lore raw

RE: [PATCH 11/21] Staging: hv: Make vmbus driver a platform pci driver

In reply to Greg KH
Quoted 91 lines

-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Thursday, March 10, 2011 5:33 PM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; Haiyang Zhang; Mike Sterling; Abhishek Kane (Mindtree Consulting PVT LTD); Hank Janssen
Subject: Re: [PATCH 11/21] Staging: hv: Make vmbus driver a platform pci driver

Quoted 10 lines · KY Srinivasan
Quoted 10 lines

-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Thursday, March 10, 2011 5:21 PM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; Haiyang Zhang; Mike Sterling; Abhishek Kane (Mindtree Consulting PVT LTD); Hank Janssen
Subject: Re: [PATCH 11/21] Staging: hv: Make vmbus driver a platform pci

driver

Quoted 14 lines
Quoted 14 lines · K. Y. Srinivasan
Quoted 3 lines

Make vmbus driver a platform pci driver. This is in preparation to cleaning up irq allocation for this driver.

The idea is nice, but the nameing is a bit confusing.

We have "platform drivers" which are much different from what you are doing here, you are just creating a "normal" pci driver.

Very minor comments below.

Quoted 1 line
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
---
 drivers/staging/hv/vmbus_drv.c |   63 +++++++++++++++++++++++--------

-----

Quoted 4 lines
Quoted 4 lines

----

Review

Quoted 3 lines
 1 files changed, 36 insertions(+), 27 deletions(-)
(quoted diff) +0 -0

b/drivers/staging/hv/vmbus_drv.c

Quoted 33 lines
Quoted 22 lines
Quoted 13 lines

index 8b9394a..e4855ac 100644

drivers/staging/hv/vmbus_drv.c +2 -0
@@ -43,6 +43,8 @@
 
 static struct device *root_dev; /* Root device */
 
+struct pci_dev *hv_pci_dev;
+
 /* Main vmbus driver data structure */
 struct vmbus_driver_context {
 

drivers/staging/hv/vmbus_drv.c static irqreturn_t vmbus_isr(int irq, void *dev_id) · line 894

Quoted 8 lines
drivers/staging/hv/vmbus_drv.c +0 -5
@@ -887,36 +889,24 @@ static irqreturn_t vmbus_isr(int irq, void *dev_id)
 	}
 }
 
-static struct dmi_system_id __initdata microsoft_hv_dmi_table[] = {
-	{
-		.ident = "Hyper-V",
-		.matches = {
-			DMI_MATCH(DMI_SYS_VENDOR, "Microsoft

Corporation"),

Quoted 11 lines

drivers/staging/hv/vmbus_drv.c static irqreturn_t vmbus_isr(int irq, void *dev_id) · line 901

Quoted 7 lines
drivers/staging/hv/vmbus_drv.c +0 -7
-			DMI_MATCH(DMI_PRODUCT_NAME, "Virtual Machine"),
-			DMI_MATCH(DMI_BOARD_NAME, "Virtual Machine"),
-		},
-	},
-	{ },
-};
-MODULE_DEVICE_TABLE(dmi, microsoft_hv_dmi_table);

You're sure it's safe to delete this now and just rely on the PCI ids, right? For some wierd reason I thought we needed both to catch all types of systems, but I can't remember why.

Quoted 1 line

I have tested this; I don't think we need the dmi table.

Ok, if you are sure, that's fine with me.

Quoted 4 lines
Quoted 3 lines

How about "hv_bus" as a name, as that's what this really is. It's a "bus adapter", like USB, Firewire, and all sorts of other bus controllers.

Quoted 6 lines
Quoted 1 line

Sure; I will make these changes. Would you mind if I submit these name

changes as a separate patch.

How about just redo this patch? I haven't reviewed the others yet, so you might want to wait a day to see if I don't like any of them either :)

Greg, I have redone this patch as well as [PATCH 12/21]. Do you want me send you just these two patches or the entire series including these two. Also, does this patch-set address all of architectural issues you had noted earlier in the vmbus core. Please let us know what else needs to be done to exit staging as far as the vmbus driver is concerned. I want get a head start before the new week begins! Also, we have patches ready for all DPRINT cleanup. Hank is holding them off until we finish addressing the architectural issues first.

Regards,

K. Y

#21 lore raw

Re: [PATCH 11/21] Staging: hv: Make vmbus driver a platform pci driver

Quoted 3 lines · KY Srinivasan

Greg, I have redone this patch as well as [PATCH 12/21]. Do you want me send you just these two patches or the entire series including these two.

Just resend those two patches if that is easier.

Quoted 6 lines

Also, does this patch-set address all of architectural issues you had noted earlier in the vmbus core. Please let us know what else needs to be done to exit staging as far as the vmbus driver is concerned. I want get a head start before the new week begins! Also, we have patches ready for all DPRINT cleanup. Hank is holding them off until we finish addressing the architectural issues first.

I do not know if this addresses everything, sorry, I have not had the time to review all of them yet. Give me a few days at the least to go over them and apply them before I will be able to tell you this.

Also note that there shouldn't be anything holding back the DPRINT stuff, why wait? If they apply on top of yours that should be fine, right?

thanks,

greg k-h

#22 lore raw

RE: [PATCH 11/21] Staging: hv: Make vmbus driver a platform pci driver

Quoted 11 lines

-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Sunday, March 13, 2011 11:25 PM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; Haiyang Zhang; Mike Sterling; Abhishek Kane (Mindtree Consulting PVT LTD); Hank Janssen
Subject: Re: [PATCH 11/21] Staging: hv: Make vmbus driver a platform pci driver

Quoted 6 lines
Quoted 3 lines · KY Srinivasan

Greg, I have redone this patch as well as [PATCH 12/21]. Do you want me send you just these two patches or the entire series including these two.

Just resend those two patches if that is easier.

Will do.

Quoted 11 lines
Quoted 7 lines

Also, does this patch-set address all of architectural issues you had noted earlier in the vmbus core. Please let us know what else needs to be done to exit staging as far as the vmbus driver is concerned. I want get a head start before the new week begins! Also, we have patches ready for all DPRINT cleanup. Hank is holding them off until we finish addressing the architectural issues first.

I do not know if this addresses everything, sorry, I have not had the time to review all of them yet. Give me a few days at the least to go over them and apply them before I will be able to tell you this.

Thanks for taking the time to look at this.

Quoted 4 lines

Also note that there shouldn't be anything holding back the DPRINT stuff, why wait? If they apply on top of yours that should be fine, right?

You are right. We will submit the DPRINT patches soon.

Regards,

K. Y

#23 lore raw

Re: [PATCH 11/21] Staging: hv: Make vmbus driver a platform pci driver

In reply to K. Y. Srinivasan
Quoted 3 lines · K. Y. Srinivasan

Make vmbus driver a platform pci driver. This is in preparation to cleaning up irq allocation for this driver.

Now wouldn't this be the "root" device that everything else hangs off of?

Quoted 14 lines
---
 drivers/staging/hv/vmbus_drv.c |   63 +++++++++++++++++++++++-----------------
 1 files changed, 36 insertions(+), 27 deletions(-)
drivers/staging/hv/vmbus_drv.c +0 -0
index 8b9394a..e4855ac 100644

drivers/staging/hv/vmbus_drv.c line 46

Quoted 4 lines
drivers/staging/hv/vmbus_drv.c +1 -0
@@ -43,6 +43,8 @@
 
 static struct device *root_dev; /* Root device */
 
+struct pci_dev *hv_pci_dev;

Why do you have 2 different devices here? Is the root_dev still needed now?

Still confused,

greg k-h

#24 lore raw

PATCH 12/21 Staging: hv: Cleanup irq management

In reply to a message not in the archive

Now that vmbus_driver is a platform pci driver, cleanup the irq allocation mess by using the standard irq allocation mechanisms.

Note that this patch generates an error when the checkpatch script is run because of the IRQF_SAMPLE_RANDOM flag used in request_irq() function. This interrupt is the only external event this VM will get and consequently if this flag (IRQF_SAMPLE_RANDOM) is not specified, experimentally we have shown that the entropy in the VM will very very low.

---
 drivers/staging/hv/vmbus_drv.c |   30 ++++++++++++++----------------
 1 files changed, 14 insertions(+), 16 deletions(-)
drivers/staging/hv/vmbus_drv.c +14 -16
index e4855ac..4e45016 100644
@@ -17,6 +17,8 @@
  * Authors:
  *   Haiyang Zhang <[email protected]>
  *   Hank Janssen  <[email protected]>
+ *
+ * 3/9/2011: K. Y. Srinivasan	- Significant restructuring and cleanup
  */
 #include <linux/init.h>
 #include <linux/err.h>
@@ -37,10 +39,6 @@
 #include "vmbus_private.h"
 
 
-/* FIXME! We need to do this dynamically for PIC and APIC system */
-#define VMBUS_IRQ		0x5
-#define VMBUS_IRQ_VECTOR	IRQ5_VECTOR
-
 static struct device *root_dev; /* Root device */
 
 struct pci_dev *hv_pci_dev;
@@ -74,7 +72,6 @@ EXPORT_SYMBOL(vmbus_loglevel);
 	/* (ALL_MODULES << 16 | DEBUG_LVL_ENTEREXIT); */
 	/* (((VMBUS | VMBUS_DRV)<<16) | DEBUG_LVL_ENTEREXIT); */
 
-static int vmbus_irq = VMBUS_IRQ;
 
 /* Set up per device attributes in /sys/bus/vmbus/devices/<bus device> */
 static struct device_attribute vmbus_device_attrs[] = {
@@ -375,7 +372,7 @@ static ssize_t vmbus_show_device_attr(struct device *dev,
  *	- setup the vmbus root device
  *	- retrieve the channel offers
  */
-static int vmbus_bus_init(void)
+static int vmbus_bus_init(struct pci_dev *pdev)
 {
 	struct vmbus_driver_context *vmbus_drv_ctx = &vmbus_drv;
 	int ret;
@@ -418,21 +415,23 @@ static int vmbus_bus_init(void)
 	}
 
 	/* Get the interrupt resource */
-	ret = request_irq(vmbus_irq, vmbus_isr, IRQF_SAMPLE_RANDOM,
-			  driver_name, NULL);
+	ret = request_irq(pdev->irq, vmbus_isr,
+			  IRQF_SHARED | IRQF_SAMPLE_RANDOM,
+			  driver_name, pdev);
 
 	if (ret != 0) {
 		DPRINT_ERR(VMBUS_DRV, "ERROR - Unable to request IRQ %d",
-			   vmbus_irq);
+			   pdev->irq);
 
 		bus_unregister(&vmbus_drv_ctx->bus);
 
 		ret = -1;
 		goto cleanup;
 	}
-	vector = VMBUS_IRQ_VECTOR;
 
-	DPRINT_INFO(VMBUS_DRV, "irq 0x%x vector 0x%x", vmbus_irq, vector);
+	vector = IRQ0_VECTOR + pdev->irq;
+	DPRINT_INFO(VMBUS_DRV, "irq 0x%x vector 0x%x", pdev->irq,
+			IRQ0_VECTOR + pdev->irq);
 
 	/* Register the root device */
 	root_dev = root_device_register(driver_name);
@@ -441,7 +440,7 @@ static int vmbus_bus_init(void)
 		DPRINT_ERR(VMBUS_DRV,
 			   "ERROR - Unable to register vmbus root device");
 
-		free_irq(vmbus_irq, NULL);
+		free_irq(pdev->irq, pdev);
 		bus_unregister(&vmbus_drv_ctx->bus);
 
 		ret = PTR_ERR(root_dev);
@@ -456,7 +455,7 @@ static int vmbus_bus_init(void)
 	ret = vmbus_connect();
 	if (ret) {
 		root_device_unregister(root_dev);
-		free_irq(vmbus_irq, NULL);
+		free_irq(pdev->irq, pdev);
 		bus_unregister(&vmbus_drv_ctx->bus);
 		goto cleanup;
 	}
@@ -490,7 +489,7 @@ static void vmbus_bus_exit(void)
 
 	bus_unregister(&vmbus_drv_ctx->bus);
 
-	free_irq(vmbus_irq, NULL);
+	free_irq(hv_pci_dev->irq, hv_pci_dev);
 
 	tasklet_kill(&vmbus_drv_ctx->msg_dpc);
 	tasklet_kill(&vmbus_drv_ctx->event_dpc);
@@ -902,7 +901,7 @@ static int __devinit hv_pci_probe(struct pci_dev *pdev,
 	if (err)
 		return err;
 
-	err = vmbus_bus_init();
+	err = vmbus_bus_init(pdev);
 	if (err)
 		pci_disable_device(pdev);
 
@@ -942,7 +941,6 @@ static void __exit hv_pci_exit(void)
 
 MODULE_LICENSE("GPL");
 MODULE_VERSION(HV_DRV_VERSION);
-module_param(vmbus_irq, int, S_IRUGO);
 module_param(vmbus_loglevel, int, S_IRUGO);
 
 module_init(hv_pci_init);
Signature · 1 line
1.5.5.6
#25 lore raw

Re: [PATCH 12/21] Staging: hv: Cleanup irq management

Quoted 10 lines · K. Y. Srinivasan

Now that vmbus_driver is a platform pci driver, cleanup the irq allocation mess by using the standard irq allocation mechanisms.

Note that this patch generates an error when the checkpatch script is run because of the IRQF_SAMPLE_RANDOM flag used in request_irq() function. This interrupt is the only external event this VM will get and consequently if this flag (IRQF_SAMPLE_RANDOM) is not specified, experimentally we have shown that the entropy in the VM will very very low.

Fair enough. We need to come up with some way to work around this though.

drivers/staging/hv/vmbus_drv.c static int vmbus_bus_init(void) · line 434

Quoted 7 lines
drivers/staging/hv/vmbus_drv.c +3 -2
 	}
-	vector = VMBUS_IRQ_VECTOR;
 
-	DPRINT_INFO(VMBUS_DRV, "irq 0x%x vector 0x%x", vmbus_irq, vector);
+	vector = IRQ0_VECTOR + pdev->irq;
+	DPRINT_INFO(VMBUS_DRV, "irq 0x%x vector 0x%x", pdev->irq,
+			IRQ0_VECTOR + pdev->irq);

Why evaluating vector first and then not using it for that debug print thingy?

Btw, are you going to replace that DPRINT_* stuff as well ?

Thanks,

tglx

#26 lore raw

Re: [PATCH 12/21] Staging: hv: Cleanup irq management

Quoted 10 lines · Thomas Gleixner

drivers/staging/hv/vmbus_drv.c static int vmbus_bus_init(void) · line 434

Quoted 9 lines

   }
drivers/staging/hv/vmbus_drv.c +3 -2
-    vector = VMBUS_IRQ_VECTOR;
 
-    DPRINT_INFO(VMBUS_DRV, "irq 0x%x vector 0x%x", vmbus_irq, vector);
+    vector = IRQ0_VECTOR + pdev->irq;
+    DPRINT_INFO(VMBUS_DRV, "irq 0x%x vector 0x%x", pdev->irq,
+            IRQ0_VECTOR + pdev->irq);
Quoted 8 lines

Why evaluating vector first and then not using it for that debug print thingy?

Btw, are you going to replace that DPRINT_* stuff as well ?

Thanks,

Yes, that is in my next set of patches.

Hank

#27 lore raw

RE: [PATCH 12/21] Staging: hv: Cleanup irq management

Quoted 16 lines

-----Original Message-----
From: Hank Janssen
Sent: Thursday, March 10, 2011 5:54 PM
To: Thomas Gleixner
Cc: KY Srinivasan; [email protected]; [email protected]; [email protected]; [email protected]; Haiyang Zhang; Mike Sterling; Abhishek Kane (Mindtree Consulting PVT LTD)
Subject: Re: [PATCH 12/21] Staging: hv: Cleanup irq management

Quoted 13 lines
Quoted 12 lines · Thomas Gleixner

drivers/staging/hv/vmbus_drv.c static int vmbus_bus_init(void) · line 434

Quoted 9 lines

   }
drivers/staging/hv/vmbus_drv.c +3 -2
-    vector = VMBUS_IRQ_VECTOR;
 
-    DPRINT_INFO(VMBUS_DRV, "irq 0x%x vector 0x%x", vmbus_irq, vector);
+    vector = IRQ0_VECTOR + pdev->irq;
+    DPRINT_INFO(VMBUS_DRV, "irq 0x%x vector 0x%x", pdev->irq,
+            IRQ0_VECTOR + pdev->irq);

Why evaluating vector first and then not using it for that debug print thingy?

Good point; I will fix this before Hank gets rid of the DPRINT_INFO altogether.

Regards,

K. Y

#28 lore raw

PATCH 13/21 Staging: hv: Rename vmbus_driver_context structure

In reply to a message not in the archive

Now that struct vmbus_driver_context is properly cleaned up, rename this structure appropriately and cleanup the code.

---
 drivers/staging/hv/vmbus_drv.c |   36 ++++++++++++++++--------------------
 1 files changed, 16 insertions(+), 20 deletions(-)
drivers/staging/hv/vmbus_drv.c +16 -20
index 4e45016..7b9a2c8 100644
@@ -44,12 +44,10 @@ static struct device *root_dev; /* Root device */
 struct pci_dev *hv_pci_dev;
 
 /* Main vmbus driver data structure */
-struct vmbus_driver_context {
-
+struct hv_bus {
 	struct bus_type bus;
 	struct tasklet_struct msg_dpc;
 	struct tasklet_struct event_dpc;
-
 };
 
 static int vmbus_match(struct device *device, struct device_driver *driver);
@@ -104,7 +102,7 @@ static struct device_attribute vmbus_device_attrs[] = {
 };
 
 /* The one and only one */
-static struct vmbus_driver_context vmbus_drv = {
+static struct hv_bus  hv_bus = {
 	.bus.name =		"vmbus",
 	.bus.match =		vmbus_match,
 	.bus.shutdown =		vmbus_shutdown,
@@ -374,7 +372,6 @@ static ssize_t vmbus_show_device_attr(struct device *dev,
  */
 static int vmbus_bus_init(struct pci_dev *pdev)
 {
-	struct vmbus_driver_context *vmbus_drv_ctx = &vmbus_drv;
 	int ret;
 	unsigned int vector;
 
@@ -399,16 +396,16 @@ static int vmbus_bus_init(struct pci_dev *pdev)
 	}
 
 
-	vmbus_drv_ctx->bus.name = driver_name;
+	hv_bus.bus.name = driver_name;
 
 	/* Initialize the bus context */
-	tasklet_init(&vmbus_drv_ctx->msg_dpc, vmbus_on_msg_dpc,
+	tasklet_init(&hv_bus.msg_dpc, vmbus_on_msg_dpc,
 		     (unsigned long)NULL);
-	tasklet_init(&vmbus_drv_ctx->event_dpc, vmbus_on_event,
+	tasklet_init(&hv_bus.event_dpc, vmbus_on_event,
 		     (unsigned long)NULL);
 
 	/* Now, register the bus  with LDM */
-	ret = bus_register(&vmbus_drv_ctx->bus);
+	ret = bus_register(&hv_bus.bus);
 	if (ret) {
 		ret = -1;
 		goto cleanup;
@@ -423,7 +420,7 @@ static int vmbus_bus_init(struct pci_dev *pdev)
 		DPRINT_ERR(VMBUS_DRV, "ERROR - Unable to request IRQ %d",
 			   pdev->irq);
 
-		bus_unregister(&vmbus_drv_ctx->bus);
+		bus_unregister(&hv_bus.bus);
 
 		ret = -1;
 		goto cleanup;
@@ -441,7 +438,7 @@ static int vmbus_bus_init(struct pci_dev *pdev)
 			   "ERROR - Unable to register vmbus root device");
 
 		free_irq(pdev->irq, pdev);
-		bus_unregister(&vmbus_drv_ctx->bus);
+		bus_unregister(&hv_bus.bus);
 
 		ret = PTR_ERR(root_dev);
 		goto cleanup;
@@ -456,7 +453,7 @@ static int vmbus_bus_init(struct pci_dev *pdev)
 	if (ret) {
 		root_device_unregister(root_dev);
 		free_irq(pdev->irq, pdev);
-		bus_unregister(&vmbus_drv_ctx->bus);
+		bus_unregister(&hv_bus.bus);
 		goto cleanup;
 	}
 
@@ -475,7 +472,6 @@ cleanup:
  */
 static void vmbus_bus_exit(void)
 {
-	struct vmbus_driver_context *vmbus_drv_ctx = &vmbus_drv;
 
 
 	vmbus_release_unattached_channels();
@@ -487,12 +483,12 @@ static void vmbus_bus_exit(void)
 	/* Unregister the root bus device */
 	root_device_unregister(root_dev);
 
-	bus_unregister(&vmbus_drv_ctx->bus);
+	bus_unregister(&hv_bus.bus);
 
 	free_irq(hv_pci_dev->irq, hv_pci_dev);
 
-	tasklet_kill(&vmbus_drv_ctx->msg_dpc);
-	tasklet_kill(&vmbus_drv_ctx->event_dpc);
+	tasklet_kill(&hv_bus.msg_dpc);
+	tasklet_kill(&hv_bus.event_dpc);
 }
 
 
@@ -515,7 +511,7 @@ int vmbus_child_driver_register(struct device_driver *drv)
 		    drv, drv->name);
 
 	/* The child driver on this vmbus */
-	drv->bus = &vmbus_drv.bus;
+	drv->bus = &hv_bus.bus;
 
 	ret = driver_register(drv);
 
@@ -609,7 +605,7 @@ int vmbus_child_device_register(struct hv_device *child_device_obj)
 		     atomic_inc_return(&device_num));
 
 	/* The new device belongs to this bus */
-	child_device_obj->device.bus = &vmbus_drv.bus; /* device->dev.bus; */
+	child_device_obj->device.bus = &hv_bus.bus; /* device->dev.bus; */
 	child_device_obj->device.parent = root_dev;
 	child_device_obj->device.release = vmbus_device_release;
 
@@ -877,10 +873,10 @@ static irqreturn_t vmbus_isr(int irq, void *dev_id)
 	/* Schedules a dpc if necessary */
 	if (ret > 0) {
 		if (test_bit(0, (unsigned long *)&ret))
-			tasklet_schedule(&vmbus_drv.msg_dpc);
+			tasklet_schedule(&hv_bus.msg_dpc);
 
 		if (test_bit(1, (unsigned long *)&ret))
-			tasklet_schedule(&vmbus_drv.event_dpc);
+			tasklet_schedule(&hv_bus.event_dpc);
 
 		return IRQ_HANDLED;
 	} else {
Signature · 1 line
1.5.5.6
#29 lore raw

Re: [PATCH 13/21] [PATCH 13/21] Staging: hv: Rename vmbus_driver_context structure

Quoted 5 lines · K. Y. Srinivasan

Now that struct vmbus_driver_context is properly cleaned up, rename this structure appropriately and cleanup the code.

drivers/staging/hv/vmbus_drv.c static irqreturn_t vmbus_isr(int irq, void *dev_id) · line 879

Quoted 9 lines
drivers/staging/hv/vmbus_drv.c +2 -2
@@ -877,10 +873,10 @@ static irqreturn_t vmbus_isr(int irq, void *dev_id)
 	/* Schedules a dpc if necessary */
 	if (ret > 0) {
 		if (test_bit(0, (unsigned long *)&ret))
-			tasklet_schedule(&vmbus_drv.msg_dpc);
+			tasklet_schedule(&hv_bus.msg_dpc);
 
 		if (test_bit(1, (unsigned long *)&ret))
-			tasklet_schedule(&vmbus_drv.event_dpc);
+			tasklet_schedule(&hv_bus.event_dpc);

What's the plan to convert that tasklet/work stuff to threaded irqs ?

Thanks,

tglx

#30 lore raw

RE: [PATCH 13/21] [PATCH 13/21] Staging: hv: Rename vmbus_driver_context structure

Quoted 24 lines

-----Original Message-----
From: Thomas Gleixner [mailto:[email protected]]
Sent: Thursday, March 10, 2011 5:50 PM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Haiyang Zhang; Mike Sterling; Abhishek Kane (Mindtree Consulting PVT LTD); Hank Janssen
Subject: Re: [PATCH 13/21] [PATCH 13/21] Staging: hv: Rename vmbus_driver_context structure

Quoted 11 lines · K. Y. Srinivasan

Now that struct vmbus_driver_context is properly cleaned up, rename this structure appropriately and cleanup the code.

drivers/staging/hv/vmbus_drv.c +1 -1
@@ -877,10 +873,10 @@ static irqreturn_t vmbus_isr(int irq, void *dev_id)
 	/* Schedules a dpc if necessary */
 	if (ret > 0) {
 		if (test_bit(0, (unsigned long *)&ret))
-			tasklet_schedule(&vmbus_drv.msg_dpc);
+			tasklet_schedule(&hv_bus.msg_dpc);
 
Quoted 5 lines

drivers/staging/hv/vmbus_drv.c static irqreturn_t vmbus_isr(int irq, void *dev_id) · line 879

Quoted 3 lines
drivers/staging/hv/vmbus_drv.c +1 -1
 		if (test_bit(1, (unsigned long *)&ret))
-			tasklet_schedule(&vmbus_drv.event_dpc);
+			tasklet_schedule(&hv_bus.event_dpc);

What's the plan to convert that tasklet/work stuff to threaded irqs ?

This is on my plate; I was going to work on this after I addressed all other issues preventing the vmbus driver from exiting staging.

Regards,

K. Y

#31 lore raw

PATCH 14/21 Get rid of the forward declaration for vmbus_uevent

In reply to a message not in the archive

Get rid of the forward declaration of vmbus_uevent by moving the code around.

---
 drivers/staging/hv/vmbus_drv.c |  151 ++++++++++++++++++++--------------------
 1 files changed, 75 insertions(+), 76 deletions(-)
drivers/staging/hv/vmbus_drv.c +75 -76
index 7b9a2c8..97ebeb4 100644
@@ -54,7 +54,6 @@ static int vmbus_match(struct device *device, struct device_driver *driver);
 static int vmbus_probe(struct device *device);
 static int vmbus_remove(struct device *device);
 static void vmbus_shutdown(struct device *device);
-static int vmbus_uevent(struct device *device, struct kobj_uevent_env *env);
 
 static irqreturn_t vmbus_isr(int irq, void *dev_id);
 
@@ -101,6 +100,81 @@ static struct device_attribute vmbus_device_attrs[] = {
 	__ATTR_NULL
 };
 
+/*
+ * vmbus_uevent - add uevent for our device
+ *
+ * This routine is invoked when a device is added or removed on the vmbus to
+ * generate a uevent to udev in the userspace. The udev will then look at its
+ * rule and the uevent generated here to load the appropriate driver
+ */
+static int vmbus_uevent(struct device *device, struct kobj_uevent_env *env)
+{
+	struct hv_device *dev = device_to_hv_device(device);
+	int ret;
+
+	DPRINT_INFO(VMBUS_DRV, "generating uevent - VMBUS_DEVICE_CLASS_GUID={"
+		    "%02x%02x%02x%02x-%02x%02x-%02x%02x-"
+		    "%02x%02x%02x%02x%02x%02x%02x%02x}",
+		    dev->dev_type.data[3], dev->dev_type.data[2],
+		    dev->dev_type.data[1], dev->dev_type.data[0],
+		    dev->dev_type.data[5], dev->dev_type.data[4],
+		    dev->dev_type.data[7], dev->dev_type.data[6],
+		    dev->dev_type.data[8], dev->dev_type.data[9],
+		    dev->dev_type.data[10],
+		    dev->dev_type.data[11],
+		    dev->dev_type.data[12],
+		    dev->dev_type.data[13],
+		    dev->dev_type.data[14],
+		    dev->dev_type.data[15]);
+
+	ret = add_uevent_var(env, "VMBUS_DEVICE_CLASS_GUID={"
+			     "%02x%02x%02x%02x-%02x%02x-%02x%02x-"
+			     "%02x%02x%02x%02x%02x%02x%02x%02x}",
+			     dev->dev_type.data[3],
+			     dev->dev_type.data[2],
+			     dev->dev_type.data[1],
+			     dev->dev_type.data[0],
+			     dev->dev_type.data[5],
+			     dev->dev_type.data[4],
+			     dev->dev_type.data[7],
+			     dev->dev_type.data[6],
+			     dev->dev_type.data[8],
+			     dev->dev_type.data[9],
+			     dev->dev_type.data[10],
+			     dev->dev_type.data[11],
+			     dev->dev_type.data[12],
+			     dev->dev_type.data[13],
+			     dev->dev_type.data[14],
+			     dev->dev_type.data[15]);
+
+	if (ret)
+		return ret;
+
+	ret = add_uevent_var(env, "VMBUS_DEVICE_DEVICE_GUID={"
+			     "%02x%02x%02x%02x-%02x%02x-%02x%02x-"
+			     "%02x%02x%02x%02x%02x%02x%02x%02x}",
+			     dev->dev_instance.data[3],
+			     dev->dev_instance.data[2],
+			     dev->dev_instance.data[1],
+			     dev->dev_instance.data[0],
+			     dev->dev_instance.data[5],
+			     dev->dev_instance.data[4],
+			     dev->dev_instance.data[7],
+			     dev->dev_instance.data[6],
+			     dev->dev_instance.data[8],
+			     dev->dev_instance.data[9],
+			     dev->dev_instance.data[10],
+			     dev->dev_instance.data[11],
+			     dev->dev_instance.data[12],
+			     dev->dev_instance.data[13],
+			     dev->dev_instance.data[14],
+			     dev->dev_instance.data[15]);
+	if (ret)
+		return ret;
+
+	return 0;
+}
+
 /* The one and only one */
 static struct hv_bus  hv_bus = {
 	.bus.name =		"vmbus",
@@ -649,81 +723,6 @@ void vmbus_child_device_unregister(struct hv_device *device_obj)
 }
 
 /*
- * vmbus_uevent - add uevent for our device
- *
- * This routine is invoked when a device is added or removed on the vmbus to
- * generate a uevent to udev in the userspace. The udev will then look at its
- * rule and the uevent generated here to load the appropriate driver
- */
-static int vmbus_uevent(struct device *device, struct kobj_uevent_env *env)
-{
-	struct hv_device *dev = device_to_hv_device(device);
-	int ret;
-
-	DPRINT_INFO(VMBUS_DRV, "generating uevent - VMBUS_DEVICE_CLASS_GUID={"
-		    "%02x%02x%02x%02x-%02x%02x-%02x%02x-"
-		    "%02x%02x%02x%02x%02x%02x%02x%02x}",
-		    dev->dev_type.data[3], dev->dev_type.data[2],
-		    dev->dev_type.data[1], dev->dev_type.data[0],
-		    dev->dev_type.data[5], dev->dev_type.data[4],
-		    dev->dev_type.data[7], dev->dev_type.data[6],
-		    dev->dev_type.data[8], dev->dev_type.data[9],
-		    dev->dev_type.data[10],
-		    dev->dev_type.data[11],
-		    dev->dev_type.data[12],
-		    dev->dev_type.data[13],
-		    dev->dev_type.data[14],
-		    dev->dev_type.data[15]);
-
-	ret = add_uevent_var(env, "VMBUS_DEVICE_CLASS_GUID={"
-			     "%02x%02x%02x%02x-%02x%02x-%02x%02x-"
-			     "%02x%02x%02x%02x%02x%02x%02x%02x}",
-			     dev->dev_type.data[3],
-			     dev->dev_type.data[2],
-			     dev->dev_type.data[1],
-			     dev->dev_type.data[0],
-			     dev->dev_type.data[5],
-			     dev->dev_type.data[4],
-			     dev->dev_type.data[7],
-			     dev->dev_type.data[6],
-			     dev->dev_type.data[8],
-			     dev->dev_type.data[9],
-			     dev->dev_type.data[10],
-			     dev->dev_type.data[11],
-			     dev->dev_type.data[12],
-			     dev->dev_type.data[13],
-			     dev->dev_type.data[14],
-			     dev->dev_type.data[15]);
-
-	if (ret)
-		return ret;
-
-	ret = add_uevent_var(env, "VMBUS_DEVICE_DEVICE_GUID={"
-			     "%02x%02x%02x%02x-%02x%02x-%02x%02x-"
-			     "%02x%02x%02x%02x%02x%02x%02x%02x}",
-			     dev->dev_instance.data[3],
-			     dev->dev_instance.data[2],
-			     dev->dev_instance.data[1],
-			     dev->dev_instance.data[0],
-			     dev->dev_instance.data[5],
-			     dev->dev_instance.data[4],
-			     dev->dev_instance.data[7],
-			     dev->dev_instance.data[6],
-			     dev->dev_instance.data[8],
-			     dev->dev_instance.data[9],
-			     dev->dev_instance.data[10],
-			     dev->dev_instance.data[11],
-			     dev->dev_instance.data[12],
-			     dev->dev_instance.data[13],
-			     dev->dev_instance.data[14],
-			     dev->dev_instance.data[15]);
-	if (ret)
-		return ret;
-
-	return 0;
-}
-
-/*
  * vmbus_match - Attempt to match the specified device to the specified driver
  */
 static int vmbus_match(struct device *device, struct device_driver *driver)
Signature · 1 line
1.5.5.6
#32 lore raw

PATCH 15/21 Staging: hv: Get rid of the forward declaration for vmbus_match

In reply to a message not in the archive

Get rid of the forward declaration of vmbus_match by moving the code around.

---
 drivers/staging/hv/vmbus_drv.c |   49 ++++++++++++++++++++-------------------
 1 files changed, 25 insertions(+), 24 deletions(-)
drivers/staging/hv/vmbus_drv.c +25 -24
index 97ebeb4..e15c465 100644
@@ -50,7 +50,6 @@ struct hv_bus {
 	struct tasklet_struct event_dpc;
 };
 
-static int vmbus_match(struct device *device, struct device_driver *driver);
 static int vmbus_probe(struct device *device);
 static int vmbus_remove(struct device *device);
 static void vmbus_shutdown(struct device *device);
@@ -175,6 +174,31 @@ static int vmbus_uevent(struct device *device, struct kobj_uevent_env *env)
 	return 0;
 }
 
+
+/*
+ * vmbus_match - Attempt to match the specified device to the specified driver
+ */
+static int vmbus_match(struct device *device, struct device_driver *driver)
+{
+	int match = 0;
+	struct hv_driver *drv = drv_to_hv_drv(driver);
+	struct hv_device *device_ctx = device_to_hv_device(device);
+
+	/* We found our driver ? */
+	if (memcmp(&device_ctx->dev_type, &drv->dev_type,
+		   sizeof(struct hv_guid)) == 0) {
+
+		device_ctx->drv = drv->priv;
+		DPRINT_INFO(VMBUS_DRV,
+			    "device object (%p) set to driver object (%p)",
+			    &device_ctx,
+			    device_ctx->drv);
+
+		match = 1;
+	}
+	return match;
+}
+
 /* The one and only one */
 static struct hv_bus  hv_bus = {
 	.bus.name =		"vmbus",
@@ -722,29 +746,6 @@ void vmbus_child_device_unregister(struct hv_device *device_obj)
 		    &device_obj->device);
 }
 
-/*
- * vmbus_match - Attempt to match the specified device to the specified driver
- */
-static int vmbus_match(struct device *device, struct device_driver *driver)
-{
-	int match = 0;
-	struct hv_driver *drv = drv_to_hv_drv(driver);
-	struct hv_device *device_ctx = device_to_hv_device(device);
-
-	/* We found our driver ? */
-	if (memcmp(&device_ctx->dev_type, &drv->dev_type,
-		   sizeof(struct hv_guid)) == 0) {
-
-		device_ctx->drv = drv->priv;
-		DPRINT_INFO(VMBUS_DRV,
-			    "device object (%p) set to driver object (%p)",
-			    &device_ctx,
-			    device_ctx->drv);
-
-		match = 1;
-	}
-	return match;
-}
 
 /*
  * vmbus_probe_failed_cb - Callback when a driver probe failed in vmbus_probe()
Signature · 1 line
1.5.5.6
#33 lore raw

PATCH 16/21 Staging: hv: Get rid of the forward declaration for vmbus_probe

In reply to a message not in the archive

Get rid of the forward declaration of vmbus_probe by moving the code around.

---
 drivers/staging/hv/vmbus_drv.c |  107 ++++++++++++++++++++--------------------
 1 files changed, 53 insertions(+), 54 deletions(-)
drivers/staging/hv/vmbus_drv.c +53 -54
index e15c465..35503b6 100644
@@ -50,7 +50,6 @@ struct hv_bus {
 	struct tasklet_struct event_dpc;
 };
 
-static int vmbus_probe(struct device *device);
 static int vmbus_remove(struct device *device);
 static void vmbus_shutdown(struct device *device);
 
@@ -199,6 +198,59 @@ static int vmbus_match(struct device *device, struct device_driver *driver)
 	return match;
 }
 
+
+/*
+ * vmbus_probe_failed_cb - Callback when a driver probe failed in vmbus_probe()
+ *
+ * We need a callback because we cannot invoked device_unregister() inside
+ * vmbus_probe() since vmbus_probe() may be invoked inside device_register()
+ * i.e. we cannot call device_unregister() inside device_register()
+ */
+static void vmbus_probe_failed_cb(struct work_struct *context)
+{
+	struct hv_device *device_ctx = (struct hv_device *)context;
+
+	/*
+	 * Kick off the process of unregistering the device.
+	 * This will call vmbus_remove() and eventually vmbus_device_release()
+	 */
+	device_unregister(&device_ctx->device);
+
+	/* put_device(&device_ctx->device); */
+}
+
+/*
+ * vmbus_probe - Add the new vmbus's child device
+ */
+static int vmbus_probe(struct device *child_device)
+{
+	int ret = 0;
+	struct hv_driver *drv =
+			drv_to_hv_drv(child_device->driver);
+	struct hv_device *dev = device_to_hv_device(child_device);
+
+	/* Let the specific open-source driver handles the probe if it can */
+	if (drv->driver.probe) {
+		ret = dev->probe_error =
+		drv->driver.probe(child_device);
+		if (ret != 0) {
+			DPRINT_ERR(VMBUS_DRV, "probe() failed for device %s "
+				   "(%p) on driver %s (%d)...",
+				   dev_name(child_device), child_device,
+				   child_device->driver->name, ret);
+
+			INIT_WORK(&dev->probe_failed_work_item,
+				  vmbus_probe_failed_cb);
+			schedule_work(&dev->probe_failed_work_item);
+		}
+	} else {
+		DPRINT_ERR(VMBUS_DRV, "probe() method not set for driver - %s",
+			   child_device->driver->name);
+		ret = -1;
+	}
+	return ret;
+}
+
 /* The one and only one */
 static struct hv_bus  hv_bus = {
 	.bus.name =		"vmbus",
@@ -746,59 +798,6 @@ void vmbus_child_device_unregister(struct hv_device *device_obj)
 		    &device_obj->device);
 }
 
-
-/*
- * vmbus_probe_failed_cb - Callback when a driver probe failed in vmbus_probe()
- *
- * We need a callback because we cannot invoked device_unregister() inside
- * vmbus_probe() since vmbus_probe() may be invoked inside device_register()
- * i.e. we cannot call device_unregister() inside device_register()
- */
-static void vmbus_probe_failed_cb(struct work_struct *context)
-{
-	struct hv_device *device_ctx = (struct hv_device *)context;
-
-	/*
-	 * Kick off the process of unregistering the device.
-	 * This will call vmbus_remove() and eventually vmbus_device_release()
-	 */
-	device_unregister(&device_ctx->device);
-
-	/* put_device(&device_ctx->device); */
-}
-
-/*
- * vmbus_probe - Add the new vmbus's child device
- */
-static int vmbus_probe(struct device *child_device)
-{
-	int ret = 0;
-	struct hv_driver *drv =
-			drv_to_hv_drv(child_device->driver);
-	struct hv_device *dev = device_to_hv_device(child_device);
-
-	/* Let the specific open-source driver handles the probe if it can */
-	if (drv->driver.probe) {
-		ret = dev->probe_error =
-		drv->driver.probe(child_device);
-		if (ret != 0) {
-			DPRINT_ERR(VMBUS_DRV, "probe() failed for device %s "
-				   "(%p) on driver %s (%d)...",
-				   dev_name(child_device), child_device,
-				   child_device->driver->name, ret);
-
-			INIT_WORK(&dev->probe_failed_work_item,
-				  vmbus_probe_failed_cb);
-			schedule_work(&dev->probe_failed_work_item);
-		}
-	} else {
-		DPRINT_ERR(VMBUS_DRV, "probe() method not set for driver - %s",
-			   child_device->driver->name);
-		ret = -1;
-	}
-	return ret;
-}
-
 /*
  * vmbus_remove - Remove a vmbus device
  */
Signature · 1 line
1.5.5.6
#34 lore raw

PATCH 17/21 Staging: hv: Get rid of the forward declaration for vmbus_remove

In reply to a message not in the archive

Get rid of the forward declaration of vmbus_remove by moving the code around.

---
 drivers/staging/hv/vmbus_drv.c |   59 +++++++++++++++++++--------------------
 1 files changed, 29 insertions(+), 30 deletions(-)
drivers/staging/hv/vmbus_drv.c +29 -30
index 35503b6..db5e735 100644
@@ -50,7 +50,6 @@ struct hv_bus {
 	struct tasklet_struct event_dpc;
 };
 
-static int vmbus_remove(struct device *device);
 static void vmbus_shutdown(struct device *device);
 
 static irqreturn_t vmbus_isr(int irq, void *dev_id);
@@ -251,6 +250,35 @@ static int vmbus_probe(struct device *child_device)
 	return ret;
 }
 
+/*
+ * vmbus_remove - Remove a vmbus device
+ */
+static int vmbus_remove(struct device *child_device)
+{
+	int ret;
+	struct hv_driver *drv;
+
+
+	if (child_device->driver) {
+		drv = drv_to_hv_drv(child_device->driver);
+
+		/*
+		 * Let the specific open-source driver handles the removal if
+		 * it can
+		 */
+		if (drv->driver.remove) {
+			ret = drv->driver.remove(child_device);
+		} else {
+			DPRINT_ERR(VMBUS_DRV,
+				   "remove() method not set for driver - %s",
+				   child_device->driver->name);
+			ret = -1;
+		}
+	}
+
+	return 0;
+}
+
 /* The one and only one */
 static struct hv_bus  hv_bus = {
 	.bus.name =		"vmbus",
@@ -799,35 +827,6 @@ void vmbus_child_device_unregister(struct hv_device *device_obj)
 }
 
 /*
- * vmbus_remove - Remove a vmbus device
- */
-static int vmbus_remove(struct device *child_device)
-{
-	int ret;
-	struct hv_driver *drv;
-
-
-	if (child_device->driver) {
-		drv = drv_to_hv_drv(child_device->driver);
-
-		/*
-		 * Let the specific open-source driver handles the removal if
-		 * it can
-		 */
-		if (drv->driver.remove) {
-			ret = drv->driver.remove(child_device);
-		} else {
-			DPRINT_ERR(VMBUS_DRV,
-				   "remove() method not set for driver - %s",
-				   child_device->driver->name);
-			ret = -1;
-		}
-	}
-
-	return 0;
-}
-
-/*
  * vmbus_shutdown - Shutdown a vmbus device
  */
 static void vmbus_shutdown(struct device *child_device)
Signature · 1 line
1.5.5.6
#35 lore raw

PATCH 18/21 Staging: hv: Get rid of the forward declaration for vmbus_shutdown

In reply to a message not in the archive

Get rid of the forward declaration of vmbus_shutdown by moving the code around.

---
 drivers/staging/hv/vmbus_drv.c |   44 ++++++++++++++++++++--------------------
 1 files changed, 22 insertions(+), 22 deletions(-)
drivers/staging/hv/vmbus_drv.c +22 -22
index db5e735..6f4094b 100644
@@ -50,7 +50,6 @@ struct hv_bus {
 	struct tasklet_struct event_dpc;
 };
 
-static void vmbus_shutdown(struct device *device);
 
 static irqreturn_t vmbus_isr(int irq, void *dev_id);
 
@@ -279,6 +278,28 @@ static int vmbus_remove(struct device *child_device)
 	return 0;
 }
 
+
+/*
+ * vmbus_shutdown - Shutdown a vmbus device
+ */
+static void vmbus_shutdown(struct device *child_device)
+{
+	struct hv_driver *drv;
+
+
+	/* The device may not be attached yet */
+	if (!child_device->driver)
+		return;
+
+	drv = drv_to_hv_drv(child_device->driver);
+
+	/* Let the specific open-source driver handles the removal if it can */
+	if (drv->driver.shutdown)
+		drv->driver.shutdown(child_device);
+
+	return;
+}
+
 /* The one and only one */
 static struct hv_bus  hv_bus = {
 	.bus.name =		"vmbus",
@@ -826,27 +847,6 @@ void vmbus_child_device_unregister(struct hv_device *device_obj)
 		    &device_obj->device);
 }
 
-/*
- * vmbus_shutdown - Shutdown a vmbus device
- */
-static void vmbus_shutdown(struct device *child_device)
-{
-	struct hv_driver *drv;
-
-
-	/* The device may not be attached yet */
-	if (!child_device->driver)
-		return;
-
-	drv = drv_to_hv_drv(child_device->driver);
-
-	/* Let the specific open-source driver handles the removal if it can */
-	if (drv->driver.shutdown)
-		drv->driver.shutdown(child_device);
-
-	return;
-}
-
 
 /*
  * vmbus_device_release - Final callback release of the vmbus child device
Signature · 1 line
1.5.5.6
#36 lore raw

PATCH 19/21 Staging: hv: Get rid of the forward declaration for vmbus_device_release

In reply to a message not in the archive

Get rid of the forward declaration of vmbus_device_release by moving the code around.

---
 drivers/staging/hv/vmbus_drv.c |   27 ++++++++++++---------------
 1 files changed, 12 insertions(+), 15 deletions(-)
drivers/staging/hv/vmbus_drv.c +12 -15
index 6f4094b..7c16acd 100644
@@ -53,8 +53,6 @@ struct hv_bus {
 
 static irqreturn_t vmbus_isr(int irq, void *dev_id);
 
-static void vmbus_device_release(struct device *device);
-
 static ssize_t vmbus_show_device_attr(struct device *dev,
 				      struct device_attribute *dev_attr,
 				      char *buf);
@@ -300,6 +298,18 @@ static void vmbus_shutdown(struct device *child_device)
 	return;
 }
 
+
+/*
+ * vmbus_device_release - Final callback release of the vmbus child device
+ */
+static void vmbus_device_release(struct device *device)
+{
+	struct hv_device *device_ctx = device_to_hv_device(device);
+
+	kfree(device_ctx);
+
+}
+
 /* The one and only one */
 static struct hv_bus  hv_bus = {
 	.bus.name =		"vmbus",
@@ -848,19 +858,6 @@ void vmbus_child_device_unregister(struct hv_device *device_obj)
 }
 
 
-/*
- * vmbus_device_release - Final callback release of the vmbus child device
- */
-static void vmbus_device_release(struct device *device)
-{
-	struct hv_device *device_ctx = device_to_hv_device(device);
-
-	kfree(device_ctx);
-
-	/* !!DO NOT REFERENCE device_ctx anymore at this point!! */
-}
-
-
 
 static irqreturn_t vmbus_isr(int irq, void *dev_id)
 {
Signature · 1 line
1.5.5.6
#37 lore raw

PATCH 20/21 Staging: hv: Get rid of the forward declaration for vmbus_isr

In reply to a message not in the archive

Get rid of the forward declaration of vmbus_isr by moving the code around.

---
 drivers/staging/hv/vmbus_drv.c |   47 +++++++++++++++++++--------------------
 1 files changed, 23 insertions(+), 24 deletions(-)
drivers/staging/hv/vmbus_drv.c +23 -24
index 7c16acd..dfa3c66 100644
@@ -51,7 +51,6 @@ struct hv_bus {
 };
 
 
-static irqreturn_t vmbus_isr(int irq, void *dev_id);
 
 static ssize_t vmbus_show_device_attr(struct device *dev,
 				      struct device_attribute *dev_attr,
@@ -94,6 +93,7 @@ static struct device_attribute vmbus_device_attrs[] = {
 	__ATTR_NULL
 };
 
+
 /*
  * vmbus_uevent - add uevent for our device
  *
@@ -420,6 +420,28 @@ static int vmbus_on_isr(void)
 	return ret;
 }
 
+
+static irqreturn_t vmbus_isr(int irq, void *dev_id)
+{
+	int ret;
+
+	ret = vmbus_on_isr();
+
+	/* Schedules a dpc if necessary */
+	if (ret > 0) {
+		if (test_bit(0, (unsigned long *)&ret))
+			tasklet_schedule(&hv_bus.msg_dpc);
+
+		if (test_bit(1, (unsigned long *)&ret))
+			tasklet_schedule(&hv_bus.event_dpc);
+
+		return IRQ_HANDLED;
+	} else {
+		return IRQ_NONE;
+	}
+}
+
+
 static void get_channel_info(struct hv_device *device,
 			     struct hv_device_info *info)
 {
@@ -858,29 +880,6 @@ void vmbus_child_device_unregister(struct hv_device *device_obj)
 }
 
 
-
-static irqreturn_t vmbus_isr(int irq, void *dev_id)
-{
-	int ret;
-
-	ret = vmbus_on_isr();
-
-	/* Schedules a dpc if necessary */
-	if (ret > 0) {
-		if (test_bit(0, (unsigned long *)&ret))
-			tasklet_schedule(&hv_bus.msg_dpc);
-
-		if (test_bit(1, (unsigned long *)&ret))
-			tasklet_schedule(&hv_bus.event_dpc);
-
-		return IRQ_HANDLED;
-	} else {
-		return IRQ_NONE;
-	}
-}
-
-
-
 static int __devinit hv_pci_probe(struct pci_dev *pdev,
 				const struct pci_device_id *ent)
 {
Signature · 1 line
1.5.5.6
#38 lore raw

PATCH 21/21 Staging: hv: Get rid of the forward declaration for vmbus_show_device_attr

In reply to a message not in the archive

Get rid of the forward declaration of vmbus_show_device_attr by moving the code around.

---
 drivers/staging/hv/vmbus_drv.c |  302 +++++++++++++++++++--------------------
 1 files changed, 147 insertions(+), 155 deletions(-)
drivers/staging/hv/vmbus_drv.c +147 -155
index dfa3c66..881c3c0 100644
@@ -50,18 +50,160 @@ struct hv_bus {
 	struct tasklet_struct event_dpc;
 };
 
+unsigned int vmbus_loglevel = (ALL_MODULES << 16 | INFO_LVL);
+EXPORT_SYMBOL(vmbus_loglevel);
+	/* (ALL_MODULES << 16 | DEBUG_LVL_ENTEREXIT); */
+	/* (((VMBUS | VMBUS_DRV)<<16) | DEBUG_LVL_ENTEREXIT); */
+
+
+static void get_channel_info(struct hv_device *device,
+			     struct hv_device_info *info)
+{
+	struct vmbus_channel_debug_info debug_info;
+
+	if (!device->channel)
+		return;
+
+	vmbus_get_debug_info(device->channel, &debug_info);
+
+	info->chn_id = debug_info.relid;
+	info->chn_state = debug_info.state;
+	memcpy(&info->chn_type, &debug_info.interfacetype,
+	       sizeof(struct hv_guid));
+	memcpy(&info->chn_instance, &debug_info.interface_instance,
+	       sizeof(struct hv_guid));
+
+	info->monitor_id = debug_info.monitorid;
+
+	info->server_monitor_pending = debug_info.servermonitor_pending;
+	info->server_monitor_latency = debug_info.servermonitor_latency;
+	info->server_monitor_conn_id = debug_info.servermonitor_connectionid;
+
+	info->client_monitor_pending = debug_info.clientmonitor_pending;
+	info->client_monitor_latency = debug_info.clientmonitor_latency;
+	info->client_monitor_conn_id = debug_info.clientmonitor_connectionid;
+
+	info->inbound.int_mask = debug_info.inbound.current_interrupt_mask;
+	info->inbound.read_idx = debug_info.inbound.current_read_index;
+	info->inbound.write_idx = debug_info.inbound.current_write_index;
+	info->inbound.bytes_avail_toread =
+		debug_info.inbound.bytes_avail_toread;
+	info->inbound.bytes_avail_towrite =
+		debug_info.inbound.bytes_avail_towrite;
 
+	info->outbound.int_mask =
+		debug_info.outbound.current_interrupt_mask;
+	info->outbound.read_idx = debug_info.outbound.current_read_index;
+	info->outbound.write_idx = debug_info.outbound.current_write_index;
+	info->outbound.bytes_avail_toread =
+		debug_info.outbound.bytes_avail_toread;
+	info->outbound.bytes_avail_towrite =
+		debug_info.outbound.bytes_avail_towrite;
+}
 
+/*
+ * vmbus_show_device_attr - Show the device attribute in sysfs.
+ *
+ * This is invoked when user does a
+ * "cat /sys/bus/vmbus/devices/<busdevice>/<attr name>"
+ */
 static ssize_t vmbus_show_device_attr(struct device *dev,
 				      struct device_attribute *dev_attr,
-				      char *buf);
+				      char *buf)
+{
+	struct hv_device *device_ctx = device_to_hv_device(dev);
+	struct hv_device_info device_info;
 
+	memset(&device_info, 0, sizeof(struct hv_device_info));
 
-unsigned int vmbus_loglevel = (ALL_MODULES << 16 | INFO_LVL);
-EXPORT_SYMBOL(vmbus_loglevel);
-	/* (ALL_MODULES << 16 | DEBUG_LVL_ENTEREXIT); */
-	/* (((VMBUS | VMBUS_DRV)<<16) | DEBUG_LVL_ENTEREXIT); */
+	get_channel_info(device_ctx, &device_info);
 
+	if (!strcmp(dev_attr->attr.name, "class_id")) {
+		return sprintf(buf, "{%02x%02x%02x%02x-%02x%02x-%02x%02x-"
+			       "%02x%02x%02x%02x%02x%02x%02x%02x}\n",
+			       device_info.chn_type.data[3],
+			       device_info.chn_type.data[2],
+			       device_info.chn_type.data[1],
+			       device_info.chn_type.data[0],
+			       device_info.chn_type.data[5],
+			       device_info.chn_type.data[4],
+			       device_info.chn_type.data[7],
+			       device_info.chn_type.data[6],
+			       device_info.chn_type.data[8],
+			       device_info.chn_type.data[9],
+			       device_info.chn_type.data[10],
+			       device_info.chn_type.data[11],
+			       device_info.chn_type.data[12],
+			       device_info.chn_type.data[13],
+			       device_info.chn_type.data[14],
+			       device_info.chn_type.data[15]);
+	} else if (!strcmp(dev_attr->attr.name, "device_id")) {
+		return sprintf(buf, "{%02x%02x%02x%02x-%02x%02x-%02x%02x-"
+			       "%02x%02x%02x%02x%02x%02x%02x%02x}\n",
+			       device_info.chn_instance.data[3],
+			       device_info.chn_instance.data[2],
+			       device_info.chn_instance.data[1],
+			       device_info.chn_instance.data[0],
+			       device_info.chn_instance.data[5],
+			       device_info.chn_instance.data[4],
+			       device_info.chn_instance.data[7],
+			       device_info.chn_instance.data[6],
+			       device_info.chn_instance.data[8],
+			       device_info.chn_instance.data[9],
+			       device_info.chn_instance.data[10],
+			       device_info.chn_instance.data[11],
+			       device_info.chn_instance.data[12],
+			       device_info.chn_instance.data[13],
+			       device_info.chn_instance.data[14],
+			       device_info.chn_instance.data[15]);
+	} else if (!strcmp(dev_attr->attr.name, "state")) {
+		return sprintf(buf, "%d\n", device_info.chn_state);
+	} else if (!strcmp(dev_attr->attr.name, "id")) {
+		return sprintf(buf, "%d\n", device_info.chn_id);
+	} else if (!strcmp(dev_attr->attr.name, "out_intr_mask")) {
+		return sprintf(buf, "%d\n", device_info.outbound.int_mask);
+	} else if (!strcmp(dev_attr->attr.name, "out_read_index")) {
+		return sprintf(buf, "%d\n", device_info.outbound.read_idx);
+	} else if (!strcmp(dev_attr->attr.name, "out_write_index")) {
+		return sprintf(buf, "%d\n", device_info.outbound.write_idx);
+	} else if (!strcmp(dev_attr->attr.name, "out_read_bytes_avail")) {
+		return sprintf(buf, "%d\n",
+			       device_info.outbound.bytes_avail_toread);
+	} else if (!strcmp(dev_attr->attr.name, "out_write_bytes_avail")) {
+		return sprintf(buf, "%d\n",
+			       device_info.outbound.bytes_avail_towrite);
+	} else if (!strcmp(dev_attr->attr.name, "in_intr_mask")) {
+		return sprintf(buf, "%d\n", device_info.inbound.int_mask);
+	} else if (!strcmp(dev_attr->attr.name, "in_read_index")) {
+		return sprintf(buf, "%d\n", device_info.inbound.read_idx);
+	} else if (!strcmp(dev_attr->attr.name, "in_write_index")) {
+		return sprintf(buf, "%d\n", device_info.inbound.write_idx);
+	} else if (!strcmp(dev_attr->attr.name, "in_read_bytes_avail")) {
+		return sprintf(buf, "%d\n",
+			       device_info.inbound.bytes_avail_toread);
+	} else if (!strcmp(dev_attr->attr.name, "in_write_bytes_avail")) {
+		return sprintf(buf, "%d\n",
+			       device_info.inbound.bytes_avail_towrite);
+	} else if (!strcmp(dev_attr->attr.name, "monitor_id")) {
+		return sprintf(buf, "%d\n", device_info.monitor_id);
+	} else if (!strcmp(dev_attr->attr.name, "server_monitor_pending")) {
+		return sprintf(buf, "%d\n", device_info.server_monitor_pending);
+	} else if (!strcmp(dev_attr->attr.name, "server_monitor_latency")) {
+		return sprintf(buf, "%d\n", device_info.server_monitor_latency);
+	} else if (!strcmp(dev_attr->attr.name, "server_monitor_conn_id")) {
+		return sprintf(buf, "%d\n",
+			       device_info.server_monitor_conn_id);
+	} else if (!strcmp(dev_attr->attr.name, "client_monitor_pending")) {
+		return sprintf(buf, "%d\n", device_info.client_monitor_pending);
+	} else if (!strcmp(dev_attr->attr.name, "client_monitor_latency")) {
+		return sprintf(buf, "%d\n", device_info.client_monitor_latency);
+	} else if (!strcmp(dev_attr->attr.name, "client_monitor_conn_id")) {
+		return sprintf(buf, "%d\n",
+			       device_info.client_monitor_conn_id);
+	} else {
+		return 0;
+	}
+}
 
 /* Set up per device attributes in /sys/bus/vmbus/devices/<bus device> */
 static struct device_attribute vmbus_device_attrs[] = {
@@ -441,156 +583,6 @@ static irqreturn_t vmbus_isr(int irq, void *dev_id)
 	}
 }
 
-
-static void get_channel_info(struct hv_device *device,
-			     struct hv_device_info *info)
-{
-	struct vmbus_channel_debug_info debug_info;
-
-	if (!device->channel)
-		return;
-
-	vmbus_get_debug_info(device->channel, &debug_info);
-
-	info->chn_id = debug_info.relid;
-	info->chn_state = debug_info.state;
-	memcpy(&info->chn_type, &debug_info.interfacetype,
-	       sizeof(struct hv_guid));
-	memcpy(&info->chn_instance, &debug_info.interface_instance,
-	       sizeof(struct hv_guid));
-
-	info->monitor_id = debug_info.monitorid;
-
-	info->server_monitor_pending = debug_info.servermonitor_pending;
-	info->server_monitor_latency = debug_info.servermonitor_latency;
-	info->server_monitor_conn_id = debug_info.servermonitor_connectionid;
-
-	info->client_monitor_pending = debug_info.clientmonitor_pending;
-	info->client_monitor_latency = debug_info.clientmonitor_latency;
-	info->client_monitor_conn_id = debug_info.clientmonitor_connectionid;
-
-	info->inbound.int_mask = debug_info.inbound.current_interrupt_mask;
-	info->inbound.read_idx = debug_info.inbound.current_read_index;
-	info->inbound.write_idx = debug_info.inbound.current_write_index;
-	info->inbound.bytes_avail_toread =
-		debug_info.inbound.bytes_avail_toread;
-	info->inbound.bytes_avail_towrite =
-		debug_info.inbound.bytes_avail_towrite;
-
-	info->outbound.int_mask =
-		debug_info.outbound.current_interrupt_mask;
-	info->outbound.read_idx = debug_info.outbound.current_read_index;
-	info->outbound.write_idx = debug_info.outbound.current_write_index;
-	info->outbound.bytes_avail_toread =
-		debug_info.outbound.bytes_avail_toread;
-	info->outbound.bytes_avail_towrite =
-		debug_info.outbound.bytes_avail_towrite;
-}
-
-/*
- * vmbus_show_device_attr - Show the device attribute in sysfs.
- *
- * This is invoked when user does a
- * "cat /sys/bus/vmbus/devices/<busdevice>/<attr name>"
- */
-static ssize_t vmbus_show_device_attr(struct device *dev,
-				      struct device_attribute *dev_attr,
-				      char *buf)
-{
-	struct hv_device *device_ctx = device_to_hv_device(dev);
-	struct hv_device_info device_info;
-
-	memset(&device_info, 0, sizeof(struct hv_device_info));
-
-	get_channel_info(device_ctx, &device_info);
-
-	if (!strcmp(dev_attr->attr.name, "class_id")) {
-		return sprintf(buf, "{%02x%02x%02x%02x-%02x%02x-%02x%02x-"
-			       "%02x%02x%02x%02x%02x%02x%02x%02x}\n",
-			       device_info.chn_type.data[3],
-			       device_info.chn_type.data[2],
-			       device_info.chn_type.data[1],
-			       device_info.chn_type.data[0],
-			       device_info.chn_type.data[5],
-			       device_info.chn_type.data[4],
-			       device_info.chn_type.data[7],
-			       device_info.chn_type.data[6],
-			       device_info.chn_type.data[8],
-			       device_info.chn_type.data[9],
-			       device_info.chn_type.data[10],
-			       device_info.chn_type.data[11],
-			       device_info.chn_type.data[12],
-			       device_info.chn_type.data[13],
-			       device_info.chn_type.data[14],
-			       device_info.chn_type.data[15]);
-	} else if (!strcmp(dev_attr->attr.name, "device_id")) {
-		return sprintf(buf, "{%02x%02x%02x%02x-%02x%02x-%02x%02x-"
-			       "%02x%02x%02x%02x%02x%02x%02x%02x}\n",
-			       device_info.chn_instance.data[3],
-			       device_info.chn_instance.data[2],
-			       device_info.chn_instance.data[1],
-			       device_info.chn_instance.data[0],
-			       device_info.chn_instance.data[5],
-			       device_info.chn_instance.data[4],
-			       device_info.chn_instance.data[7],
-			       device_info.chn_instance.data[6],
-			       device_info.chn_instance.data[8],
-			       device_info.chn_instance.data[9],
-			       device_info.chn_instance.data[10],
-			       device_info.chn_instance.data[11],
-			       device_info.chn_instance.data[12],
-			       device_info.chn_instance.data[13],
-			       device_info.chn_instance.data[14],
-			       device_info.chn_instance.data[15]);
-	} else if (!strcmp(dev_attr->attr.name, "state")) {
-		return sprintf(buf, "%d\n", device_info.chn_state);
-	} else if (!strcmp(dev_attr->attr.name, "id")) {
-		return sprintf(buf, "%d\n", device_info.chn_id);
-	} else if (!strcmp(dev_attr->attr.name, "out_intr_mask")) {
-		return sprintf(buf, "%d\n", device_info.outbound.int_mask);
-	} else if (!strcmp(dev_attr->attr.name, "out_read_index")) {
-		return sprintf(buf, "%d\n", device_info.outbound.read_idx);
-	} else if (!strcmp(dev_attr->attr.name, "out_write_index")) {
-		return sprintf(buf, "%d\n", device_info.outbound.write_idx);
-	} else if (!strcmp(dev_attr->attr.name, "out_read_bytes_avail")) {
-		return sprintf(buf, "%d\n",
-			       device_info.outbound.bytes_avail_toread);
-	} else if (!strcmp(dev_attr->attr.name, "out_write_bytes_avail")) {
-		return sprintf(buf, "%d\n",
-			       device_info.outbound.bytes_avail_towrite);
-	} else if (!strcmp(dev_attr->attr.name, "in_intr_mask")) {
-		return sprintf(buf, "%d\n", device_info.inbound.int_mask);
-	} else if (!strcmp(dev_attr->attr.name, "in_read_index")) {
-		return sprintf(buf, "%d\n", device_info.inbound.read_idx);
-	} else if (!strcmp(dev_attr->attr.name, "in_write_index")) {
-		return sprintf(buf, "%d\n", device_info.inbound.write_idx);
-	} else if (!strcmp(dev_attr->attr.name, "in_read_bytes_avail")) {
-		return sprintf(buf, "%d\n",
-			       device_info.inbound.bytes_avail_toread);
-	} else if (!strcmp(dev_attr->attr.name, "in_write_bytes_avail")) {
-		return sprintf(buf, "%d\n",
-			       device_info.inbound.bytes_avail_towrite);
-	} else if (!strcmp(dev_attr->attr.name, "monitor_id")) {
-		return sprintf(buf, "%d\n", device_info.monitor_id);
-	} else if (!strcmp(dev_attr->attr.name, "server_monitor_pending")) {
-		return sprintf(buf, "%d\n", device_info.server_monitor_pending);
-	} else if (!strcmp(dev_attr->attr.name, "server_monitor_latency")) {
-		return sprintf(buf, "%d\n", device_info.server_monitor_latency);
-	} else if (!strcmp(dev_attr->attr.name, "server_monitor_conn_id")) {
-		return sprintf(buf, "%d\n",
-			       device_info.server_monitor_conn_id);
-	} else if (!strcmp(dev_attr->attr.name, "client_monitor_pending")) {
-		return sprintf(buf, "%d\n", device_info.client_monitor_pending);
-	} else if (!strcmp(dev_attr->attr.name, "client_monitor_latency")) {
-		return sprintf(buf, "%d\n", device_info.client_monitor_latency);
-	} else if (!strcmp(dev_attr->attr.name, "client_monitor_conn_id")) {
-		return sprintf(buf, "%d\n",
-			       device_info.client_monitor_conn_id);
-	} else {
-		return 0;
-	}
-}
-
 /*
  * vmbus_bus_init -Main vmbus driver initialization routine.
  *
Signature · 1 line
1.5.5.6