Staging: hv: Cleanup vmbus driver - Phase II
Subsystems (2)
cover Staging: hv: Cleanup vmbus driver - Phase II
This patch-set fixes the following issues in the vmbus driver (vmbus_drv.c):
Make vmbus driver a platform pci device and cleanup root device management and irq allocation (patches 1/12 through 3/12):
1) Make vmbus driver a platform pci driver.
2) Cleanup root device management.
3) Leverage the pci model for allocating irq.
General cleanup of vmbus driver (patches 4/12 though 12/12):
1) Rename vmbus_driver_context structure and do related cleanup.
2) Get rid of forward declarations by moving code.
Regards,
K. Y
PATCH 1/12 Staging: hv: Make vmbus driver a pci driver
Make vmbus driver a pci driver. This is
in preparation to cleaning up the root device management as well as the irq allocation for this driver.
--- drivers/staging/hv/vmbus_drv.c | 63 +++++++++++++++++++++++----------------- 1 files changed, 36 insertions(+), 27 deletions(-)
drivers/staging/hv/vmbus_drv.c +36 -27
@@ -40,6 +40,8 @@#define VMBUS_IRQ 0x5#define VMBUS_IRQ_VECTOR IRQ5_VECTOR +struct pci_dev *hv_pci_dev; +/* Main vmbus driver data structure */ struct vmbus_driver_context {
@@ -977,36 +979,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; }/*
@@ -1021,10 +1011,29 @@ static const struct pci_device_id microsoft_hv_pci_table[] = { };MODULE_DEVICE_TABLE (pci, microsoft_hv_pci_table); +static struct pci_driver hv_bus_driver = { + .name ="hv_bus" , + .probe = hv_pci_probe, + .id_table = microsoft_hv_pci_table, +}; + +static int __init hv_pci_init (void ) +{ +return pci_register_driver (&hv_bus_driver); +} + +static void __exit hv_pci_exit(void) +{ +vmbus_bus_exit (); +pci_unregister_driver (&hv_bus_driver); +} + + +MODULE_LICENSE ("GPL" );MODULE_VERSION (HV_DRV_VERSION );module_param (vmbus_irq, int,S_IRUGO );module_param (vmbus_loglevel, int,S_IRUGO ); -module_init (vmbus_init); -module_exit (vmbus_exit); +module_init (hv_pci_init); +module_exit (hv_pci_exit);
Signature · 1 line
1.5.5.6
PATCH 7/12 Staging: hv: Get rid of the forward declaration for vmbus_probe
In reply to K. Y. SrinivasanGet rid of the forward declaration of vmbus_probe by moving the code around.
--- drivers/staging/hv/vmbus_drv.c | 107 ++++++++++++++++++++-------------------- 1 files changed, 53 insertions(+), 54 deletions(-)
drivers/staging/hv/vmbus_drv.c +53 -54
@@ -47,7 +47,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);
@@ -196,6 +195,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" ,
@@ -724,59 +776,6 @@ void vmbus_child_device_unregister(struct hv_device *device_obj) &device_obj->device); } - -/* -* vmbus_probe_failed_cb - Callback when a driver probe failed in vmbus_probe() -* -* We need a callback because we cannot invoked device_unregister() inside -* vmbus_probe() since vmbus_probe() may be invoked inside device_register() -* i.e. we cannot call device_unregister() inside device_register() -*/ -static void vmbus_probe_failed_cb (struct work_struct *context) -{ -struct hv_device *device_ctx = (struct hv_device *)context; - -/* -* Kick off the process of unregistering the device. -* This will call vmbus_remove() and eventually vmbus_device_release() -*/ -device_unregister (&device_ctx->device); - -/* put_device(&device_ctx->device); */ -} - -/* -* vmbus_probe - Add the new vmbus's child device -*/ -static int vmbus_probe (struct device *child_device) -{ -int ret =0 ; -struct hv_driver *drv = -drv_to_hv_drv (child_device->driver); -struct hv_device *dev =device_to_hv_device (child_device); - -/* Let the specific open-source driver handles the probe if it can */ -if (drv->driver.probe) { - ret = dev->probe_error = - drv->driver.probe (child_device); -if (ret !=0 ) { -DPRINT_ERR (VMBUS_DRV ,"probe() failed for device %s " -"(%p) on driver %s (%d)..." , -dev_name (child_device), child_device, - child_device->driver->name, ret); - -INIT_WORK (&dev->probe_failed_work_item, - vmbus_probe_failed_cb); -schedule_work (&dev->probe_failed_work_item); - } - }else { -DPRINT_ERR (VMBUS_DRV ,"probe() method not set for driver - %s" , - child_device->driver->name); - ret =-1 ; - } -return ret; -} -/* * vmbus_remove - Remove a vmbus device */
Signature · 1 line
1.5.5.6
PATCH 6/12 Staging: hv: Get rid of the forward declaration for vmbus_match
In reply to K. Y. SrinivasanGet rid of the forward declaration of vmbus_match by moving the code around.
--- drivers/staging/hv/vmbus_drv.c | 49 ++++++++++++++++++++------------------- 1 files changed, 25 insertions(+), 24 deletions(-)
drivers/staging/hv/vmbus_drv.c +25 -24
@@ -47,7 +47,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);
@@ -172,6 +171,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" ,
@@ -700,29 +724,6 @@ void vmbus_child_device_unregister(struct hv_device *device_obj) &device_obj->device); } -/* -* vmbus_match - Attempt to match the specified device to the specified driver -*/ -static int vmbus_match (struct device *device,struct device_driver *driver) -{ -int match =0 ; -struct hv_driver *drv =drv_to_hv_drv (driver); -struct hv_device *device_ctx =device_to_hv_device (device); - -/* We found our driver ? */ -if (memcmp (&device_ctx->dev_type, &drv->dev_type, -sizeof (struct hv_guid )) ==0 ) { - - device_ctx->drv = drv->priv; -DPRINT_INFO (VMBUS_DRV , -"device object (%p) set to driver object (%p)" , - &device_ctx, - device_ctx->drv); - - match =1 ; - } -return match; -}/* * vmbus_probe_failed_cb - Callback when a driver probe failed in vmbus_probe()
Signature · 1 line
1.5.5.6
PATCH 2/12 Staging: hv: Cleanup root device handling
In reply to K. Y. SrinivasanNow we can complete the cleanup of the root device management - use the pci device as the root device for all Hyper-V devices. As part of this cleanup get rid of the root device object from vmbus_driver_context.
--- drivers/staging/hv/vmbus_drv.c | 130 +++------------------------------------- 1 files changed, 8 insertions(+), 122 deletions(-)
drivers/staging/hv/vmbus_drv.c +8 -122
@@ -44,13 +44,9 @@ struct pci_dev *hv_pci_dev;/* Main vmbus driver data structure */ struct vmbus_driver_context { -struct bus_type bus;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);
@@ -62,7 +58,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,
@@ -119,54 +114,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;
@@ -418,17 +365,13 @@ 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;
@@ -485,45 +428,19 @@ 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 )); - - ret =vmbus_dev_add (dev_ctx, &vector); -if (ret !=0 ) { -DPRINT_ERR (VMBUS_DRV , -"ERROR - Unable to add vmbus root device" ); - -free_irq (vmbus_irq,NULL ); - -bus_unregister (&vmbus_drv_ctx->bus); - - ret =-1 ; - 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" ); -free_irq (vmbus_irq,NULL );bus_unregister (&vmbus_drv_ctx->bus); - - ret =-1 ; goto cleanup; } +vmbus_request_offers ();wait_for_completion (&hv_channel_ready);
@@ -540,7 +457,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 ();
@@ -548,9 +464,6 @@ static void vmbus_bus_exit(void)hv_cleanup (); -/* Unregister the root bus device */ -device_unregister (&dev_ctx->device); -bus_unregister (&vmbus_drv_ctx->bus);free_irq (vmbus_irq,NULL );
@@ -674,7 +587,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 = &hv_pci_dev->dev; child_device_obj->device.release = vmbus_device_release;/*
@@ -875,14 +788,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);
@@ -911,14 +816,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)
@@ -933,17 +830,6 @@ static void vmbus_shutdown(struct device *child_device)return ; } -/* -* vmbus_bus_release - Final callback release of the vmbus root device -*/ -static void vmbus_bus_release (struct device *device) -{ -/* FIXME */ -/* Empty release functions are a bug, or a major sign -* of a problem design, this MUST BE FIXED! */ -dev_err (device,"%s needs to be fixed!\n" , __func__); -WARN_ON (1 ); -}/* * vmbus_device_release - Final callback release of the vmbus child device
Signature · 1 line
1.5.5.6
PATCH 9/12 Staging: hv: Get rid of the forward declaration for vmbus_shutdown
In reply to K. Y. SrinivasanGet rid of the forward declaration of vmbus_shutdown by moving the code around.
--- drivers/staging/hv/vmbus_drv.c | 44 ++++++++++++++++++++-------------------- 1 files changed, 22 insertions(+), 22 deletions(-)
drivers/staging/hv/vmbus_drv.c +22 -22
@@ -47,7 +47,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);
@@ -276,6 +275,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" ,
@@ -804,27 +825,6 @@ void vmbus_child_device_unregister(struct hv_device *device_obj) &device_obj->device); } -/* -* vmbus_shutdown - Shutdown a vmbus device -*/ -static void vmbus_shutdown (struct device *child_device) -{ -struct hv_driver *drv; - - -/* The device may not be attached yet */ -if (!child_device->driver) -return ; - - drv =drv_to_hv_drv (child_device->driver); - -/* Let the specific open-source driver handles the removal if it can */ -if (drv->driver.shutdown) - drv->driver.shutdown (child_device); - -return ; -} -/* * vmbus_device_release - Final callback release of the vmbus child device
Signature · 1 line
1.5.5.6
PATCH 4/12 Staging: hv: Rename vmbus_driver_context structure
In reply to K. Y. SrinivasanNow that struct vmbus_driver_context is properly cleaned up, rename this structure appropriately and cleanup the code.
--- drivers/staging/hv/vmbus_drv.c | 32 +++++++++++++++----------------- 1 files changed, 15 insertions(+), 17 deletions(-)
drivers/staging/hv/vmbus_drv.c +15 -17
@@ -41,7 +41,7 @@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;
@@ -99,7 +99,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,
@@ -368,7 +368,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;
@@ -393,16 +392,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;
@@ -417,7 +416,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;
@@ -435,7 +434,7 @@ static int vmbus_bus_init(struct pci_dev *pdev) ret =vmbus_connect ();if (ret) {free_irq (pdev->irq, pdev); -bus_unregister (&vmbus_drv_ctx->bus); +bus_unregister (&hv_bus.bus); goto cleanup; }
@@ -454,7 +453,6 @@ cleanup:*/ static void vmbus_bus_exit (void ) { -struct vmbus_driver_context *vmbus_drv_ctx = &vmbus_drv;vmbus_release_unattached_channels ();
@@ -463,12 +461,12 @@ static void vmbus_bus_exit(void)hv_cleanup (); -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); }
@@ -491,7 +489,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);
@@ -585,7 +583,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 = &hv_pci_dev->dev; child_device_obj->device.release = vmbus_device_release;
@@ -853,10 +851,10 @@ static irqreturn_t vmbus_isr(int irq, void *dev_id)/* Schedules a dpc if necessary */ if (ret >0 ) {if (test_bit (0 , (unsigned long *)&ret)) -tasklet_schedule (&vmbus_drv.msg_dpc); +tasklet_schedule (&hv_bus.msg_dpc);if (test_bit (1 , (unsigned long *)&ret)) -tasklet_schedule (&vmbus_drv.event_dpc); +tasklet_schedule (&hv_bus.event_dpc);return IRQ_HANDLED ; }else {
Signature · 1 line
1.5.5.6
PATCH 12/12 Staging: hv: Get rid of the forward declaration for vmbus_show_device_attr
In reply to K. Y. SrinivasanGet rid of the forward declaration of vmbus_show_device_attr by moving the code around.
--- drivers/staging/hv/vmbus_drv.c | 302 +++++++++++++++++++-------------------- 1 files changed, 147 insertions(+), 155 deletions(-)
drivers/staging/hv/vmbus_drv.c +147 -155
@@ -47,18 +47,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[] = {
@@ -438,156 +580,6 @@ static irqreturn_t vmbus_isr(int irq, void *dev_id) } } - -static void get_channel_info (struct hv_device *device, -struct hv_device_info *info) -{ -struct vmbus_channel_debug_info debug_info; - -if (!device->channel) -return ; - -vmbus_get_debug_info (device->channel, &debug_info); - - info->chn_id = debug_info.relid; - info->chn_state = debug_info.state; -memcpy (&info->chn_type, &debug_info.interfacetype, -sizeof (struct hv_guid )); -memcpy (&info->chn_instance, &debug_info.interface_instance, -sizeof (struct hv_guid )); - - info->monitor_id = debug_info.monitorid; - - info->server_monitor_pending = debug_info.servermonitor_pending; - info->server_monitor_latency = debug_info.servermonitor_latency; - info->server_monitor_conn_id = debug_info.servermonitor_connectionid; - - info->client_monitor_pending = debug_info.clientmonitor_pending; - info->client_monitor_latency = debug_info.clientmonitor_latency; - info->client_monitor_conn_id = debug_info.clientmonitor_connectionid; - - info->inbound.int_mask = debug_info.inbound.current_interrupt_mask; - info->inbound.read_idx = debug_info.inbound.current_read_index; - info->inbound.write_idx = debug_info.inbound.current_write_index; - info->inbound.bytes_avail_toread = - debug_info.inbound.bytes_avail_toread; - info->inbound.bytes_avail_towrite = - debug_info.inbound.bytes_avail_towrite; - - info->outbound.int_mask = - debug_info.outbound.current_interrupt_mask; - info->outbound.read_idx = debug_info.outbound.current_read_index; - info->outbound.write_idx = debug_info.outbound.current_write_index; - info->outbound.bytes_avail_toread = - debug_info.outbound.bytes_avail_toread; - info->outbound.bytes_avail_towrite = - debug_info.outbound.bytes_avail_towrite; -} - -/* -* vmbus_show_device_attr - Show the device attribute in sysfs. -* -* This is invoked when user does a -* "cat /sys/bus/vmbus/devices/<busdevice>/<attr name>" -*/ -static ssize_t vmbus_show_device_attr (struct device *dev, -struct device_attribute *dev_attr, -char *buf) -{ -struct hv_device *device_ctx =device_to_hv_device (dev); -struct hv_device_info device_info; - -memset (&device_info,0 ,sizeof (struct hv_device_info )); - -get_channel_info (device_ctx, &device_info); - -if (!strcmp (dev_attr->attr.name,"class_id" )) { -return sprintf (buf,"{%02x%02x%02x%02x-%02x%02x-%02x%02x-" -"%02x%02x%02x%02x%02x%02x%02x%02x}\n" , - device_info.chn_type.data[3 ], - device_info.chn_type.data[2 ], - device_info.chn_type.data[1 ], - device_info.chn_type.data[0 ], - device_info.chn_type.data[5 ], - device_info.chn_type.data[4 ], - device_info.chn_type.data[7 ], - device_info.chn_type.data[6 ], - device_info.chn_type.data[8 ], - device_info.chn_type.data[9 ], - device_info.chn_type.data[10 ], - device_info.chn_type.data[11 ], - device_info.chn_type.data[12 ], - device_info.chn_type.data[13 ], - device_info.chn_type.data[14 ], - device_info.chn_type.data[15 ]); - }else if (!strcmp (dev_attr->attr.name,"device_id" )) { -return sprintf (buf,"{%02x%02x%02x%02x-%02x%02x-%02x%02x-" -"%02x%02x%02x%02x%02x%02x%02x%02x}\n" , - device_info.chn_instance.data[3 ], - device_info.chn_instance.data[2 ], - device_info.chn_instance.data[1 ], - device_info.chn_instance.data[0 ], - device_info.chn_instance.data[5 ], - device_info.chn_instance.data[4 ], - device_info.chn_instance.data[7 ], - device_info.chn_instance.data[6 ], - device_info.chn_instance.data[8 ], - device_info.chn_instance.data[9 ], - device_info.chn_instance.data[10 ], - device_info.chn_instance.data[11 ], - device_info.chn_instance.data[12 ], - device_info.chn_instance.data[13 ], - device_info.chn_instance.data[14 ], - device_info.chn_instance.data[15 ]); - }else if (!strcmp (dev_attr->attr.name,"state" )) { -return sprintf (buf,"%d\n" , device_info.chn_state); - }else if (!strcmp (dev_attr->attr.name,"id" )) { -return sprintf (buf,"%d\n" , device_info.chn_id); - }else if (!strcmp (dev_attr->attr.name,"out_intr_mask" )) { -return sprintf (buf,"%d\n" , device_info.outbound.int_mask); - }else if (!strcmp (dev_attr->attr.name,"out_read_index" )) { -return sprintf (buf,"%d\n" , device_info.outbound.read_idx); - }else if (!strcmp (dev_attr->attr.name,"out_write_index" )) { -return sprintf (buf,"%d\n" , device_info.outbound.write_idx); - }else if (!strcmp (dev_attr->attr.name,"out_read_bytes_avail" )) { -return sprintf (buf,"%d\n" , - device_info.outbound.bytes_avail_toread); - }else if (!strcmp (dev_attr->attr.name,"out_write_bytes_avail" )) { -return sprintf (buf,"%d\n" , - device_info.outbound.bytes_avail_towrite); - }else if (!strcmp (dev_attr->attr.name,"in_intr_mask" )) { -return sprintf (buf,"%d\n" , device_info.inbound.int_mask); - }else if (!strcmp (dev_attr->attr.name,"in_read_index" )) { -return sprintf (buf,"%d\n" , device_info.inbound.read_idx); - }else if (!strcmp (dev_attr->attr.name,"in_write_index" )) { -return sprintf (buf,"%d\n" , device_info.inbound.write_idx); - }else if (!strcmp (dev_attr->attr.name,"in_read_bytes_avail" )) { -return sprintf (buf,"%d\n" , - device_info.inbound.bytes_avail_toread); - }else if (!strcmp (dev_attr->attr.name,"in_write_bytes_avail" )) { -return sprintf (buf,"%d\n" , - device_info.inbound.bytes_avail_towrite); - }else if (!strcmp (dev_attr->attr.name,"monitor_id" )) { -return sprintf (buf,"%d\n" , device_info.monitor_id); - }else if (!strcmp (dev_attr->attr.name,"server_monitor_pending" )) { -return sprintf (buf,"%d\n" , device_info.server_monitor_pending); - }else if (!strcmp (dev_attr->attr.name,"server_monitor_latency" )) { -return sprintf (buf,"%d\n" , device_info.server_monitor_latency); - }else if (!strcmp (dev_attr->attr.name,"server_monitor_conn_id" )) { -return sprintf (buf,"%d\n" , - device_info.server_monitor_conn_id); - }else if (!strcmp (dev_attr->attr.name,"client_monitor_pending" )) { -return sprintf (buf,"%d\n" , device_info.client_monitor_pending); - }else if (!strcmp (dev_attr->attr.name,"client_monitor_latency" )) { -return sprintf (buf,"%d\n" , device_info.client_monitor_latency); - }else if (!strcmp (dev_attr->attr.name,"client_monitor_conn_id" )) { -return sprintf (buf,"%d\n" , - device_info.client_monitor_conn_id); - }else { -return 0 ; - } -} -/* * vmbus_bus_init -Main vmbus driver initialization routine. *
Signature · 1 line
1.5.5.6
PATCH 5/12 Get rid of the forward declaration for vmbus_uevent
In reply to K. Y. Srinivasan--- drivers/staging/hv/vmbus_drv.c | 151 ++++++++++++++++++++-------------------- 1 files changed, 75 insertions(+), 76 deletions(-)
drivers/staging/hv/vmbus_drv.c +75 -76
@@ -51,7 +51,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);
@@ -98,6 +97,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" ,
@@ -627,81 +701,6 @@ void vmbus_child_device_unregister(struct hv_device *device_obj) }/* -* vmbus_uevent - add uevent for our device -* -* This routine is invoked when a device is added or removed on the vmbus to -* generate a uevent to udev in the userspace. The udev will then look at its -* rule and the uevent generated here to load the appropriate driver -*/ -static int vmbus_uevent (struct device *device,struct kobj_uevent_env *env) -{ -struct hv_device *dev =device_to_hv_device (device); -int ret; - -DPRINT_INFO (VMBUS_DRV ,"generating uevent - VMBUS_DEVICE_CLASS_GUID={" -"%02x%02x%02x%02x-%02x%02x-%02x%02x-" -"%02x%02x%02x%02x%02x%02x%02x%02x}" , - dev->dev_type.data[3 ], dev->dev_type.data[2 ], - dev->dev_type.data[1 ], dev->dev_type.data[0 ], - dev->dev_type.data[5 ], dev->dev_type.data[4 ], - dev->dev_type.data[7 ], dev->dev_type.data[6 ], - dev->dev_type.data[8 ], dev->dev_type.data[9 ], - dev->dev_type.data[10 ], - dev->dev_type.data[11 ], - dev->dev_type.data[12 ], - dev->dev_type.data[13 ], - dev->dev_type.data[14 ], - dev->dev_type.data[15 ]); - - ret =add_uevent_var (env,"VMBUS_DEVICE_CLASS_GUID={" -"%02x%02x%02x%02x-%02x%02x-%02x%02x-" -"%02x%02x%02x%02x%02x%02x%02x%02x}" , - dev->dev_type.data[3 ], - dev->dev_type.data[2 ], - dev->dev_type.data[1 ], - dev->dev_type.data[0 ], - dev->dev_type.data[5 ], - dev->dev_type.data[4 ], - dev->dev_type.data[7 ], - dev->dev_type.data[6 ], - dev->dev_type.data[8 ], - dev->dev_type.data[9 ], - dev->dev_type.data[10 ], - dev->dev_type.data[11 ], - dev->dev_type.data[12 ], - dev->dev_type.data[13 ], - dev->dev_type.data[14 ], - dev->dev_type.data[15 ]); - -if (ret) -return ret; - - ret =add_uevent_var (env,"VMBUS_DEVICE_DEVICE_GUID={" -"%02x%02x%02x%02x-%02x%02x-%02x%02x-" -"%02x%02x%02x%02x%02x%02x%02x%02x}" , - dev->dev_instance.data[3 ], - dev->dev_instance.data[2 ], - dev->dev_instance.data[1 ], - dev->dev_instance.data[0 ], - dev->dev_instance.data[5 ], - dev->dev_instance.data[4 ], - dev->dev_instance.data[7 ], - dev->dev_instance.data[6 ], - dev->dev_instance.data[8 ], - dev->dev_instance.data[9 ], - dev->dev_instance.data[10 ], - dev->dev_instance.data[11 ], - dev->dev_instance.data[12 ], - dev->dev_instance.data[13 ], - dev->dev_instance.data[14 ], - dev->dev_instance.data[15 ]); -if (ret) -return ret; - -return 0 ; -} - -/* * vmbus_match - Attempt to match the specified device to the specified driver */ static int vmbus_match (struct device *device,struct device_driver *driver)
Signature · 1 line
1.5.5.6
PATCH 10/12 Staging: hv: Get rid of the forward declaration for vmbus_device_release
In reply to K. Y. SrinivasanGet rid of the forward declaration of vmbus_device_release by moving the code around.
--- drivers/staging/hv/vmbus_drv.c | 27 ++++++++++++--------------- 1 files changed, 12 insertions(+), 15 deletions(-)
drivers/staging/hv/vmbus_drv.c +12 -15
@@ -50,8 +50,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);
@@ -297,6 +295,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" ,
@@ -826,19 +836,6 @@ void vmbus_child_device_unregister(struct hv_device *device_obj) } -/* -* vmbus_device_release - Final callback release of the vmbus child device -*/ -static void vmbus_device_release (struct device *device) -{ -struct hv_device *device_ctx =device_to_hv_device (device); - -kfree (device_ctx); - -/* !!DO NOT REFERENCE device_ctx anymore at this point!! */ -} - -static irqreturn_t vmbus_isr (int irq,void *dev_id) {
Signature · 1 line
1.5.5.6
PATCH 11/12 Staging: hv: Get rid of the forward declaration for vmbus_isr
Get rid of the forward declaration of vmbus_isr by moving the code around.
--- drivers/staging/hv/vmbus_drv.c | 47 +++++++++++++++++++-------------------- 1 files changed, 23 insertions(+), 24 deletions(-)
drivers/staging/hv/vmbus_drv.c +23 -24
@@ -48,7 +48,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,
@@ -91,6 +90,7 @@ static struct device_attribute vmbus_device_attrs[] = { __ATTR_NULL }; +/* * vmbus_uevent - add uevent for our device *
@@ -417,6 +417,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) {
@@ -836,29 +858,6 @@ void vmbus_child_device_unregister(struct hv_device *device_obj) } - -static irqreturn_t vmbus_isr (int irq,void *dev_id) -{ -int ret; - - ret =vmbus_on_isr (); - -/* Schedules a dpc if necessary */ -if (ret >0 ) { -if (test_bit (0 , (unsigned long *)&ret)) -tasklet_schedule (&hv_bus.msg_dpc); - -if (test_bit (1 , (unsigned long *)&ret)) -tasklet_schedule (&hv_bus.event_dpc); - -return IRQ_HANDLED ; - }else { -return IRQ_NONE ; - } -} - - -static int __devinit hv_pci_probe (struct pci_dev *pdev,const struct pci_device_id *ent) {
Signature · 1 line
1.5.5.6
PATCH 3/12 Staging: hv: Cleanup irq management
In reply to K. Y. SrinivasanNow that vmbus_driver is a 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 may be the only external event this VM will get and consequently if this flag (IRQF_SAMPLE_RANDOM) is not specified, experimentally we have shown that the entropy in the VM will very very low.
--- drivers/staging/hv/vmbus_drv.c | 28 +++++++++++++--------------- 1 files changed, 13 insertions(+), 15 deletions(-)
drivers/staging/hv/vmbus_drv.c +13 -15
@@ -17,6 +17,8 @@* Authors: * Haiyang Zhang <[email protected]> * Hank Janssen <[email protected]> +* +* 3/9/2011: K. Y. Srinivasan - Significant restructuring and cleanup */ #include <linux/init.h> #include <linux/module.h>
@@ -36,10 +38,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 -struct pci_dev *hv_pci_dev;/* Main vmbus driver data structure */
@@ -69,7 +67,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[] = {
@@ -369,7 +366,7 @@ static ssize_t vmbus_show_device_attr(struct device *dev,* - get the irq resource * - 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;
@@ -412,21 +409,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, + vector);/* * Notify the hypervisor of our irq and
@@ -435,7 +434,7 @@ static int vmbus_bus_init(void)on_each_cpu (hv_synic_init, (void *)&vector,1 ); ret =vmbus_connect ();if (ret) { -free_irq (vmbus_irq,NULL ); +free_irq (pdev->irq, pdev);bus_unregister (&vmbus_drv_ctx->bus); goto cleanup; }
@@ -466,7 +465,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);
@@ -878,7 +877,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);
@@ -918,7 +917,6 @@ static void __exit hv_pci_exit(void)MODULE_LICENSE ("GPL" );MODULE_VERSION (HV_DRV_VERSION ); -module_param (vmbus_irq, int,S_IRUGO );module_param (vmbus_loglevel, int,S_IRUGO );module_init (hv_pci_init);
Signature · 1 line
1.5.5.6
PATCH 5/12 Staging: hv: Get rid of the forward declaration for vmbus_uevent
In reply to K. Y. SrinivasanGet rid of the forward declaration of vmbus_uevent by moving the code around.
--- drivers/staging/hv/vmbus_drv.c | 151 ++++++++++++++++++++-------------------- 1 files changed, 75 insertions(+), 76 deletions(-)
drivers/staging/hv/vmbus_drv.c +75 -76
@@ -51,7 +51,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);
@@ -98,6 +97,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" ,
@@ -627,81 +701,6 @@ void vmbus_child_device_unregister(struct hv_device *device_obj) }/* -* vmbus_uevent - add uevent for our device -* -* This routine is invoked when a device is added or removed on the vmbus to -* generate a uevent to udev in the userspace. The udev will then look at its -* rule and the uevent generated here to load the appropriate driver -*/ -static int vmbus_uevent (struct device *device,struct kobj_uevent_env *env) -{ -struct hv_device *dev =device_to_hv_device (device); -int ret; - -DPRINT_INFO (VMBUS_DRV ,"generating uevent - VMBUS_DEVICE_CLASS_GUID={" -"%02x%02x%02x%02x-%02x%02x-%02x%02x-" -"%02x%02x%02x%02x%02x%02x%02x%02x}" , - dev->dev_type.data[3 ], dev->dev_type.data[2 ], - dev->dev_type.data[1 ], dev->dev_type.data[0 ], - dev->dev_type.data[5 ], dev->dev_type.data[4 ], - dev->dev_type.data[7 ], dev->dev_type.data[6 ], - dev->dev_type.data[8 ], dev->dev_type.data[9 ], - dev->dev_type.data[10 ], - dev->dev_type.data[11 ], - dev->dev_type.data[12 ], - dev->dev_type.data[13 ], - dev->dev_type.data[14 ], - dev->dev_type.data[15 ]); - - ret =add_uevent_var (env,"VMBUS_DEVICE_CLASS_GUID={" -"%02x%02x%02x%02x-%02x%02x-%02x%02x-" -"%02x%02x%02x%02x%02x%02x%02x%02x}" , - dev->dev_type.data[3 ], - dev->dev_type.data[2 ], - dev->dev_type.data[1 ], - dev->dev_type.data[0 ], - dev->dev_type.data[5 ], - dev->dev_type.data[4 ], - dev->dev_type.data[7 ], - dev->dev_type.data[6 ], - dev->dev_type.data[8 ], - dev->dev_type.data[9 ], - dev->dev_type.data[10 ], - dev->dev_type.data[11 ], - dev->dev_type.data[12 ], - dev->dev_type.data[13 ], - dev->dev_type.data[14 ], - dev->dev_type.data[15 ]); - -if (ret) -return ret; - - ret =add_uevent_var (env,"VMBUS_DEVICE_DEVICE_GUID={" -"%02x%02x%02x%02x-%02x%02x-%02x%02x-" -"%02x%02x%02x%02x%02x%02x%02x%02x}" , - dev->dev_instance.data[3 ], - dev->dev_instance.data[2 ], - dev->dev_instance.data[1 ], - dev->dev_instance.data[0 ], - dev->dev_instance.data[5 ], - dev->dev_instance.data[4 ], - dev->dev_instance.data[7 ], - dev->dev_instance.data[6 ], - dev->dev_instance.data[8 ], - dev->dev_instance.data[9 ], - dev->dev_instance.data[10 ], - dev->dev_instance.data[11 ], - dev->dev_instance.data[12 ], - dev->dev_instance.data[13 ], - dev->dev_instance.data[14 ], - dev->dev_instance.data[15 ]); -if (ret) -return ret; - -return 0 ; -} - -/* * vmbus_match - Attempt to match the specified device to the specified driver */ static int vmbus_match (struct device *device,struct device_driver *driver)
Signature · 1 line
1.5.5.6
PATCH 8/12 Staging: hv: Get rid of the forward declaration for vmbus_remove
In reply to K. Y. SrinivasanGet rid of the forward declaration of vmbus_remove by moving the code around.
--- drivers/staging/hv/vmbus_drv.c | 59 +++++++++++++++++++-------------------- 1 files changed, 29 insertions(+), 30 deletions(-)
drivers/staging/hv/vmbus_drv.c +29 -30
@@ -47,7 +47,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);
@@ -248,6 +247,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" ,
@@ -777,35 +805,6 @@ void vmbus_child_device_unregister(struct hv_device *device_obj) }/* -* vmbus_remove - Remove a vmbus device -*/ -static int vmbus_remove (struct device *child_device) -{ -int ret; -struct hv_driver *drv; - - -if (child_device->driver) { - drv =drv_to_hv_drv (child_device->driver); - -/* -* Let the specific open-source driver handles the removal if -* it can -*/ -if (drv->driver.remove) { - ret = drv->driver.remove (child_device); - }else { -DPRINT_ERR (VMBUS_DRV , -"remove() method not set for driver - %s" , - child_device->driver->name); - ret =-1 ; - } - } - -return 0 ; -} - -/* * vmbus_shutdown - Shutdown a vmbus device */ static void vmbus_shutdown (struct device *child_device)
Signature · 1 line
1.5.5.6
Quoted 1 line · K. Y. Srinivasan
This patch-set fixes the following issues in the vmbus driver (
vmbus_drv.c):
<snip>
Thanks for the patches, but as the .39 merge window is closed, I'll be holding on to these until after .39-rc1 is out before I can do anything with them.
So don't be surprised if I don't respond to them for a few weeks. Don't worry, they aren't lost. :)
thanks,
greg k-h
Re: [PATCH 05/12] Staging: hv: Get rid of the forward declaration for vmbus_uevent
In reply to K. Y. SrinivasanQuoted 2 lines · K. Y. Srinivasan
Get rid of the forward declaration of
vmbus_ueventby moving the code around.
There are 2 05/12 patches and they are different.
confused,
greg k-h
Re: [PATCH 05/12] Staging: hv: Get rid of the forward declaration for vmbus_uevent
Quoted 5 lines · Greg KH
Quoted 2 lines · K. Y. Srinivasan
Get rid of the forward declaration of
vmbus_ueventby moving the code around.There are 2 05/12 patches and they are different.
Ah, one has the proper subject and changelog entry and the other doesn't. Which to use?
thanks,
greg k-h
Quoted 13 lines
-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Tuesday, March 15, 2011 6:05 PM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 00/12] Staging: hv: Cleanup vmbus driver - Phase IIQuoted 1 line · K. Y. Srinivasan
This patch-set fixes the following issues in the vmbus driver (
vmbus_drv.c):
Quoted 8 lines
<snip>
Thanks for the patches, but as the .39 merge window is closed, I'll be holding on to these until after .39-rc1 is out before I can do anything with them.
So don't be surprised if I don't respond to them for a few weeks. Don't worry, they aren't lost. :)
If possible, I would love to get your feedback even if you cannot check in these patches. Also, if you can give me feedback as to what else would need to be fixed to exit staging as far as the vmbus driver is concerned, I can work on those over the next couple of weeks until the tree opens up. If it is ok with you we will send the DPRINT cleanup patches in the next couple of days.
Regards,
K. Y
Quoted 19 lines · KY Srinivasan
Quoted 19 lines
-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Tuesday, March 15, 2011 6:05 PM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 00/12] Staging: hv: Cleanup vmbus driver - Phase IIQuoted 1 line · K. Y. Srinivasan
This patch-set fixes the following issues in the vmbus driver (
vmbus_drv.c):<snip>
Thanks for the patches, but as the .39 merge window is closed, I'll be holding on to these until after .39-rc1 is out before I can do anything with them.
Quoted 8 lines
Quoted 2 lines
So don't be surprised if I don't respond to them for a few weeks. Don't worry, they aren't lost. :)
If possible, I would love to get your feedback even if you cannot check in these patches. Also, if you can give me feedback as to what else would need to be fixed to exit staging as far as the vmbus driver is concerned, I can work on those over the next couple of weeks until the tree opens up.
As I'm going to be very busy with the merge window issues, coupled with spring break and the LF Collab summit, I doubt I'll be able to do this, sorry. Give me a few weeks please.
Quoted 2 lines
If it is ok with you we will send the DPRINT cleanup patches in the next couple of days.
That's fine, they can sit in the same "to-apply" mbox next to these :)
greg k-h
RE: [PATCH 05/12] Staging: hv: Get rid of the forward declaration for vmbus_uevent
In reply to Greg KHQuoted 12 lines
-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Tuesday, March 15, 2011 6:23 PM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Haiyang Zhang; Mike Sterling; Abhishek Kane (Mindtree Consulting PVT LTD)
Subject: Re: [PATCH 05/12] Staging: hv: Get rid of the forward declaration forvmbus_uevent
Quoted 5 lines
Quoted 2 lines · K. Y. Srinivasan
Get rid of the forward declaration of
vmbus_ueventby moving the code around.There are 2 05/12 patches and they are different.
Sorry about that Greg; I had an incorrect commit message that I fixed, but forgot to delete that patch that was generated with the incorrect commit message. Loose the patch that has the subject line:
[PATCH 05/12] Get rid of the forward declaration for vmbus_uevent
You want to keep the one that has the following subject line:
[PATCH 05/12] Staging: hv: Get rid of the forward declaration for vmbus_uevent
I could resend, if you prefer.
Regards,
K. Y
Re: [PATCH 05/12] Staging: hv: Get rid of the forward declaration for vmbus_uevent
Quoted 21 lines · KY Srinivasan
Quoted 12 lines
-----Original Message-----
From: Greg KH [mailto:[email protected]]
Sent: Tuesday, March 15, 2011 6:23 PM
To: KY Srinivasan
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Haiyang Zhang; Mike Sterling; Abhishek Kane (Mindtree Consulting PVT LTD)
Subject: Re: [PATCH 05/12] Staging: hv: Get rid of the forward declaration forvmbus_ueventQuoted 5 lines
Quoted 2 lines · K. Y. Srinivasan
Get rid of the forward declaration of
vmbus_ueventby moving the code around.There are 2 05/12 patches and they are different.
Sorry about that Greg; I had an incorrect commit message that I fixed, but forgot to delete that patch that was generated with the incorrect commit message. Loose the patch that has the subject line:
Quoted 7 lines
[PATCH 05/12] Get rid of the forward declaration for
vmbus_ueventYou want to keep the one that has the following subject line:
[PATCH 05/12] Staging: hv: Get rid of the forward declaration for
vmbus_ueventI could resend, if you prefer.
No I got it, that's fine.
thanks,
greg k-h
Quoted 3 lines · Greg KH
Thanks for the patches, but as the .39 merge window is closed, I'll be holding on to these until after .39-rc1 is out before I can do anything with them.
Is that Linus's merge window, or your window to freeze a for-linus tree?
Quoted 7 lines · On Thu, Mar 17, 2011 at 05:39:27PM -0400, [email protected] wrote:
Quoted 3 lines · Greg KH
Thanks for the patches, but as the .39 merge window is closed, I'll be holding on to these until after .39-rc1 is out before I can do anything with them.
Is that Linus's merge window, or your window to freeze a for-linus tree?
My window.
Linus's merge window is for the subsystem maintainers. Everything that is to be sent during Linus's merge window had to be in the linux-next tree for a bit of time before the merge window opens.
It's been this way for a number of years now, nothing new happening here...
I also posted the "my tree is now closed for .39 stuff" message to the devel mailing list, so there shouldn't have been any questions about this.
thanks,
greg k-h
Quoted 8 lines · Greg KH
Quoted 1 line · On Thu, Mar 17, 2011 at 05:39:27PM -0400, [email protected] wrote:
Is that Linus's merge window, or your window to freeze a for-linus tree?
My window.
Linus's merge window is for the subsystem maintainers. Everything that is to be sent during Linus's merge window had to be in the linux-next tree for a bit of time before the merge window opens.
OK, that's what I suspected, but wasn't 100% sure, because..
Quoted 3 lines
I also posted the "my tree is now closed for .39 stuff" message to the devel mailing list, so there shouldn't have been any questions about this.
some of us are only on lkml, where usually it's Linus who gets to say "The 2.6.N merge window is closed".
Re: [PATCH 01/12] Staging: hv: Make vmbus driver a pci driver
In reply to K. Y. SrinivasanQuoted 19 lines · K. Y. Srinivasan
Make vmbus driver a pci driver. This is
in preparation to cleaning up the root device management as well as the irq allocation for this driver.Signed-off-by K. Y. Srinivasan <[email protected]>Signed-off-by Haiyang Zhang <[email protected]>Signed-off-by Mike Sterling <[email protected]>Signed-off-by Abhishek Kane <[email protected]>Signed-off-by Hank Janssen <[email protected]>--- drivers/staging/hv/vmbus_drv.c | 63 +++++++++++++++++++++++----------------- 1 files changed, 36 insertions(+), 27 deletions(-)drivers/staging/hv/vmbus_drv.c +0
-0
drivers/staging/hv/vmbus_drv.c line 43
Quoted 4 lines
drivers/staging/hv/vmbus_drv.c +1
-0@@ -40,6 +40,8 @@#define VMBUS_IRQ 0x5#define VMBUS_IRQ_VECTOR IRQ5_VECTOR +struct pci_dev *hv_pci_dev;
Why is this global?
Have you forgot to run 'sparse' on your changes?
thanks,
greg k-h
Re: [PATCH 03/12] Staging: hv: Cleanup irq management
In reply to K. Y. SrinivasanQuoted 26 lines · K. Y. Srinivasan
Now that
vmbus_driveris a 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_RANDOMflag used inrequest_irq()function. This interrupt may be 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 <[email protected]>Signed-off-by Haiyang Zhang <[email protected]>Signed-off-by Mike Sterling <[email protected]>Signed-off-by Abhishek Kane <[email protected]>Signed-off-by Hank Janssen <[email protected]>--- drivers/staging/hv/vmbus_drv.c | 28 +++++++++++++--------------- 1 files changed, 13 insertions(+), 15 deletions(-)drivers/staging/hv/vmbus_drv.c +0
-0
drivers/staging/hv/vmbus_drv.c line 21
Quoted 5 lines
drivers/staging/hv/vmbus_drv.c +2
-0@@ -17,6 +17,8 @@* Authors: * Haiyang Zhang <[email protected]> * Hank Janssen <[email protected]> +* +* 3/9/2011: K. Y. Srinivasan - Significant restructuring and cleanup
Changelog comments never belong in the file itself. If you consider yourself an author of the file now, then put your name in it with the others.
thanks,
greg k-h
Re: [PATCH 04/12] Staging: hv: Rename vmbus_driver_context structure
In reply to K. Y. SrinivasanQuoted 27 lines · K. Y. Srinivasan
Now that struct
vmbus_driver_contextis properly cleaned up, rename this structure appropriately and cleanup the code.Signed-off-by K. Y. Srinivasan <[email protected]>Signed-off-by Haiyang Zhang <[email protected]>Signed-off-by Mike Sterling <[email protected]>Signed-off-by Abhishek Kane <[email protected]>Signed-off-by Hank Janssen <[email protected]>--- drivers/staging/hv/vmbus_drv.c | 32 +++++++++++++++----------------- 1 files changed, 15 insertions(+), 17 deletions(-)drivers/staging/hv/vmbus_drv.c +1
-1@@ -41,7 +41,7 @@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;
drivers/staging/hv/vmbus_drv.c static struct device_attribute vmbus_device_attrs[] = { · line 102
Quoted 5 lines
drivers/staging/hv/vmbus_drv.c +1
-1@@ -99,7 +99,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 = {
2 spaces?
drivers/staging/hv/vmbus_drv.c static struct device_attribute vmbus_device_attrs[] = { · line 105
Quoted 3 lines
drivers/staging/hv/vmbus_drv.c +0
-0.bus.name = "vmbus", .bus.match = vmbus_match, .bus.shutdown = vmbus_shutdown,
Wait, why is a bus_type embedded within another structure? That is going to get pulled out later, right?
thanks,
greg k-h
Quoted 7 lines · On Thu, Mar 17, 2011 at 05:39:27PM -0400, [email protected] wrote:
Quoted 3 lines · Greg KH
Thanks for the patches, but as the .39 merge window is closed, I'll be holding on to these until after .39-rc1 is out before I can do anything with them.
Is that Linus's merge window, or your window to freeze a for-linus tree?
You are replying to a month-old email, I can't recall at the moment which I was referring to, sorry.
greg k-h