diff mbox

[5/15] pciehp: remove device field

Message ID 4AAF4FD0.6060103@jp.fujitsu.com
State Accepted, archived
Headers show

Commit Message

Kenji Kaneshige Sept. 15, 2009, 8:26 a.m. UTC
The device field in the struct slot is not necessary because it is
always 0 in pciehp driver.

Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>

---
 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(-)



--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

Index: 20090915/drivers/pci/hotplug/pciehp.h
===================================================================
--- 20090915.orig/drivers/pci/hotplug/pciehp.h
+++ 20090915/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;
Index: 20090915/drivers/pci/hotplug/pciehp_core.c
===================================================================
--- 20090915.orig/drivers/pci/hotplug/pciehp_core.c
+++ 20090915/drivers/pci/hotplug/pciehp_core.c
@@ -123,16 +123,13 @@  static int init_slot(struct controller *
 	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);
Index: 20090915/drivers/pci/hotplug/pciehp_ctrl.c
===================================================================
--- 20090915.orig/drivers/pci/hotplug/pciehp_ctrl.c
+++ 20090915/drivers/pci/hotplug/pciehp_ctrl.c
@@ -210,9 +210,8 @@  static int board_added(struct slot *p_sl
 	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_sl
 
 	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 w
 	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;
Index: 20090915/drivers/pci/hotplug/pciehp_hpc.c
===================================================================
--- 20090915.orig/drivers/pci/hotplug/pciehp_hpc.c
+++ 20090915/drivers/pci/hotplug/pciehp_hpc.c
@@ -930,7 +930,6 @@  static int pcie_init_slot(struct control
 
 	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);
Index: 20090915/drivers/pci/hotplug/pciehp_pci.c
===================================================================
--- 20090915.orig/drivers/pci/hotplug/pciehp_pci.c
+++ 20090915/drivers/pci/hotplug/pciehp_pci.c
@@ -67,24 +67,23 @@  int pciehp_configure_device(struct 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 slo
 	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) {