]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/pci/hotplug/sgi_hotplug.c
PCI: introduce pci_slot
[linux-2.6-omap-h63xx.git] / drivers / pci / hotplug / sgi_hotplug.c
index 78cf0711d1fadd5bd670425a4e7ce732748795c2..2036a43ff2fdd4e306f80138d70afacbead916fd 100644 (file)
@@ -197,13 +197,15 @@ static int sn_hp_slot_private_alloc(struct hotplug_slot *bss_hotplug_slot,
 static struct hotplug_slot * sn_hp_destroy(void)
 {
        struct slot *slot;
+       struct pci_slot *pci_slot;
        struct hotplug_slot *bss_hotplug_slot = NULL;
 
        list_for_each_entry(slot, &sn_hp_list, hp_list) {
                bss_hotplug_slot = slot->hotplug_slot;
+               pci_slot = bss_hotplug_slot->pci_slot;
                list_del(&((struct slot *)bss_hotplug_slot->private)->
                         hp_list);
-               sysfs_remove_file(&bss_hotplug_slot->kobj,
+               sysfs_remove_file(&pci_slot->kobj,
                                  &sn_slot_path_attr.attr);
                break;
        }
@@ -249,19 +251,19 @@ static int sn_slot_enable(struct hotplug_slot *bss_hotplug_slot,
 
 
        if (rc == PCI_SLOT_ALREADY_UP) {
-               dev_dbg(slot->pci_bus->self, "is already active\n");
+               dev_dbg(&slot->pci_bus->self->dev, "is already active\n");
                return 1; /* return 1 to user */
        }
 
        if (rc == PCI_L1_ERR) {
-               dev_dbg(slot->pci_bus->self,
+               dev_dbg(&slot->pci_bus->self->dev,
                        "L1 failure %d with message: %s",
                        resp.resp_sub_errno, resp.resp_l1_msg);
                return -EPERM;
        }
 
        if (rc) {
-               dev_dbg(slot->pci_bus->self,
+               dev_dbg(&slot->pci_bus->self->dev,
                        "insert failed with error %d sub-error %d\n",
                        rc, resp.resp_sub_errno);
                return -EIO;
@@ -287,25 +289,25 @@ static int sn_slot_disable(struct hotplug_slot *bss_hotplug_slot,
 
        if ((action == PCI_REQ_SLOT_ELIGIBLE) &&
            (rc == PCI_SLOT_ALREADY_DOWN)) {
-               dev_dbg(slot->pci_bus->self, "Slot %s already inactive\n");
+               dev_dbg(&slot->pci_bus->self->dev, "Slot %s already inactive\n", slot->physical_path);
                return 1; /* return 1 to user */
        }
 
        if ((action == PCI_REQ_SLOT_ELIGIBLE) && (rc == PCI_EMPTY_33MHZ)) {
-               dev_dbg(slot->pci_bus->self,
+               dev_dbg(&slot->pci_bus->self->dev,
                        "Cannot remove last 33MHz card\n");
                return -EPERM;
        }
 
        if ((action == PCI_REQ_SLOT_ELIGIBLE) && (rc == PCI_L1_ERR)) {
-               dev_dbg(slot->pci_bus->self,
+               dev_dbg(&slot->pci_bus->self->dev,
                        "L1 failure %d with message \n%s\n",
                        resp.resp_sub_errno, resp.resp_l1_msg);
                return -EPERM;
        }
 
        if ((action == PCI_REQ_SLOT_ELIGIBLE) && rc) {
-               dev_dbg(slot->pci_bus->self,
+               dev_dbg(&slot->pci_bus->self->dev,
                        "remove failed with error %d sub-error %d\n",
                        rc, resp.resp_sub_errno);
                return -EIO;
@@ -317,12 +319,12 @@ static int sn_slot_disable(struct hotplug_slot *bss_hotplug_slot,
        if ((action == PCI_REQ_SLOT_DISABLE) && !rc) {
                pcibus_info = SN_PCIBUS_BUSSOFT_INFO(slot->pci_bus);
                pcibus_info->pbi_enabled_devices &= ~(1 << device_num);
-               dev_dbg(slot->pci_bus->self, "remove successful\n");
+               dev_dbg(&slot->pci_bus->self->dev, "remove successful\n");
                return 0;
        }
 
        if ((action == PCI_REQ_SLOT_DISABLE) && rc) {
-               dev_dbg(slot->pci_bus->self,"remove failed rc = %d\n", rc);
+               dev_dbg(&slot->pci_bus->self->dev,"remove failed rc = %d\n", rc);
        }
 
        return rc;
@@ -367,7 +369,7 @@ static int enable_slot(struct hotplug_slot *bss_hotplug_slot)
                ret = acpi_load_table((struct acpi_table_header *)ssdt);
                if (ACPI_FAILURE(ret)) {
                        printk(KERN_ERR "%s: acpi_load_table failed (0x%x)\n",
-                              __FUNCTION__, ret);
+                              __func__, ret);
                        /* try to continue on */
                }
        }
@@ -375,7 +377,7 @@ static int enable_slot(struct hotplug_slot *bss_hotplug_slot)
        num_funcs = pci_scan_slot(slot->pci_bus,
                                  PCI_DEVFN(slot->device_num + 1, 0));
        if (!num_funcs) {
-               dev_dbg(slot->pci_bus->self, "no device in slot\n");
+               dev_dbg(&slot->pci_bus->self->dev, "no device in slot\n");
                mutex_unlock(&sn_hotplug_mutex);
                return -ENODEV;
        }
@@ -427,7 +429,7 @@ static int enable_slot(struct hotplug_slot *bss_hotplug_slot)
                phandle = PCI_CONTROLLER(slot->pci_bus)->acpi_handle;
 
                if (acpi_bus_get_device(phandle, &pdevice)) {
-                       dev_dbg(slot->pci_bus->self,
+                       dev_dbg(&slot->pci_bus->self->dev,
                                "no parent device, assuming NULL\n");
                        pdevice = NULL;
                }
@@ -459,7 +461,7 @@ static int enable_slot(struct hotplug_slot *bss_hotplug_slot)
                                if (ACPI_FAILURE(ret)) {
                                        printk(KERN_ERR "%s: acpi_bus_add "
                                               "failed (0x%x) for slot %d "
-                                              "func %d\n", __FUNCTION__,
+                                              "func %d\n", __func__,
                                               ret, (int)(adr>>16),
                                               (int)(adr&0xffff));
                                        /* try to continue on */
@@ -479,10 +481,10 @@ static int enable_slot(struct hotplug_slot *bss_hotplug_slot)
        mutex_unlock(&sn_hotplug_mutex);
 
        if (rc == 0)
-               dev_dbg(slot->pci_bus->self,
+               dev_dbg(&slot->pci_bus->self->dev,
                        "insert operation successful\n");
        else
-               dev_dbg(slot->pci_bus->self,
+               dev_dbg(&slot->pci_bus->self->dev,
                        "insert operation failed rc = %d\n", rc);
 
        return rc;
@@ -570,7 +572,7 @@ static int disable_slot(struct hotplug_slot *bss_hotplug_slot)
                if (ACPI_FAILURE(ret)) {
                        printk(KERN_ERR "%s: acpi_unload_table_id "
                               "failed (0x%x) for id %d\n",
-                              __FUNCTION__, ret, ssdt_id);
+                              __func__, ret, ssdt_id);
                        /* try to continue on */
                }
        }
@@ -614,6 +616,7 @@ static void sn_release_slot(struct hotplug_slot *bss_hotplug_slot)
 static int sn_hotplug_slot_register(struct pci_bus *pci_bus)
 {
        int device;
+       struct pci_slot *pci_slot;
        struct hotplug_slot *bss_hotplug_slot;
        int rc = 0;
 
@@ -650,25 +653,26 @@ static int sn_hotplug_slot_register(struct pci_bus *pci_bus)
                bss_hotplug_slot->ops = &sn_hotplug_slot_ops;
                bss_hotplug_slot->release = &sn_release_slot;
 
-               rc = pci_hp_register(bss_hotplug_slot);
+               rc = pci_hp_register(bss_hotplug_slot, pci_bus, device);
                if (rc)
                        goto register_err;
 
-               rc = sysfs_create_file(&bss_hotplug_slot->kobj,
+               pci_slot = bss_hotplug_slot->pci_slot;
+               rc = sysfs_create_file(&pci_slot->kobj,
                                       &sn_slot_path_attr.attr);
                if (rc)
                        goto register_err;
        }
-       dev_dbg(pci_bus->self, "Registered bus with hotplug\n");
+       dev_dbg(&pci_bus->self->dev, "Registered bus with hotplug\n");
        return rc;
 
 register_err:
-       dev_dbg(pci_bus->self, "bus failed to register with err = %d\n",
+       dev_dbg(&pci_bus->self->dev, "bus failed to register with err = %d\n",
                rc);
 
 alloc_err:
        if (rc == -ENOMEM)
-               dev_dbg(pci_bus->self, "Memory allocation error\n");
+               dev_dbg(&pci_bus->self->dev, "Memory allocation error\n");
 
        /* destroy THIS element */
        if (bss_hotplug_slot)
@@ -689,7 +693,7 @@ static int sn_pci_hotplug_init(void)
 
        if (!sn_prom_feature_available(PRF_HOTPLUG_SUPPORT)) {
                printk(KERN_ERR "%s: PROM version does not support hotplug.\n",
-                      __FUNCTION__);
+                      __func__);
                return -EPERM;
        }
 
@@ -701,10 +705,10 @@ static int sn_pci_hotplug_init(void)
 
                rc = sn_pci_bus_valid(pci_bus);
                if (rc != 1) {
-                       dev_dbg(pci_bus->self, "not a valid hotplug bus\n");
+                       dev_dbg(&pci_bus->self->dev, "not a valid hotplug bus\n");
                        continue;
                }
-               dev_dbg(pci_bus->self, "valid hotplug bus\n");
+               dev_dbg(&pci_bus->self->dev, "valid hotplug bus\n");
 
                rc = sn_hotplug_slot_register(pci_bus);
                if (!rc) {