* [PATCH 01/21] Staging: hv: Simplify root device management
[not found] <[PATCH 00/21] Staging: hv: Cleanup vmbus driver>
@ 2011-03-10 22:03 ` K. Y. Srinivasan
2011-03-10 22:04 ` [PATCH 02/21] Staging: hv: Change the signature for vmbus_cleanup() K. Y. Srinivasan
` (19 subsequent siblings)
20 siblings, 0 replies; 38+ messages in thread
From: K. Y. Srinivasan @ 2011-03-10 22:03 UTC (permalink / raw)
To: kys, gregkh, linux-kernel, devel, virtualization
Cc: Haiyang Zhang, Mike Sterling, Abhishek Kane, Hank Janssen
As part of simplifying root device management,
get rid of the hv_driver object from
vmbus_driver_context.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Mike Sterling <mike.sterling@microsoft.com>
Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
---
drivers/staging/hv/vmbus_drv.c | 41 ++++++++++-----------------------------
1 files changed, 11 insertions(+), 30 deletions(-)
diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c
index 159dfda..884a4c6 100644
--- a/drivers/staging/hv/vmbus_drv.c
+++ b/drivers/staging/hv/vmbus_drv.c
@@ -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) {
--
1.5.5.6
^ permalink raw reply related [flat|nested] 38+ messages in thread* [PATCH 02/21] Staging: hv: Change the signature for vmbus_cleanup()
[not found] <[PATCH 00/21] Staging: hv: Cleanup vmbus driver>
2011-03-10 22:03 ` [PATCH 01/21] Staging: hv: Simplify root device management K. Y. Srinivasan
@ 2011-03-10 22:04 ` K. Y. Srinivasan
2011-03-10 22:04 ` [PATCH 03/21] Staging: hv: Get rid of the function vmbus_msg_dpc() K. Y. Srinivasan
` (18 subsequent siblings)
20 siblings, 0 replies; 38+ messages in thread
From: K. Y. Srinivasan @ 2011-03-10 22:04 UTC (permalink / raw)
To: kys, gregkh, linux-kernel, devel, virtualization
Cc: Haiyang Zhang, Mike Sterling, Abhishek Kane, Hank Janssen
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.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Mike Sterling <mike.sterling@microsoft.com>
Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
---
drivers/staging/hv/vmbus_drv.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c
index 884a4c6..95654b1 100644
--- a/drivers/staging/hv/vmbus_drv.c
+++ b/drivers/staging/hv/vmbus_drv.c
@@ -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);
--
1.5.5.6
^ permalink raw reply related [flat|nested] 38+ messages in thread* [PATCH 03/21] Staging: hv: Get rid of the function vmbus_msg_dpc()
[not found] <[PATCH 00/21] Staging: hv: Cleanup vmbus driver>
2011-03-10 22:03 ` [PATCH 01/21] Staging: hv: Simplify root device management K. Y. Srinivasan
2011-03-10 22:04 ` [PATCH 02/21] Staging: hv: Change the signature for vmbus_cleanup() K. Y. Srinivasan
@ 2011-03-10 22:04 ` K. Y. Srinivasan
2011-03-10 22:05 ` [PATCH 04/21] Staging: hv: Eliminate vmbus_event_dpc() K. Y. Srinivasan
` (17 subsequent siblings)
20 siblings, 0 replies; 38+ messages in thread
From: K. Y. Srinivasan @ 2011-03-10 22:04 UTC (permalink / raw)
To: kys, gregkh, linux-kernel, devel, virtualization
Cc: Haiyang Zhang, Mike Sterling, Abhishek Kane, Hank Janssen
vmbus_msg_dpc() was a wrapper adding no additional value;
get rid of this function.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Mike Sterling <mike.sterling@microsoft.com>
Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
---
drivers/staging/hv/vmbus_drv.c | 15 ++-------------
1 files changed, 2 insertions(+), 13 deletions(-)
diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c
index 95654b1..7e67933 100644
--- a/drivers/staging/hv/vmbus_drv.c
+++ b/drivers/staging/hv/vmbus_drv.c
@@ -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
--
1.5.5.6
^ permalink raw reply related [flat|nested] 38+ messages in thread* [PATCH 04/21] Staging: hv: Eliminate vmbus_event_dpc()
[not found] <[PATCH 00/21] Staging: hv: Cleanup vmbus driver>
` (2 preceding siblings ...)
2011-03-10 22:04 ` [PATCH 03/21] Staging: hv: Get rid of the function vmbus_msg_dpc() K. Y. Srinivasan
@ 2011-03-10 22:05 ` K. Y. Srinivasan
2011-03-10 22:06 ` [PATCH 05/21] Staging: hv: Change the signature for vmbus_on_isr() K. Y. Srinivasan
` (16 subsequent siblings)
20 siblings, 0 replies; 38+ messages in thread
From: K. Y. Srinivasan @ 2011-03-10 22:05 UTC (permalink / raw)
To: kys, gregkh, linux-kernel, devel, virtualization
Cc: Haiyang Zhang, Mike Sterling, Abhishek Kane, Hank Janssen
vmbus_event_dpc() was a wrapper function not adding any value;
get rid of it.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Mike Sterling <mike.sterling@microsoft.com>
Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
---
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(-)
diff --git a/drivers/staging/hv/connection.c b/drivers/staging/hv/connection.c
index f7df479..fd589e3 100644
--- a/drivers/staging/hv/connection.c
+++ b/drivers/staging/hv/connection.c
@@ -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;
diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c
index 7e67933..4b4483b 100644
--- a/drivers/staging/hv/vmbus_drv.c
+++ b/drivers/staging/hv/vmbus_drv.c
@@ -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)
{
diff --git a/drivers/staging/hv/vmbus_private.h b/drivers/staging/hv/vmbus_private.h
index 9f505c4..1b88b6f 100644
--- a/drivers/staging/hv/vmbus_private.h
+++ b/drivers/staging/hv/vmbus_private.h
@@ -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_ */
--
1.5.5.6
^ permalink raw reply related [flat|nested] 38+ messages in thread* [PATCH 05/21] Staging: hv: Change the signature for vmbus_on_isr()
[not found] <[PATCH 00/21] Staging: hv: Cleanup vmbus driver>
` (3 preceding siblings ...)
2011-03-10 22:05 ` [PATCH 04/21] Staging: hv: Eliminate vmbus_event_dpc() K. Y. Srinivasan
@ 2011-03-10 22:06 ` K. Y. Srinivasan
2011-03-10 22:06 ` [PATCH 06/21] Staging: hv: Get rid of vmbus_dev_rm() function K. Y. Srinivasan
` (15 subsequent siblings)
20 siblings, 0 replies; 38+ messages in thread
From: K. Y. Srinivasan @ 2011-03-10 22:06 UTC (permalink / raw)
To: kys, gregkh, linux-kernel, devel, virtualization
Cc: Haiyang Zhang, Mike Sterling, Abhishek Kane, Hank Janssen
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.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Mike Sterling <mike.sterling@microsoft.com>
Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
---
drivers/staging/hv/vmbus_drv.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c
index 4b4483b..8e8a408 100644
--- a/drivers/staging/hv/vmbus_drv.c
+++ b/drivers/staging/hv/vmbus_drv.c
@@ -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) {
--
1.5.5.6
^ permalink raw reply related [flat|nested] 38+ messages in thread* [PATCH 06/21] Staging: hv: Get rid of vmbus_dev_rm() function
[not found] <[PATCH 00/21] Staging: hv: Cleanup vmbus driver>
` (4 preceding siblings ...)
2011-03-10 22:06 ` [PATCH 05/21] Staging: hv: Change the signature for vmbus_on_isr() K. Y. Srinivasan
@ 2011-03-10 22:06 ` K. Y. Srinivasan
2011-03-10 22:06 ` [PATCH 07/21] Staging: hv: Get rid of vmbus_cleanup() function K. Y. Srinivasan
` (14 subsequent siblings)
20 siblings, 0 replies; 38+ messages in thread
From: K. Y. Srinivasan @ 2011-03-10 22:06 UTC (permalink / raw)
To: kys, gregkh, linux-kernel, devel, virtualization
Cc: Haiyang Zhang, Mike Sterling, Abhishek Kane, Hank Janssen
Get rid of the vmbus_dev_rm() function by inlining
the necessary code.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Mike Sterling <mike.sterling@microsoft.com>
Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
---
drivers/staging/hv/vmbus_drv.c | 17 +++--------------
1 files changed, 3 insertions(+), 14 deletions(-)
diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c
index 8e8a408..11c69c5 100644
--- a/drivers/staging/hv/vmbus_drv.c
+++ b/drivers/staging/hv/vmbus_drv.c
@@ -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();
--
1.5.5.6
^ permalink raw reply related [flat|nested] 38+ messages in thread* [PATCH 07/21] Staging: hv: Get rid of vmbus_cleanup() function
[not found] <[PATCH 00/21] Staging: hv: Cleanup vmbus driver>
` (5 preceding siblings ...)
2011-03-10 22:06 ` [PATCH 06/21] Staging: hv: Get rid of vmbus_dev_rm() function K. Y. Srinivasan
@ 2011-03-10 22:06 ` K. Y. Srinivasan
2011-03-10 22:07 ` [PATCH 08/21] Staging: hv: Change the signature for vmbus_child_device_register() K. Y. Srinivasan
` (13 subsequent siblings)
20 siblings, 0 replies; 38+ messages in thread
From: K. Y. Srinivasan @ 2011-03-10 22:06 UTC (permalink / raw)
To: kys, gregkh, linux-kernel, devel, virtualization
Cc: Haiyang Zhang, Mike Sterling, Abhishek Kane, Hank Janssen
Get rid of the vmbus_cleanup() function by inlining the
necessary code.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Mike Sterling <mike.sterling@microsoft.com>
Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
---
drivers/staging/hv/vmbus_drv.c | 11 +----------
1 files changed, 1 insertions(+), 10 deletions(-)
diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c
index 11c69c5..e078c59 100644
--- a/drivers/staging/hv/vmbus_drv.c
+++ b/drivers/staging/hv/vmbus_drv.c
@@ -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);
--
1.5.5.6
^ permalink raw reply related [flat|nested] 38+ messages in thread* [PATCH 08/21] Staging: hv: Change the signature for vmbus_child_device_register()
[not found] <[PATCH 00/21] Staging: hv: Cleanup vmbus driver>
` (6 preceding siblings ...)
2011-03-10 22:06 ` [PATCH 07/21] Staging: hv: Get rid of vmbus_cleanup() function K. Y. Srinivasan
@ 2011-03-10 22:07 ` K. Y. Srinivasan
2011-03-10 22:07 ` [PATCH 09/21] Staging: hv: Get rid of vmbus_child_dev_add() K. Y. Srinivasan
` (12 subsequent siblings)
20 siblings, 0 replies; 38+ messages in thread
From: K. Y. Srinivasan @ 2011-03-10 22:07 UTC (permalink / raw)
To: kys, gregkh, linux-kernel, devel, virtualization
Cc: Haiyang Zhang, Mike Sterling, Abhishek Kane, Hank Janssen
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.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Mike Sterling <mike.sterling@microsoft.com>
Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
---
drivers/staging/hv/vmbus_drv.c | 7 +++----
drivers/staging/hv/vmbus_private.h | 3 +--
2 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c
index e078c59..0b91eda 100644
--- a/drivers/staging/hv/vmbus_drv.c
+++ b/drivers/staging/hv/vmbus_drv.c
@@ -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;
/*
diff --git a/drivers/staging/hv/vmbus_private.h b/drivers/staging/hv/vmbus_private.h
index 1b88b6f..c176773 100644
--- a/drivers/staging/hv/vmbus_private.h
+++ b/drivers/staging/hv/vmbus_private.h
@@ -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 */
--
1.5.5.6
^ permalink raw reply related [flat|nested] 38+ messages in thread* [PATCH 09/21] Staging: hv: Get rid of vmbus_child_dev_add()
[not found] <[PATCH 00/21] Staging: hv: Cleanup vmbus driver>
` (7 preceding siblings ...)
2011-03-10 22:07 ` [PATCH 08/21] Staging: hv: Change the signature for vmbus_child_device_register() K. Y. Srinivasan
@ 2011-03-10 22:07 ` K. Y. Srinivasan
2011-03-10 22:08 ` [PATCH 10/21] Staging: hv: Cleanup root device handling K. Y. Srinivasan
` (11 subsequent siblings)
20 siblings, 0 replies; 38+ messages in thread
From: K. Y. Srinivasan @ 2011-03-10 22:07 UTC (permalink / raw)
To: kys, gregkh, linux-kernel, devel, virtualization
Cc: Haiyang Zhang, Mike Sterling, Abhishek Kane, Hank Janssen
The function vmbus_child_dev_add() is a wrapper that can be
eliminated; get rid of it.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Mike Sterling <mike.sterling@microsoft.com>
Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
---
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(-)
diff --git a/drivers/staging/hv/channel_mgmt.c b/drivers/staging/hv/channel_mgmt.c
index 0781c0e..3368809 100644
--- a/drivers/staging/hv/channel_mgmt.c
+++ b/drivers/staging/hv/channel_mgmt.c
@@ -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)",
diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c
index 0b91eda..b473f46 100644
--- a/drivers/staging/hv/vmbus_drv.c
+++ b/drivers/staging/hv/vmbus_drv.c
@@ -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)
{
diff --git a/drivers/staging/hv/vmbus_private.h b/drivers/staging/hv/vmbus_private.h
index c176773..ca050a4 100644
--- a/drivers/staging/hv/vmbus_private.h
+++ b/drivers/staging/hv/vmbus_private.h
@@ -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);
--
1.5.5.6
^ permalink raw reply related [flat|nested] 38+ messages in thread* [PATCH 10/21] Staging: hv: Cleanup root device handling
[not found] <[PATCH 00/21] Staging: hv: Cleanup vmbus driver>
` (8 preceding siblings ...)
2011-03-10 22:07 ` [PATCH 09/21] Staging: hv: Get rid of vmbus_child_dev_add() K. Y. Srinivasan
@ 2011-03-10 22:08 ` K. Y. Srinivasan
2011-03-14 19:33 ` Greg KH
2011-03-10 22:08 ` [PATCH 11/21] Staging: hv: Make vmbus driver a platform pci driver K. Y. Srinivasan
` (10 subsequent siblings)
20 siblings, 1 reply; 38+ messages in thread
From: K. Y. Srinivasan @ 2011-03-10 22:08 UTC (permalink / raw)
To: kys, gregkh, linux-kernel, devel, virtualization
Cc: Haiyang Zhang, Mike Sterling, Abhishek Kane, Hank Janssen
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.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Mike Sterling <mike.sterling@microsoft.com>
Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
---
drivers/staging/hv/vmbus_drv.c | 126 ++++++----------------------------------
1 files changed, 18 insertions(+), 108 deletions(-)
diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c
index b473f46..8b9394a 100644
--- a/drivers/staging/hv/vmbus_drv.c
+++ b/drivers/staging/hv/vmbus_drv.c
@@ -19,6 +19,7 @@
* Hank Janssen <hjanssen@microsoft.com>
*/
#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
--
1.5.5.6
^ permalink raw reply related [flat|nested] 38+ messages in thread* Re: [PATCH 10/21] Staging: hv: Cleanup root device handling
2011-03-10 22:08 ` [PATCH 10/21] Staging: hv: Cleanup root device handling K. Y. Srinivasan
@ 2011-03-14 19:33 ` Greg KH
2011-03-14 19:54 ` KY Srinivasan
0 siblings, 1 reply; 38+ messages in thread
From: Greg KH @ 2011-03-14 19:33 UTC (permalink / raw)
To: K. Y. Srinivasan
Cc: gregkh, linux-kernel, devel, virtualization, Haiyang Zhang,
Mike Sterling, Abhishek Kane
On Thu, Mar 10, 2011 at 02:08:06PM -0800, K. Y. Srinivasan wrote:
> 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"?
>
> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
> Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
> Signed-off-by: Mike Sterling <mike.sterling@microsoft.com>
> Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
> Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
> ---
> drivers/staging/hv/vmbus_drv.c | 126 ++++++----------------------------------
> 1 files changed, 18 insertions(+), 108 deletions(-)
>
> diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c
> index b473f46..8b9394a 100644
> --- a/drivers/staging/hv/vmbus_drv.c
> +++ b/drivers/staging/hv/vmbus_drv.c
> @@ -19,6 +19,7 @@
> * Hank Janssen <hjanssen@microsoft.com>
> */
> #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 */
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
^ permalink raw reply [flat|nested] 38+ messages in thread
* RE: [PATCH 10/21] Staging: hv: Cleanup root device handling
2011-03-14 19:33 ` Greg KH
@ 2011-03-14 19:54 ` KY Srinivasan
2011-03-14 19:58 ` Greg KH
0 siblings, 1 reply; 38+ messages in thread
From: KY Srinivasan @ 2011-03-14 19:54 UTC (permalink / raw)
To: Greg KH
Cc: gregkh@suse.de, linux-kernel@vger.kernel.org,
devel@linuxdriverproject.org, virtualization@lists.osdl.org,
Haiyang Zhang, Mike Sterling,
Abhishek Kane (Mindtree Consulting PVT LTD)
> -----Original Message-----
> From: Greg KH [mailto:greg@kroah.com]
> Sent: Monday, March 14, 2011 3:34 PM
> To: KY Srinivasan
> Cc: gregkh@suse.de; linux-kernel@vger.kernel.org;
> devel@linuxdriverproject.org; virtualization@lists.osdl.org; Haiyang Zhang; Mike
> Sterling; Abhishek Kane (Mindtree Consulting PVT LTD)
> Subject: Re: [PATCH 10/21] Staging: hv: Cleanup root device handling
>
> On Thu, Mar 10, 2011 at 02:08:06PM -0800, K. Y. Srinivasan wrote:
> > 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
>
> The hyper-v "bus controller"?
>
> >
> > Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
> > Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
> > Signed-off-by: Mike Sterling <mike.sterling@microsoft.com>
> > Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
> > Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
> > ---
> > drivers/staging/hv/vmbus_drv.c | 126 ++++++----------------------------------
> > 1 files changed, 18 insertions(+), 108 deletions(-)
> >
> > diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c
> > index b473f46..8b9394a 100644
> > --- a/drivers/staging/hv/vmbus_drv.c
> > +++ b/drivers/staging/hv/vmbus_drv.c
> > @@ -19,6 +19,7 @@
> > * Hank Janssen <hjanssen@microsoft.com>
> > */
> > #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 */
>
> 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
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH 10/21] Staging: hv: Cleanup root device handling
2011-03-14 19:54 ` KY Srinivasan
@ 2011-03-14 19:58 ` Greg KH
2011-03-14 20:13 ` KY Srinivasan
0 siblings, 1 reply; 38+ messages in thread
From: Greg KH @ 2011-03-14 19:58 UTC (permalink / raw)
To: KY Srinivasan
Cc: Greg KH, linux-kernel@vger.kernel.org,
devel@linuxdriverproject.org, virtualization@lists.osdl.org,
Haiyang Zhang, Mike Sterling,
Abhishek Kane (Mindtree Consulting PVT LTD)
On Mon, Mar 14, 2011 at 07:54:29PM +0000, KY Srinivasan wrote:
>
>
> > -----Original Message-----
> > From: Greg KH [mailto:greg@kroah.com]
> > Sent: Monday, March 14, 2011 3:34 PM
> > To: KY Srinivasan
> > Cc: gregkh@suse.de; linux-kernel@vger.kernel.org;
> > devel@linuxdriverproject.org; virtualization@lists.osdl.org; Haiyang Zhang; Mike
> > Sterling; Abhishek Kane (Mindtree Consulting PVT LTD)
> > Subject: Re: [PATCH 10/21] Staging: hv: Cleanup root device handling
> >
> > On Thu, Mar 10, 2011 at 02:08:06PM -0800, K. Y. Srinivasan wrote:
> > > 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.
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
^ permalink raw reply [flat|nested] 38+ messages in thread
* RE: [PATCH 10/21] Staging: hv: Cleanup root device handling
2011-03-14 19:58 ` Greg KH
@ 2011-03-14 20:13 ` KY Srinivasan
0 siblings, 0 replies; 38+ messages in thread
From: KY Srinivasan @ 2011-03-14 20:13 UTC (permalink / raw)
To: Greg KH
Cc: Greg KH, linux-kernel@vger.kernel.org,
devel@linuxdriverproject.org, virtualization@lists.osdl.org,
Haiyang Zhang, Mike Sterling,
Abhishek Kane (Mindtree Consulting PVT LTD)
> -----Original Message-----
> From: Greg KH [mailto:gregkh@suse.de]
> Sent: Monday, March 14, 2011 3:59 PM
> To: KY Srinivasan
> Cc: Greg KH; linux-kernel@vger.kernel.org; devel@linuxdriverproject.org;
> virtualization@lists.osdl.org; Haiyang Zhang; Mike Sterling; Abhishek Kane
> (Mindtree Consulting PVT LTD)
> Subject: Re: [PATCH 10/21] Staging: hv: Cleanup root device handling
>
> On Mon, Mar 14, 2011 at 07:54:29PM +0000, KY Srinivasan wrote:
> >
> >
> > > -----Original Message-----
> > > From: Greg KH [mailto:greg@kroah.com]
> > > Sent: Monday, March 14, 2011 3:34 PM
> > > To: KY Srinivasan
> > > Cc: gregkh@suse.de; linux-kernel@vger.kernel.org;
> > > devel@linuxdriverproject.org; virtualization@lists.osdl.org; Haiyang Zhang;
> Mike
> > > Sterling; Abhishek Kane (Mindtree Consulting PVT LTD)
> > > Subject: Re: [PATCH 10/21] Staging: hv: Cleanup root device handling
> > >
> > > On Thu, Mar 10, 2011 at 02:08:06PM -0800, K. Y. Srinivasan wrote:
> > > > 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.
>
> 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
^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 11/21] Staging: hv: Make vmbus driver a platform pci driver
[not found] <[PATCH 00/21] Staging: hv: Cleanup vmbus driver>
` (9 preceding siblings ...)
2011-03-10 22:08 ` [PATCH 10/21] Staging: hv: Cleanup root device handling K. Y. Srinivasan
@ 2011-03-10 22:08 ` K. Y. Srinivasan
2011-03-10 22:20 ` Greg KH
2011-03-14 19:34 ` Greg KH
2011-03-10 22:08 ` [PATCH 12/21] Staging: hv: Cleanup irq management K. Y. Srinivasan
` (9 subsequent siblings)
20 siblings, 2 replies; 38+ messages in thread
From: K. Y. Srinivasan @ 2011-03-10 22:08 UTC (permalink / raw)
To: kys, gregkh, linux-kernel, devel, virtualization
Cc: Haiyang Zhang, Mike Sterling, Abhishek Kane, Hank Janssen
Make vmbus driver a platform pci driver. This is
in preparation to cleaning up irq allocation for this
driver.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Mike Sterling <mike.sterling@microsoft.com>
Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
---
drivers/staging/hv/vmbus_drv.c | 63 +++++++++++++++++++++++-----------------
1 files changed, 36 insertions(+), 27 deletions(-)
diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c
index 8b9394a..e4855ac 100644
--- a/drivers/staging/hv/vmbus_drv.c
+++ b/drivers/staging/hv/vmbus_drv.c
@@ -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);
--
1.5.5.6
^ permalink raw reply related [flat|nested] 38+ messages in thread* Re: [PATCH 11/21] Staging: hv: Make vmbus driver a platform pci driver
2011-03-10 22:08 ` [PATCH 11/21] Staging: hv: Make vmbus driver a platform pci driver K. Y. Srinivasan
@ 2011-03-10 22:20 ` Greg KH
2011-03-10 22:28 ` KY Srinivasan
2011-03-14 19:34 ` Greg KH
1 sibling, 1 reply; 38+ messages in thread
From: Greg KH @ 2011-03-10 22:20 UTC (permalink / raw)
To: K. Y. Srinivasan
Cc: linux-kernel, devel, virtualization, Haiyang Zhang, Mike Sterling,
Abhishek Kane, Hank Janssen
On Thu, Mar 10, 2011 at 02:08:32PM -0800, K. Y. Srinivasan wrote:
> 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.
>
> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
> Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
> Signed-off-by: Mike Sterling <mike.sterling@microsoft.com>
> Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
> Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
> ---
> drivers/staging/hv/vmbus_drv.c | 63 +++++++++++++++++++++++-----------------
> 1 files changed, 36 insertions(+), 27 deletions(-)
>
> diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c
> index 8b9394a..e4855ac 100644
> --- a/drivers/staging/hv/vmbus_drv.c
> +++ b/drivers/staging/hv/vmbus_drv.c
> @@ -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);
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.
>
> -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 = {
"hv_bus_driver"?
> + .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.
> + .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);
> --
> 1.5.5.6
^ permalink raw reply [flat|nested] 38+ messages in thread* RE: [PATCH 11/21] Staging: hv: Make vmbus driver a platform pci driver
2011-03-10 22:20 ` Greg KH
@ 2011-03-10 22:28 ` KY Srinivasan
2011-03-10 22:32 ` Greg KH
0 siblings, 1 reply; 38+ messages in thread
From: KY Srinivasan @ 2011-03-10 22:28 UTC (permalink / raw)
To: Greg KH
Cc: linux-kernel@vger.kernel.org, devel@linuxdriverproject.org,
virtualization@lists.osdl.org, Haiyang Zhang, Mike Sterling,
Abhishek Kane (Mindtree Consulting PVT LTD), Hank Janssen
> -----Original Message-----
> From: Greg KH [mailto:gregkh@suse.de]
> Sent: Thursday, March 10, 2011 5:21 PM
> To: KY Srinivasan
> Cc: linux-kernel@vger.kernel.org; devel@linuxdriverproject.org;
> virtualization@lists.osdl.org; 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
>
> On Thu, Mar 10, 2011 at 02:08:32PM -0800, K. Y. Srinivasan wrote:
> > 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.
>
> >
> > Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
> > Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
> > Signed-off-by: Mike Sterling <mike.sterling@microsoft.com>
> > Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
> > Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
> > ---
> > drivers/staging/hv/vmbus_drv.c | 63 +++++++++++++++++++++++-------------
> ----
> > 1 files changed, 36 insertions(+), 27 deletions(-)
> >
> > diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c
> > index 8b9394a..e4855ac 100644
> > --- a/drivers/staging/hv/vmbus_drv.c
> > +++ b/drivers/staging/hv/vmbus_drv.c
> > @@ -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);
>
> 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.
>
> >
> > -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 = {
>
> "hv_bus_driver"?
>
> > + .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
^ permalink raw reply [flat|nested] 38+ messages in thread* Re: [PATCH 11/21] Staging: hv: Make vmbus driver a platform pci driver
2011-03-10 22:28 ` KY Srinivasan
@ 2011-03-10 22:32 ` Greg KH
2011-03-10 22:36 ` KY Srinivasan
2011-03-12 23:23 ` KY Srinivasan
0 siblings, 2 replies; 38+ messages in thread
From: Greg KH @ 2011-03-10 22:32 UTC (permalink / raw)
To: KY Srinivasan
Cc: linux-kernel@vger.kernel.org, devel@linuxdriverproject.org,
virtualization@lists.osdl.org, Haiyang Zhang, Mike Sterling,
Abhishek Kane (Mindtree Consulting PVT LTD), Hank Janssen
On Thu, Mar 10, 2011 at 10:28:27PM +0000, KY Srinivasan wrote:
>
>
> > -----Original Message-----
> > From: Greg KH [mailto:gregkh@suse.de]
> > Sent: Thursday, March 10, 2011 5:21 PM
> > To: KY Srinivasan
> > Cc: linux-kernel@vger.kernel.org; devel@linuxdriverproject.org;
> > virtualization@lists.osdl.org; 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
> >
> > On Thu, Mar 10, 2011 at 02:08:32PM -0800, K. Y. Srinivasan wrote:
> > > 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.
> >
> > >
> > > Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
> > > Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
> > > Signed-off-by: Mike Sterling <mike.sterling@microsoft.com>
> > > Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
> > > Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
> > > ---
> > > drivers/staging/hv/vmbus_drv.c | 63 +++++++++++++++++++++++-------------
> > ----
> > > 1 files changed, 36 insertions(+), 27 deletions(-)
> > >
> > > diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c
> > > index 8b9394a..e4855ac 100644
> > > --- a/drivers/staging/hv/vmbus_drv.c
> > > +++ b/drivers/staging/hv/vmbus_drv.c
> > > @@ -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);
> >
> > 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.
Ok, if you are sure, that's fine with me.
> > 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
:)
>
> Regards,
>
> K. Y
^ permalink raw reply [flat|nested] 38+ messages in thread* RE: [PATCH 11/21] Staging: hv: Make vmbus driver a platform pci driver
2011-03-10 22:32 ` Greg KH
@ 2011-03-10 22:36 ` KY Srinivasan
2011-03-12 23:23 ` KY Srinivasan
1 sibling, 0 replies; 38+ messages in thread
From: KY Srinivasan @ 2011-03-10 22:36 UTC (permalink / raw)
To: Greg KH
Cc: linux-kernel@vger.kernel.org, devel@linuxdriverproject.org,
virtualization@lists.osdl.org, Haiyang Zhang, Mike Sterling,
Abhishek Kane (Mindtree Consulting PVT LTD), Hank Janssen
> -----Original Message-----
> From: Greg KH [mailto:gregkh@suse.de]
> Sent: Thursday, March 10, 2011 5:33 PM
> To: KY Srinivasan
> Cc: linux-kernel@vger.kernel.org; devel@linuxdriverproject.org;
> virtualization@lists.osdl.org; 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
>
> On Thu, Mar 10, 2011 at 10:28:27PM +0000, KY Srinivasan wrote:
> >
> >
> > > -----Original Message-----
> > > From: Greg KH [mailto:gregkh@suse.de]
> > > Sent: Thursday, March 10, 2011 5:21 PM
> > > To: KY Srinivasan
> > > Cc: linux-kernel@vger.kernel.org; devel@linuxdriverproject.org;
> > > virtualization@lists.osdl.org; 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
> > >
> > > On Thu, Mar 10, 2011 at 02:08:32PM -0800, K. Y. Srinivasan wrote:
> > > > 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.
> > >
> > > >
> > > > Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
> > > > Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
> > > > Signed-off-by: Mike Sterling <mike.sterling@microsoft.com>
> > > > Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
> > > > Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
> > > > ---
> > > > drivers/staging/hv/vmbus_drv.c | 63 +++++++++++++++++++++++--------
> -----
> > > ----
> > > > 1 files changed, 36 insertions(+), 27 deletions(-)
> > > >
> > > > diff --git a/drivers/staging/hv/vmbus_drv.c
> b/drivers/staging/hv/vmbus_drv.c
> > > > index 8b9394a..e4855ac 100644
> > > > --- a/drivers/staging/hv/vmbus_drv.c
> > > > +++ b/drivers/staging/hv/vmbus_drv.c
> > > > @@ -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);
> > >
> > > 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.
>
> Ok, if you are sure, that's fine with me.
>
> > > 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
> :)
Ok; I will wait for the reviews.
Regards,
K. Y
^ permalink raw reply [flat|nested] 38+ messages in thread* RE: [PATCH 11/21] Staging: hv: Make vmbus driver a platform pci driver
2011-03-10 22:32 ` Greg KH
2011-03-10 22:36 ` KY Srinivasan
@ 2011-03-12 23:23 ` KY Srinivasan
2011-03-14 3:24 ` Greg KH
1 sibling, 1 reply; 38+ messages in thread
From: KY Srinivasan @ 2011-03-12 23:23 UTC (permalink / raw)
To: Greg KH
Cc: linux-kernel@vger.kernel.org, devel@linuxdriverproject.org,
virtualization@lists.osdl.org, Haiyang Zhang, Mike Sterling,
Abhishek Kane (Mindtree Consulting PVT LTD), Hank Janssen
> -----Original Message-----
> From: Greg KH [mailto:gregkh@suse.de]
> Sent: Thursday, March 10, 2011 5:33 PM
> To: KY Srinivasan
> Cc: linux-kernel@vger.kernel.org; devel@linuxdriverproject.org;
> virtualization@lists.osdl.org; 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
>
> On Thu, Mar 10, 2011 at 10:28:27PM +0000, KY Srinivasan wrote:
> >
> >
> > > -----Original Message-----
> > > From: Greg KH [mailto:gregkh@suse.de]
> > > Sent: Thursday, March 10, 2011 5:21 PM
> > > To: KY Srinivasan
> > > Cc: linux-kernel@vger.kernel.org; devel@linuxdriverproject.org;
> > > virtualization@lists.osdl.org; 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
> > >
> > > On Thu, Mar 10, 2011 at 02:08:32PM -0800, K. Y. Srinivasan wrote:
> > > > 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.
> > >
> > > >
> > > > Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
> > > > Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
> > > > Signed-off-by: Mike Sterling <mike.sterling@microsoft.com>
> > > > Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
> > > > Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
> > > > ---
> > > > drivers/staging/hv/vmbus_drv.c | 63 +++++++++++++++++++++++--------
> -----
> > > ----
> > > > 1 files changed, 36 insertions(+), 27 deletions(-)
> > > >
> > > > diff --git a/drivers/staging/hv/vmbus_drv.c
> b/drivers/staging/hv/vmbus_drv.c
> > > > index 8b9394a..e4855ac 100644
> > > > --- a/drivers/staging/hv/vmbus_drv.c
> > > > +++ b/drivers/staging/hv/vmbus_drv.c
> > > > @@ -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);
> > >
> > > 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.
>
> Ok, if you are sure, that's fine with me.
>
> > > 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
> :)
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
^ permalink raw reply [flat|nested] 38+ messages in thread* Re: [PATCH 11/21] Staging: hv: Make vmbus driver a platform pci driver
2011-03-12 23:23 ` KY Srinivasan
@ 2011-03-14 3:24 ` Greg KH
2011-03-14 12:43 ` KY Srinivasan
0 siblings, 1 reply; 38+ messages in thread
From: Greg KH @ 2011-03-14 3:24 UTC (permalink / raw)
To: KY Srinivasan
Cc: linux-kernel@vger.kernel.org, devel@linuxdriverproject.org,
virtualization@lists.osdl.org, Haiyang Zhang, Mike Sterling,
Abhishek Kane (Mindtree Consulting PVT LTD), Hank Janssen
On Sat, Mar 12, 2011 at 11:23:05PM +0000, KY Srinivasan wrote:
> 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.
> 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
^ permalink raw reply [flat|nested] 38+ messages in thread
* RE: [PATCH 11/21] Staging: hv: Make vmbus driver a platform pci driver
2011-03-14 3:24 ` Greg KH
@ 2011-03-14 12:43 ` KY Srinivasan
0 siblings, 0 replies; 38+ messages in thread
From: KY Srinivasan @ 2011-03-14 12:43 UTC (permalink / raw)
To: Greg KH
Cc: linux-kernel@vger.kernel.org, devel@linuxdriverproject.org,
virtualization@lists.osdl.org, Haiyang Zhang, Mike Sterling,
Abhishek Kane (Mindtree Consulting PVT LTD), Hank Janssen
> -----Original Message-----
> From: Greg KH [mailto:gregkh@suse.de]
> Sent: Sunday, March 13, 2011 11:25 PM
> To: KY Srinivasan
> Cc: linux-kernel@vger.kernel.org; devel@linuxdriverproject.org;
> virtualization@lists.osdl.org; 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
>
> On Sat, Mar 12, 2011 at 11:23:05PM +0000, KY Srinivasan wrote:
> > 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.
>
> > 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.
>
> 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
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH 11/21] Staging: hv: Make vmbus driver a platform pci driver
2011-03-10 22:08 ` [PATCH 11/21] Staging: hv: Make vmbus driver a platform pci driver K. Y. Srinivasan
2011-03-10 22:20 ` Greg KH
@ 2011-03-14 19:34 ` Greg KH
1 sibling, 0 replies; 38+ messages in thread
From: Greg KH @ 2011-03-14 19:34 UTC (permalink / raw)
To: K. Y. Srinivasan
Cc: gregkh, linux-kernel, devel, virtualization, Haiyang Zhang,
Mike Sterling, Abhishek Kane
On Thu, Mar 10, 2011 at 02:08:32PM -0800, K. Y. Srinivasan wrote:
> 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?
> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
> Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
> Signed-off-by: Mike Sterling <mike.sterling@microsoft.com>
> Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
> Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
> ---
> drivers/staging/hv/vmbus_drv.c | 63 +++++++++++++++++++++++-----------------
> 1 files changed, 36 insertions(+), 27 deletions(-)
>
> diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c
> index 8b9394a..e4855ac 100644
> --- a/drivers/staging/hv/vmbus_drv.c
> +++ b/drivers/staging/hv/vmbus_drv.c
> @@ -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
^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 12/21] Staging: hv: Cleanup irq management
[not found] <[PATCH 00/21] Staging: hv: Cleanup vmbus driver>
` (10 preceding siblings ...)
2011-03-10 22:08 ` [PATCH 11/21] Staging: hv: Make vmbus driver a platform pci driver K. Y. Srinivasan
@ 2011-03-10 22:08 ` K. Y. Srinivasan
2011-03-10 22:46 ` Thomas Gleixner
2011-03-10 22:12 ` [PATCH 13/21] [PATCH 13/21] Staging: hv: Rename vmbus_driver_context structure K. Y. Srinivasan
` (8 subsequent siblings)
20 siblings, 1 reply; 38+ messages in thread
From: K. Y. Srinivasan @ 2011-03-10 22:08 UTC (permalink / raw)
To: kys, gregkh, linux-kernel, devel, virtualization
Cc: Haiyang Zhang, Mike Sterling, Abhishek Kane, Hank Janssen
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.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Mike Sterling <mike.sterling@microsoft.com>
Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
---
drivers/staging/hv/vmbus_drv.c | 30 ++++++++++++++----------------
1 files changed, 14 insertions(+), 16 deletions(-)
diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c
index e4855ac..4e45016 100644
--- a/drivers/staging/hv/vmbus_drv.c
+++ b/drivers/staging/hv/vmbus_drv.c
@@ -17,6 +17,8 @@
* Authors:
* Haiyang Zhang <haiyangz@microsoft.com>
* Hank Janssen <hjanssen@microsoft.com>
+ *
+ * 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);
--
1.5.5.6
^ permalink raw reply related [flat|nested] 38+ messages in thread* Re: [PATCH 12/21] Staging: hv: Cleanup irq management
2011-03-10 22:08 ` [PATCH 12/21] Staging: hv: Cleanup irq management K. Y. Srinivasan
@ 2011-03-10 22:46 ` Thomas Gleixner
2011-03-10 22:54 ` Hank Janssen
0 siblings, 1 reply; 38+ messages in thread
From: Thomas Gleixner @ 2011-03-10 22:46 UTC (permalink / raw)
To: K. Y. Srinivasan
Cc: gregkh, linux-kernel, devel, virtualization, Haiyang Zhang,
Mike Sterling, Abhishek Kane, Hank Janssen
On Thu, 10 Mar 2011, K. Y. Srinivasan wrote:
> 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.
> }
> - 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
^ permalink raw reply [flat|nested] 38+ messages in thread
* Re: [PATCH 12/21] Staging: hv: Cleanup irq management
2011-03-10 22:46 ` Thomas Gleixner
@ 2011-03-10 22:54 ` Hank Janssen
2011-03-11 2:09 ` KY Srinivasan
0 siblings, 1 reply; 38+ messages in thread
From: Hank Janssen @ 2011-03-10 22:54 UTC (permalink / raw)
To: Thomas Gleixner
Cc: KY Srinivasan, gregkh@suse.de, linux-kernel@vger.kernel.org,
devel@linuxdriverproject.org, virtualization@lists.osdl.org,
Haiyang Zhang, Mike Sterling,
Abhishek Kane (Mindtree Consulting PVT LTD)
On Mar 10, 2011, at 14:46, "Thomas Gleixner" <tglx@linutronix.de> wrote:
>>
>
>> }
>> - 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,
>
>
Yes, that is in my next set of patches.
Hank
^ permalink raw reply [flat|nested] 38+ messages in thread
* RE: [PATCH 12/21] Staging: hv: Cleanup irq management
2011-03-10 22:54 ` Hank Janssen
@ 2011-03-11 2:09 ` KY Srinivasan
0 siblings, 0 replies; 38+ messages in thread
From: KY Srinivasan @ 2011-03-11 2:09 UTC (permalink / raw)
To: Hank Janssen, Thomas Gleixner
Cc: gregkh@suse.de, linux-kernel@vger.kernel.org,
devel@linuxdriverproject.org, virtualization@lists.osdl.org,
Haiyang Zhang, Mike Sterling,
Abhishek Kane (Mindtree Consulting PVT LTD)
> -----Original Message-----
> From: Hank Janssen
> Sent: Thursday, March 10, 2011 5:54 PM
> To: Thomas Gleixner
> Cc: KY Srinivasan; gregkh@suse.de; linux-kernel@vger.kernel.org;
> devel@linuxdriverproject.org; virtualization@lists.osdl.org; Haiyang Zhang; Mike
> Sterling; Abhishek Kane (Mindtree Consulting PVT LTD)
> Subject: Re: [PATCH 12/21] Staging: hv: Cleanup irq management
>
>
>
>
>
>
> On Mar 10, 2011, at 14:46, "Thomas Gleixner" <tglx@linutronix.de> wrote:
> >>
> >
> >> }
> >> - 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
^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 13/21] [PATCH 13/21] Staging: hv: Rename vmbus_driver_context structure
[not found] <[PATCH 00/21] Staging: hv: Cleanup vmbus driver>
` (11 preceding siblings ...)
2011-03-10 22:08 ` [PATCH 12/21] Staging: hv: Cleanup irq management K. Y. Srinivasan
@ 2011-03-10 22:12 ` K. Y. Srinivasan
2011-03-10 22:49 ` Thomas Gleixner
2011-03-10 22:12 ` [PATCH 14/21] Get rid of the forward declaration for vmbus_uevent K. Y. Srinivasan
` (7 subsequent siblings)
20 siblings, 1 reply; 38+ messages in thread
From: K. Y. Srinivasan @ 2011-03-10 22:12 UTC (permalink / raw)
To: kys, gregkh, linux-kernel, devel, virtualization
Cc: Haiyang Zhang, Mike Sterling, Abhishek Kane, Hank Janssen
Now that struct vmbus_driver_context is properly
cleaned up, rename this structure appropriately and
cleanup the code.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Mike Sterling <mike.sterling@microsoft.com>
Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
---
drivers/staging/hv/vmbus_drv.c | 36 ++++++++++++++++--------------------
1 files changed, 16 insertions(+), 20 deletions(-)
diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c
index 4e45016..7b9a2c8 100644
--- a/drivers/staging/hv/vmbus_drv.c
+++ b/drivers/staging/hv/vmbus_drv.c
@@ -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 {
--
1.5.5.6
^ permalink raw reply related [flat|nested] 38+ messages in thread* Re: [PATCH 13/21] [PATCH 13/21] Staging: hv: Rename vmbus_driver_context structure
2011-03-10 22:12 ` [PATCH 13/21] [PATCH 13/21] Staging: hv: Rename vmbus_driver_context structure K. Y. Srinivasan
@ 2011-03-10 22:49 ` Thomas Gleixner
2011-03-11 3:17 ` KY Srinivasan
0 siblings, 1 reply; 38+ messages in thread
From: Thomas Gleixner @ 2011-03-10 22:49 UTC (permalink / raw)
To: K. Y. Srinivasan
Cc: gregkh, linux-kernel, devel, virtualization, Haiyang Zhang,
Mike Sterling, Abhishek Kane, Hank Janssen
On Thu, 10 Mar 2011, K. Y. Srinivasan wrote:
> Now that struct vmbus_driver_context is properly
> cleaned up, rename this structure appropriately and
> cleanup the code.
> @@ -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
^ permalink raw reply [flat|nested] 38+ messages in thread* RE: [PATCH 13/21] [PATCH 13/21] Staging: hv: Rename vmbus_driver_context structure
2011-03-10 22:49 ` Thomas Gleixner
@ 2011-03-11 3:17 ` KY Srinivasan
0 siblings, 0 replies; 38+ messages in thread
From: KY Srinivasan @ 2011-03-11 3:17 UTC (permalink / raw)
To: Thomas Gleixner
Cc: gregkh@suse.de, linux-kernel@vger.kernel.org,
devel@linuxdriverproject.org, virtualization@lists.osdl.org,
Haiyang Zhang, Mike Sterling,
Abhishek Kane (Mindtree Consulting PVT LTD), Hank Janssen
> -----Original Message-----
> From: Thomas Gleixner [mailto:tglx@linutronix.de]
> Sent: Thursday, March 10, 2011 5:50 PM
> To: KY Srinivasan
> Cc: gregkh@suse.de; linux-kernel@vger.kernel.org;
> devel@linuxdriverproject.org; virtualization@lists.osdl.org; 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
>
> On Thu, 10 Mar 2011, K. Y. Srinivasan wrote:
> > Now that struct vmbus_driver_context is properly
> > cleaned up, rename this structure appropriately and
> > cleanup the code.
>
> > @@ -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 ?
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
^ permalink raw reply [flat|nested] 38+ messages in thread
* [PATCH 14/21] Get rid of the forward declaration for vmbus_uevent
[not found] <[PATCH 00/21] Staging: hv: Cleanup vmbus driver>
` (12 preceding siblings ...)
2011-03-10 22:12 ` [PATCH 13/21] [PATCH 13/21] Staging: hv: Rename vmbus_driver_context structure K. Y. Srinivasan
@ 2011-03-10 22:12 ` K. Y. Srinivasan
2011-03-10 22:13 ` [PATCH 15/21] Staging: hv: Get rid of the forward declaration for vmbus_match K. Y. Srinivasan
` (6 subsequent siblings)
20 siblings, 0 replies; 38+ messages in thread
From: K. Y. Srinivasan @ 2011-03-10 22:12 UTC (permalink / raw)
To: kys, gregkh, linux-kernel, devel, virtualization
Cc: Haiyang Zhang, Mike Sterling, Abhishek Kane, Hank Janssen
Get rid of the forward declaration of vmbus_uevent by moving
the code around.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Mike Sterling <mike.sterling@microsoft.com>
Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
---
drivers/staging/hv/vmbus_drv.c | 151 ++++++++++++++++++++--------------------
1 files changed, 75 insertions(+), 76 deletions(-)
diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c
index 7b9a2c8..97ebeb4 100644
--- a/drivers/staging/hv/vmbus_drv.c
+++ b/drivers/staging/hv/vmbus_drv.c
@@ -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)
--
1.5.5.6
^ permalink raw reply related [flat|nested] 38+ messages in thread* [PATCH 15/21] Staging: hv: Get rid of the forward declaration for vmbus_match
[not found] <[PATCH 00/21] Staging: hv: Cleanup vmbus driver>
` (13 preceding siblings ...)
2011-03-10 22:12 ` [PATCH 14/21] Get rid of the forward declaration for vmbus_uevent K. Y. Srinivasan
@ 2011-03-10 22:13 ` K. Y. Srinivasan
2011-03-10 22:14 ` [PATCH 16/21] Staging: hv: Get rid of the forward declaration for vmbus_probe K. Y. Srinivasan
` (5 subsequent siblings)
20 siblings, 0 replies; 38+ messages in thread
From: K. Y. Srinivasan @ 2011-03-10 22:13 UTC (permalink / raw)
To: kys, gregkh, linux-kernel, devel, virtualization
Cc: Haiyang Zhang, Mike Sterling, Abhishek Kane, Hank Janssen
Get rid of the forward declaration of vmbus_match by moving
the code around.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Mike Sterling <mike.sterling@microsoft.com>
Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
---
drivers/staging/hv/vmbus_drv.c | 49 ++++++++++++++++++++-------------------
1 files changed, 25 insertions(+), 24 deletions(-)
diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c
index 97ebeb4..e15c465 100644
--- a/drivers/staging/hv/vmbus_drv.c
+++ b/drivers/staging/hv/vmbus_drv.c
@@ -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()
--
1.5.5.6
^ permalink raw reply related [flat|nested] 38+ messages in thread* [PATCH 16/21] Staging: hv: Get rid of the forward declaration for vmbus_probe
[not found] <[PATCH 00/21] Staging: hv: Cleanup vmbus driver>
` (14 preceding siblings ...)
2011-03-10 22:13 ` [PATCH 15/21] Staging: hv: Get rid of the forward declaration for vmbus_match K. Y. Srinivasan
@ 2011-03-10 22:14 ` K. Y. Srinivasan
2011-03-10 22:14 ` [PATCH 17/21] Staging: hv: Get rid of the forward declaration for vmbus_remove K. Y. Srinivasan
` (4 subsequent siblings)
20 siblings, 0 replies; 38+ messages in thread
From: K. Y. Srinivasan @ 2011-03-10 22:14 UTC (permalink / raw)
To: kys, gregkh, linux-kernel, devel, virtualization
Cc: Haiyang Zhang, Mike Sterling, Abhishek Kane, Hank Janssen
Get rid of the forward declaration of vmbus_probe by moving
the code around.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Mike Sterling <mike.sterling@microsoft.com>
Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
---
drivers/staging/hv/vmbus_drv.c | 107 ++++++++++++++++++++--------------------
1 files changed, 53 insertions(+), 54 deletions(-)
diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c
index e15c465..35503b6 100644
--- a/drivers/staging/hv/vmbus_drv.c
+++ b/drivers/staging/hv/vmbus_drv.c
@@ -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
*/
--
1.5.5.6
^ permalink raw reply related [flat|nested] 38+ messages in thread* [PATCH 17/21] Staging: hv: Get rid of the forward declaration for vmbus_remove
[not found] <[PATCH 00/21] Staging: hv: Cleanup vmbus driver>
` (15 preceding siblings ...)
2011-03-10 22:14 ` [PATCH 16/21] Staging: hv: Get rid of the forward declaration for vmbus_probe K. Y. Srinivasan
@ 2011-03-10 22:14 ` K. Y. Srinivasan
2011-03-10 22:15 ` [PATCH 18/21] Staging: hv: Get rid of the forward declaration for vmbus_shutdown K. Y. Srinivasan
` (3 subsequent siblings)
20 siblings, 0 replies; 38+ messages in thread
From: K. Y. Srinivasan @ 2011-03-10 22:14 UTC (permalink / raw)
To: kys, gregkh, linux-kernel, devel, virtualization
Cc: Haiyang Zhang, Mike Sterling, Abhishek Kane, Hank Janssen
Get rid of the forward declaration of vmbus_remove by moving
the code around.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Mike Sterling <mike.sterling@microsoft.com>
Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
---
drivers/staging/hv/vmbus_drv.c | 59 +++++++++++++++++++--------------------
1 files changed, 29 insertions(+), 30 deletions(-)
diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c
index 35503b6..db5e735 100644
--- a/drivers/staging/hv/vmbus_drv.c
+++ b/drivers/staging/hv/vmbus_drv.c
@@ -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)
--
1.5.5.6
^ permalink raw reply related [flat|nested] 38+ messages in thread* [PATCH 18/21] Staging: hv: Get rid of the forward declaration for vmbus_shutdown
[not found] <[PATCH 00/21] Staging: hv: Cleanup vmbus driver>
` (16 preceding siblings ...)
2011-03-10 22:14 ` [PATCH 17/21] Staging: hv: Get rid of the forward declaration for vmbus_remove K. Y. Srinivasan
@ 2011-03-10 22:15 ` K. Y. Srinivasan
2011-03-10 22:15 ` [PATCH 19/21] Staging: hv: Get rid of the forward declaration for vmbus_device_release K. Y. Srinivasan
` (2 subsequent siblings)
20 siblings, 0 replies; 38+ messages in thread
From: K. Y. Srinivasan @ 2011-03-10 22:15 UTC (permalink / raw)
To: kys, gregkh, linux-kernel, devel, virtualization
Cc: Haiyang Zhang, Mike Sterling, Abhishek Kane, Hank Janssen
Get rid of the forward declaration of vmbus_shutdown by moving
the code around.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Mike Sterling <mike.sterling@microsoft.com>
Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
---
drivers/staging/hv/vmbus_drv.c | 44 ++++++++++++++++++++--------------------
1 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c
index db5e735..6f4094b 100644
--- a/drivers/staging/hv/vmbus_drv.c
+++ b/drivers/staging/hv/vmbus_drv.c
@@ -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
--
1.5.5.6
^ permalink raw reply related [flat|nested] 38+ messages in thread* [PATCH 19/21] Staging: hv: Get rid of the forward declaration for vmbus_device_release
[not found] <[PATCH 00/21] Staging: hv: Cleanup vmbus driver>
` (17 preceding siblings ...)
2011-03-10 22:15 ` [PATCH 18/21] Staging: hv: Get rid of the forward declaration for vmbus_shutdown K. Y. Srinivasan
@ 2011-03-10 22:15 ` K. Y. Srinivasan
2011-03-10 22:15 ` [PATCH 20/21] Staging: hv: Get rid of the forward declaration for vmbus_isr K. Y. Srinivasan
2011-03-10 22:16 ` [PATCH 21/21] Staging: hv: Get rid of the forward declaration for vmbus_show_device_attr K. Y. Srinivasan
20 siblings, 0 replies; 38+ messages in thread
From: K. Y. Srinivasan @ 2011-03-10 22:15 UTC (permalink / raw)
To: kys, gregkh, linux-kernel, devel, virtualization
Cc: Haiyang Zhang, Mike Sterling, Abhishek Kane, Hank Janssen
Get rid of the forward declaration of vmbus_device_release by moving
the code around.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Mike Sterling <mike.sterling@microsoft.com>
Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
---
drivers/staging/hv/vmbus_drv.c | 27 ++++++++++++---------------
1 files changed, 12 insertions(+), 15 deletions(-)
diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c
index 6f4094b..7c16acd 100644
--- a/drivers/staging/hv/vmbus_drv.c
+++ b/drivers/staging/hv/vmbus_drv.c
@@ -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)
{
--
1.5.5.6
^ permalink raw reply related [flat|nested] 38+ messages in thread* [PATCH 20/21] Staging: hv: Get rid of the forward declaration for vmbus_isr
[not found] <[PATCH 00/21] Staging: hv: Cleanup vmbus driver>
` (18 preceding siblings ...)
2011-03-10 22:15 ` [PATCH 19/21] Staging: hv: Get rid of the forward declaration for vmbus_device_release K. Y. Srinivasan
@ 2011-03-10 22:15 ` K. Y. Srinivasan
2011-03-10 22:16 ` [PATCH 21/21] Staging: hv: Get rid of the forward declaration for vmbus_show_device_attr K. Y. Srinivasan
20 siblings, 0 replies; 38+ messages in thread
From: K. Y. Srinivasan @ 2011-03-10 22:15 UTC (permalink / raw)
To: kys, gregkh, linux-kernel, devel, virtualization
Cc: Haiyang Zhang, Mike Sterling, Abhishek Kane, Hank Janssen
Get rid of the forward declaration of vmbus_isr by moving
the code around.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Mike Sterling <mike.sterling@microsoft.com>
Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
---
drivers/staging/hv/vmbus_drv.c | 47 +++++++++++++++++++--------------------
1 files changed, 23 insertions(+), 24 deletions(-)
diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c
index 7c16acd..dfa3c66 100644
--- a/drivers/staging/hv/vmbus_drv.c
+++ b/drivers/staging/hv/vmbus_drv.c
@@ -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)
{
--
1.5.5.6
^ permalink raw reply related [flat|nested] 38+ messages in thread* [PATCH 21/21] Staging: hv: Get rid of the forward declaration for vmbus_show_device_attr
[not found] <[PATCH 00/21] Staging: hv: Cleanup vmbus driver>
` (19 preceding siblings ...)
2011-03-10 22:15 ` [PATCH 20/21] Staging: hv: Get rid of the forward declaration for vmbus_isr K. Y. Srinivasan
@ 2011-03-10 22:16 ` K. Y. Srinivasan
20 siblings, 0 replies; 38+ messages in thread
From: K. Y. Srinivasan @ 2011-03-10 22:16 UTC (permalink / raw)
To: kys, gregkh, linux-kernel, devel, virtualization
Cc: Haiyang Zhang, Mike Sterling, Abhishek Kane, Hank Janssen
Get rid of the forward declaration of vmbus_show_device_attr by moving
the code around.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Mike Sterling <mike.sterling@microsoft.com>
Signed-off-by: Abhishek Kane <v-abkane@microsoft.com>
Signed-off-by: Hank Janssen <hjanssen@microsoft.com>
---
drivers/staging/hv/vmbus_drv.c | 302 +++++++++++++++++++--------------------
1 files changed, 147 insertions(+), 155 deletions(-)
diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c
index dfa3c66..881c3c0 100644
--- a/drivers/staging/hv/vmbus_drv.c
+++ b/drivers/staging/hv/vmbus_drv.c
@@ -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.
*
--
1.5.5.6
^ permalink raw reply related [flat|nested] 38+ messages in thread