]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/pci/hotplug/acpiphp_glue.c
PCI: introduce pci_slot
[linux-2.6-omap-h63xx.git] / drivers / pci / hotplug / acpiphp_glue.c
index 5e50008d1181046ea2b77378f68c4fd7596c1914..9342c848db29f8888b82000c6defcf07a435b968 100644 (file)
@@ -258,7 +258,12 @@ register_slot(acpi_handle handle, u32 lvl, void *context, void **rv)
                                bridge->pci_bus->number, slot->device);
                retval = acpiphp_register_hotplug_slot(slot);
                if (retval) {
-                       warn("acpiphp_register_hotplug_slot failed(err code = 0x%x)\n", retval);
+                       if (retval == -EBUSY)
+                               warn("Slot %d already registered by another "
+                                       "hotplug driver\n", slot->sun);
+                       else
+                               warn("acpiphp_register_hotplug_slot failed "
+                                       "(err code = 0x%x)\n", retval);
                        goto err_exit;
                }
        }
@@ -352,7 +357,7 @@ static void decode_hpp(struct acpiphp_bridge *bridge)
                /* use default numbers */
                printk(KERN_WARNING
                       "%s: Could not get hotplug parameters. Use defaults\n",
-                      __FUNCTION__);
+                      __func__);
                bridge->hpp.t0 = &bridge->hpp.type0_data;
                bridge->hpp.t0->revision = 0;
                bridge->hpp.t0->cache_line_size = 0x10;
@@ -534,7 +539,7 @@ find_p2p_bridge(acpi_handle handle, u32 lvl, void *context, void **rv)
 
        status = acpi_evaluate_integer(handle, "_ADR", NULL, &tmp);
        if (ACPI_FAILURE(status)) {
-               dbg("%s: _ADR evaluation failure\n", __FUNCTION__);
+               dbg("%s: _ADR evaluation failure\n", __func__);
                return AE_OK;
        }
 
@@ -578,7 +583,7 @@ static int add_bridge(acpi_handle handle)
        if (ACPI_SUCCESS(status)) {
                status = acpi_evaluate_integer(handle, "_STA", NULL, &tmp);
                if (ACPI_FAILURE(status)) {
-                       dbg("%s: _STA evaluation failure\n", __FUNCTION__);
+                       dbg("%s: _STA evaluation failure\n", __func__);
                        return 0;
                }
                if ((tmp & ACPI_STA_FUNCTIONING) == 0)
@@ -928,10 +933,10 @@ static int power_on_slot(struct acpiphp_slot *slot)
                func = list_entry(l, struct acpiphp_func, sibling);
 
                if (func->flags & FUNC_HAS_PS0) {
-                       dbg("%s: executing _PS0\n", __FUNCTION__);
+                       dbg("%s: executing _PS0\n", __func__);
                        status = acpi_evaluate_object(func->handle, "_PS0", NULL, NULL);
                        if (ACPI_FAILURE(status)) {
-                               warn("%s: _PS0 failed\n", __FUNCTION__);
+                               warn("%s: _PS0 failed\n", __func__);
                                retval = -1;
                                goto err_exit;
                        } else
@@ -966,7 +971,7 @@ static int power_off_slot(struct acpiphp_slot *slot)
                if (func->flags & FUNC_HAS_PS3) {
                        status = acpi_evaluate_object(func->handle, "_PS3", NULL, NULL);
                        if (ACPI_FAILURE(status)) {
-                               warn("%s: _PS3 failed\n", __FUNCTION__);
+                               warn("%s: _PS3 failed\n", __func__);
                                retval = -1;
                                goto err_exit;
                        } else
@@ -1300,7 +1305,7 @@ int acpiphp_eject_slot(struct acpiphp_slot *slot)
 
                        status = acpi_evaluate_object(func->handle, "_EJ0", &arg_list, NULL);
                        if (ACPI_FAILURE(status)) {
-                               warn("%s: _EJ0 failed\n", __FUNCTION__);
+                               warn("%s: _EJ0 failed\n", __func__);
                                return -1;
                        } else
                                break;
@@ -1349,7 +1354,7 @@ static int acpiphp_check_bridge(struct acpiphp_bridge *bridge)
                }
        }
 
-       dbg("%s: %d enabled, %d disabled\n", __FUNCTION__, enabled, disabled);
+       dbg("%s: %d enabled, %d disabled\n", __func__, enabled, disabled);
 
  err_exit:
        return retval;
@@ -1527,7 +1532,7 @@ check_sub_bridges(acpi_handle handle, u32 lvl, void *context, void **rv)
        if (bridge) {
                acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer);
                dbg("%s: re-enumerating slots under %s\n",
-                       __FUNCTION__, objname);
+                       __func__, objname);
                acpiphp_check_bridge(bridge);
        }
        return AE_OK ;
