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 <achiang@hp.com>
Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
This commit is contained in:
Kenji Kaneshige 2009-09-15 17:26:56 +09:00 committed by Jesse Barnes
parent ab9c6c8670
commit d689f7eb36
5 changed files with 17 additions and 28 deletions

View file

@ -72,7 +72,6 @@ do { \
#define SLOT_NAME_SIZE 10
struct slot {
u8 device;
u8 state;
u8 hp_slot;
u32 number;

View file

@ -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);

View file

@ -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;

View file

@ -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);

View file

@ -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) {