summaryrefslogtreecommitdiffstats
path: root/target/linux
diff options
context:
space:
mode:
authorRosen Penev <rosenp@gmail.com>2024-10-18 19:08:02 -0700
committerHauke Mehrtens <hauke@hauke-m.de>2024-11-10 22:36:16 +0100
commit44824f0b787b13e2f2fccc58256b2c42fa3f9f5d (patch)
treeabd0c7caee3484fdcb82b42fdaa6120bc5f315dd /target/linux
parentadb921c34ff220951a699665bb35dc0e3538b3b2 (diff)
downloadopenwrt-44824f0b787b13e2f2fccc58256b2c42fa3f9f5d.tar.gz
openwrt-44824f0b787b13e2f2fccc58256b2c42fa3f9f5d.tar.bz2
openwrt-44824f0b787b13e2f2fccc58256b2c42fa3f9f5d.zip
lantiq: use more devm for i2c
i2c_add_numbered_adapter is the wrong function to use here. It requires setting nr to some value, otherwise it behaves the same as i2c_add_adapter. nr is not set. Signed-off-by: Rosen Penev <rosenp@gmail.com> Link: https://github.com/openwrt/openwrt/pull/16825 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Diffstat (limited to 'target/linux')
-rw-r--r--target/linux/lantiq/patches-6.6/0031-I2C-MIPS-lantiq-add-FALC-ON-i2c-bus-master.patch13
1 files changed, 5 insertions, 8 deletions
diff --git a/target/linux/lantiq/patches-6.6/0031-I2C-MIPS-lantiq-add-FALC-ON-i2c-bus-master.patch b/target/linux/lantiq/patches-6.6/0031-I2C-MIPS-lantiq-add-FALC-ON-i2c-bus-master.patch
index 235e48f6de..1f2f5139d6 100644
--- a/target/linux/lantiq/patches-6.6/0031-I2C-MIPS-lantiq-add-FALC-ON-i2c-bus-master.patch
+++ b/target/linux/lantiq/patches-6.6/0031-I2C-MIPS-lantiq-add-FALC-ON-i2c-bus-master.patch
@@ -47,7 +47,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
obj-$(CONFIG_I2C_MESON) += i2c-meson.o
--- /dev/null
+++ b/drivers/i2c/busses/i2c-lantiq.c
-@@ -0,0 +1,745 @@
+@@ -0,0 +1,742 @@
+
+/*
+ * Lantiq I2C bus adapter
@@ -658,7 +658,9 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+ }
+
+ init_completion(&priv->cmd_complete);
-+ mutex_init(&priv->mutex);
++ ret = devm_mutex_init(&pdev->dev, &priv->mutex);
++ if (ret)
++ return ret;
+
+ priv->membase = devm_platform_ioremap_resource(pdev, 0);
+ if (IS_ERR(priv->membase))
@@ -719,7 +721,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+ clk_activate(priv->clk_gate);
+
+ /* add our adapter to the i2c stack */
-+ ret = i2c_add_numbered_adapter(adap);
++ ret = devm_i2c_add_adapter(&pdev->dev, adap);
+ if (ret) {
+ dev_err(&pdev->dev, "can't register I2C adapter\n");
+ goto out;
@@ -737,7 +739,6 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+ ret = ltq_i2c_hw_init(adap);
+ if (ret) {
+ dev_err(&pdev->dev, "can't configure adapter\n");
-+ i2c_del_adapter(adap);
+ platform_set_drvdata(pdev, NULL);
+ goto out;
+ } else {
@@ -762,10 +763,6 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
+ /* power down the core */
+ clk_deactivate(priv->clk_gate);
+
-+ /* remove driver */
-+ i2c_del_adapter(&priv->adap);
-+ kfree(priv);
-+
+ dev_dbg(&pdev->dev, "removed\n");
+ platform_set_drvdata(pdev, NULL);
+