Skip to content

Commit 6e72dac

Browse files
committed
PCI/AER: Increase compile coverage of CONFIG_PCIEAER_CXL implementation
Per coding-style, avoid usage of conditional compilation for CONFIG_PCIEAER_CXL related helpers. Instead use IS_ENABLED(CONFIG_PCIEAER_CXL) to check when CXL error handling is compile-time disabled. Cc: Terry Bowman <terry.bowman@amd.com> Cc: Robert Richter <rrichter@amd.com> Cc: Bjorn Helgaas <bhelgaas@google.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
1 parent e8db070 commit 6e72dac

File tree

3 files changed

+8
-22
lines changed

3 files changed

+8
-22
lines changed

drivers/cxl/core/pci.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -729,8 +729,6 @@ static bool cxl_handle_endpoint_ras(struct cxl_dev_state *cxlds)
729729
return __cxl_handle_ras(cxlds, cxlds->regs.ras);
730730
}
731731

732-
#ifdef CONFIG_PCIEAER_CXL
733-
734732
static void cxl_dport_map_rch_aer(struct cxl_dport *dport)
735733
{
736734
struct cxl_rcrb_info *ri = &dport->rcrb;
@@ -797,6 +795,9 @@ void cxl_setup_parent_dport(struct device *host, struct cxl_dport *dport)
797795
struct device *dport_dev = dport->dport_dev;
798796
struct pci_host_bridge *host_bridge;
799797

798+
if (!IS_ENABLED(CONFIG_PCIEAER_CXL))
799+
return;
800+
800801
host_bridge = to_pci_host_bridge(dport_dev);
801802
if (host_bridge->native_cxl_error)
802803
dport->rcrb.aer_cap = cxl_rcrb_to_aer(dport_dev, dport->rcrb.base);
@@ -897,10 +898,6 @@ static void cxl_handle_rdport_errors(struct cxl_dev_state *cxlds)
897898
cxl_handle_rdport_ras(cxlds, dport);
898899
}
899900

900-
#else
901-
static void cxl_handle_rdport_errors(struct cxl_dev_state *cxlds) { }
902-
#endif
903-
904901
void cxl_cor_error_detected(struct pci_dev *pdev)
905902
{
906903
struct cxl_dev_state *cxlds = pci_get_drvdata(pdev);

drivers/cxl/cxl.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -712,13 +712,7 @@ struct cxl_dport *devm_cxl_add_dport(struct cxl_port *port,
712712
struct cxl_dport *devm_cxl_add_rch_dport(struct cxl_port *port,
713713
struct device *dport_dev, int port_id,
714714
resource_size_t rcrb);
715-
716-
#ifdef CONFIG_PCIEAER_CXL
717715
void cxl_setup_parent_dport(struct device *host, struct cxl_dport *dport);
718-
#else
719-
static inline void cxl_setup_parent_dport(struct device *host,
720-
struct cxl_dport *dport) { }
721-
#endif
722716

723717
struct cxl_decoder *to_cxl_decoder(struct device *dev);
724718
struct cxl_root_decoder *to_cxl_root_decoder(struct device *dev);

drivers/pci/pcie/aer.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -934,8 +934,6 @@ static bool find_source_device(struct pci_dev *parent,
934934
return true;
935935
}
936936

937-
#ifdef CONFIG_PCIEAER_CXL
938-
939937
/**
940938
* pci_aer_unmask_internal_errors - unmask internal errors
941939
* @dev: pointer to the pcie_dev data structure
@@ -1000,7 +998,8 @@ static int cxl_rch_handle_error_iter(struct pci_dev *dev, void *data)
1000998
struct aer_err_info *info = (struct aer_err_info *)data;
1001999
const struct pci_error_handlers *err_handler;
10021000

1003-
if (!is_cxl_mem_dev(dev) || !cxl_error_is_native(dev))
1001+
if (!is_cxl_mem_dev(dev) || !cxl_error_is_native(dev) ||
1002+
!IS_ENABLED(CONFIG_PCIEAER_CXL))
10041003
return 0;
10051004

10061005
/* protect dev->driver */
@@ -1041,7 +1040,9 @@ static int handles_cxl_error_iter(struct pci_dev *dev, void *data)
10411040
bool *handles_cxl = data;
10421041

10431042
if (!*handles_cxl)
1044-
*handles_cxl = is_cxl_mem_dev(dev) && cxl_error_is_native(dev);
1043+
*handles_cxl = is_cxl_mem_dev(dev) &&
1044+
cxl_error_is_native(dev) &&
1045+
IS_ENABLED(CONFIG_PCIEAER_CXL);
10451046

10461047
/* Non-zero terminates iteration */
10471048
return *handles_cxl;
@@ -1067,12 +1068,6 @@ static void cxl_rch_enable_rcec(struct pci_dev *rcec)
10671068
pci_info(rcec, "CXL: Internal errors unmasked");
10681069
}
10691070

1070-
#else
1071-
static inline void cxl_rch_enable_rcec(struct pci_dev *dev) { }
1072-
static inline void cxl_rch_handle_error(struct pci_dev *dev,
1073-
struct aer_err_info *info) { }
1074-
#endif
1075-
10761071
/**
10771072
* pci_aer_handle_error - handle logging error into an event log
10781073
* @dev: pointer to pci_dev data structure of error source device

0 commit comments

Comments
 (0)