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 #define SLOT_NAME_SIZE 10
struct slot { struct slot {
u8 device;
u8 state; u8 state;
u8 hp_slot; u8 hp_slot;
u32 number; u32 number;

View file

@ -123,16 +123,13 @@ static int init_slot(struct controller *ctrl)
slot->hotplug_slot = hotplug; slot->hotplug_slot = hotplug;
snprintf(name, SLOT_NAME_SIZE, "%u", slot->number); 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", "hp_slot=%x sun=%x slot_device_offset=%x\n",
pci_domain_nr(ctrl->pci_dev->subordinate), pci_domain_nr(ctrl->pci_dev->subordinate),
ctrl->pci_dev->subordinate->number, ctrl->pci_dev->subordinate->number,
slot->device, slot->hp_slot, slot->number, slot->hp_slot, slot->number, ctrl->slot_device_offset);
ctrl->slot_device_offset);
retval = pci_hp_register(hotplug, retval = pci_hp_register(hotplug,
ctrl->pci_dev->subordinate, ctrl->pci_dev->subordinate, 0, name);
slot->device,
name);
if (retval) { if (retval) {
ctrl_err(ctrl, ctrl_err(ctrl,
"pci_hp_register failed with error %d\n", retval); "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 controller *ctrl = p_slot->ctrl;
struct pci_bus *parent = ctrl->pci_dev->subordinate; struct pci_bus *parent = ctrl->pci_dev->subordinate;
ctrl_dbg(ctrl, "%s: slot device, slot offset, hp slot = %d, %d, %d\n", ctrl_dbg(ctrl, "%s: slot device, slot offset, hp slot = 0, %d, %d\n",
__func__, p_slot->device, ctrl->slot_device_offset, __func__, ctrl->slot_device_offset, p_slot->hp_slot);
p_slot->hp_slot);
if (POWER_CTRL(ctrl)) { if (POWER_CTRL(ctrl)) {
/* Power on slot */ /* Power on slot */
@ -241,9 +240,8 @@ static int board_added(struct slot *p_slot)
retval = pciehp_configure_device(p_slot); retval = pciehp_configure_device(p_slot);
if (retval) { if (retval) {
ctrl_err(ctrl, "Cannot add device at %04x:%02x:%02x\n", ctrl_err(ctrl, "Cannot add device at %04x:%02x:00\n",
pci_domain_nr(parent), parent->number, pci_domain_nr(parent), parent->number);
p_slot->device);
goto err_exit; goto err_exit;
} }
@ -318,10 +316,9 @@ static void pciehp_power_thread(struct work_struct *work)
case POWEROFF_STATE: case POWEROFF_STATE:
mutex_unlock(&p_slot->lock); mutex_unlock(&p_slot->lock);
ctrl_dbg(p_slot->ctrl, 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), pci_domain_nr(p_slot->ctrl->pci_dev->subordinate),
p_slot->ctrl->pci_dev->subordinate->number, p_slot->ctrl->pci_dev->subordinate->number);
p_slot->device);
pciehp_disable_slot(p_slot); pciehp_disable_slot(p_slot);
mutex_lock(&p_slot->lock); mutex_lock(&p_slot->lock);
p_slot->state = STATIC_STATE; p_slot->state = STATIC_STATE;

View file

@ -930,7 +930,6 @@ static int pcie_init_slot(struct controller *ctrl)
slot->hp_slot = 0; slot->hp_slot = 0;
slot->ctrl = ctrl; slot->ctrl = ctrl;
slot->device = ctrl->slot_device_offset + slot->hp_slot;
slot->hpc_ops = ctrl->hpc_ops; slot->hpc_ops = ctrl->hpc_ops;
slot->number = ctrl->first_slot; slot->number = ctrl->first_slot;
mutex_init(&slot->lock); mutex_init(&slot->lock);

View file

@ -67,24 +67,23 @@ int pciehp_configure_device(struct slot *p_slot)
int num, fn; int num, fn;
struct controller *ctrl = p_slot->ctrl; 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) { if (dev) {
ctrl_err(ctrl, "Device %s already exists " ctrl_err(ctrl, "Device %s already exists "
"at %04x:%02x:%02x, cannot hot-add\n", pci_name(dev), "at %04x:%02x:00, cannot hot-add\n", pci_name(dev),
pci_domain_nr(parent), parent->number, pci_domain_nr(parent), parent->number);
p_slot->device);
pci_dev_put(dev); pci_dev_put(dev);
return -EINVAL; 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) { if (num == 0) {
ctrl_err(ctrl, "No new device found\n"); ctrl_err(ctrl, "No new device found\n");
return -ENODEV; return -ENODEV;
} }
for (fn = 0; fn < 8; fn++) { 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) if (!dev)
continue; continue;
if ((dev->class >> 16) == PCI_BASE_CLASS_DISPLAY) { if ((dev->class >> 16) == PCI_BASE_CLASS_DISPLAY) {
@ -116,16 +115,14 @@ int pciehp_unconfigure_device(struct slot *p_slot)
u16 command; u16 command;
struct controller *ctrl = p_slot->ctrl; struct controller *ctrl = p_slot->ctrl;
ctrl_dbg(ctrl, "%s: domain:bus:dev = %04x:%02x:%02x\n", ctrl_dbg(ctrl, "%s: domain:bus:dev = %04x:%02x:00\n",
__func__, pci_domain_nr(parent), parent->number, __func__, pci_domain_nr(parent), parent->number);
p_slot->device);
ret = p_slot->hpc_ops->get_adapter_status(p_slot, &presence); ret = p_slot->hpc_ops->get_adapter_status(p_slot, &presence);
if (ret) if (ret)
presence = 0; presence = 0;
for (j = 0; j < 8; j++) { for (j = 0; j < 8; j++) {
struct pci_dev* temp = pci_get_slot(parent, struct pci_dev* temp = pci_get_slot(parent, PCI_DEVFN(0, j));
(p_slot->device << 3) | j);
if (!temp) if (!temp)
continue; continue;
if ((temp->class >> 16) == PCI_BASE_CLASS_DISPLAY) { if ((temp->class >> 16) == PCI_BASE_CLASS_DISPLAY) {