[PATCH 13/21] patch: Allow usage of pci_error_handlers->reset_notify

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The member reset_notify in the struct pci_error_handlers was divided
into reset_prepare and reset_done in upstream commit 775755ed3c65fb
("PCI: Split ->reset_notify() method into ->reset_prepare() and
->reset_done()"). Make new code also work with old kernel versions.

Signed-off-by: Hauke Mehrtens <hauke@xxxxxxxxxx>
---
 patches/0082-pci_error_handlers.cocci | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
 create mode 100644 patches/0082-pci_error_handlers.cocci

diff --git a/patches/0082-pci_error_handlers.cocci b/patches/0082-pci_error_handlers.cocci
new file mode 100644
index 00000000..9b5573d4
--- /dev/null
+++ b/patches/0082-pci_error_handlers.cocci
@@ -0,0 +1,32 @@
+@r@
+identifier OPS;
+identifier pcie_reset_prepare_fn;
+identifier pcie_reset_done_fn;
+fresh identifier pcie_reset_notify_fn = pcie_reset_prepare_fn ## "_notify";
+position p;
+@@
+struct pci_error_handlers OPS@p = {
++#if LINUX_VERSION_IS_GEQ(4,13,0)
+	.reset_prepare = pcie_reset_prepare_fn,
+	.reset_done = pcie_reset_done_fn,
++#else
++	.reset_notify = pcie_reset_notify_fn,
++#endif
+};
+
+
+@@
+identifier r.pcie_reset_prepare_fn;
+identifier r.pcie_reset_done_fn;
+identifier r.pcie_reset_notify_fn;
+@@
+void pcie_reset_done_fn(...) {...}
++#if LINUX_VERSION_IS_LESS(4,13,0)
++static void pcie_reset_notify_fn(struct pci_dev *dev, bool prepare)
++{
++	if (prepare)
++		pcie_reset_prepare_fn(dev);
++	else
++		pcie_reset_done_fn(dev);
++}
++#endif
-- 
2.11.0

--
To unsubscribe from this list: send the line "unsubscribe backports" in



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux