aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
authorKenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>2009-09-15 04:26:56 -0400
committerJesse Barnes <jbarnes@virtuousgeek.org>2009-09-17 13:05:51 -0400
commitd689f7eb364a51ccd857605dede0d6c22a1aad91 (patch)
tree34efda76db5ec3e0c57034deb254014c55b93068 /drivers/pci
parentab9c6c86701b498445334db746aa2e8dc473c7b6 (diff)
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>
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/hotplug/pciehp.h1
-rw-r--r--drivers/pci/hotplug/pciehp_core.c9
-rw-r--r--drivers/pci/hotplug/pciehp_ctrl.c15
-rw-r--r--drivers/pci/hotplug/pciehp_hpc.c1
-rw-r--r--drivers/pci/hotplug/pciehp_pci.c19
5 files changed, 17 insertions, 28 deletions
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 { \
72 72
73#define SLOT_NAME_SIZE 10 73#define SLOT_NAME_SIZE 10
74struct slot { 74struct slot {
75 u8 device;
76 u8 state; 75 u8 state;
77 u8 hp_slot; 76 u8 hp_slot;
78 u32 number; 77 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)
123 slot->hotplug_slot = hotplug; 123 slot->hotplug_slot = hotplug;
124 snprintf(name, SLOT_NAME_SIZE, "%u", slot->number); 124 snprintf(name, SLOT_NAME_SIZE, "%u", slot->number);
125 125
126 ctrl_dbg(ctrl, "Registering domain:bus:dev=%04x:%02x:%02x " 126 ctrl_dbg(ctrl, "Registering domain:bus:dev=%04x:%02x:00 "
127 "hp_slot=%x sun=%x slot_device_offset=%x\n", 127 "hp_slot=%x sun=%x slot_device_offset=%x\n",
128 pci_domain_nr(ctrl->pci_dev->subordinate), 128 pci_domain_nr(ctrl->pci_dev->subordinate),
129 ctrl->pci_dev->subordinate->number, 129 ctrl->pci_dev->subordinate->number,
130 slot->device, slot->hp_slot, slot->number, 130 slot->hp_slot, slot->number, ctrl->slot_device_offset);
131 ctrl->slot_device_offset);
132 retval = pci_hp_register(hotplug, 131 retval = pci_hp_register(hotplug,
133 ctrl->pci_dev->subordinate, 132 ctrl->pci_dev->subordinate, 0, name);
134 slot->device,
135 name);
136 if (retval) { 133 if (retval) {
137 ctrl_err(ctrl, 134 ctrl_err(ctrl,
138 "pci_hp_register failed with error %d\n", retval); 135 "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)
210 struct controller *ctrl = p_slot->ctrl; 210 struct controller *ctrl = p_slot->ctrl;
211 struct pci_bus *parent = ctrl->pci_dev->subordinate; 211 struct pci_bus *parent = ctrl->pci_dev->subordinate;
212 212
213 ctrl_dbg(ctrl, "%s: slot device, slot offset, hp slot = %d, %d, %d\n", 213 ctrl_dbg(ctrl, "%s: slot device, slot offset, hp slot = 0, %d, %d\n",
214 __func__, p_slot->device, ctrl->slot_device_offset, 214 __func__, ctrl->slot_device_offset, p_slot->hp_slot);
215 p_slot->hp_slot);
216 215
217 if (POWER_CTRL(ctrl)) { 216 if (POWER_CTRL(ctrl)) {
218 /* Power on slot */ 217 /* Power on slot */
@@ -241,9 +240,8 @@ static int board_added(struct slot *p_slot)
241 240
242 retval = pciehp_configure_device(p_slot); 241 retval = pciehp_configure_device(p_slot);
243 if (retval) { 242 if (retval) {
244 ctrl_err(ctrl, "Cannot add device at %04x:%02x:%02x\n", 243 ctrl_err(ctrl, "Cannot add device at %04x:%02x:00\n",
245 pci_domain_nr(parent), parent->number, 244 pci_domain_nr(parent), parent->number);
246 p_slot->device);
247 goto err_exit; 245 goto err_exit;
248 } 246 }
249 247
@@ -318,10 +316,9 @@ static void pciehp_power_thread(struct work_struct *work)
318 case POWEROFF_STATE: 316 case POWEROFF_STATE:
319 mutex_unlock(&p_slot->lock); 317 mutex_unlock(&p_slot->lock);
320 ctrl_dbg(p_slot->ctrl, 318 ctrl_dbg(p_slot->ctrl,
321 "Disabling domain:bus:device=%04x:%02x:%02x\n", 319 "Disabling domain:bus:device=%04x:%02x:00\n",
322 pci_domain_nr(p_slot->ctrl->pci_dev->subordinate), 320 pci_domain_nr(p_slot->ctrl->pci_dev->subordinate),
323 p_slot->ctrl->pci_dev->subordinate->number, 321 p_slot->ctrl->pci_dev->subordinate->number);
324 p_slot->device);
325 pciehp_disable_slot(p_slot); 322 pciehp_disable_slot(p_slot);
326 mutex_lock(&p_slot->lock); 323 mutex_lock(&p_slot->lock);
327 p_slot->state = STATIC_STATE; 324 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)
930 930
931 slot->hp_slot = 0; 931 slot->hp_slot = 0;
932 slot->ctrl = ctrl; 932 slot->ctrl = ctrl;
933 slot->device = ctrl->slot_device_offset + slot->hp_slot;
934 slot->hpc_ops = ctrl->hpc_ops; 933 slot->hpc_ops = ctrl->hpc_ops;
935 slot->number = ctrl->first_slot; 934 slot->number = ctrl->first_slot;
936 mutex_init(&slot->lock); 935 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)
67 int num, fn; 67 int num, fn;
68 struct controller *ctrl = p_slot->ctrl; 68 struct controller *ctrl = p_slot->ctrl;
69 69
70 dev = pci_get_slot(parent, PCI_DEVFN(p_slot->device, 0)); 70 dev = pci_get_slot(parent, PCI_DEVFN(0, 0));
71 if (dev) { 71 if (dev) {
72 ctrl_err(ctrl, "Device %s already exists " 72 ctrl_err(ctrl, "Device %s already exists "
73 "at %04x:%02x:%02x, cannot hot-add\n", pci_name(dev), 73 "at %04x:%02x:00, cannot hot-add\n", pci_name(dev),
74 pci_domain_nr(parent), parent->number, 74 pci_domain_nr(parent), parent->number);
75 p_slot->device);
76 pci_dev_put(dev); 75 pci_dev_put(dev);
77 return -EINVAL; 76 return -EINVAL;
78 } 77 }
79 78
80 num = pci_scan_slot(parent, PCI_DEVFN(p_slot->device, 0)); 79 num = pci_scan_slot(parent, PCI_DEVFN(0, 0));
81 if (num == 0) { 80 if (num == 0) {
82 ctrl_err(ctrl, "No new device found\n"); 81 ctrl_err(ctrl, "No new device found\n");
83 return -ENODEV; 82 return -ENODEV;
84 } 83 }
85 84
86 for (fn = 0; fn < 8; fn++) { 85 for (fn = 0; fn < 8; fn++) {
87 dev = pci_get_slot(parent, PCI_DEVFN(p_slot->device, fn)); 86 dev = pci_get_slot(parent, PCI_DEVFN(0, fn));
88 if (!dev) 87 if (!dev)
89 continue; 88 continue;
90 if ((dev->class >> 16) == PCI_BASE_CLASS_DISPLAY) { 89 if ((dev->class >> 16) == PCI_BASE_CLASS_DISPLAY) {
@@ -116,16 +115,14 @@ int pciehp_unconfigure_device(struct slot *p_slot)
116 u16 command; 115 u16 command;
117 struct controller *ctrl = p_slot->ctrl; 116 struct controller *ctrl = p_slot->ctrl;
118 117
119 ctrl_dbg(ctrl, "%s: domain:bus:dev = %04x:%02x:%02x\n", 118 ctrl_dbg(ctrl, "%s: domain:bus:dev = %04x:%02x:00\n",
120 __func__, pci_domain_nr(parent), parent->number, 119 __func__, pci_domain_nr(parent), parent->number);
121 p_slot->device);
122 ret = p_slot->hpc_ops->get_adapter_status(p_slot, &presence); 120 ret = p_slot->hpc_ops->get_adapter_status(p_slot, &presence);
123 if (ret) 121 if (ret)
124 presence = 0; 122 presence = 0;
125 123
126 for (j = 0; j < 8; j++) { 124 for (j = 0; j < 8; j++) {
127 struct pci_dev* temp = pci_get_slot(parent, 125 struct pci_dev* temp = pci_get_slot(parent, PCI_DEVFN(0, j));
128 (p_slot->device << 3) | j);
129 if (!temp) 126 if (!temp)
130 continue; 127 continue;
131 if ((temp->class >> 16) == PCI_BASE_CLASS_DISPLAY) { 128 if ((temp->class >> 16) == PCI_BASE_CLASS_DISPLAY) {