]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/hv/vmbus_drv.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial
[karo-tx-linux.git] / drivers / hv / vmbus_drv.c
index 9e0e25c394f5db810e4b138158bdf5443f00cc2a..328e4c3808e06d146add9ade074efd2d1728e1dd 100644 (file)
@@ -47,7 +47,6 @@ static struct acpi_device  *hv_acpi_dev;
 
 static struct tasklet_struct msg_dpc;
 static struct completion probe_event;
-static int irq;
 
 
 static void hyperv_report_panic(struct pt_regs *regs)
@@ -602,23 +601,11 @@ static int vmbus_remove(struct device *child_device)
 {
        struct hv_driver *drv;
        struct hv_device *dev = device_to_hv_device(child_device);
-       u32 relid = dev->channel->offermsg.child_relid;
 
        if (child_device->driver) {
                drv = drv_to_hv_drv(child_device->driver);
                if (drv->remove)
                        drv->remove(dev);
-               else {
-                       hv_process_channel_removal(dev->channel, relid);
-                       pr_err("remove not set for driver %s\n",
-                               dev_name(child_device));
-               }
-       } else {
-               /*
-                * We don't have a driver for this device; deal with the
-                * rescind message by removing the channel.
-                */
-               hv_process_channel_removal(dev->channel, relid);
        }
 
        return 0;
@@ -653,7 +640,10 @@ static void vmbus_shutdown(struct device *child_device)
 static void vmbus_device_release(struct device *device)
 {
        struct hv_device *hv_dev = device_to_hv_device(device);
+       struct vmbus_channel *channel = hv_dev->channel;
 
+       hv_process_channel_removal(channel,
+                                  channel->offermsg.child_relid);
        kfree(hv_dev);
 
 }
@@ -835,10 +825,9 @@ static void vmbus_isr(void)
  * Here, we
  *     - initialize the vmbus driver context
  *     - invoke the vmbus hv main init routine
- *     - get the irq resource
  *     - retrieve the channel offers
  */
-static int vmbus_bus_init(int irq)
+static int vmbus_bus_init(void)
 {
        int ret;
 
@@ -1033,9 +1022,6 @@ static acpi_status vmbus_walk_resources(struct acpi_resource *res, void *ctx)
        struct resource **prev_res = NULL;
 
        switch (res->type) {
-       case ACPI_RESOURCE_TYPE_IRQ:
-               irq = res->data.irq.interrupts[0];
-               return AE_OK;
 
        /*
         * "Address" descriptors are for bus windows. Ignore
@@ -1077,12 +1063,28 @@ static acpi_status vmbus_walk_resources(struct acpi_resource *res, void *ctx)
        new_res->start = start;
        new_res->end = end;
 
+       /*
+        * Stick ranges from higher in address space at the front of the list.
+        * If two ranges are adjacent, merge them.
+        */
        do {
                if (!*old_res) {
                        *old_res = new_res;
                        break;
                }
 
+               if (((*old_res)->end + 1) == new_res->start) {
+                       (*old_res)->end = new_res->end;
+                       kfree(new_res);
+                       break;
+               }
+
+               if ((*old_res)->start == new_res->end + 1) {
+                       (*old_res)->start = new_res->start;
+                       kfree(new_res);
+                       break;
+               }
+
                if ((*old_res)->end < new_res->start) {
                        new_res->sibling = *old_res;
                        if (prev_res)
@@ -1294,7 +1296,7 @@ static int __init hv_acpi_init(void)
        init_completion(&probe_event);
 
        /*
-        * Get irq resources first.
+        * Get ACPI resources first.
         */
        ret = acpi_bus_register_driver(&vmbus_acpi_driver);
 
@@ -1307,12 +1309,7 @@ static int __init hv_acpi_init(void)
                goto cleanup;
        }
 
-       if (irq <= 0) {
-               ret = -ENODEV;
-               goto cleanup;
-       }
-
-       ret = vmbus_bus_init(irq);
+       ret = vmbus_bus_init();
        if (ret)
                goto cleanup;