Skip to content

Commit 385e249

Browse files
kkaneshigejbarnes993
authored andcommitted
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>
1 parent 6aaa6d0 commit 385e249

5 files changed

Lines changed: 15 additions & 17 deletions

File tree

‎drivers/pci/hotplug/pciehp.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ struct event_info {
8989

9090
struct controller {
9191
struct mutex ctrl_lock; /* controller lock */
92-
struct pci_dev *pci_dev;
9392
struct pcie_device *pcie; /* PCI Express port service */
9493
struct slot *slot;
9594
struct hpc_ops *hpc_ops;

‎drivers/pci/hotplug/pciehp_core.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,10 @@ static int init_slot(struct controller *ctrl)
124124
snprintf(name, SLOT_NAME_SIZE, "%u", slot->number);
125125

126126
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);
129129
retval = pci_hp_register(hotplug,
130-
ctrl->pci_dev->subordinate, 0, name);
130+
ctrl->pcie->port->subordinate, 0, name);
131131
if (retval) {
132132
ctrl_err(ctrl,
133133
"pci_hp_register failed with error %d\n", retval);

‎drivers/pci/hotplug/pciehp_ctrl.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ static int board_added(struct slot *p_slot)
208208
{
209209
int retval = 0;
210210
struct controller *ctrl = p_slot->ctrl;
211-
struct pci_bus *parent = ctrl->pci_dev->subordinate;
211+
struct pci_bus *parent = ctrl->pcie->port->subordinate;
212212

213213
if (POWER_CTRL(ctrl)) {
214214
/* Power on slot */
@@ -312,8 +312,8 @@ static void pciehp_power_thread(struct work_struct *work)
312312
mutex_unlock(&p_slot->lock);
313313
ctrl_dbg(p_slot->ctrl,
314314
"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);
317317
pciehp_disable_slot(p_slot);
318318
mutex_lock(&p_slot->lock);
319319
p_slot->state = STATIC_STATE;

‎drivers/pci/hotplug/pciehp_hpc.c‎

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,25 +44,25 @@ static atomic_t pciehp_num_controllers = ATOMIC_INIT(0);
4444

4545
static inline int pciehp_readw(struct controller *ctrl, int reg, u16 *value)
4646
{
47-
struct pci_dev *dev = ctrl->pci_dev;
47+
struct pci_dev *dev = ctrl->pcie->port;
4848
return pci_read_config_word(dev, ctrl->cap_base + reg, value);
4949
}
5050

5151
static inline int pciehp_readl(struct controller *ctrl, int reg, u32 *value)
5252
{
53-
struct pci_dev *dev = ctrl->pci_dev;
53+
struct pci_dev *dev = ctrl->pcie->port;
5454
return pci_read_config_dword(dev, ctrl->cap_base + reg, value);
5555
}
5656

5757
static inline int pciehp_writew(struct controller *ctrl, int reg, u16 value)
5858
{
59-
struct pci_dev *dev = ctrl->pci_dev;
59+
struct pci_dev *dev = ctrl->pcie->port;
6060
return pci_write_config_word(dev, ctrl->cap_base + reg, value);
6161
}
6262

6363
static inline int pciehp_writel(struct controller *ctrl, int reg, u32 value)
6464
{
65-
struct pci_dev *dev = ctrl->pci_dev;
65+
struct pci_dev *dev = ctrl->pcie->port;
6666
return pci_write_config_dword(dev, ctrl->cap_base + reg, value);
6767
}
6868

@@ -537,7 +537,7 @@ static int hpc_power_on_slot(struct slot * slot)
537537

538538
static inline int pcie_mask_bad_dllp(struct controller *ctrl)
539539
{
540-
struct pci_dev *dev = ctrl->pci_dev;
540+
struct pci_dev *dev = ctrl->pcie->port;
541541
int pos;
542542
u32 reg;
543543

@@ -554,7 +554,7 @@ static inline int pcie_mask_bad_dllp(struct controller *ctrl)
554554

555555
static inline void pcie_unmask_bad_dllp(struct controller *ctrl)
556556
{
557-
struct pci_dev *dev = ctrl->pci_dev;
557+
struct pci_dev *dev = ctrl->pcie->port;
558558
u32 reg;
559559
int pos;
560560

@@ -946,7 +946,7 @@ static inline void dbg_ctrl(struct controller *ctrl)
946946
{
947947
int i;
948948
u16 reg16;
949-
struct pci_dev *pdev = ctrl->pci_dev;
949+
struct pci_dev *pdev = ctrl->pcie->port;
950950

951951
if (!pciehp_debug)
952952
return;
@@ -1004,7 +1004,6 @@ struct controller *pcie_init(struct pcie_device *dev)
10041004
goto abort;
10051005
}
10061006
ctrl->pcie = dev;
1007-
ctrl->pci_dev = pdev;
10081007
ctrl->cap_base = pci_find_capability(pdev, PCI_CAP_ID_EXP);
10091008
if (!ctrl->cap_base) {
10101009
ctrl_err(ctrl, "Cannot find PCI Express capability\n");

‎drivers/pci/hotplug/pciehp_pci.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ static int __ref pciehp_add_bridge(struct pci_dev *dev)
6363
int pciehp_configure_device(struct slot *p_slot)
6464
{
6565
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;
6767
int num, fn;
6868
struct controller *ctrl = p_slot->ctrl;
6969

@@ -111,7 +111,7 @@ int pciehp_unconfigure_device(struct slot *p_slot)
111111
int j;
112112
u8 bctl = 0;
113113
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;
115115
u16 command;
116116
struct controller *ctrl = p_slot->ctrl;
117117

0 commit comments

Comments
 (0)