@@ -1572,10 +1577,10 @@ static void handle_hotplug_event_bridge(acpi_handle handle, u32 type, void *cont
        switch (type) {
        case ACPI_NOTIFY_BUS_CHECK:
                /* bus re-enumerate */
-               dbg("%s: Bus check notify on %s\n", __FUNCTION__, objname);
+               dbg("%s: Bus check notify on %s\n", __func__, objname);
                if (bridge) {
                        dbg("%s: re-enumerating slots under %s\n",
-                               __FUNCTION__, objname);
+                               __func__, objname);
                        acpiphp_check_bridge(bridge);
                }
                if (num_sub_bridges)
@@ -1585,18 +1590,18 @@ static void handle_hotplug_event_bridge(acpi_handle handle, u32 type, void *cont
 
        case ACPI_NOTIFY_DEVICE_CHECK:
                /* device check */
-               dbg("%s: Device check notify on %s\n", __FUNCTION__, objname);
+               dbg("%s: Device check notify on %s\n", __func__, objname);
                acpiphp_check_bridge(bridge);
                break;
 
        case ACPI_NOTIFY_DEVICE_WAKE:
                /* wake event */
-               dbg("%s: Device wake notify on %s\n", __FUNCTION__, objname);
+               dbg("%s: Device wake notify on %s\n", __func__, objname);
                break;
 
        case ACPI_NOTIFY_EJECT_REQUEST:
                /* request device eject */
-               dbg("%s: Device eject notify on %s\n", __FUNCTION__, objname);
+               dbg("%s: Device eject notify on %s\n", __func__, objname);
                if ((bridge->type != BRIDGE_TYPE_HOST) &&
                    (bridge->flags & BRIDGE_HAS_EJ0)) {
                        struct acpiphp_slot *slot;
@@ -1649,24 +1654,24 @@ static void handle_hotplug_event_func(acpi_handle handle, u32 type, void *contex
        switch (type) {
        case ACPI_NOTIFY_BUS_CHECK:
                /* bus re-enumerate */
-               dbg("%s: Bus check notify on %s\n", __FUNCTION__, objname);
+               dbg("%s: Bus check notify on %s\n", __func__, objname);
                acpiphp_enable_slot(func->slot);
                break;
 
        case ACPI_NOTIFY_DEVICE_CHECK:
                /* device check : re-enumerate from parent bus */
-               dbg("%s: Device check notify on %s\n", __FUNCTION__, objname);
+               dbg("%s: Device check notify on %s\n", __func__, objname);
                acpiphp_check_bridge(func->slot->bridge);
                break;
 
        case ACPI_NOTIFY_DEVICE_WAKE:
                /* wake event */
-               dbg("%s: Device wake notify on %s\n", __FUNCTION__, objname);
+               dbg("%s: Device wake notify on %s\n", __func__, objname);
                break;
 
        case ACPI_NOTIFY_EJECT_REQUEST:
                /* request device eject */
-               dbg("%s: Device eject notify on %s\n", __FUNCTION__, objname);
+               dbg("%s: Device eject notify on %s\n", __func__, objname);
                if (!(acpiphp_disable_slot(func->slot)))
                        acpiphp_eject_slot(func->slot);
                break;
@@ -1796,7 +1801,7 @@ int acpiphp_enable_slot(struct acpiphp_slot *slot)
                if (retval)
                        power_off_slot(slot);
        } else {
-               dbg("%s: Slot status is not ACPI_STA_ALL\n", __FUNCTION__);
+               dbg("%s: Slot status is not ACPI_STA_ALL\n", __func__);
                power_off_slot(slot);
        }
 
@@ -1867,19 +1872,3 @@ u8 acpiphp_get_adapter_status(struct acpiphp_slot *slot)
 
        return (sta == 0) ? 0 : 1;
 }
-
-
-/*
- * pci address (seg/bus/dev)
- */
-u32 acpiphp_get_address(struct acpiphp_slot *slot)
-{
-       u32 address;
-       struct pci_bus *pci_bus = slot->bridge->pci_bus;
-
-       address = (pci_domain_nr(pci_bus) << 16) |
-                 (pci_bus->number << 8) |
-                 slot->device;
-
-       return address;
-}