[PATCH 17/21] patches: backport the probe_new for i2c drivers

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

 



I2C got a new probe function which does not take the struct
i2c_device_id any more, backport this to older kernel versions with a
spatch.

Signed-off-by: Hauke Mehrtens <hauke@xxxxxxxxxx>
---
 patches/0080-i2c-proble-new.cocci | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
 create mode 100644 patches/0080-i2c-proble-new.cocci

diff --git a/patches/0080-i2c-proble-new.cocci b/patches/0080-i2c-proble-new.cocci
new file mode 100644
index 00000000..35580aca
--- /dev/null
+++ b/patches/0080-i2c-proble-new.cocci
@@ -0,0 +1,25 @@
+@r@
+identifier OPS;
+identifier i2c_probe;
+fresh identifier i2c_probe_wrap = "bp_" ## i2c_probe;
+position p;
+@@
+struct i2c_driver OPS@p = {
++#if LINUX_VERSION_IS_GEQ(4,10,0)
+	.probe_new = i2c_probe,
++#else
++	.probe = i2c_probe_wrap,
++#endif
+};
+
+@@
+identifier r.i2c_probe_wrap;
+identifier r.i2c_probe;
+@@
+int i2c_probe(...) {...}
++#if LINUX_VERSION_IS_LESS(4,10,0)
++static int i2c_probe_wrap(struct i2c_client *client, const struct i2c_device_id *id)
++{
++	return i2c_probe(client);
++}
++#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