Commit 385e2491 authored by Kenji Kaneshige's avatar Kenji Kaneshige Committed by Jesse Barnes

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: default avatarAlex Chiang <achiang@hp.com>
Signed-off-by: default avatarKenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
parent 6aaa6d06
...@@ -89,7 +89,6 @@ struct event_info { ...@@ -89,7 +89,6 @@ struct event_info {
struct controller { struct controller {
struct mutex ctrl_lock; /* controller lock */ struct mutex ctrl_lock; /* controller lock */
struct pci_dev *pci_dev;
struct pcie_device *pcie; /* PCI Express port service */ struct pcie_device *pcie; /* PCI Express port service */
struct slot *slot; struct slot *slot;
struct hpc_ops *hpc_ops; struct hpc_ops *hpc_ops;
......
...@@ -124,10 +124,10 @@ static int init_slot(struct controller *ctrl) ...@@ -124,10 +124,10 @@ static int init_slot(struct controller *ctrl)
snprintf(name, SLOT_NAME_SIZE, "%u", slot->number); snprintf(name, SLOT_NAME_SIZE, "%u", slot->number);
ctrl_dbg(ctrl, "Registering domain:bus:dev=%04x:%02x:00 sun=%x\n", ctrl_dbg(ctrl, "Registering domain:bus:dev=%04x:%02x:00 sun=%x\n",
pci_domain_nr(ctrl->pci_dev->subordinate), pci_domain_nr(ctrl->pcie->port->subordinate),
ctrl->pci_dev->subordinate->number, slot->number); ctrl->pcie->port->subordinate->number, slot->number);
retval = pci_hp_register(hotplug, retval = pci_hp_register(hotplug,
ctrl->pci_dev->subordinate, 0, name); ctrl->pcie->port->subordinate, 0, name);
if (retval) { if (retval) {
ctrl_err(ctrl, ctrl_err(ctrl,
"pci_hp_register failed with error %d\n", retval); "pci_hp_register failed with error %d\n", retval);
......
...@@ -208,7 +208,7 @@ static int board_added(struct slot *p_slot) ...@@ -208,7 +208,7 @@ static int board_added(struct slot *p_slot)
{ {
int retval = 0; int retval = 0;
struct controller *ctrl = p_slot->ctrl; struct controller *ctrl = p_slot->ctrl;
struct pci_bus *parent = ctrl->pci_dev->subordinate; struct pci_bus *parent = ctrl->pcie->port->subordinate;
if (POWER_CTRL(ctrl)) { if (POWER_CTRL(ctrl)) {
/* Power on slot */ /* Power on slot */
...@@ -312,8 +312,8 @@ static void pciehp_power_thread(struct work_struct *work) ...@@ -312,8 +312,8 @@ static void pciehp_power_thread(struct work_struct *work)
mutex_unlock(&p_slot->lock); mutex_unlock(&p_slot->lock);
ctrl_dbg(p_slot->ctrl, ctrl_dbg(p_slot->ctrl,
"Disabling domain:bus:device=%04x:%02x:00\n", "Disabling domain:bus:device=%04x:%02x:00\n",
pci_domain_nr(p_slot->ctrl->pci_dev->subordinate), pci_domain_nr(p_slot->ctrl->pcie->port->subordinate),
p_slot->ctrl->pci_dev->subordinate->number); p_slot->ctrl->pcie->port->subordinate->number);
pciehp_disable_slot(p_slot); pciehp_disable_slot(p_slot);
mutex_lock(&p_slot->lock); mutex_lock(&p_slot->lock);
p_slot->state = STATIC_STATE; p_slot->state = STATIC_STATE;
......
...@@ -44,25 +44,25 @@ static atomic_t pciehp_num_controllers = ATOMIC_INIT(0); ...@@ -44,25 +44,25 @@ static atomic_t pciehp_num_controllers = ATOMIC_INIT(0);
static inline int pciehp_readw(struct controller *ctrl, int reg, u16 *value) static inline int pciehp_readw(struct controller *ctrl, int reg, u16 *value)
{ {
struct pci_dev *dev = ctrl->pci_dev; struct pci_dev *dev = ctrl->pcie->port;
return pci_read_config_word(dev, ctrl->cap_base + reg, value); return pci_read_config_word(dev, ctrl->cap_base + reg, value);
} }
static inline int pciehp_readl(struct controller *ctrl, int reg, u32 *value) static inline int pciehp_readl(struct controller *ctrl, int reg, u32 *value)
{ {
struct pci_dev *dev = ctrl->pci_dev; struct pci_dev *dev = ctrl->pcie->port;
return pci_read_config_dword(dev, ctrl->cap_base + reg, value); return pci_read_config_dword(dev, ctrl->cap_base + reg, value);
} }
static inline int pciehp_writew(struct controller *ctrl, int reg, u16 value) static inline int pciehp_writew(struct controller *ctrl, int reg, u16 value)
{ {
struct pci_dev *dev = ctrl->pci_dev; struct pci_dev *dev = ctrl->pcie->port;
return pci_write_config_word(dev, ctrl->cap_base + reg, value); return pci_write_config_word(dev, ctrl->cap_base + reg, value);
} }
static inline int pciehp_writel(struct controller *ctrl, int reg, u32 value) static inline int pciehp_writel(struct controller *ctrl, int reg, u32 value)
{ {
struct pci_dev *dev = ctrl->pci_dev; struct pci_dev *dev = ctrl->pcie->port;
return pci_write_config_dword(dev, ctrl->cap_base + reg, value); return pci_write_config_dword(dev, ctrl->cap_base + reg, value);
} }
...@@ -537,7 +537,7 @@ static int hpc_power_on_slot(struct slot * slot) ...@@ -537,7 +537,7 @@ static int hpc_power_on_slot(struct slot * slot)
static inline int pcie_mask_bad_dllp(struct controller *ctrl) static inline int pcie_mask_bad_dllp(struct controller *ctrl)
{ {
struct pci_dev *dev = ctrl->pci_dev; struct pci_dev *dev = ctrl->pcie->port;
int pos; int pos;
u32 reg; u32 reg;
...@@ -554,7 +554,7 @@ static inline int pcie_mask_bad_dllp(struct controller *ctrl) ...@@ -554,7 +554,7 @@ static inline int pcie_mask_bad_dllp(struct controller *ctrl)
static inline void pcie_unmask_bad_dllp(struct controller *ctrl) static inline void pcie_unmask_bad_dllp(struct controller *ctrl)
{ {
struct pci_dev *dev = ctrl->pci_dev; struct pci_dev *dev = ctrl->pcie->port;
u32 reg; u32 reg;
int pos; int pos;
...@@ -946,7 +946,7 @@ static inline void dbg_ctrl(struct controller *ctrl) ...@@ -946,7 +946,7 @@ static inline void dbg_ctrl(struct controller *ctrl)
{ {
int i; int i;
u16 reg16; u16 reg16;
struct pci_dev *pdev = ctrl->pci_dev; struct pci_dev *pdev = ctrl->pcie->port;
if (!pciehp_debug) if (!pciehp_debug)
return; return;
...@@ -1004,7 +1004,6 @@ struct controller *pcie_init(struct pcie_device *dev) ...@@ -1004,7 +1004,6 @@ struct controller *pcie_init(struct pcie_device *dev)
goto abort; goto abort;
} }
ctrl->pcie = dev; ctrl->pcie = dev;
ctrl->pci_dev = pdev;
ctrl->cap_base = pci_find_capability(pdev, PCI_CAP_ID_EXP); ctrl->cap_base = pci_find_capability(pdev, PCI_CAP_ID_EXP);
if (!ctrl->cap_base) { if (!ctrl->cap_base) {
ctrl_err(ctrl, "Cannot find PCI Express capability\n"); ctrl_err(ctrl, "Cannot find PCI Express capability\n");
......
...@@ -63,7 +63,7 @@ static int __ref pciehp_add_bridge(struct pci_dev *dev) ...@@ -63,7 +63,7 @@ static int __ref pciehp_add_bridge(struct pci_dev *dev)
int pciehp_configure_device(struct slot *p_slot) int pciehp_configure_device(struct slot *p_slot)
{ {
struct pci_dev *dev; struct pci_dev *dev;
struct pci_bus *parent = p_slot->ctrl->pci_dev->subordinate; struct pci_bus *parent = p_slot->ctrl->pcie->port->subordinate;
int num, fn; int num, fn;
struct controller *ctrl = p_slot->ctrl; struct controller *ctrl = p_slot->ctrl;
...@@ -111,7 +111,7 @@ int pciehp_unconfigure_device(struct slot *p_slot) ...@@ -111,7 +111,7 @@ int pciehp_unconfigure_device(struct slot *p_slot)
int j; int j;
u8 bctl = 0; u8 bctl = 0;
u8 presence = 0; u8 presence = 0;
struct pci_bus *parent = p_slot->ctrl->pci_dev->subordinate; struct pci_bus *parent = p_slot->ctrl->pcie->port->subordinate;
u16 command; u16 command;
struct controller *ctrl = p_slot->ctrl; struct controller *ctrl = p_slot->ctrl;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment