diff options
author | Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> | 2009-09-15 04:30:14 -0400 |
---|---|---|
committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2009-09-17 13:06:25 -0400 |
commit | 385e24917ed8eeba25dddd8e63bf3fe3d53eafc5 (patch) | |
tree | 8ab67402844702e534d9d0684fbb49db75883383 /drivers/pci/hotplug | |
parent | 6aaa6d06f57f3689afe27c1fad256c5d6aa9b271 (diff) |
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>
Diffstat (limited to 'drivers/pci/hotplug')
-rw-r--r-- | drivers/pci/hotplug/pciehp.h | 1 | ||||
-rw-r--r-- | drivers/pci/hotplug/pciehp_core.c | 6 | ||||
-rw-r--r-- | drivers/pci/hotplug/pciehp_ctrl.c | 6 | ||||
-rw-r--r-- | drivers/pci/hotplug/pciehp_hpc.c | 15 | ||||
-rw-r--r-- | drivers/pci/hotplug/pciehp_pci.c | 4 |
5 files changed, 15 insertions, 17 deletions
diff --git a/drivers/pci/hotplug/pciehp.h b/drivers/pci/hotplug/pciehp.h index 720844e0389..b23f8ca03d8 100644 --- a/drivers/pci/hotplug/pciehp.h +++ b/drivers/pci/hotplug/pciehp.h | |||
@@ -89,7 +89,6 @@ struct event_info { | |||
89 | 89 | ||
90 | struct controller { | 90 | struct controller { |
91 | struct mutex ctrl_lock; /* controller lock */ | 91 | struct mutex ctrl_lock; /* controller lock */ |
92 | struct pci_dev *pci_dev; | ||
93 | struct pcie_device *pcie; /* PCI Express port service */ | 92 | struct pcie_device *pcie; /* PCI Express port service */ |
94 | struct slot *slot; | 93 | struct slot *slot; |
95 | struct hpc_ops *hpc_ops; | 94 | struct hpc_ops *hpc_ops; |
diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c index 209dd9de9a2..f82dc036ab3 100644 --- a/drivers/pci/hotplug/pciehp_core.c +++ b/drivers/pci/hotplug/pciehp_core.c | |||
@@ -124,10 +124,10 @@ static int init_slot(struct controller *ctrl) | |||
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:00 sun=%x\n", | 126 | ctrl_dbg(ctrl, "Registering domain:bus:dev=%04x:%02x:00 sun=%x\n", |
127 | pci_domain_nr(ctrl->pci_dev->subordinate), | 127 | pci_domain_nr(ctrl->pcie->port->subordinate), |
128 | ctrl->pci_dev->subordinate->number, slot->number); | 128 | ctrl->pcie->port->subordinate->number, slot->number); |
129 | retval = pci_hp_register(hotplug, | 129 | retval = pci_hp_register(hotplug, |
130 | ctrl->pci_dev->subordinate, 0, name); | 130 | ctrl->pcie->port->subordinate, 0, name); |
131 | if (retval) { | 131 | if (retval) { |
132 | ctrl_err(ctrl, | 132 | ctrl_err(ctrl, |
133 | "pci_hp_register failed with error %d\n", retval); | 133 | "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 b3c9ae580d9..c3e5ca57af7 100644 --- a/drivers/pci/hotplug/pciehp_ctrl.c +++ b/drivers/pci/hotplug/pciehp_ctrl.c | |||
@@ -208,7 +208,7 @@ static int board_added(struct slot *p_slot) | |||
208 | { | 208 | { |
209 | int retval = 0; | 209 | int retval = 0; |
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->pcie->port->subordinate; |
212 | 212 | ||
213 | if (POWER_CTRL(ctrl)) { | 213 | if (POWER_CTRL(ctrl)) { |
214 | /* Power on slot */ | 214 | /* Power on slot */ |
@@ -312,8 +312,8 @@ static void pciehp_power_thread(struct work_struct *work) | |||
312 | mutex_unlock(&p_slot->lock); | 312 | mutex_unlock(&p_slot->lock); |
313 | ctrl_dbg(p_slot->ctrl, | 313 | ctrl_dbg(p_slot->ctrl, |
314 | "Disabling domain:bus:device=%04x:%02x:00\n", | 314 | "Disabling domain:bus:device=%04x:%02x:00\n", |
315 | pci_domain_nr(p_slot->ctrl->pci_dev->subordinate), | 315 | pci_domain_nr(p_slot->ctrl->pcie->port->subordinate), |
316 | p_slot->ctrl->pci_dev->subordinate->number); | 316 | p_slot->ctrl->pcie->port->subordinate->number); |
317 | pciehp_disable_slot(p_slot); | 317 | pciehp_disable_slot(p_slot); |
318 | mutex_lock(&p_slot->lock); | 318 | mutex_lock(&p_slot->lock); |
319 | p_slot->state = STATIC_STATE; | 319 | p_slot->state = STATIC_STATE; |
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c index b1dcf9aa80b..3867d9c47eb 100644 --- a/drivers/pci/hotplug/pciehp_hpc.c +++ b/drivers/pci/hotplug/pciehp_hpc.c | |||
@@ -44,25 +44,25 @@ static atomic_t pciehp_num_controllers = ATOMIC_INIT(0); | |||
44 | 44 | ||
45 | static inline int pciehp_readw(struct controller *ctrl, int reg, u16 *value) | 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 | return pci_read_config_word(dev, ctrl->cap_base + reg, value); | 48 | return pci_read_config_word(dev, ctrl->cap_base + reg, value); |
49 | } | 49 | } |
50 | 50 | ||
51 | static inline int pciehp_readl(struct controller *ctrl, int reg, u32 *value) | 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 | return pci_read_config_dword(dev, ctrl->cap_base + reg, value); | 54 | return pci_read_config_dword(dev, ctrl->cap_base + reg, value); |
55 | } | 55 | } |
56 | 56 | ||
57 | static inline int pciehp_writew(struct controller *ctrl, int reg, u16 value) | 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 | return pci_write_config_word(dev, ctrl->cap_base + reg, value); | 60 | return pci_write_config_word(dev, ctrl->cap_base + reg, value); |
61 | } | 61 | } |
62 | 62 | ||
63 | static inline int pciehp_writel(struct controller *ctrl, int reg, u32 value) | 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 | return pci_write_config_dword(dev, ctrl->cap_base + reg, value); | 66 | return pci_write_config_dword(dev, ctrl->cap_base + reg, value); |
67 | } | 67 | } |
68 | 68 | ||
@@ -537,7 +537,7 @@ static int hpc_power_on_slot(struct slot * slot) | |||
537 | 537 | ||
538 | static inline int pcie_mask_bad_dllp(struct controller *ctrl) | 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 | int pos; | 541 | int pos; |
542 | u32 reg; | 542 | u32 reg; |
543 | 543 | ||
@@ -554,7 +554,7 @@ static inline int pcie_mask_bad_dllp(struct controller *ctrl) | |||
554 | 554 | ||
555 | static inline void pcie_unmask_bad_dllp(struct controller *ctrl) | 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 | u32 reg; | 558 | u32 reg; |
559 | int pos; | 559 | int pos; |
560 | 560 | ||
@@ -946,7 +946,7 @@ static inline void dbg_ctrl(struct controller *ctrl) | |||
946 | { | 946 | { |
947 | int i; | 947 | int i; |
948 | u16 reg16; | 948 | u16 reg16; |
949 | struct pci_dev *pdev = ctrl->pci_dev; | 949 | struct pci_dev *pdev = ctrl->pcie->port; |
950 | 950 | ||
951 | if (!pciehp_debug) | 951 | if (!pciehp_debug) |
952 | return; | 952 | return; |
@@ -1004,7 +1004,6 @@ struct controller *pcie_init(struct pcie_device *dev) | |||
1004 | goto abort; | 1004 | goto abort; |
1005 | } | 1005 | } |
1006 | ctrl->pcie = dev; | 1006 | ctrl->pcie = dev; |
1007 | ctrl->pci_dev = pdev; | ||
1008 | ctrl->cap_base = pci_find_capability(pdev, PCI_CAP_ID_EXP); | 1007 | ctrl->cap_base = pci_find_capability(pdev, PCI_CAP_ID_EXP); |
1009 | if (!ctrl->cap_base) { | 1008 | if (!ctrl->cap_base) { |
1010 | ctrl_err(ctrl, "Cannot find PCI Express capability\n"); | 1009 | ctrl_err(ctrl, "Cannot find PCI Express capability\n"); |
diff --git a/drivers/pci/hotplug/pciehp_pci.c b/drivers/pci/hotplug/pciehp_pci.c index 0efffd45ccb..002a72d9ad7 100644 --- a/drivers/pci/hotplug/pciehp_pci.c +++ b/drivers/pci/hotplug/pciehp_pci.c | |||
@@ -63,7 +63,7 @@ static int __ref pciehp_add_bridge(struct pci_dev *dev) | |||
63 | int pciehp_configure_device(struct slot *p_slot) | 63 | int pciehp_configure_device(struct slot *p_slot) |
64 | { | 64 | { |
65 | struct pci_dev *dev; | 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 | int num, fn; | 67 | int num, fn; |
68 | struct controller *ctrl = p_slot->ctrl; | 68 | struct controller *ctrl = p_slot->ctrl; |
69 | 69 | ||
@@ -111,7 +111,7 @@ int pciehp_unconfigure_device(struct slot *p_slot) | |||
111 | int j; | 111 | int j; |
112 | u8 bctl = 0; | 112 | u8 bctl = 0; |
113 | u8 presence = 0; | 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 | u16 command; | 115 | u16 command; |
116 | struct controller *ctrl = p_slot->ctrl; | 116 | struct controller *ctrl = p_slot->ctrl; |
117 | 117 | ||