Commit 385e24917ed8eeba25dddd8e63bf3fe3d53eafc5

Authored by Kenji Kaneshige
Committed by Jesse Barnes
1 parent 6aaa6d06f5

PCI: pciehp: remove pci_dev field

Since we have a pointer to pcie_device in struct controller, we don't
need a pointer to pci_dev.

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>

Showing 5 changed files with 15 additions and 17 deletions Side-by-side Diff

drivers/pci/hotplug/pciehp.h
... ... @@ -89,7 +89,6 @@
89 89  
90 90 struct controller {
91 91 struct mutex ctrl_lock; /* controller lock */
92   - struct pci_dev *pci_dev;
93 92 struct pcie_device *pcie; /* PCI Express port service */
94 93 struct slot *slot;
95 94 struct hpc_ops *hpc_ops;
drivers/pci/hotplug/pciehp_core.c
... ... @@ -124,10 +124,10 @@
124 124 snprintf(name, SLOT_NAME_SIZE, "%u", slot->number);
125 125  
126 126 ctrl_dbg(ctrl, "Registering domain:bus:dev=%04x:%02x:00 sun=%x\n",
127   - pci_domain_nr(ctrl->pci_dev->subordinate),
128   - ctrl->pci_dev->subordinate->number, slot->number);
  127 + pci_domain_nr(ctrl->pcie->port->subordinate),
  128 + ctrl->pcie->port->subordinate->number, slot->number);
129 129 retval = pci_hp_register(hotplug,
130   - ctrl->pci_dev->subordinate, 0, name);
  130 + ctrl->pcie->port->subordinate, 0, name);
131 131 if (retval) {
132 132 ctrl_err(ctrl,
133 133 "pci_hp_register failed with error %d\n", retval);
drivers/pci/hotplug/pciehp_ctrl.c
... ... @@ -208,7 +208,7 @@
208 208 {
209 209 int retval = 0;
210 210 struct controller *ctrl = p_slot->ctrl;
211   - struct pci_bus *parent = ctrl->pci_dev->subordinate;
  211 + struct pci_bus *parent = ctrl->pcie->port->subordinate;
212 212  
213 213 if (POWER_CTRL(ctrl)) {
214 214 /* Power on slot */
... ... @@ -312,8 +312,8 @@
312 312 mutex_unlock(&p_slot->lock);
313 313 ctrl_dbg(p_slot->ctrl,
314 314 "Disabling domain:bus:device=%04x:%02x:00\n",
315   - pci_domain_nr(p_slot->ctrl->pci_dev->subordinate),
316   - p_slot->ctrl->pci_dev->subordinate->number);
  315 + pci_domain_nr(p_slot->ctrl->pcie->port->subordinate),
  316 + p_slot->ctrl->pcie->port->subordinate->number);
317 317 pciehp_disable_slot(p_slot);
318 318 mutex_lock(&p_slot->lock);
319 319 p_slot->state = STATIC_STATE;
drivers/pci/hotplug/pciehp_hpc.c
... ... @@ -44,25 +44,25 @@
44 44  
45 45 static inline int pciehp_readw(struct controller *ctrl, int reg, u16 *value)
46 46 {
47   - struct pci_dev *dev = ctrl->pci_dev;
  47 + struct pci_dev *dev = ctrl->pcie->port;
48 48 return pci_read_config_word(dev, ctrl->cap_base + reg, value);
49 49 }
50 50  
51 51 static inline int pciehp_readl(struct controller *ctrl, int reg, u32 *value)
52 52 {
53   - struct pci_dev *dev = ctrl->pci_dev;
  53 + struct pci_dev *dev = ctrl->pcie->port;
54 54 return pci_read_config_dword(dev, ctrl->cap_base + reg, value);
55 55 }
56 56  
57 57 static inline int pciehp_writew(struct controller *ctrl, int reg, u16 value)
58 58 {
59   - struct pci_dev *dev = ctrl->pci_dev;
  59 + struct pci_dev *dev = ctrl->pcie->port;
60 60 return pci_write_config_word(dev, ctrl->cap_base + reg, value);
61 61 }
62 62  
63 63 static inline int pciehp_writel(struct controller *ctrl, int reg, u32 value)
64 64 {
65   - struct pci_dev *dev = ctrl->pci_dev;
  65 + struct pci_dev *dev = ctrl->pcie->port;
66 66 return pci_write_config_dword(dev, ctrl->cap_base + reg, value);
67 67 }
68 68  
... ... @@ -537,7 +537,7 @@
537 537  
538 538 static inline int pcie_mask_bad_dllp(struct controller *ctrl)
539 539 {
540   - struct pci_dev *dev = ctrl->pci_dev;
  540 + struct pci_dev *dev = ctrl->pcie->port;
541 541 int pos;
542 542 u32 reg;
543 543  
... ... @@ -554,7 +554,7 @@
554 554  
555 555 static inline void pcie_unmask_bad_dllp(struct controller *ctrl)
556 556 {
557   - struct pci_dev *dev = ctrl->pci_dev;
  557 + struct pci_dev *dev = ctrl->pcie->port;
558 558 u32 reg;
559 559 int pos;
560 560  
... ... @@ -946,7 +946,7 @@
946 946 {
947 947 int i;
948 948 u16 reg16;
949   - struct pci_dev *pdev = ctrl->pci_dev;
  949 + struct pci_dev *pdev = ctrl->pcie->port;
950 950  
951 951 if (!pciehp_debug)
952 952 return;
... ... @@ -1004,7 +1004,6 @@
1004 1004 goto abort;
1005 1005 }
1006 1006 ctrl->pcie = dev;
1007   - ctrl->pci_dev = pdev;
1008 1007 ctrl->cap_base = pci_find_capability(pdev, PCI_CAP_ID_EXP);
1009 1008 if (!ctrl->cap_base) {
1010 1009 ctrl_err(ctrl, "Cannot find PCI Express capability\n");
drivers/pci/hotplug/pciehp_pci.c
... ... @@ -63,7 +63,7 @@
63 63 int pciehp_configure_device(struct slot *p_slot)
64 64 {
65 65 struct pci_dev *dev;
66   - struct pci_bus *parent = p_slot->ctrl->pci_dev->subordinate;
  66 + struct pci_bus *parent = p_slot->ctrl->pcie->port->subordinate;
67 67 int num, fn;
68 68 struct controller *ctrl = p_slot->ctrl;
69 69  
... ... @@ -111,7 +111,7 @@
111 111 int j;
112 112 u8 bctl = 0;
113 113 u8 presence = 0;
114   - struct pci_bus *parent = p_slot->ctrl->pci_dev->subordinate;
  114 + struct pci_bus *parent = p_slot->ctrl->pcie->port->subordinate;
115 115 u16 command;
116 116 struct controller *ctrl = p_slot->ctrl;
117 117