[openwrt/openwrt] lantiq: fix i2c driver compatibility issue on 6.12 kernel
LEDE Commits
lede-commits at lists.infradead.org
Fri Jul 18 04:31:44 PDT 2025
dangole pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/a86c31926740261c55f2e2753c183d3dd897a549
commit a86c31926740261c55f2e2753c183d3dd897a549
Author: Shiji Yang <yangshiji66 at outlook.com>
AuthorDate: Fri May 9 21:55:07 2025 +0800
lantiq: fix i2c driver compatibility issue on 6.12 kernel
* Drop obsolete flag I2C_CLASS_SPD. [1]
* Change .remove callback return type to NULL.
* Use strscpy instead of strlcpy.
This patch fixes the following build errors:
drivers/i2c/busses/i2c-lantiq.c:599:41: error: 'I2C_CLASS_SPD' undeclared (first use in this function); did you mean 'I2C_CLASS_HWMON'?
599 | adap->class = I2C_CLASS_HWMON | I2C_CLASS_SPD;
| ^~~~~~~~~~~~~
| I2C_CLASS_HWMON
drivers/i2c/busses/i2c-lantiq.c:600:9: error: implicit declaration of function 'strlcpy'; did you mean 'strncpy'? [-Wimplicit-function-declaration]
600 | strlcpy(adap->name, DRV_NAME "-adapter", sizeof(adap->name));
| ^~~~~~~
| strncpy
drivers/i2c/busses/i2c-lantiq.c:729:19: error: initialization of 'void (*)(struct platform_device *)' from incompatible pointer type 'int (*)(struct platform_device *)' [-Wincompatible-pointer-types]
729 | .remove = ltq_i2c_remove,
|
[1] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-6.12.y&id=e61bcf42d290e73025bab38e0e55a5586c2d8ad5
Signed-off-by: Shiji Yang <yangshiji66 at outlook.com>
---
.../031-I2C-MIPS-lantiq-add-FALC-ON-i2c-bus-master.patch | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/target/linux/lantiq/patches-6.12/031-I2C-MIPS-lantiq-add-FALC-ON-i2c-bus-master.patch b/target/linux/lantiq/patches-6.12/031-I2C-MIPS-lantiq-add-FALC-ON-i2c-bus-master.patch
index bb78a470e1..27159c7c50 100644
--- a/target/linux/lantiq/patches-6.12/031-I2C-MIPS-lantiq-add-FALC-ON-i2c-bus-master.patch
+++ b/target/linux/lantiq/patches-6.12/031-I2C-MIPS-lantiq-add-FALC-ON-i2c-bus-master.patch
@@ -47,7 +47,7 @@ Signed-off-by: John Crispin <blogic at openwrt.org>
obj-$(CONFIG_I2C_MESON) += i2c-meson.o
--- /dev/null
+++ b/drivers/i2c/busses/i2c-lantiq.c
-@@ -0,0 +1,742 @@
+@@ -0,0 +1,741 @@
+
+/*
+ * Lantiq I2C bus adapter
@@ -646,8 +646,8 @@ Signed-off-by: John Crispin <blogic at openwrt.org>
+ adap = &priv->adap;
+ i2c_set_adapdata(adap, priv);
+ adap->owner = THIS_MODULE;
-+ adap->class = I2C_CLASS_HWMON | I2C_CLASS_SPD;
-+ strlcpy(adap->name, DRV_NAME "-adapter", sizeof(adap->name));
++ adap->class = I2C_CLASS_HWMON;
++ strscpy(adap->name, DRV_NAME "-adapter", sizeof(adap->name));
+ adap->algo = <q_i2c_algorithm;
+ adap->dev.parent = &pdev->dev;
+ adap->dev.of_node = pdev->dev.of_node;
@@ -753,7 +753,7 @@ Signed-off-by: John Crispin <blogic at openwrt.org>
+ return ret;
+}
+
-+static int ltq_i2c_remove(struct platform_device *pdev)
++static void ltq_i2c_remove(struct platform_device *pdev)
+{
+ struct ltq_i2c *priv = platform_get_drvdata(pdev);
+
@@ -765,9 +765,8 @@ Signed-off-by: John Crispin <blogic at openwrt.org>
+
+ dev_dbg(&pdev->dev, "removed\n");
+ platform_set_drvdata(pdev, NULL);
-+
-+ return 0;
+}
++
+static const struct of_device_id ltq_i2c_match[] = {
+ { .compatible = "lantiq,lantiq-i2c" },
+ {},
More information about the lede-commits
mailing list