mirror of https://gitee.com/openkylin/linux.git
PCI/AER: Replace struct pcie_device with pci_dev
The AER driver only needed the pcie_device to get to the port pci_dev. Save the pci_dev pointer directly in struct aer_rpc and remove the unnecessary indirection. Signed-off-by: Keith Busch <keith.busch@intel.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
This commit is contained in:
parent
8f6fb67775
commit
e13d17f732
|
@ -94,7 +94,7 @@ static void set_downstream_devices_error_reporting(struct pci_dev *dev,
|
||||||
*/
|
*/
|
||||||
static void aer_enable_rootport(struct aer_rpc *rpc)
|
static void aer_enable_rootport(struct aer_rpc *rpc)
|
||||||
{
|
{
|
||||||
struct pci_dev *pdev = rpc->rpd->port;
|
struct pci_dev *pdev = rpc->rpd;
|
||||||
int aer_pos;
|
int aer_pos;
|
||||||
u16 reg16;
|
u16 reg16;
|
||||||
u32 reg32;
|
u32 reg32;
|
||||||
|
@ -136,7 +136,7 @@ static void aer_enable_rootport(struct aer_rpc *rpc)
|
||||||
*/
|
*/
|
||||||
static void aer_disable_rootport(struct aer_rpc *rpc)
|
static void aer_disable_rootport(struct aer_rpc *rpc)
|
||||||
{
|
{
|
||||||
struct pci_dev *pdev = rpc->rpd->port;
|
struct pci_dev *pdev = rpc->rpd;
|
||||||
u32 reg32;
|
u32 reg32;
|
||||||
int pos;
|
int pos;
|
||||||
|
|
||||||
|
@ -232,7 +232,7 @@ static struct aer_rpc *aer_alloc_rpc(struct pcie_device *dev)
|
||||||
/* Initialize Root lock access, e_lock, to Root Error Status Reg */
|
/* Initialize Root lock access, e_lock, to Root Error Status Reg */
|
||||||
spin_lock_init(&rpc->e_lock);
|
spin_lock_init(&rpc->e_lock);
|
||||||
|
|
||||||
rpc->rpd = dev;
|
rpc->rpd = dev->port;
|
||||||
INIT_WORK(&rpc->dpc_handler, aer_isr);
|
INIT_WORK(&rpc->dpc_handler, aer_isr);
|
||||||
mutex_init(&rpc->rpc_mutex);
|
mutex_init(&rpc->rpc_mutex);
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ struct aer_err_source {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct aer_rpc {
|
struct aer_rpc {
|
||||||
struct pcie_device *rpd; /* Root Port device */
|
struct pci_dev *rpd; /* Root Port device */
|
||||||
struct work_struct dpc_handler;
|
struct work_struct dpc_handler;
|
||||||
struct aer_err_source e_sources[AER_ERROR_SOURCES_MAX];
|
struct aer_err_source e_sources[AER_ERROR_SOURCES_MAX];
|
||||||
struct aer_err_info e_info;
|
struct aer_err_info e_info;
|
||||||
|
|
|
@ -402,13 +402,13 @@ static inline void aer_process_err_devices(struct aer_err_info *e_info)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* aer_isr_one_error - consume an error detected by root port
|
* aer_isr_one_error - consume an error detected by root port
|
||||||
* @p_device: pointer to error root port service device
|
* @rpc: pointer to the root port which holds an error
|
||||||
* @e_src: pointer to an error source
|
* @e_src: pointer to an error source
|
||||||
*/
|
*/
|
||||||
static void aer_isr_one_error(struct pcie_device *p_device,
|
static void aer_isr_one_error(struct aer_rpc *rpc,
|
||||||
struct aer_err_source *e_src)
|
struct aer_err_source *e_src)
|
||||||
{
|
{
|
||||||
struct aer_rpc *rpc = get_service_data(p_device);
|
struct pci_dev *pdev = rpc->rpd;
|
||||||
struct aer_err_info *e_info = &rpc->e_info;
|
struct aer_err_info *e_info = &rpc->e_info;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -423,10 +423,9 @@ static void aer_isr_one_error(struct pcie_device *p_device,
|
||||||
e_info->multi_error_valid = 1;
|
e_info->multi_error_valid = 1;
|
||||||
else
|
else
|
||||||
e_info->multi_error_valid = 0;
|
e_info->multi_error_valid = 0;
|
||||||
|
aer_print_port_info(pdev, e_info);
|
||||||
|
|
||||||
aer_print_port_info(p_device->port, e_info);
|
if (find_source_device(pdev, e_info))
|
||||||
|
|
||||||
if (find_source_device(p_device->port, e_info))
|
|
||||||
aer_process_err_devices(e_info);
|
aer_process_err_devices(e_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -443,9 +442,9 @@ static void aer_isr_one_error(struct pcie_device *p_device,
|
||||||
else
|
else
|
||||||
e_info->multi_error_valid = 0;
|
e_info->multi_error_valid = 0;
|
||||||
|
|
||||||
aer_print_port_info(p_device->port, e_info);
|
aer_print_port_info(pdev, e_info);
|
||||||
|
|
||||||
if (find_source_device(p_device->port, e_info))
|
if (find_source_device(pdev, e_info))
|
||||||
aer_process_err_devices(e_info);
|
aer_process_err_devices(e_info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -488,11 +487,10 @@ static int get_e_source(struct aer_rpc *rpc, struct aer_err_source *e_src)
|
||||||
void aer_isr(struct work_struct *work)
|
void aer_isr(struct work_struct *work)
|
||||||
{
|
{
|
||||||
struct aer_rpc *rpc = container_of(work, struct aer_rpc, dpc_handler);
|
struct aer_rpc *rpc = container_of(work, struct aer_rpc, dpc_handler);
|
||||||
struct pcie_device *p_device = rpc->rpd;
|
|
||||||
struct aer_err_source uninitialized_var(e_src);
|
struct aer_err_source uninitialized_var(e_src);
|
||||||
|
|
||||||
mutex_lock(&rpc->rpc_mutex);
|
mutex_lock(&rpc->rpc_mutex);
|
||||||
while (get_e_source(rpc, &e_src))
|
while (get_e_source(rpc, &e_src))
|
||||||
aer_isr_one_error(p_device, &e_src);
|
aer_isr_one_error(rpc, &e_src);
|
||||||
mutex_unlock(&rpc->rpc_mutex);
|
mutex_unlock(&rpc->rpc_mutex);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue