Skip to content

Commit 6fc4dae

Browse files
committed
PCI/AER: Factor COR/UNCOR error handling out from aer_isr_one_error()
aer_isr_one_error() duplicates the Error Source ID logging and AER error processing for Correctable Errors and Uncorrectable Errors. Factor out the duplicated code to aer_isr_one_error_type(). aer_isr_one_error() doesn't need the struct aer_rpc pointer, so pass it the Root Port or RCEC pci_dev pointer instead. Signed-off-by: Bjorn Helgaas <[email protected]> Reviewed-by: Ilpo Järvinen <[email protected]> Reviewed-by: Jonathan Cameron <[email protected]> Reviewed-by: Kuppuswamy Sathyanarayanan <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent a0b62cc commit 6fc4dae

File tree

1 file changed

+23
-13
lines changed

1 file changed

+23
-13
lines changed

drivers/pci/pcie/aer.c

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,17 +1273,32 @@ static inline void aer_process_err_devices(struct aer_err_info *e_info)
12731273
}
12741274

12751275
/**
1276-
* aer_isr_one_error - consume an error detected by Root Port
1277-
* @rpc: pointer to the Root Port which holds an error
1276+
* aer_isr_one_error_type - consume a Correctable or Uncorrectable Error
1277+
* detected by Root Port or RCEC
1278+
* @root: pointer to Root Port or RCEC that signaled AER interrupt
1279+
* @info: pointer to AER error info
1280+
*/
1281+
static void aer_isr_one_error_type(struct pci_dev *root,
1282+
struct aer_err_info *info)
1283+
{
1284+
aer_print_port_info(root, info);
1285+
1286+
if (find_source_device(root, info))
1287+
aer_process_err_devices(info);
1288+
}
1289+
1290+
/**
1291+
* aer_isr_one_error - consume error(s) signaled by an AER interrupt from
1292+
* Root Port or RCEC
1293+
* @root: pointer to Root Port or RCEC that signaled AER interrupt
12781294
* @e_src: pointer to an error source
12791295
*/
1280-
static void aer_isr_one_error(struct aer_rpc *rpc,
1296+
static void aer_isr_one_error(struct pci_dev *root,
12811297
struct aer_err_source *e_src)
12821298
{
1283-
struct pci_dev *pdev = rpc->rpd;
12841299
struct aer_err_info e_info;
12851300

1286-
pci_rootport_aer_stats_incr(pdev, e_src);
1301+
pci_rootport_aer_stats_incr(root, e_src);
12871302

12881303
/*
12891304
* There is a possibility that both correctable error and
@@ -1297,10 +1312,8 @@ static void aer_isr_one_error(struct aer_rpc *rpc,
12971312
e_info.multi_error_valid = 1;
12981313
else
12991314
e_info.multi_error_valid = 0;
1300-
aer_print_port_info(pdev, &e_info);
13011315

1302-
if (find_source_device(pdev, &e_info))
1303-
aer_process_err_devices(&e_info);
1316+
aer_isr_one_error_type(root, &e_info);
13041317
}
13051318

13061319
if (e_src->status & PCI_ERR_ROOT_UNCOR_RCV) {
@@ -1316,10 +1329,7 @@ static void aer_isr_one_error(struct aer_rpc *rpc,
13161329
else
13171330
e_info.multi_error_valid = 0;
13181331

1319-
aer_print_port_info(pdev, &e_info);
1320-
1321-
if (find_source_device(pdev, &e_info))
1322-
aer_process_err_devices(&e_info);
1332+
aer_isr_one_error_type(root, &e_info);
13231333
}
13241334
}
13251335

@@ -1340,7 +1350,7 @@ static irqreturn_t aer_isr(int irq, void *context)
13401350
return IRQ_NONE;
13411351

13421352
while (kfifo_get(&rpc->aer_fifo, &e_src))
1343-
aer_isr_one_error(rpc, &e_src);
1353+
aer_isr_one_error(rpc->rpd, &e_src);
13441354
return IRQ_HANDLED;
13451355
}
13461356

0 commit comments

Comments
 (0)