diff options
author | Bjorn Helgaas <bhelgaas@google.com> | 2018-04-04 14:27:36 -0400 |
---|---|---|
committer | Bjorn Helgaas <helgaas@kernel.org> | 2018-04-04 14:27:36 -0400 |
commit | 63d5ce5fc854293a4f479ff6992ef4efe76ac457 (patch) | |
tree | a8df44b4b1d68716fcb3ca4030b10a18d930edfc | |
parent | 7928b2cbe55b2a410a0f5c1f154610059c57b1b2 (diff) | |
parent | 3ecac020d6dd09259414f423b577347ebee9f533 (diff) |
Merge branch 'pci/aer'
- move pci_uevent_ers() out of pci.h (Michael Ellerman)
* pci/aer:
PCI/AER: Move pci_uevent_ers() out of pci.h
-rw-r--r-- | drivers/pci/pci-driver.c | 36 | ||||
-rw-r--r-- | include/linux/pci.h | 38 |
2 files changed, 39 insertions, 35 deletions
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index 3bed6beda051..8876b98546ce 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c | |||
@@ -1517,6 +1517,42 @@ static int pci_uevent(struct device *dev, struct kobj_uevent_env *env) | |||
1517 | return 0; | 1517 | return 0; |
1518 | } | 1518 | } |
1519 | 1519 | ||
1520 | #if defined(CONFIG_PCIEAER) || defined(CONFIG_EEH) | ||
1521 | /** | ||
1522 | * pci_uevent_ers - emit a uevent during recovery path of PCI device | ||
1523 | * @pdev: PCI device undergoing error recovery | ||
1524 | * @err_type: type of error event | ||
1525 | */ | ||
1526 | void pci_uevent_ers(struct pci_dev *pdev, enum pci_ers_result err_type) | ||
1527 | { | ||
1528 | int idx = 0; | ||
1529 | char *envp[3]; | ||
1530 | |||
1531 | switch (err_type) { | ||
1532 | case PCI_ERS_RESULT_NONE: | ||
1533 | case PCI_ERS_RESULT_CAN_RECOVER: | ||
1534 | envp[idx++] = "ERROR_EVENT=BEGIN_RECOVERY"; | ||
1535 | envp[idx++] = "DEVICE_ONLINE=0"; | ||
1536 | break; | ||
1537 | case PCI_ERS_RESULT_RECOVERED: | ||
1538 | envp[idx++] = "ERROR_EVENT=SUCCESSFUL_RECOVERY"; | ||
1539 | envp[idx++] = "DEVICE_ONLINE=1"; | ||
1540 | break; | ||
1541 | case PCI_ERS_RESULT_DISCONNECT: | ||
1542 | envp[idx++] = "ERROR_EVENT=FAILED_RECOVERY"; | ||
1543 | envp[idx++] = "DEVICE_ONLINE=0"; | ||
1544 | break; | ||
1545 | default: | ||
1546 | break; | ||
1547 | } | ||
1548 | |||
1549 | if (idx > 0) { | ||
1550 | envp[idx++] = NULL; | ||
1551 | kobject_uevent_env(&pdev->dev.kobj, KOBJ_CHANGE, envp); | ||
1552 | } | ||
1553 | } | ||
1554 | #endif | ||
1555 | |||
1520 | static int pci_bus_num_vf(struct device *dev) | 1556 | static int pci_bus_num_vf(struct device *dev) |
1521 | { | 1557 | { |
1522 | return pci_num_vf(to_pci_dev(dev)); | 1558 | return pci_num_vf(to_pci_dev(dev)); |
diff --git a/include/linux/pci.h b/include/linux/pci.h index 024a1beda008..19c1dbcff0c6 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -2280,41 +2280,9 @@ static inline bool pci_is_thunderbolt_attached(struct pci_dev *pdev) | |||
2280 | return false; | 2280 | return false; |
2281 | } | 2281 | } |
2282 | 2282 | ||
2283 | /** | 2283 | #if defined(CONFIG_PCIEAER) || defined(CONFIG_EEH) |
2284 | * pci_uevent_ers - emit a uevent during recovery path of pci device | 2284 | void pci_uevent_ers(struct pci_dev *pdev, enum pci_ers_result err_type); |
2285 | * @pdev: pci device to check | 2285 | #endif |
2286 | * @err_type: type of error event | ||
2287 | * | ||
2288 | */ | ||
2289 | static inline void pci_uevent_ers(struct pci_dev *pdev, | ||
2290 | enum pci_ers_result err_type) | ||
2291 | { | ||
2292 | int idx = 0; | ||
2293 | char *envp[3]; | ||
2294 | |||
2295 | switch (err_type) { | ||
2296 | case PCI_ERS_RESULT_NONE: | ||
2297 | case PCI_ERS_RESULT_CAN_RECOVER: | ||
2298 | envp[idx++] = "ERROR_EVENT=BEGIN_RECOVERY"; | ||
2299 | envp[idx++] = "DEVICE_ONLINE=0"; | ||
2300 | break; | ||
2301 | case PCI_ERS_RESULT_RECOVERED: | ||
2302 | envp[idx++] = "ERROR_EVENT=SUCCESSFUL_RECOVERY"; | ||
2303 | envp[idx++] = "DEVICE_ONLINE=1"; | ||
2304 | break; | ||
2305 | case PCI_ERS_RESULT_DISCONNECT: | ||
2306 | envp[idx++] = "ERROR_EVENT=FAILED_RECOVERY"; | ||
2307 | envp[idx++] = "DEVICE_ONLINE=0"; | ||
2308 | break; | ||
2309 | default: | ||
2310 | break; | ||
2311 | } | ||
2312 | |||
2313 | if (idx > 0) { | ||
2314 | envp[idx++] = NULL; | ||
2315 | kobject_uevent_env(&pdev->dev.kobj, KOBJ_CHANGE, envp); | ||
2316 | } | ||
2317 | } | ||
2318 | 2286 | ||
2319 | /* Provide the legacy pci_dma_* API */ | 2287 | /* Provide the legacy pci_dma_* API */ |
2320 | #include <linux/pci-dma-compat.h> | 2288 | #include <linux/pci-dma-compat.h> |