Skip to contentSkip to conversation

clk: ralink: mtmips: quiet unused variable warning

PATCH Applied Sergio Paracuellos 3 participants 6 messages Aug 27, 2023 – Oct 19, 2023

Subsystems (2)
lore
Share & tools
lore

Sergio Paracuellos

author maintainer
#0 lore raw

PATCH v2 1/1 clk: ralink: mtmips: quiet unused variable warning

When CONFIG_OF is disabled then the matching table is not referenced and the following warning appears:

drivers/clk/ralink/clk-mtmips.c:821:34: warning: unused variable 'mtmips_of_match' [-Wunused-const-variable]
821 | static const struct of_device_id mtmips_of_match[] = {
| ^

There are two match tables in the driver: one for the clock driver and the other for the reset driver. The only difference between them is that the clock driver uses 'data' and does not have 'ralink,rt2880-reset' compatible. Both just can be merged into a single one just by adding the compatible 'ralink,rt2880-reset' entry to 'mtmips_of_match[]', which will allow it to be used for 'mtmips_clk_driver' (which doesn't use the data) as well as for 'mtmips_clk_init()' (which doesn't need get called for 'ralink,rt2880-reset').

Doing in this way ensures that 'CONFIG_OF' is not disabled anymore so the above warning disapears.

Fixes 6f3b15586eef ("clk: ralink: add clock and reset driver for MTMIPS SoCs")

---
Changes in v2:
- Merge two match tables into one to properly avoid this warning.

PATCH in v1: https://lore.kernel.org/lkml/[email protected]/T/

 drivers/clk/ralink/clk-mtmips.c | 20 +++++---------------
 1 file changed, 5 insertions(+), 15 deletions(-)
drivers/clk/ralink/clk-mtmips.c +5 -15
index 1e7991439527..50a443bf79ec 100644
@@ -821,6 +821,10 @@ static const struct mtmips_clk_data mt76x8_clk_data = {
 };
 
 static const struct of_device_id mtmips_of_match[] = {
+	{
+		.compatible = "ralink,rt2880-reset",
+		.data = NULL,
+	},
 	{
 		.compatible = "ralink,rt2880-sysc",
 		.data = &rt2880_clk_data,
@@ -1088,25 +1092,11 @@ static int mtmips_clk_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static const struct of_device_id mtmips_clk_of_match[] = {
-	{ .compatible = "ralink,rt2880-reset" },
-	{ .compatible = "ralink,rt2880-sysc" },
-	{ .compatible = "ralink,rt3050-sysc" },
-	{ .compatible = "ralink,rt3052-sysc" },
-	{ .compatible = "ralink,rt3352-sysc" },
-	{ .compatible = "ralink,rt3883-sysc" },
-	{ .compatible = "ralink,rt5350-sysc" },
-	{ .compatible = "ralink,mt7620-sysc" },
-	{ .compatible = "ralink,mt7628-sysc" },
-	{ .compatible = "ralink,mt7688-sysc" },
-	{}
-};
-
 static struct platform_driver mtmips_clk_driver = {
 	.probe = mtmips_clk_probe,
 	.driver = {
 		.name = "mtmips-clk",
-		.of_match_table = mtmips_clk_of_match,
+		.of_match_table = mtmips_of_match,
 	},
 };
 
Signature · 1 line
2.25.1
author maintainer
#1 lore raw
Quoted 76 lines · Sergio Paracuellos

When CONFIG_OF is disabled then the matching table is not referenced and the following warning appears:

drivers/clk/ralink/clk-mtmips.c:821:34: warning: unused variable 'mtmips_of_match' [-Wunused-const-variable]
821 | static const struct of_device_id mtmips_of_match[] = {
| ^

There are two match tables in the driver: one for the clock driver and the other for the reset driver. The only difference between them is that the clock driver uses 'data' and does not have 'ralink,rt2880-reset' compatible. Both just can be merged into a single one just by adding the compatible 'ralink,rt2880-reset' entry to 'mtmips_of_match[]', which will allow it to be used for 'mtmips_clk_driver' (which doesn't use the data) as well as for 'mtmips_clk_init()' (which doesn't need get called for 'ralink,rt2880-reset').

Doing in this way ensures that 'CONFIG_OF' is not disabled anymore so the above warning disapears.

Fixes 6f3b15586eef ("clk: ralink: add clock and reset driver for MTMIPS SoCs")

---
Changes in v2:
- Merge two match tables into one to properly avoid this warning.

PATCH in v1: https://lore.kernel.org/lkml/[email protected]/T/

 drivers/clk/ralink/clk-mtmips.c | 20 +++++---------------
 1 file changed, 5 insertions(+), 15 deletions(-)
drivers/clk/ralink/clk-mtmips.c +5 -16
index 1e7991439527..50a443bf79ec 100644
@@ -821,6 +821,10 @@ static const struct mtmips_clk_data mt76x8_clk_data = {
 };
 
 static const struct of_device_id mtmips_of_match[] = {
+       {
+               .compatible = "ralink,rt2880-reset",
+               .data = NULL,
+       },
        {
                .compatible = "ralink,rt2880-sysc",
                .data = &rt2880_clk_data,
@@ -1088,25 +1092,11 @@ static int mtmips_clk_probe(struct platform_device *pdev)
        return 0;
 }
 
-static const struct of_device_id mtmips_clk_of_match[] = {
-       { .compatible = "ralink,rt2880-reset" },
-       { .compatible = "ralink,rt2880-sysc" },
-       { .compatible = "ralink,rt3050-sysc" },
-       { .compatible = "ralink,rt3052-sysc" },
-       { .compatible = "ralink,rt3352-sysc" },
-       { .compatible = "ralink,rt3883-sysc" },
-       { .compatible = "ralink,rt5350-sysc" },
-       { .compatible = "ralink,mt7620-sysc" },
-       { .compatible = "ralink,mt7628-sysc" },
-       { .compatible = "ralink,mt7688-sysc" },
-       {}
-};
-
 static struct platform_driver mtmips_clk_driver = {
        .probe = mtmips_clk_probe,
        .driver = {
                .name = "mtmips-clk",
-               .of_match_table = mtmips_clk_of_match,
+               .of_match_table = mtmips_of_match,
        },
 };
 
--
Quoted 2 lines

2.25.1

Gentle ping for this patch.

Thanks,
Sergio Paracuellos

Reviewed-by on v2 1/1
#2 lore raw
In reply to Sergio Paracuellos
Quoted 15 lines · Sergio Paracuellos

When CONFIG_OF is disabled then the matching table is not referenced and the following warning appears:

drivers/clk/ralink/clk-mtmips.c:821:34: warning: unused variable 'mtmips_of_match' [-Wunused-const-variable]
821 | static const struct of_device_id mtmips_of_match[] = {
| ^

There are two match tables in the driver: one for the clock driver and the other for the reset driver. The only difference between them is that the clock driver uses 'data' and does not have 'ralink,rt2880-reset' compatible. Both just can be merged into a single one just by adding the compatible 'ralink,rt2880-reset' entry to 'mtmips_of_match[]', which will allow it to be used for 'mtmips_clk_driver' (which doesn't use the data) as well as for 'mtmips_clk_init()' (which doesn't need get called for 'ralink,rt2880-reset').

Quoted 8 lines

Doing in this way ensures that 'CONFIG_OF' is not disabled anymore so the above warning disapears.

Fixes 6f3b15586eef ("clk: ralink: add clock and reset driver for MTMIPS SoCs")
Quoted 54 lines

---
Changes in v2:
- Merge two match tables into one to properly avoid this warning.

PATCH in v1: https://lore.kernel.org/lkml/[email protected]/T/

 drivers/clk/ralink/clk-mtmips.c | 20 +++++---------------
 1 file changed, 5 insertions(+), 15 deletions(-)
drivers/clk/ralink/clk-mtmips.c +5 -15
index 1e7991439527..50a443bf79ec 100644
@@ -821,6 +821,10 @@ static const struct mtmips_clk_data mt76x8_clk_data = {
 };
 
 static const struct of_device_id mtmips_of_match[] = {
+	{
+		.compatible = "ralink,rt2880-reset",
+		.data = NULL,
+	},
 	{
 		.compatible = "ralink,rt2880-sysc",
 		.data = &rt2880_clk_data,
@@ -1088,25 +1092,11 @@ static int mtmips_clk_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static const struct of_device_id mtmips_clk_of_match[] = {
-	{ .compatible = "ralink,rt2880-reset" },
-	{ .compatible = "ralink,rt2880-sysc" },
-	{ .compatible = "ralink,rt3050-sysc" },
-	{ .compatible = "ralink,rt3052-sysc" },
-	{ .compatible = "ralink,rt3352-sysc" },
-	{ .compatible = "ralink,rt3883-sysc" },
-	{ .compatible = "ralink,rt5350-sysc" },
-	{ .compatible = "ralink,mt7620-sysc" },
-	{ .compatible = "ralink,mt7628-sysc" },
-	{ .compatible = "ralink,mt7688-sysc" },
-	{}
-};
-
 static struct platform_driver mtmips_clk_driver = {
 	.probe = mtmips_clk_probe,
 	.driver = {
 		.name = "mtmips-clk",
-		.of_match_table = mtmips_clk_of_match,
+		.of_match_table = mtmips_of_match,
 	},
 };
 
Signature · 1 line
2.25.1
author maintainer
#3 lore raw
Quoted 20 lines · Nathan Chancellor
Quoted 18 lines · Sergio Paracuellos

When CONFIG_OF is disabled then the matching table is not referenced and the following warning appears:

drivers/clk/ralink/clk-mtmips.c:821:34: warning: unused variable 'mtmips_of_match' [-Wunused-const-variable]
821 | static const struct of_device_id mtmips_of_match[] = {
| ^

There are two match tables in the driver: one for the clock driver and the other for the reset driver. The only difference between them is that the clock driver uses 'data' and does not have 'ralink,rt2880-reset' compatible. Both just can be merged into a single one just by adding the compatible 'ralink,rt2880-reset' entry to 'mtmips_of_match[]', which will allow it to be used for 'mtmips_clk_driver' (which doesn't use the data) as well as for 'mtmips_clk_init()' (which doesn't need get called for 'ralink,rt2880-reset').

Doing in this way ensures that 'CONFIG_OF' is not disabled anymore so the above warning disapears.

Quoted 7 lines
Quoted 5 lines
Fixes 6f3b15586eef ("clk: ralink: add clock and reset driver for MTMIPS SoCs")

Thanks, Nathan!

Best regards,
Sergio Paracuellos

Quoted 55 lines
Quoted 55 lines

---
Changes in v2:
- Merge two match tables into one to properly avoid this warning.

PATCH in v1: https://lore.kernel.org/lkml/[email protected]/T/

 drivers/clk/ralink/clk-mtmips.c | 20 +++++---------------
 1 file changed, 5 insertions(+), 15 deletions(-)
drivers/clk/ralink/clk-mtmips.c +5 -16
index 1e7991439527..50a443bf79ec 100644
@@ -821,6 +821,10 @@ static const struct mtmips_clk_data mt76x8_clk_data = {
 };
 
 static const struct of_device_id mtmips_of_match[] = {
+     {
+             .compatible = "ralink,rt2880-reset",
+             .data = NULL,
+     },
      {
              .compatible = "ralink,rt2880-sysc",
              .data = &rt2880_clk_data,
@@ -1088,25 +1092,11 @@ static int mtmips_clk_probe(struct platform_device *pdev)
      return 0;
 }
 
-static const struct of_device_id mtmips_clk_of_match[] = {
-     { .compatible = "ralink,rt2880-reset" },
-     { .compatible = "ralink,rt2880-sysc" },
-     { .compatible = "ralink,rt3050-sysc" },
-     { .compatible = "ralink,rt3052-sysc" },
-     { .compatible = "ralink,rt3352-sysc" },
-     { .compatible = "ralink,rt3883-sysc" },
-     { .compatible = "ralink,rt5350-sysc" },
-     { .compatible = "ralink,mt7620-sysc" },
-     { .compatible = "ralink,mt7628-sysc" },
-     { .compatible = "ralink,mt7688-sysc" },
-     {}
-};
-
 static struct platform_driver mtmips_clk_driver = {
      .probe = mtmips_clk_probe,
      .driver = {
              .name = "mtmips-clk",
-             .of_match_table = mtmips_clk_of_match,
+             .of_match_table = mtmips_of_match,
      },
 };
 
--

2.25.1

maintainer Applied
#4 lore raw
In reply to Sergio Paracuellos

Quoting Sergio Paracuellos (2023-08-26 19:39:32)

Quoted 18 lines

When CONFIG_OF is disabled then the matching table is not referenced and the following warning appears:

drivers/clk/ralink/clk-mtmips.c:821:34: warning: unused variable 'mtmips_of_match' [-Wunused-const-variable]
821 | static const struct of_device_id mtmips_of_match[] = {
| ^

There are two match tables in the driver: one for the clock driver and the other for the reset driver. The only difference between them is that the clock driver uses 'data' and does not have 'ralink,rt2880-reset' compatible. Both just can be merged into a single one just by adding the compatible 'ralink,rt2880-reset' entry to 'mtmips_of_match[]', which will allow it to be used for 'mtmips_clk_driver' (which doesn't use the data) as well as for 'mtmips_clk_init()' (which doesn't need get called for 'ralink,rt2880-reset').

Doing in this way ensures that 'CONFIG_OF' is not disabled anymore so the above warning disapears.

Quoted 6 lines
Fixes 6f3b15586eef ("clk: ralink: add clock and reset driver for MTMIPS SoCs")

---

Applied to clk-next

author maintainer
#5 lore raw
Quoted 20 lines · Stephen Boyd

Quoting Sergio Paracuellos (2023-08-26 19:39:32)

Quoted 18 lines

When CONFIG_OF is disabled then the matching table is not referenced and the following warning appears:

drivers/clk/ralink/clk-mtmips.c:821:34: warning: unused variable 'mtmips_of_match' [-Wunused-const-variable]
821 | static const struct of_device_id mtmips_of_match[] = {
| ^

There are two match tables in the driver: one for the clock driver and the other for the reset driver. The only difference between them is that the clock driver uses 'data' and does not have 'ralink,rt2880-reset' compatible. Both just can be merged into a single one just by adding the compatible 'ralink,rt2880-reset' entry to 'mtmips_of_match[]', which will allow it to be used for 'mtmips_clk_driver' (which doesn't use the data) as well as for 'mtmips_clk_init()' (which doesn't need get called for 'ralink,rt2880-reset').

Doing in this way ensures that 'CONFIG_OF' is not disabled anymore so the above warning disapears.

Quoted 8 lines
Quoted 6 lines
Fixes 6f3b15586eef ("clk: ralink: add clock and reset driver for MTMIPS SoCs")

---

Applied to clk-next

Thanks Stephen!

Best regards,
Sergio Paracuellos