From d689f7eb364a51ccd857605dede0d6c22a1aad91 Mon Sep 17 00:00:00 2001 From: Kenji Kaneshige Date: Tue, 15 Sep 2009 17:26:56 +0900 Subject: PCI: pciehp: remove device field The device field in the struct slot is not necessary because it is always 0 in pciehp driver. Acked-by: Alex Chiang Signed-off-by: Kenji Kaneshige Signed-off-by: Jesse Barnes --- drivers/pci/hotplug/pciehp.h | 1 - drivers/pci/hotplug/pciehp_core.c | 9 +++------ drivers/pci/hotplug/pciehp_ctrl.c | 15 ++++++--------- drivers/pci/hotplug/pciehp_hpc.c | 1 - drivers/pci/hotplug/pciehp_pci.c | 19 ++++++++----------- 5 files changed, 17 insertions(+), 28 deletions(-) (limited to 'drivers/pci') diff --git a/drivers/pci/hotplug/pciehp.h b/drivers/pci/hotplug/pciehp.h index 44df330c1488..d69a96cd9681 100644 --- a/drivers/pci/hotplug/pciehp.h +++ b/drivers/pci/hotplug/pciehp.h @@ -72,7 +72,6 @@ do { \ #define SLOT_NAME_SIZE 10 struct slot { - u8 device; u8 state; u8 hp_slot; u32 number; diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c index 3164d0e7903b..cc3a852e38bd 100644 --- a/drivers/pci/hotplug/pciehp_core.c +++ b/drivers/pci/hotplug/pciehp_core.c @@ -123,16 +123,13 @@ static int init_slot(struct controller *ctrl) slot->hotplug_slot = hotplug; snprintf(name, SLOT_NAME_SIZE, "%u", slot->number); - ctrl_dbg(ctrl, "Registering domain:bus:dev=%04x:%02x:%02x " + ctrl_dbg(ctrl, "Registering domain:bus:dev=%04x:%02x:00 " "hp_slot=%x sun=%x slot_device_offset=%x\n", pci_domain_nr(ctrl->pci_dev->subordinate), ctrl->pci_dev->subordinate->number, - slot->device, slot->hp_slot, slot->number, - ctrl->slot_device_offset); + slot->hp_slot, slot->number, ctrl->slot_device_offset); retval = pci_hp_register(hotplug, - ctrl->pci_dev->subordinate, - slot->device, - name); + ctrl->pci_dev->subordinate, 0, name); if (retval) { ctrl_err(ctrl, "pci_hp_register failed with error %d\n", retval); diff --git a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c index a68069c9ba8d..7e31728d8ca4 100644 --- a/drivers/pci/hotplug/pciehp_ctrl.c +++ b/drivers/pci/hotplug/pciehp_ctrl.c @@ -210,9 +210,8 @@ static int board_added(struct slot *p_slot) struct controller *ctrl = p_slot->ctrl; struct pci_bus *parent = ctrl->pci_dev->subordinate; - ctrl_dbg(ctrl, "%s: slot device, slot offset, hp slot = %d, %d, %d\n", - __func__, p_slot->device, ctrl->slot_device_offset, - p_slot->hp_slot); + ctrl_dbg(ctrl, "%s: slot device, slot offset, hp slot = 0, %d, %d\n", + __func__, ctrl->slot_device_offset, p_slot->hp_slot); if (POWER_CTRL(ctrl)) { /* Power on slot */ @@ -241,9 +240,8 @@ static int board_added(struct slot *p_slot) retval = pciehp_configure_device(p_slot); if (retval) { - ctrl_err(ctrl, "Cannot add device at %04x:%02x:%02x\n", - pci_domain_nr(parent), parent->number, - p_slot->device); + ctrl_err(ctrl, "Cannot add device at %04x:%02x:00\n", + pci_domain_nr(parent), parent->number); goto err_exit; } @@ -318,10 +316,9 @@ static void pciehp_power_thread(struct work_struct *work) case POWEROFF_STATE: mutex_unlock(&p_slot->lock); ctrl_dbg(p_slot->ctrl, - "Disabling domain:bus:device=%04x:%02x:%02x\n", + "Disabling domain:bus:device=%04x:%02x:00\n", pci_domain_nr(p_slot->ctrl->pci_dev->subordinate), - p_slot->ctrl->pci_dev->subordinate->number, - p_slot->device); + p_slot->ctrl->pci_dev->subordinate->number); pciehp_disable_slot(p_slot); mutex_lock(&p_slot->lock); p_slot->state = STATIC_STATE; diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c index aec1d663f623..bbbed34bce78 100644 --- a/drivers/pci/hotplug/pciehp_hpc.c +++ b/drivers/pci/hotplug/pciehp_hpc.c @@ -930,7 +930,6 @@ static int pcie_init_slot(struct controller *ctrl) slot->hp_slot = 0; slot->ctrl = ctrl; - slot->device = ctrl->slot_device_offset + slot->hp_slot; slot->hpc_ops = ctrl->hpc_ops; slot->number = ctrl->first_slot; mutex_init(&slot->lock); diff --git a/drivers/pci/hotplug/pciehp_pci.c b/drivers/pci/hotplug/pciehp_pci.c index 2e5f6b816da6..0efffd45ccbf 100644 --- a/drivers/pci/hotplug/pciehp_pci.c +++ b/drivers/pci/hotplug/pciehp_pci.c @@ -67,24 +67,23 @@ int pciehp_configure_device(struct slot *p_slot) int num, fn; struct controller *ctrl = p_slot->ctrl; - dev = pci_get_slot(parent, PCI_DEVFN(p_slot->device, 0)); + dev = pci_get_slot(parent, PCI_DEVFN(0, 0)); if (dev) { ctrl_err(ctrl, "Device %s already exists " - "at %04x:%02x:%02x, cannot hot-add\n", pci_name(dev), - pci_domain_nr(parent), parent->number, - p_slot->device); + "at %04x:%02x:00, cannot hot-add\n", pci_name(dev), + pci_domain_nr(parent), parent->number); pci_dev_put(dev); return -EINVAL; } - num = pci_scan_slot(parent, PCI_DEVFN(p_slot->device, 0)); + num = pci_scan_slot(parent, PCI_DEVFN(0, 0)); if (num == 0) { ctrl_err(ctrl, "No new device found\n"); return -ENODEV; } for (fn = 0; fn < 8; fn++) { - dev = pci_get_slot(parent, PCI_DEVFN(p_slot->device, fn)); + dev = pci_get_slot(parent, PCI_DEVFN(0, fn)); if (!dev) continue; if ((dev->class >> 16) == PCI_BASE_CLASS_DISPLAY) { @@ -116,16 +115,14 @@ int pciehp_unconfigure_device(struct slot *p_slot) u16 command; struct controller *ctrl = p_slot->ctrl; - ctrl_dbg(ctrl, "%s: domain:bus:dev = %04x:%02x:%02x\n", - __func__, pci_domain_nr(parent), parent->number, - p_slot->device); + ctrl_dbg(ctrl, "%s: domain:bus:dev = %04x:%02x:00\n", + __func__, pci_domain_nr(parent), parent->number); ret = p_slot->hpc_ops->get_adapter_status(p_slot, &presence); if (ret) presence = 0; for (j = 0; j < 8; j++) { - struct pci_dev* temp = pci_get_slot(parent, - (p_slot->device << 3) | j); + struct pci_dev* temp = pci_get_slot(parent, PCI_DEVFN(0, j)); if (!temp) continue; if ((temp->class >> 16) == PCI_BASE_CLASS_DISPLAY) { -- cgit v1.2.3