Merge tag 'for-4.5' of git://git.osdn.jp/gitroot/uclinux-h8/linux
[deliverable/linux.git] / drivers / hv / vmbus_drv.c
index 7078b5f143a245c7a4805743f883b465f3262694..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)
@@ -533,7 +532,7 @@ static const uuid_le null_guid;
 
 static inline bool is_null_guid(const uuid_le *guid)
 {
-       if (memcmp(guid, &null_guid, sizeof(uuid_le)))
+       if (uuid_le_cmp(*guid, null_guid))
                return false;
        return true;
 }
@@ -547,7 +546,7 @@ static const struct hv_vmbus_device_id *hv_vmbus_get_id(
                                        const uuid_le *guid)
 {
        for (; !is_null_guid(&id->guid); id++)
-               if (!memcmp(&id->guid, guid, sizeof(uuid_le)))
+               if (!uuid_le_cmp(id->guid, *guid))
                        return id;
 
        return NULL;
@@ -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;
 
This page took 0.027371 seconds and 5 git commands to generate.