[PATCH 46/75] patches: Handle changed spi_driver->remove signature

Hauke Mehrtens <[email protected]> Fri, 28 Jun 2024 01:47:32 +0200
Newsgroups org.kernel.vger.backports
Message-ID <[email protected]>
The return type was changed from int to void. Create an spatch to handle
this change.

Signed-off-by: Hauke Mehrtens <[email protected]>
---
 patches/0108-spi-probe.cocci | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
 create mode 100644 patches/0108-spi-probe.cocci

diff --git a/patches/0108-spi-probe.cocci b/patches/0108-spi-probe.cocci
new file mode 100644
index 00000000..35c32e26
--- /dev/null
+++ b/patches/0108-spi-probe.cocci
@@ -0,0 +1,27 @@
+@r@
+identifier OPS;
+identifier spi_driver_remove;
+fresh identifier spi_driver_remove_wrap = "bp_" ## spi_driver_remove;
+position p;
+@@
+struct spi_driver OPS@p = {
++#if LINUX_VERSION_IS_GEQ(5,18,0)
+	.remove = spi_driver_remove,
++#else
++	.remove = spi_driver_remove_wrap,
++#endif
+};
+
+@@
+identifier r.spi_driver_remove_wrap;
+identifier r.spi_driver_remove;
+@@
+void spi_driver_remove(...) {...}
++#if LINUX_VERSION_IS_LESS(5,18,0)
++static int spi_driver_remove_wrap(struct spi_device *spi)
++{
++	spi_driver_remove(spi);
++
++	return 0;
++}
++#endif
-- 
2.45.2