ipq806x: fix build errors on 6.12 kernel

- Replace "strlcpy()" with "strscpy()".
- Convert platform driver .remove() to .remove_new().

This patch fixes the following compile errors:

drivers/of/fdt.c:1064:17: error: implicit declaration of function 'strlcpy'; did you mean 'strncpy'? [-Wimplicit-function-declaration]
 1064 |                 strlcpy(cmdline, p, min((int)l, COMMAND_LINE_SIZE));
      |                 ^~~~~~~
      |                 strncpy

drivers/devfreq/krait-cache-devfreq.c:171:27: error: initialization of 'void (*)(struct platform_device *)' from incompatible pointer type 'int (*)(struct platform_device *)' [-Wincompatible-pointer-types]
  171 |         .remove         = krait_cache_remove,
      |                           ^~~~~~~~~~~~~~~~~~

drivers/devfreq/ipq806x-fab-devfreq.c:145:27: error: initialization of 'void (*)(struct platform_device *)' from incompatible pointer type 'int (*)(struct platform_device *)' [-Wincompatible-pointer-types]
  145 |         .remove         = ipq806x_fab_remove,
      |                           ^~~~~~~~~~~~~~~~~~

Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
Link: https://github.com/openwrt/openwrt/pull/18989
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
This commit is contained in:
Shiji Yang 2025-06-01 00:41:31 +08:00 committed by Christian Marangi
parent 1a76ae3269
commit 1125d07cf4
No known key found for this signature in database
GPG key ID: AC001D09ADBFEAD7
3 changed files with 7 additions and 11 deletions

View file

@ -51,7 +51,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
obj-$(CONFIG_PM_DEVFREQ_EVENT) += event/
--- /dev/null
+++ b/drivers/devfreq/krait-cache-devfreq.c
@@ -0,0 +1,181 @@
@@ -0,0 +1,179 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include <linux/kernel.h>
@ -206,13 +206,11 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
+ return ret;
+};
+
+static int krait_cache_remove(struct platform_device *pdev)
+static void krait_cache_remove(struct platform_device *pdev)
+{
+ struct krait_cache_data *data = dev_get_drvdata(&pdev->dev);
+
+ dev_pm_opp_clear_config(data->token);
+
+ return 0;
+};
+
+static const struct of_device_id krait_cache_match_table[] = {
@ -222,7 +220,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
+
+static struct platform_driver krait_cache_driver = {
+ .probe = krait_cache_probe,
+ .remove = krait_cache_remove,
+ .remove_new = krait_cache_remove,
+ .driver = {
+ .name = "krait-cache-scaling",
+ .of_match_table = krait_cache_match_table,

View file

@ -45,7 +45,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
obj-$(CONFIG_PM_DEVFREQ_EVENT) += event/
--- /dev/null
+++ b/drivers/devfreq/ipq806x-fab-devfreq.c
@@ -0,0 +1,155 @@
@@ -0,0 +1,153 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include <linux/kernel.h>
@ -168,7 +168,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
+ return PTR_ERR(clk);
+};
+
+static int ipq806x_fab_remove(struct platform_device *pdev)
+static void ipq806x_fab_remove(struct platform_device *pdev)
+{
+ struct ipq806x_fab_data *data = dev_get_drvdata(&pdev->dev);
+
@ -179,8 +179,6 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
+ clk_put(data->ddr_clk);
+
+ dev_pm_opp_remove_table(&pdev->dev);
+
+ return 0;
+};
+
+static const struct of_device_id ipq806x_fab_match_table[] = {
@ -190,7 +188,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
+
+static struct platform_driver ipq806x_fab_driver = {
+ .probe = ipq806x_fab_probe,
+ .remove = ipq806x_fab_remove,
+ .remove_new = ipq806x_fab_remove,
+ .driver = {
+ .name = "ipq806x-fab-scaling",
+ .of_match_table = ipq806x_fab_match_table,

View file

@ -29,7 +29,7 @@
+#ifdef CONFIG_CMDLINE_OVERRIDE
+ p = of_get_flat_dt_prop(node, "bootargs-override", &l);
+ if (p != NULL && l > 0)
+ strlcpy(cmdline, p, min((int)l, COMMAND_LINE_SIZE));
+ strscpy(cmdline, p, min((int)l, COMMAND_LINE_SIZE));
+#endif
+
handle_cmdline: