linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCHv3 wireless-next 0/7] wifi: rt2x00: add OF bindings + cleanup
@ 2025-07-10 20:08 Rosen Penev
  2025-07-10 20:08 ` [PATCHv3 wireless-next 1/7] wifi: rt2x00: add COMPILE_TEST Rosen Penev
                   ` (6 more replies)
  0 siblings, 7 replies; 26+ messages in thread
From: Rosen Penev @ 2025-07-10 20:08 UTC (permalink / raw)
  To: linux-wireless
  Cc: Johannes Berg, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Thomas Bogendoerfer, Matthias Brugger, AngeloGioacchino Del Regno,
	Stanislaw Gruszka,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	open list, open list:MIPS,
	moderated list:ARM/Mediatek SoC support,
	moderated list:ARM/Mediatek SoC support

It doesn't even compile. Added OF bindings, documentation, and other
stuff to hopefully this doesn't happen again.

v2: move all of 2x00soc to 2800soc. I didn't realize only two functions
remained for no good reason.
Fixed typos.
Slightly changed probe for clarity.

v3: fix wrong compatible in Documentation.

Rosen Penev (7):
  wifi: rt2x00: add COMPILE_TEST
  wifi: rt2x00: remove mod_name from platform_driver
  wifi: rt2800soc: allow loading from OF
  wifi: rt2800: move 2x00soc to 2800soc
  wifi: rt2x00: soc: modernize probe
  MIPS: dts: ralink: mt7620a: add wifi
  dt-bindings: net: wireless: rt2800: add

 .../bindings/net/wireless/ralink,rt2800.yaml  |  47 ++++++
 arch/mips/boot/dts/ralink/mt7620a.dtsi        |  10 ++
 drivers/net/wireless/ralink/rt2x00/Kconfig    |   7 +-
 drivers/net/wireless/ralink/rt2x00/Makefile   |   1 -
 .../net/wireless/ralink/rt2x00/rt2800soc.c    | 102 +++++++++++-
 .../net/wireless/ralink/rt2x00/rt2x00soc.c    | 151 ------------------
 .../net/wireless/ralink/rt2x00/rt2x00soc.h    |  29 ----
 7 files changed, 156 insertions(+), 191 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/wireless/ralink,rt2800.yaml
 delete mode 100644 drivers/net/wireless/ralink/rt2x00/rt2x00soc.c
 delete mode 100644 drivers/net/wireless/ralink/rt2x00/rt2x00soc.h

-- 
2.50.0


^ permalink raw reply	[flat|nested] 26+ messages in thread

* [PATCHv3 wireless-next 1/7] wifi: rt2x00: add COMPILE_TEST
  2025-07-10 20:08 [PATCHv3 wireless-next 0/7] wifi: rt2x00: add OF bindings + cleanup Rosen Penev
@ 2025-07-10 20:08 ` Rosen Penev
  2025-07-12  8:59   ` Stanislaw Gruszka
  2025-07-10 20:08 ` [PATCHv3 wireless-next 2/7] wifi: rt2x00: remove mod_name from platform_driver Rosen Penev
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 26+ messages in thread
From: Rosen Penev @ 2025-07-10 20:08 UTC (permalink / raw)
  To: linux-wireless
  Cc: Johannes Berg, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Thomas Bogendoerfer, Matthias Brugger, AngeloGioacchino Del Regno,
	Stanislaw Gruszka,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	open list, open list:MIPS,
	moderated list:ARM/Mediatek SoC support,
	moderated list:ARM/Mediatek SoC support

While this driver is for a specific arch, there is nothing preventing it
from being compiled on other platforms.

Allows the various bots to test compilation and complain if a patch is
bad.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 drivers/net/wireless/ralink/rt2x00/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ralink/rt2x00/Kconfig b/drivers/net/wireless/ralink/rt2x00/Kconfig
index d1fd66d44a7e..3a32ceead54f 100644
--- a/drivers/net/wireless/ralink/rt2x00/Kconfig
+++ b/drivers/net/wireless/ralink/rt2x00/Kconfig
@@ -202,7 +202,7 @@ endif
 
 config RT2800SOC
 	tristate "Ralink WiSoC support"
-	depends on SOC_RT288X || SOC_RT305X || SOC_MT7620
+	depends on SOC_RT288X || SOC_RT305X || SOC_MT7620 || COMPILE_TEST
 	select RT2X00_LIB_SOC
 	select RT2X00_LIB_MMIO
 	select RT2X00_LIB_CRYPTO
-- 
2.50.0


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCHv3 wireless-next 2/7] wifi: rt2x00: remove mod_name from platform_driver
  2025-07-10 20:08 [PATCHv3 wireless-next 0/7] wifi: rt2x00: add OF bindings + cleanup Rosen Penev
  2025-07-10 20:08 ` [PATCHv3 wireless-next 1/7] wifi: rt2x00: add COMPILE_TEST Rosen Penev
@ 2025-07-10 20:08 ` Rosen Penev
  2025-07-12  8:59   ` Stanislaw Gruszka
  2025-07-10 20:08 ` [PATCHv3 wireless-next 3/7] wifi: rt2800soc: allow loading from OF Rosen Penev
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 26+ messages in thread
From: Rosen Penev @ 2025-07-10 20:08 UTC (permalink / raw)
  To: linux-wireless
  Cc: Johannes Berg, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Thomas Bogendoerfer, Matthias Brugger, AngeloGioacchino Del Regno,
	Stanislaw Gruszka,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	open list, open list:MIPS,
	moderated list:ARM/Mediatek SoC support,
	moderated list:ARM/Mediatek SoC support

mod_name is a legacy debugging feature with no real modern use. An
analysis of the underlying MIPS setup code reveals it to also be unused.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Reviewed-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
---
 drivers/net/wireless/ralink/rt2x00/rt2800soc.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
index 701ba54bf3e5..e73394cf6ea6 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
@@ -246,7 +246,6 @@ static int rt2800soc_probe(struct platform_device *pdev)
 static struct platform_driver rt2800soc_driver = {
 	.driver		= {
 		.name		= "rt2800_wmac",
-		.mod_name	= KBUILD_MODNAME,
 	},
 	.probe		= rt2800soc_probe,
 	.remove		= rt2x00soc_remove,
-- 
2.50.0


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCHv3 wireless-next 3/7] wifi: rt2800soc: allow loading from OF
  2025-07-10 20:08 [PATCHv3 wireless-next 0/7] wifi: rt2x00: add OF bindings + cleanup Rosen Penev
  2025-07-10 20:08 ` [PATCHv3 wireless-next 1/7] wifi: rt2x00: add COMPILE_TEST Rosen Penev
  2025-07-10 20:08 ` [PATCHv3 wireless-next 2/7] wifi: rt2x00: remove mod_name from platform_driver Rosen Penev
@ 2025-07-10 20:08 ` Rosen Penev
  2025-07-12 10:14   ` Stanislaw Gruszka
  2025-07-10 20:08 ` [PATCHv3 wireless-next 4/7] wifi: rt2800: move 2x00soc to 2800soc Rosen Penev
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 26+ messages in thread
From: Rosen Penev @ 2025-07-10 20:08 UTC (permalink / raw)
  To: linux-wireless
  Cc: Johannes Berg, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Thomas Bogendoerfer, Matthias Brugger, AngeloGioacchino Del Regno,
	Stanislaw Gruszka,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	open list, open list:MIPS,
	moderated list:ARM/Mediatek SoC support,
	moderated list:ARM/Mediatek SoC support

Add a single binding to help the already present dts files load the
driver. More are possible but there doesn't seem to be a significant
difference between them to justify this.

Use wifi name per dtschema requirements.

The data field will be used to remove the custom non static probe
function and use of_device_get_match_data.

Added OF dependency to SOC CONFIG as adding of_match_table without OF
being present makes no sense.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Reviewed-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
---
 drivers/net/wireless/ralink/rt2x00/Kconfig     | 2 +-
 drivers/net/wireless/ralink/rt2x00/rt2800soc.c | 7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ralink/rt2x00/Kconfig b/drivers/net/wireless/ralink/rt2x00/Kconfig
index 3a32ceead54f..a0dc9a751234 100644
--- a/drivers/net/wireless/ralink/rt2x00/Kconfig
+++ b/drivers/net/wireless/ralink/rt2x00/Kconfig
@@ -202,7 +202,7 @@ endif
 
 config RT2800SOC
 	tristate "Ralink WiSoC support"
-	depends on SOC_RT288X || SOC_RT305X || SOC_MT7620 || COMPILE_TEST
+	depends on OF && (SOC_RT288X || SOC_RT305X || SOC_MT7620 || COMPILE_TEST)
 	select RT2X00_LIB_SOC
 	select RT2X00_LIB_MMIO
 	select RT2X00_LIB_CRYPTO
diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
index e73394cf6ea6..db8d01f0cdc3 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
@@ -243,9 +243,16 @@ static int rt2800soc_probe(struct platform_device *pdev)
 	return rt2x00soc_probe(pdev, &rt2800soc_ops);
 }
 
+static const struct of_device_id rt2880_wmac_match[] = {
+	{ .compatible = "ralink,rt2880-wifi", .data = &rt2800soc_ops },
+	{},
+};
+MODULE_DEVICE_TABLE(of, rt2880_wmac_match);
+
 static struct platform_driver rt2800soc_driver = {
 	.driver		= {
 		.name		= "rt2800_wmac",
+		.of_match_table = rt2880_wmac_match,
 	},
 	.probe		= rt2800soc_probe,
 	.remove		= rt2x00soc_remove,
-- 
2.50.0


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCHv3 wireless-next 4/7] wifi: rt2800: move 2x00soc to 2800soc
  2025-07-10 20:08 [PATCHv3 wireless-next 0/7] wifi: rt2x00: add OF bindings + cleanup Rosen Penev
                   ` (2 preceding siblings ...)
  2025-07-10 20:08 ` [PATCHv3 wireless-next 3/7] wifi: rt2800soc: allow loading from OF Rosen Penev
@ 2025-07-10 20:08 ` Rosen Penev
  2025-07-12 10:20   ` Stanislaw Gruszka
  2025-07-10 20:08 ` [PATCHv3 wireless-next 5/7] wifi: rt2x00: soc: modernize probe Rosen Penev
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 26+ messages in thread
From: Rosen Penev @ 2025-07-10 20:08 UTC (permalink / raw)
  To: linux-wireless
  Cc: Johannes Berg, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Thomas Bogendoerfer, Matthias Brugger, AngeloGioacchino Del Regno,
	Stanislaw Gruszka,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	open list, open list:MIPS,
	moderated list:ARM/Mediatek SoC support,
	moderated list:ARM/Mediatek SoC support

This driver was written with multiple SOC platforms in mind. However
since Ralink was aquired by Mediatek, it only effectively got used by
older platforms. As such, we can slim down the driver slightly by moving
all of rt2x00soc to rt2800soc in order to benefit from inlining.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 drivers/net/wireless/ralink/rt2x00/Kconfig    |   5 -
 drivers/net/wireless/ralink/rt2x00/Makefile   |   1 -
 .../net/wireless/ralink/rt2x00/rt2800soc.c    | 119 +++++++++++++-
 .../net/wireless/ralink/rt2x00/rt2x00soc.c    | 151 ------------------
 .../net/wireless/ralink/rt2x00/rt2x00soc.h    |  29 ----
 5 files changed, 118 insertions(+), 187 deletions(-)
 delete mode 100644 drivers/net/wireless/ralink/rt2x00/rt2x00soc.c
 delete mode 100644 drivers/net/wireless/ralink/rt2x00/rt2x00soc.h

diff --git a/drivers/net/wireless/ralink/rt2x00/Kconfig b/drivers/net/wireless/ralink/rt2x00/Kconfig
index a0dc9a751234..4d98b7723c56 100644
--- a/drivers/net/wireless/ralink/rt2x00/Kconfig
+++ b/drivers/net/wireless/ralink/rt2x00/Kconfig
@@ -203,7 +203,6 @@ endif
 config RT2800SOC
 	tristate "Ralink WiSoC support"
 	depends on OF && (SOC_RT288X || SOC_RT305X || SOC_MT7620 || COMPILE_TEST)
-	select RT2X00_LIB_SOC
 	select RT2X00_LIB_MMIO
 	select RT2X00_LIB_CRYPTO
 	select RT2X00_LIB_FIRMWARE
@@ -231,10 +230,6 @@ config RT2X00_LIB_PCI
 	tristate
 	select RT2X00_LIB
 
-config RT2X00_LIB_SOC
-	tristate
-	select RT2X00_LIB
-
 config RT2X00_LIB_USB
 	tristate
 	select RT2X00_LIB
diff --git a/drivers/net/wireless/ralink/rt2x00/Makefile b/drivers/net/wireless/ralink/rt2x00/Makefile
index de030ebcdf6e..48d84d243606 100644
--- a/drivers/net/wireless/ralink/rt2x00/Makefile
+++ b/drivers/net/wireless/ralink/rt2x00/Makefile
@@ -12,7 +12,6 @@ rt2x00lib-$(CONFIG_RT2X00_LIB_LEDS)	+= rt2x00leds.o
 obj-$(CONFIG_RT2X00_LIB)		+= rt2x00lib.o
 obj-$(CONFIG_RT2X00_LIB_MMIO)		+= rt2x00mmio.o
 obj-$(CONFIG_RT2X00_LIB_PCI)		+= rt2x00pci.o
-obj-$(CONFIG_RT2X00_LIB_SOC)		+= rt2x00soc.o
 obj-$(CONFIG_RT2X00_LIB_USB)		+= rt2x00usb.o
 obj-$(CONFIG_RT2800_LIB)		+= rt2800lib.o
 obj-$(CONFIG_RT2800_LIB_MMIO)		+= rt2800mmio.o
diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
index db8d01f0cdc3..a19906c35d0a 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
@@ -22,7 +22,6 @@
 
 #include "rt2x00.h"
 #include "rt2x00mmio.h"
-#include "rt2x00soc.h"
 #include "rt2800.h"
 #include "rt2800lib.h"
 #include "rt2800mmio.h"
@@ -131,6 +130,124 @@ static int rt2800soc_write_firmware(struct rt2x00_dev *rt2x00dev,
 	return 0;
 }
 
+static void rt2x00soc_free_reg(struct rt2x00_dev *rt2x00dev)
+{
+	kfree(rt2x00dev->rf);
+	rt2x00dev->rf = NULL;
+
+	kfree(rt2x00dev->eeprom);
+	rt2x00dev->eeprom = NULL;
+
+	iounmap(rt2x00dev->csr.base);
+}
+
+static int rt2x00soc_alloc_reg(struct rt2x00_dev *rt2x00dev)
+{
+	struct platform_device *pdev = to_platform_device(rt2x00dev->dev);
+	struct resource *res;
+
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!res)
+		return -ENODEV;
+
+	rt2x00dev->csr.base = ioremap(res->start, resource_size(res));
+	if (!rt2x00dev->csr.base)
+		return -ENOMEM;
+
+	rt2x00dev->eeprom = kzalloc(rt2x00dev->ops->eeprom_size, GFP_KERNEL);
+	if (!rt2x00dev->eeprom)
+		goto exit;
+
+	rt2x00dev->rf = kzalloc(rt2x00dev->ops->rf_size, GFP_KERNEL);
+	if (!rt2x00dev->rf)
+		goto exit;
+
+	return 0;
+
+exit:
+	rt2x00_probe_err("Failed to allocate registers\n");
+	rt2x00soc_free_reg(rt2x00dev);
+
+	return -ENOMEM;
+}
+
+static int rt2x00soc_probe(struct platform_device *pdev, const struct rt2x00_ops *ops)
+{
+	struct ieee80211_hw *hw;
+	struct rt2x00_dev *rt2x00dev;
+	int retval;
+
+	hw = ieee80211_alloc_hw(sizeof(struct rt2x00_dev), ops->hw);
+	if (!hw) {
+		rt2x00_probe_err("Failed to allocate hardware\n");
+		return -ENOMEM;
+	}
+
+	platform_set_drvdata(pdev, hw);
+
+	rt2x00dev = hw->priv;
+	rt2x00dev->dev = &pdev->dev;
+	rt2x00dev->ops = ops;
+	rt2x00dev->hw = hw;
+	rt2x00dev->irq = platform_get_irq(pdev, 0);
+	rt2x00dev->name = pdev->dev.driver->name;
+
+	rt2x00dev->clk = clk_get(&pdev->dev, NULL);
+	if (IS_ERR(rt2x00dev->clk))
+		rt2x00dev->clk = NULL;
+
+	rt2x00_set_chip_intf(rt2x00dev, RT2X00_CHIP_INTF_SOC);
+
+	retval = rt2x00soc_alloc_reg(rt2x00dev);
+	if (retval)
+		goto exit_free_device;
+
+	retval = rt2x00lib_probe_dev(rt2x00dev);
+	if (retval)
+		goto exit_free_reg;
+
+	return 0;
+
+exit_free_reg:
+	rt2x00soc_free_reg(rt2x00dev);
+
+exit_free_device:
+	ieee80211_free_hw(hw);
+
+	return retval;
+}
+
+static void rt2x00soc_remove(struct platform_device *pdev)
+{
+	struct ieee80211_hw *hw = platform_get_drvdata(pdev);
+	struct rt2x00_dev *rt2x00dev = hw->priv;
+
+	/*
+	 * Free all allocated data.
+	 */
+	rt2x00lib_remove_dev(rt2x00dev);
+	rt2x00soc_free_reg(rt2x00dev);
+	ieee80211_free_hw(hw);
+}
+
+#ifdef CONFIG_PM
+static int rt2x00soc_suspend(struct platform_device *pdev, pm_message_t state)
+{
+	struct ieee80211_hw *hw = platform_get_drvdata(pdev);
+	struct rt2x00_dev *rt2x00dev = hw->priv;
+
+	return rt2x00lib_suspend(rt2x00dev);
+}
+
+static int rt2x00soc_resume(struct platform_device *pdev)
+{
+	struct ieee80211_hw *hw = platform_get_drvdata(pdev);
+	struct rt2x00_dev *rt2x00dev = hw->priv;
+
+	return rt2x00lib_resume(rt2x00dev);
+}
+#endif /* CONFIG_PM */
+
 static const struct ieee80211_ops rt2800soc_mac80211_ops = {
 	.add_chanctx = ieee80211_emulate_add_chanctx,
 	.remove_chanctx = ieee80211_emulate_remove_chanctx,
diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00soc.c b/drivers/net/wireless/ralink/rt2x00/rt2x00soc.c
deleted file mode 100644
index f7f3a2340c39..000000000000
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00soc.c
+++ /dev/null
@@ -1,151 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
-	Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com>
-	Copyright (C) 2004 - 2009 Felix Fietkau <nbd@openwrt.org>
-	<http://rt2x00.serialmonkey.com>
-
- */
-
-/*
-	Module: rt2x00soc
-	Abstract: rt2x00 generic soc device routines.
- */
-
-#include <linux/bug.h>
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/platform_device.h>
-#include <linux/slab.h>
-
-#include "rt2x00.h"
-#include "rt2x00soc.h"
-
-static void rt2x00soc_free_reg(struct rt2x00_dev *rt2x00dev)
-{
-	kfree(rt2x00dev->rf);
-	rt2x00dev->rf = NULL;
-
-	kfree(rt2x00dev->eeprom);
-	rt2x00dev->eeprom = NULL;
-
-	iounmap(rt2x00dev->csr.base);
-}
-
-static int rt2x00soc_alloc_reg(struct rt2x00_dev *rt2x00dev)
-{
-	struct platform_device *pdev = to_platform_device(rt2x00dev->dev);
-	struct resource *res;
-
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!res)
-		return -ENODEV;
-
-	rt2x00dev->csr.base = ioremap(res->start, resource_size(res));
-	if (!rt2x00dev->csr.base)
-		return -ENOMEM;
-
-	rt2x00dev->eeprom = kzalloc(rt2x00dev->ops->eeprom_size, GFP_KERNEL);
-	if (!rt2x00dev->eeprom)
-		goto exit;
-
-	rt2x00dev->rf = kzalloc(rt2x00dev->ops->rf_size, GFP_KERNEL);
-	if (!rt2x00dev->rf)
-		goto exit;
-
-	return 0;
-
-exit:
-	rt2x00_probe_err("Failed to allocate registers\n");
-	rt2x00soc_free_reg(rt2x00dev);
-
-	return -ENOMEM;
-}
-
-int rt2x00soc_probe(struct platform_device *pdev, const struct rt2x00_ops *ops)
-{
-	struct ieee80211_hw *hw;
-	struct rt2x00_dev *rt2x00dev;
-	int retval;
-
-	hw = ieee80211_alloc_hw(sizeof(struct rt2x00_dev), ops->hw);
-	if (!hw) {
-		rt2x00_probe_err("Failed to allocate hardware\n");
-		return -ENOMEM;
-	}
-
-	platform_set_drvdata(pdev, hw);
-
-	rt2x00dev = hw->priv;
-	rt2x00dev->dev = &pdev->dev;
-	rt2x00dev->ops = ops;
-	rt2x00dev->hw = hw;
-	rt2x00dev->irq = platform_get_irq(pdev, 0);
-	rt2x00dev->name = pdev->dev.driver->name;
-
-	rt2x00dev->clk = clk_get(&pdev->dev, NULL);
-	if (IS_ERR(rt2x00dev->clk))
-		rt2x00dev->clk = NULL;
-
-	rt2x00_set_chip_intf(rt2x00dev, RT2X00_CHIP_INTF_SOC);
-
-	retval = rt2x00soc_alloc_reg(rt2x00dev);
-	if (retval)
-		goto exit_free_device;
-
-	retval = rt2x00lib_probe_dev(rt2x00dev);
-	if (retval)
-		goto exit_free_reg;
-
-	return 0;
-
-exit_free_reg:
-	rt2x00soc_free_reg(rt2x00dev);
-
-exit_free_device:
-	ieee80211_free_hw(hw);
-
-	return retval;
-}
-EXPORT_SYMBOL_GPL(rt2x00soc_probe);
-
-void rt2x00soc_remove(struct platform_device *pdev)
-{
-	struct ieee80211_hw *hw = platform_get_drvdata(pdev);
-	struct rt2x00_dev *rt2x00dev = hw->priv;
-
-	/*
-	 * Free all allocated data.
-	 */
-	rt2x00lib_remove_dev(rt2x00dev);
-	rt2x00soc_free_reg(rt2x00dev);
-	ieee80211_free_hw(hw);
-}
-EXPORT_SYMBOL_GPL(rt2x00soc_remove);
-
-#ifdef CONFIG_PM
-int rt2x00soc_suspend(struct platform_device *pdev, pm_message_t state)
-{
-	struct ieee80211_hw *hw = platform_get_drvdata(pdev);
-	struct rt2x00_dev *rt2x00dev = hw->priv;
-
-	return rt2x00lib_suspend(rt2x00dev);
-}
-EXPORT_SYMBOL_GPL(rt2x00soc_suspend);
-
-int rt2x00soc_resume(struct platform_device *pdev)
-{
-	struct ieee80211_hw *hw = platform_get_drvdata(pdev);
-	struct rt2x00_dev *rt2x00dev = hw->priv;
-
-	return rt2x00lib_resume(rt2x00dev);
-}
-EXPORT_SYMBOL_GPL(rt2x00soc_resume);
-#endif /* CONFIG_PM */
-
-/*
- * rt2x00soc module information.
- */
-MODULE_AUTHOR(DRV_PROJECT);
-MODULE_VERSION(DRV_VERSION);
-MODULE_DESCRIPTION("rt2x00 soc library");
-MODULE_LICENSE("GPL");
diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00soc.h b/drivers/net/wireless/ralink/rt2x00/rt2x00soc.h
deleted file mode 100644
index d6226b8a10e0..000000000000
--- a/drivers/net/wireless/ralink/rt2x00/rt2x00soc.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-/*
-	Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com>
-	<http://rt2x00.serialmonkey.com>
-
- */
-
-/*
-	Module: rt2x00soc
-	Abstract: Data structures for the rt2x00soc module.
- */
-
-#ifndef RT2X00SOC_H
-#define RT2X00SOC_H
-
-/*
- * SoC driver handlers.
- */
-int rt2x00soc_probe(struct platform_device *pdev, const struct rt2x00_ops *ops);
-void rt2x00soc_remove(struct platform_device *pdev);
-#ifdef CONFIG_PM
-int rt2x00soc_suspend(struct platform_device *pdev, pm_message_t state);
-int rt2x00soc_resume(struct platform_device *pdev);
-#else
-#define rt2x00soc_suspend	NULL
-#define rt2x00soc_resume	NULL
-#endif /* CONFIG_PM */
-
-#endif /* RT2X00SOC_H */
-- 
2.50.0


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCHv3 wireless-next 5/7] wifi: rt2x00: soc: modernize probe
  2025-07-10 20:08 [PATCHv3 wireless-next 0/7] wifi: rt2x00: add OF bindings + cleanup Rosen Penev
                   ` (3 preceding siblings ...)
  2025-07-10 20:08 ` [PATCHv3 wireless-next 4/7] wifi: rt2800: move 2x00soc to 2800soc Rosen Penev
@ 2025-07-10 20:08 ` Rosen Penev
  2025-07-11 14:01   ` Alexander Savchenko
  2025-07-10 20:08 ` [PATCHv3 wireless-next 6/7] MIPS: dts: ralink: mt7620a: add wifi Rosen Penev
  2025-07-10 20:08 ` [PATCHv3 wireless-next 7/7] dt-bindings: net: wireless: rt2800: add Rosen Penev
  6 siblings, 1 reply; 26+ messages in thread
From: Rosen Penev @ 2025-07-10 20:08 UTC (permalink / raw)
  To: linux-wireless
  Cc: Johannes Berg, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Thomas Bogendoerfer, Matthias Brugger, AngeloGioacchino Del Regno,
	Stanislaw Gruszka,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	open list, open list:MIPS,
	moderated list:ARM/Mediatek SoC support,
	moderated list:ARM/Mediatek SoC support

Remove a bunch of static memory management functions and simplify with
devm.

Also move allocation before ieee80211_alloc_hw to get rid of goto
statements and clarify the error handling a bit more.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 .../net/wireless/ralink/rt2x00/rt2800soc.c    | 185 ++++++++----------
 1 file changed, 79 insertions(+), 106 deletions(-)

diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
index a19906c35d0a..6f148dec2469 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
@@ -18,6 +18,7 @@
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
+#include <linux/of.h>
 #include <linux/platform_device.h>
 
 #include "rt2x00.h"
@@ -130,108 +131,8 @@ static int rt2800soc_write_firmware(struct rt2x00_dev *rt2x00dev,
 	return 0;
 }
 
-static void rt2x00soc_free_reg(struct rt2x00_dev *rt2x00dev)
-{
-	kfree(rt2x00dev->rf);
-	rt2x00dev->rf = NULL;
-
-	kfree(rt2x00dev->eeprom);
-	rt2x00dev->eeprom = NULL;
-
-	iounmap(rt2x00dev->csr.base);
-}
-
-static int rt2x00soc_alloc_reg(struct rt2x00_dev *rt2x00dev)
-{
-	struct platform_device *pdev = to_platform_device(rt2x00dev->dev);
-	struct resource *res;
-
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!res)
-		return -ENODEV;
-
-	rt2x00dev->csr.base = ioremap(res->start, resource_size(res));
-	if (!rt2x00dev->csr.base)
-		return -ENOMEM;
-
-	rt2x00dev->eeprom = kzalloc(rt2x00dev->ops->eeprom_size, GFP_KERNEL);
-	if (!rt2x00dev->eeprom)
-		goto exit;
-
-	rt2x00dev->rf = kzalloc(rt2x00dev->ops->rf_size, GFP_KERNEL);
-	if (!rt2x00dev->rf)
-		goto exit;
-
-	return 0;
-
-exit:
-	rt2x00_probe_err("Failed to allocate registers\n");
-	rt2x00soc_free_reg(rt2x00dev);
-
-	return -ENOMEM;
-}
-
-static int rt2x00soc_probe(struct platform_device *pdev, const struct rt2x00_ops *ops)
-{
-	struct ieee80211_hw *hw;
-	struct rt2x00_dev *rt2x00dev;
-	int retval;
-
-	hw = ieee80211_alloc_hw(sizeof(struct rt2x00_dev), ops->hw);
-	if (!hw) {
-		rt2x00_probe_err("Failed to allocate hardware\n");
-		return -ENOMEM;
-	}
-
-	platform_set_drvdata(pdev, hw);
-
-	rt2x00dev = hw->priv;
-	rt2x00dev->dev = &pdev->dev;
-	rt2x00dev->ops = ops;
-	rt2x00dev->hw = hw;
-	rt2x00dev->irq = platform_get_irq(pdev, 0);
-	rt2x00dev->name = pdev->dev.driver->name;
-
-	rt2x00dev->clk = clk_get(&pdev->dev, NULL);
-	if (IS_ERR(rt2x00dev->clk))
-		rt2x00dev->clk = NULL;
-
-	rt2x00_set_chip_intf(rt2x00dev, RT2X00_CHIP_INTF_SOC);
-
-	retval = rt2x00soc_alloc_reg(rt2x00dev);
-	if (retval)
-		goto exit_free_device;
-
-	retval = rt2x00lib_probe_dev(rt2x00dev);
-	if (retval)
-		goto exit_free_reg;
-
-	return 0;
-
-exit_free_reg:
-	rt2x00soc_free_reg(rt2x00dev);
-
-exit_free_device:
-	ieee80211_free_hw(hw);
-
-	return retval;
-}
-
-static void rt2x00soc_remove(struct platform_device *pdev)
-{
-	struct ieee80211_hw *hw = platform_get_drvdata(pdev);
-	struct rt2x00_dev *rt2x00dev = hw->priv;
-
-	/*
-	 * Free all allocated data.
-	 */
-	rt2x00lib_remove_dev(rt2x00dev);
-	rt2x00soc_free_reg(rt2x00dev);
-	ieee80211_free_hw(hw);
-}
-
 #ifdef CONFIG_PM
-static int rt2x00soc_suspend(struct platform_device *pdev, pm_message_t state)
+static int rt2800soc_suspend(struct platform_device *pdev, pm_message_t state)
 {
 	struct ieee80211_hw *hw = platform_get_drvdata(pdev);
 	struct rt2x00_dev *rt2x00dev = hw->priv;
@@ -239,7 +140,7 @@ static int rt2x00soc_suspend(struct platform_device *pdev, pm_message_t state)
 	return rt2x00lib_suspend(rt2x00dev);
 }
 
-static int rt2x00soc_resume(struct platform_device *pdev)
+static int rt2800soc_resume(struct platform_device *pdev)
 {
 	struct ieee80211_hw *hw = platform_get_drvdata(pdev);
 	struct rt2x00_dev *rt2x00dev = hw->priv;
@@ -357,7 +258,77 @@ static const struct rt2x00_ops rt2800soc_ops = {
 
 static int rt2800soc_probe(struct platform_device *pdev)
 {
-	return rt2x00soc_probe(pdev, &rt2800soc_ops);
+	const struct rt2x00_ops *ops = of_device_get_match_data(&pdev->dev);
+	struct rt2x00_dev *rt2x00dev;
+	struct ieee80211_hw *hw;
+	void __iomem *mem;
+	struct clk *clk;
+	__le16 *eeprom;
+	int retval;
+	u32 *rf;
+	int irq;
+
+	mem = devm_platform_ioremap_resource(pdev, 0);
+	if (IS_ERR(mem))
+		return PTR_ERR(mem);
+
+	irq = platform_get_irq(pdev, 0);
+	if (irq < 0)
+		return irq;
+
+	clk = devm_clk_get_optional(&pdev->dev, NULL);
+	if (IS_ERR(clk))
+		return PTR_ERR(clk);
+
+	eeprom = devm_kzalloc(&pdev->dev, ops->eeprom_size, GFP_KERNEL);
+	if (!eeprom)
+		return -ENOMEM;
+
+	rf = devm_kzalloc(&pdev->dev, ops->rf_size, GFP_KERNEL);
+	if (!rf)
+		return -ENOMEM;
+
+	hw = ieee80211_alloc_hw(sizeof(struct rt2x00_dev), ops->hw);
+	if (!hw)
+		return dev_err_probe(&pdev->dev, -ENOMEM, "Failed to allocate hardware");
+
+	platform_set_drvdata(pdev, hw);
+
+	rt2x00dev = hw->priv;
+	rt2x00dev->dev = &pdev->dev;
+	rt2x00dev->ops = ops;
+	rt2x00dev->hw = hw;
+	rt2x00dev->irq = irq;
+	rt2x00dev->clk = clk;
+	rt2x00dev->eeprom = eeprom;
+	rt2x00dev->rf = rf;
+	rt2x00dev->name = pdev->dev.driver->name;
+	rt2x00dev->csr.base = mem;
+
+	rt2x00_set_chip_intf(rt2x00dev, RT2X00_CHIP_INTF_SOC);
+
+	retval = rt2x00lib_probe_dev(rt2x00dev);
+	if (retval)
+		goto exit_free_device;
+
+	return 0;
+
+exit_free_device:
+	ieee80211_free_hw(hw);
+
+	return retval;
+}
+
+static void rt2800soc_remove(struct platform_device *pdev)
+{
+	struct ieee80211_hw *hw = platform_get_drvdata(pdev);
+	struct rt2x00_dev *rt2x00dev = hw->priv;
+
+	/*
+	 * Free all allocated data.
+	 */
+	rt2x00lib_remove_dev(rt2x00dev);
+	ieee80211_free_hw(hw);
 }
 
 static const struct of_device_id rt2880_wmac_match[] = {
@@ -372,9 +343,11 @@ static struct platform_driver rt2800soc_driver = {
 		.of_match_table = rt2880_wmac_match,
 	},
 	.probe		= rt2800soc_probe,
-	.remove		= rt2x00soc_remove,
-	.suspend	= rt2x00soc_suspend,
-	.resume		= rt2x00soc_resume,
+	.remove		= rt2800soc_remove,
+#ifdef CONFIG_PM
+	.suspend	= rt2800soc_suspend,
+	.resume		= rt2800soc_resume,
+#endif
 };
 
 module_platform_driver(rt2800soc_driver);
-- 
2.50.0


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCHv3 wireless-next 6/7] MIPS: dts: ralink: mt7620a: add wifi
  2025-07-10 20:08 [PATCHv3 wireless-next 0/7] wifi: rt2x00: add OF bindings + cleanup Rosen Penev
                   ` (4 preceding siblings ...)
  2025-07-10 20:08 ` [PATCHv3 wireless-next 5/7] wifi: rt2x00: soc: modernize probe Rosen Penev
@ 2025-07-10 20:08 ` Rosen Penev
  2025-07-10 20:08 ` [PATCHv3 wireless-next 7/7] dt-bindings: net: wireless: rt2800: add Rosen Penev
  6 siblings, 0 replies; 26+ messages in thread
From: Rosen Penev @ 2025-07-10 20:08 UTC (permalink / raw)
  To: linux-wireless
  Cc: Johannes Berg, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Thomas Bogendoerfer, Matthias Brugger, AngeloGioacchino Del Regno,
	Stanislaw Gruszka,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	open list, open list:MIPS,
	moderated list:ARM/Mediatek SoC support,
	moderated list:ARM/Mediatek SoC support

MT7620A devices all contain a wifi device as part of the SOC. Add it
here to get it working.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 arch/mips/boot/dts/ralink/mt7620a.dtsi | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/arch/mips/boot/dts/ralink/mt7620a.dtsi b/arch/mips/boot/dts/ralink/mt7620a.dtsi
index d66045948a83..460164bdd430 100644
--- a/arch/mips/boot/dts/ralink/mt7620a.dtsi
+++ b/arch/mips/boot/dts/ralink/mt7620a.dtsi
@@ -62,4 +62,14 @@ uartlite@c00 {
 			reg-shift = <2>;
 		};
 	};
+
+	wmac: wifi@10180000 {
+		compatible = "ralink,rt2880-wifi";
+		reg = <0x10180000 0x40000>;
+
+		clocks = <&sysc 16>;
+
+		interrupt-parent = <&cpuintc>;
+		interrupts = <6>;
+	};
 };
-- 
2.50.0


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* [PATCHv3 wireless-next 7/7] dt-bindings: net: wireless: rt2800: add
  2025-07-10 20:08 [PATCHv3 wireless-next 0/7] wifi: rt2x00: add OF bindings + cleanup Rosen Penev
                   ` (5 preceding siblings ...)
  2025-07-10 20:08 ` [PATCHv3 wireless-next 6/7] MIPS: dts: ralink: mt7620a: add wifi Rosen Penev
@ 2025-07-10 20:08 ` Rosen Penev
  2025-07-10 21:39   ` Krzysztof Kozlowski
  6 siblings, 1 reply; 26+ messages in thread
From: Rosen Penev @ 2025-07-10 20:08 UTC (permalink / raw)
  To: linux-wireless
  Cc: Johannes Berg, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Thomas Bogendoerfer, Matthias Brugger, AngeloGioacchino Del Regno,
	Stanislaw Gruszka,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	open list, open list:MIPS,
	moderated list:ARM/Mediatek SoC support,
	moderated list:ARM/Mediatek SoC support

Add device-tree bindings for the RT2800 SOC wifi device found in older
Ralink/Mediatek devices.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 .../bindings/net/wireless/ralink,rt2800.yaml  | 47 +++++++++++++++++++
 1 file changed, 47 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/wireless/ralink,rt2800.yaml

diff --git a/Documentation/devicetree/bindings/net/wireless/ralink,rt2800.yaml b/Documentation/devicetree/bindings/net/wireless/ralink,rt2800.yaml
new file mode 100644
index 000000000000..8c13b25bd8b4
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/wireless/ralink,rt2800.yaml
@@ -0,0 +1,47 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/wireless/ralink,rt2800.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Ralink RT2800 wireless devices
+
+maintainers:
+  - Stanislaw Gruszka <stf_xl@wp.pl>
+
+description: |
+  This node provides properties for configuring RT2800 SOC wifi device.
+  The node is expected to be specified as a root node of the device.
+
+allOf:
+  - $ref: ieee80211.yaml#
+
+properties:
+  compatible:
+    enum:
+      - ralink,rt2880-wifi
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    wifi@110180000 {
+      compatible = "ralink,rt2880-wifi";
+      reg = <0x10180000 0x40000>;
+      clocks = <&sysc 16>;
+      interrupt-parent = <&cpuintc>;
+      interrupts = <6>;
+    };
-- 
2.50.0


^ permalink raw reply related	[flat|nested] 26+ messages in thread

* Re: [PATCHv3 wireless-next 7/7] dt-bindings: net: wireless: rt2800: add
  2025-07-10 20:08 ` [PATCHv3 wireless-next 7/7] dt-bindings: net: wireless: rt2800: add Rosen Penev
@ 2025-07-10 21:39   ` Krzysztof Kozlowski
  2025-07-10 22:40     ` Rosen Penev
  0 siblings, 1 reply; 26+ messages in thread
From: Krzysztof Kozlowski @ 2025-07-10 21:39 UTC (permalink / raw)
  To: Rosen Penev, linux-wireless
  Cc: Johannes Berg, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Thomas Bogendoerfer, Matthias Brugger, AngeloGioacchino Del Regno,
	Stanislaw Gruszka,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	open list, open list:MIPS,
	moderated list:ARM/Mediatek SoC support,
	moderated list:ARM/Mediatek SoC support

On 10/07/2025 22:08, Rosen Penev wrote:
> Add device-tree bindings for the RT2800 SOC wifi device found in older
> Ralink/Mediatek devices.
> 
> Signed-off-by: Rosen Penev <rosenp@gmail.com>
> ---
>  .../bindings/net/wireless/ralink,rt2800.yaml  | 47 +++++++++++++++++++
>  1 file changed, 47 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/net/wireless/ralink,rt2800.yaml
> 
> diff --git a/Documentation/devicetree/bindings/net/wireless/ralink,rt2800.yaml b/Documentation/devicetree/bindings/net/wireless/ralink,rt2800.yaml
> new file mode 100644
> index 000000000000..8c13b25bd8b4
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/net/wireless/ralink,rt2800.yaml

Filename should match compatible. You were already changing something
here...

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCHv3 wireless-next 7/7] dt-bindings: net: wireless: rt2800: add
  2025-07-10 21:39   ` Krzysztof Kozlowski
@ 2025-07-10 22:40     ` Rosen Penev
  2025-07-11  7:48       ` Krzysztof Kozlowski
  0 siblings, 1 reply; 26+ messages in thread
From: Rosen Penev @ 2025-07-10 22:40 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: linux-wireless, Johannes Berg, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Thomas Bogendoerfer, Matthias Brugger,
	AngeloGioacchino Del Regno, Stanislaw Gruszka,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	open list, open list:MIPS,
	moderated list:ARM/Mediatek SoC support,
	moderated list:ARM/Mediatek SoC support

On Thu, Jul 10, 2025 at 2:40 PM Krzysztof Kozlowski <krzk@kernel.org> wrote:
>
> On 10/07/2025 22:08, Rosen Penev wrote:
> > Add device-tree bindings for the RT2800 SOC wifi device found in older
> > Ralink/Mediatek devices.
> >
> > Signed-off-by: Rosen Penev <rosenp@gmail.com>
> > ---
> >  .../bindings/net/wireless/ralink,rt2800.yaml  | 47 +++++++++++++++++++
> >  1 file changed, 47 insertions(+)
> >  create mode 100644 Documentation/devicetree/bindings/net/wireless/ralink,rt2800.yaml
> >
> > diff --git a/Documentation/devicetree/bindings/net/wireless/ralink,rt2800.yaml b/Documentation/devicetree/bindings/net/wireless/ralink,rt2800.yaml
> > new file mode 100644
> > index 000000000000..8c13b25bd8b4
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/net/wireless/ralink,rt2800.yaml
>
> Filename should match compatible. You were already changing something
> here...
hrm? that makes no sense. Various drivers have multiple compatible lines.
>
> Best regards,
> Krzysztof

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCHv3 wireless-next 7/7] dt-bindings: net: wireless: rt2800: add
  2025-07-10 22:40     ` Rosen Penev
@ 2025-07-11  7:48       ` Krzysztof Kozlowski
  2025-07-12 10:40         ` Stanislaw Gruszka
  0 siblings, 1 reply; 26+ messages in thread
From: Krzysztof Kozlowski @ 2025-07-11  7:48 UTC (permalink / raw)
  To: Rosen Penev
  Cc: linux-wireless, Johannes Berg, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Thomas Bogendoerfer, Matthias Brugger,
	AngeloGioacchino Del Regno, Stanislaw Gruszka,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	open list, open list:MIPS,
	moderated list:ARM/Mediatek SoC support,
	moderated list:ARM/Mediatek SoC support

On Thu, Jul 10, 2025 at 03:40:30PM -0700, Rosen Penev wrote:
> On Thu, Jul 10, 2025 at 2:40 PM Krzysztof Kozlowski <krzk@kernel.org> wrote:
> >
> > On 10/07/2025 22:08, Rosen Penev wrote:
> > > Add device-tree bindings for the RT2800 SOC wifi device found in older
> > > Ralink/Mediatek devices.
> > >
> > > Signed-off-by: Rosen Penev <rosenp@gmail.com>
> > > ---
> > >  .../bindings/net/wireless/ralink,rt2800.yaml  | 47 +++++++++++++++++++
> > >  1 file changed, 47 insertions(+)
> > >  create mode 100644 Documentation/devicetree/bindings/net/wireless/ralink,rt2800.yaml
> > >
> > > diff --git a/Documentation/devicetree/bindings/net/wireless/ralink,rt2800.yaml b/Documentation/devicetree/bindings/net/wireless/ralink,rt2800.yaml
> > > new file mode 100644
> > > index 000000000000..8c13b25bd8b4
> > > --- /dev/null
> > > +++ b/Documentation/devicetree/bindings/net/wireless/ralink,rt2800.yaml
> >
> > Filename should match compatible. You were already changing something
> > here...
> hrm? that makes no sense. Various drivers have multiple compatible lines.

Luckily we do not speak about drivers here. Anyway, follow standard
review practices, you don't get special rules.

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCHv3 wireless-next 5/7] wifi: rt2x00: soc: modernize probe
  2025-07-10 20:08 ` [PATCHv3 wireless-next 5/7] wifi: rt2x00: soc: modernize probe Rosen Penev
@ 2025-07-11 14:01   ` Alexander Savchenko
  2025-07-11 20:33     ` Rosen Penev
  0 siblings, 1 reply; 26+ messages in thread
From: Alexander Savchenko @ 2025-07-11 14:01 UTC (permalink / raw)
  To: rosenp
  Cc: angelogioacchino.delregno, conor+dt, devicetree, johannes,
	krzk+dt, linux-arm-kernel, linux-kernel, linux-mediatek,
	linux-mips, linux-wireless, matthias.bgg, robh, stf_xl, tsbogend

Hi Rosen,

looks like here are memory leaks in the patch, PSB.

> +	eeprom = devm_kzalloc(&pdev->dev, ops->eeprom_size, GFP_KERNEL);
> +	if (!eeprom)
> +		return -ENOMEM;
> +
> +	rf = devm_kzalloc(&pdev->dev, ops->rf_size, GFP_KERNEL);
> +	if (!rf)
Here driver must freed eeprom memory resource.
> +		return -ENOMEM;
> +
> +	hw = ieee80211_alloc_hw(sizeof(struct rt2x00_dev), ops->hw);
> +	if (!hw)
Here driver must freed rf and eeprom resources.
> +		return dev_err_probe(&pdev->dev, -ENOMEM, "Failed to allocate hardware");
> +
> +	platform_set_drvdata(pdev, hw);
> +
> +	rt2x00dev = hw->priv;
> +	rt2x00dev->dev = &pdev->dev;
> +	rt2x00dev->ops = ops;
> +	rt2x00dev->hw = hw;
> +	rt2x00dev->irq = irq;
> +	rt2x00dev->clk = clk;
> +	rt2x00dev->eeprom = eeprom;
> +	rt2x00dev->rf = rf;
> +	rt2x00dev->name = pdev->dev.driver->name;
> +	rt2x00dev->csr.base = mem;
> +
> +	rt2x00_set_chip_intf(rt2x00dev, RT2X00_CHIP_INTF_SOC);
> +
> +	retval = rt2x00lib_probe_dev(rt2x00dev);
> +	if (retval)
> +		goto exit_free_device;
> +
> +	return 0;
> +
> +exit_free_device:
> +	ieee80211_free_hw(hw);
> +
Here driver must freed rf and eeprom resources.
> +	return retval;
> +}

Also need to check the rest of allocated resources: mem, irq, clk.

BR,
Alexander

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCHv3 wireless-next 5/7] wifi: rt2x00: soc: modernize probe
  2025-07-11 14:01   ` Alexander Savchenko
@ 2025-07-11 20:33     ` Rosen Penev
  0 siblings, 0 replies; 26+ messages in thread
From: Rosen Penev @ 2025-07-11 20:33 UTC (permalink / raw)
  To: Alexander Savchenko
  Cc: angelogioacchino.delregno, conor+dt, devicetree, johannes,
	krzk+dt, linux-arm-kernel, linux-kernel, linux-mediatek,
	linux-mips, linux-wireless, matthias.bgg, robh, stf_xl, tsbogend

On Fri, Jul 11, 2025 at 7:01 AM Alexander Savchenko
<oleksandr.savchenko.dn@bp.renesas.com> wrote:
>
> Hi Rosen,
>
> looks like here are memory leaks in the patch, PSB.
>
> > +     eeprom = devm_kzalloc(&pdev->dev, ops->eeprom_size, GFP_KERNEL);
> > +     if (!eeprom)
> > +             return -ENOMEM;
> > +
> > +     rf = devm_kzalloc(&pdev->dev, ops->rf_size, GFP_KERNEL);
> > +     if (!rf)
> Here driver must freed eeprom memory resource.
> > +             return -ENOMEM;
> > +
> > +     hw = ieee80211_alloc_hw(sizeof(struct rt2x00_dev), ops->hw);
> > +     if (!hw)
> Here driver must freed rf and eeprom resources.
> > +             return dev_err_probe(&pdev->dev, -ENOMEM, "Failed to allocate hardware");
> > +
> > +     platform_set_drvdata(pdev, hw);
> > +
> > +     rt2x00dev = hw->priv;
> > +     rt2x00dev->dev = &pdev->dev;
> > +     rt2x00dev->ops = ops;
> > +     rt2x00dev->hw = hw;
> > +     rt2x00dev->irq = irq;
> > +     rt2x00dev->clk = clk;
> > +     rt2x00dev->eeprom = eeprom;
> > +     rt2x00dev->rf = rf;
> > +     rt2x00dev->name = pdev->dev.driver->name;
> > +     rt2x00dev->csr.base = mem;
> > +
> > +     rt2x00_set_chip_intf(rt2x00dev, RT2X00_CHIP_INTF_SOC);
> > +
> > +     retval = rt2x00lib_probe_dev(rt2x00dev);
> > +     if (retval)
> > +             goto exit_free_device;
> > +
> > +     return 0;
> > +
> > +exit_free_device:
> > +     ieee80211_free_hw(hw);
> > +
> Here driver must freed rf and eeprom resources.
> > +     return retval;
> > +}
>
> Also need to check the rest of allocated resources: mem, irq, clk.
The point of devm is to not have to...
>
> BR,
> Alexander

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCHv3 wireless-next 1/7] wifi: rt2x00: add COMPILE_TEST
  2025-07-10 20:08 ` [PATCHv3 wireless-next 1/7] wifi: rt2x00: add COMPILE_TEST Rosen Penev
@ 2025-07-12  8:59   ` Stanislaw Gruszka
  0 siblings, 0 replies; 26+ messages in thread
From: Stanislaw Gruszka @ 2025-07-12  8:59 UTC (permalink / raw)
  To: Rosen Penev
  Cc: linux-wireless, Johannes Berg, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Thomas Bogendoerfer, Matthias Brugger,
	AngeloGioacchino Del Regno,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	open list, open list:MIPS,
	moderated list:ARM/Mediatek SoC support,
	moderated list:ARM/Mediatek SoC support

On Thu, Jul 10, 2025 at 01:08:14PM -0700, Rosen Penev wrote:
> While this driver is for a specific arch, there is nothing preventing it
> from being compiled on other platforms.
> 
> Allows the various bots to test compilation and complain if a patch is
> bad.
> 
> Signed-off-by: Rosen Penev <rosenp@gmail.com>
Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>
> ---
>  drivers/net/wireless/ralink/rt2x00/Kconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/ralink/rt2x00/Kconfig b/drivers/net/wireless/ralink/rt2x00/Kconfig
> index d1fd66d44a7e..3a32ceead54f 100644
> --- a/drivers/net/wireless/ralink/rt2x00/Kconfig
> +++ b/drivers/net/wireless/ralink/rt2x00/Kconfig
> @@ -202,7 +202,7 @@ endif
>  
>  config RT2800SOC
>  	tristate "Ralink WiSoC support"
> -	depends on SOC_RT288X || SOC_RT305X || SOC_MT7620
> +	depends on SOC_RT288X || SOC_RT305X || SOC_MT7620 || COMPILE_TEST
>  	select RT2X00_LIB_SOC
>  	select RT2X00_LIB_MMIO
>  	select RT2X00_LIB_CRYPTO
> -- 
> 2.50.0
> 

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCHv3 wireless-next 2/7] wifi: rt2x00: remove mod_name from platform_driver
  2025-07-10 20:08 ` [PATCHv3 wireless-next 2/7] wifi: rt2x00: remove mod_name from platform_driver Rosen Penev
@ 2025-07-12  8:59   ` Stanislaw Gruszka
  0 siblings, 0 replies; 26+ messages in thread
From: Stanislaw Gruszka @ 2025-07-12  8:59 UTC (permalink / raw)
  To: Rosen Penev
  Cc: linux-wireless, Johannes Berg, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Thomas Bogendoerfer, Matthias Brugger,
	AngeloGioacchino Del Regno,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	open list, open list:MIPS,
	moderated list:ARM/Mediatek SoC support,
	moderated list:ARM/Mediatek SoC support

On Thu, Jul 10, 2025 at 01:08:15PM -0700, Rosen Penev wrote:
> mod_name is a legacy debugging feature with no real modern use. An
> analysis of the underlying MIPS setup code reveals it to also be unused.
> 
> Signed-off-by: Rosen Penev <rosenp@gmail.com>
> Reviewed-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>
> ---
>  drivers/net/wireless/ralink/rt2x00/rt2800soc.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
> index 701ba54bf3e5..e73394cf6ea6 100644
> --- a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
> +++ b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
> @@ -246,7 +246,6 @@ static int rt2800soc_probe(struct platform_device *pdev)
>  static struct platform_driver rt2800soc_driver = {
>  	.driver		= {
>  		.name		= "rt2800_wmac",
> -		.mod_name	= KBUILD_MODNAME,
>  	},
>  	.probe		= rt2800soc_probe,
>  	.remove		= rt2x00soc_remove,
> -- 
> 2.50.0
> 

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCHv3 wireless-next 3/7] wifi: rt2800soc: allow loading from OF
  2025-07-10 20:08 ` [PATCHv3 wireless-next 3/7] wifi: rt2800soc: allow loading from OF Rosen Penev
@ 2025-07-12 10:14   ` Stanislaw Gruszka
  2025-07-12 19:02     ` Rosen Penev
  0 siblings, 1 reply; 26+ messages in thread
From: Stanislaw Gruszka @ 2025-07-12 10:14 UTC (permalink / raw)
  To: Rosen Penev
  Cc: linux-wireless, Johannes Berg, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Thomas Bogendoerfer, Matthias Brugger,
	AngeloGioacchino Del Regno,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	open list, open list:MIPS,
	moderated list:ARM/Mediatek SoC support,
	moderated list:ARM/Mediatek SoC support

On Thu, Jul 10, 2025 at 01:08:16PM -0700, Rosen Penev wrote:
> Add a single binding to help the already present dts files load the
> driver. More are possible but there doesn't seem to be a significant
> difference between them to justify this.
> 
> Use wifi name per dtschema requirements.
> 
> The data field will be used to remove the custom non static probe
> function and use of_device_get_match_data.
> 
> Added OF dependency to SOC CONFIG as adding of_match_table without OF
> being present makes no sense.
> 
> Signed-off-by: Rosen Penev <rosenp@gmail.com>
> Reviewed-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
> ---
>  drivers/net/wireless/ralink/rt2x00/Kconfig     | 2 +-
>  drivers/net/wireless/ralink/rt2x00/rt2800soc.c | 7 +++++++
>  2 files changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/ralink/rt2x00/Kconfig b/drivers/net/wireless/ralink/rt2x00/Kconfig
> index 3a32ceead54f..a0dc9a751234 100644
> --- a/drivers/net/wireless/ralink/rt2x00/Kconfig
> +++ b/drivers/net/wireless/ralink/rt2x00/Kconfig
> @@ -202,7 +202,7 @@ endif
>  
>  config RT2800SOC
>  	tristate "Ralink WiSoC support"
> -	depends on SOC_RT288X || SOC_RT305X || SOC_MT7620 || COMPILE_TEST
> +	depends on OF && (SOC_RT288X || SOC_RT305X || SOC_MT7620 || COMPILE_TEST)
>  	select RT2X00_LIB_SOC
>  	select RT2X00_LIB_MMIO
>  	select RT2X00_LIB_CRYPTO
> diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
> index e73394cf6ea6..db8d01f0cdc3 100644
> --- a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
> +++ b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
> @@ -243,9 +243,16 @@ static int rt2800soc_probe(struct platform_device *pdev)
>  	return rt2x00soc_probe(pdev, &rt2800soc_ops);
>  }
>  
> +static const struct of_device_id rt2880_wmac_match[] = {
> +	{ .compatible = "ralink,rt2880-wifi", .data = &rt2800soc_ops },

Why do .data = rt2800soc_ops here and use it via of_device_get_match_data()
in patch 5, insead of just use rt2800soc_ops directly in rt2800soc_probe ? 

Regards
Stanislaw

> +	{},
> +};
> +MODULE_DEVICE_TABLE(of, rt2880_wmac_match);
> +
>  static struct platform_driver rt2800soc_driver = {
>  	.driver		= {
>  		.name		= "rt2800_wmac",
> +		.of_match_table = rt2880_wmac_match,
>  	},
>  	.probe		= rt2800soc_probe,
>  	.remove		= rt2x00soc_remove,
> -- 
> 2.50.0
> 

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCHv3 wireless-next 4/7] wifi: rt2800: move 2x00soc to 2800soc
  2025-07-10 20:08 ` [PATCHv3 wireless-next 4/7] wifi: rt2800: move 2x00soc to 2800soc Rosen Penev
@ 2025-07-12 10:20   ` Stanislaw Gruszka
  0 siblings, 0 replies; 26+ messages in thread
From: Stanislaw Gruszka @ 2025-07-12 10:20 UTC (permalink / raw)
  To: Rosen Penev
  Cc: linux-wireless, Johannes Berg, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Thomas Bogendoerfer, Matthias Brugger,
	AngeloGioacchino Del Regno,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	open list, open list:MIPS,
	moderated list:ARM/Mediatek SoC support,
	moderated list:ARM/Mediatek SoC support

On Thu, Jul 10, 2025 at 01:08:17PM -0700, Rosen Penev wrote:
> This driver was written with multiple SOC platforms in mind. However
> since Ralink was aquired by Mediatek, it only effectively got used by
> older platforms. As such, we can slim down the driver slightly by moving
> all of rt2x00soc to rt2800soc in order to benefit from inlining.
> 
> Signed-off-by: Rosen Penev <rosenp@gmail.com>
Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>

> ---
>  drivers/net/wireless/ralink/rt2x00/Kconfig    |   5 -
>  drivers/net/wireless/ralink/rt2x00/Makefile   |   1 -
>  .../net/wireless/ralink/rt2x00/rt2800soc.c    | 119 +++++++++++++-
>  .../net/wireless/ralink/rt2x00/rt2x00soc.c    | 151 ------------------
>  .../net/wireless/ralink/rt2x00/rt2x00soc.h    |  29 ----
>  5 files changed, 118 insertions(+), 187 deletions(-)
>  delete mode 100644 drivers/net/wireless/ralink/rt2x00/rt2x00soc.c
>  delete mode 100644 drivers/net/wireless/ralink/rt2x00/rt2x00soc.h
> 
> diff --git a/drivers/net/wireless/ralink/rt2x00/Kconfig b/drivers/net/wireless/ralink/rt2x00/Kconfig
> index a0dc9a751234..4d98b7723c56 100644
> --- a/drivers/net/wireless/ralink/rt2x00/Kconfig
> +++ b/drivers/net/wireless/ralink/rt2x00/Kconfig
> @@ -203,7 +203,6 @@ endif
>  config RT2800SOC
>  	tristate "Ralink WiSoC support"
>  	depends on OF && (SOC_RT288X || SOC_RT305X || SOC_MT7620 || COMPILE_TEST)
> -	select RT2X00_LIB_SOC
>  	select RT2X00_LIB_MMIO
>  	select RT2X00_LIB_CRYPTO
>  	select RT2X00_LIB_FIRMWARE
> @@ -231,10 +230,6 @@ config RT2X00_LIB_PCI
>  	tristate
>  	select RT2X00_LIB
>  
> -config RT2X00_LIB_SOC
> -	tristate
> -	select RT2X00_LIB
> -
>  config RT2X00_LIB_USB
>  	tristate
>  	select RT2X00_LIB
> diff --git a/drivers/net/wireless/ralink/rt2x00/Makefile b/drivers/net/wireless/ralink/rt2x00/Makefile
> index de030ebcdf6e..48d84d243606 100644
> --- a/drivers/net/wireless/ralink/rt2x00/Makefile
> +++ b/drivers/net/wireless/ralink/rt2x00/Makefile
> @@ -12,7 +12,6 @@ rt2x00lib-$(CONFIG_RT2X00_LIB_LEDS)	+= rt2x00leds.o
>  obj-$(CONFIG_RT2X00_LIB)		+= rt2x00lib.o
>  obj-$(CONFIG_RT2X00_LIB_MMIO)		+= rt2x00mmio.o
>  obj-$(CONFIG_RT2X00_LIB_PCI)		+= rt2x00pci.o
> -obj-$(CONFIG_RT2X00_LIB_SOC)		+= rt2x00soc.o
>  obj-$(CONFIG_RT2X00_LIB_USB)		+= rt2x00usb.o
>  obj-$(CONFIG_RT2800_LIB)		+= rt2800lib.o
>  obj-$(CONFIG_RT2800_LIB_MMIO)		+= rt2800mmio.o
> diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
> index db8d01f0cdc3..a19906c35d0a 100644
> --- a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
> +++ b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
> @@ -22,7 +22,6 @@
>  
>  #include "rt2x00.h"
>  #include "rt2x00mmio.h"
> -#include "rt2x00soc.h"
>  #include "rt2800.h"
>  #include "rt2800lib.h"
>  #include "rt2800mmio.h"
> @@ -131,6 +130,124 @@ static int rt2800soc_write_firmware(struct rt2x00_dev *rt2x00dev,
>  	return 0;
>  }
>  
> +static void rt2x00soc_free_reg(struct rt2x00_dev *rt2x00dev)
> +{
> +	kfree(rt2x00dev->rf);
> +	rt2x00dev->rf = NULL;
> +
> +	kfree(rt2x00dev->eeprom);
> +	rt2x00dev->eeprom = NULL;
> +
> +	iounmap(rt2x00dev->csr.base);
> +}
> +
> +static int rt2x00soc_alloc_reg(struct rt2x00_dev *rt2x00dev)
> +{
> +	struct platform_device *pdev = to_platform_device(rt2x00dev->dev);
> +	struct resource *res;
> +
> +	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> +	if (!res)
> +		return -ENODEV;
> +
> +	rt2x00dev->csr.base = ioremap(res->start, resource_size(res));
> +	if (!rt2x00dev->csr.base)
> +		return -ENOMEM;
> +
> +	rt2x00dev->eeprom = kzalloc(rt2x00dev->ops->eeprom_size, GFP_KERNEL);
> +	if (!rt2x00dev->eeprom)
> +		goto exit;
> +
> +	rt2x00dev->rf = kzalloc(rt2x00dev->ops->rf_size, GFP_KERNEL);
> +	if (!rt2x00dev->rf)
> +		goto exit;
> +
> +	return 0;
> +
> +exit:
> +	rt2x00_probe_err("Failed to allocate registers\n");
> +	rt2x00soc_free_reg(rt2x00dev);
> +
> +	return -ENOMEM;
> +}
> +
> +static int rt2x00soc_probe(struct platform_device *pdev, const struct rt2x00_ops *ops)
> +{
> +	struct ieee80211_hw *hw;
> +	struct rt2x00_dev *rt2x00dev;
> +	int retval;
> +
> +	hw = ieee80211_alloc_hw(sizeof(struct rt2x00_dev), ops->hw);
> +	if (!hw) {
> +		rt2x00_probe_err("Failed to allocate hardware\n");
> +		return -ENOMEM;
> +	}
> +
> +	platform_set_drvdata(pdev, hw);
> +
> +	rt2x00dev = hw->priv;
> +	rt2x00dev->dev = &pdev->dev;
> +	rt2x00dev->ops = ops;
> +	rt2x00dev->hw = hw;
> +	rt2x00dev->irq = platform_get_irq(pdev, 0);
> +	rt2x00dev->name = pdev->dev.driver->name;
> +
> +	rt2x00dev->clk = clk_get(&pdev->dev, NULL);
> +	if (IS_ERR(rt2x00dev->clk))
> +		rt2x00dev->clk = NULL;
> +
> +	rt2x00_set_chip_intf(rt2x00dev, RT2X00_CHIP_INTF_SOC);
> +
> +	retval = rt2x00soc_alloc_reg(rt2x00dev);
> +	if (retval)
> +		goto exit_free_device;
> +
> +	retval = rt2x00lib_probe_dev(rt2x00dev);
> +	if (retval)
> +		goto exit_free_reg;
> +
> +	return 0;
> +
> +exit_free_reg:
> +	rt2x00soc_free_reg(rt2x00dev);
> +
> +exit_free_device:
> +	ieee80211_free_hw(hw);
> +
> +	return retval;
> +}
> +
> +static void rt2x00soc_remove(struct platform_device *pdev)
> +{
> +	struct ieee80211_hw *hw = platform_get_drvdata(pdev);
> +	struct rt2x00_dev *rt2x00dev = hw->priv;
> +
> +	/*
> +	 * Free all allocated data.
> +	 */
> +	rt2x00lib_remove_dev(rt2x00dev);
> +	rt2x00soc_free_reg(rt2x00dev);
> +	ieee80211_free_hw(hw);
> +}
> +
> +#ifdef CONFIG_PM
> +static int rt2x00soc_suspend(struct platform_device *pdev, pm_message_t state)
> +{
> +	struct ieee80211_hw *hw = platform_get_drvdata(pdev);
> +	struct rt2x00_dev *rt2x00dev = hw->priv;
> +
> +	return rt2x00lib_suspend(rt2x00dev);
> +}
> +
> +static int rt2x00soc_resume(struct platform_device *pdev)
> +{
> +	struct ieee80211_hw *hw = platform_get_drvdata(pdev);
> +	struct rt2x00_dev *rt2x00dev = hw->priv;
> +
> +	return rt2x00lib_resume(rt2x00dev);
> +}
> +#endif /* CONFIG_PM */
> +
>  static const struct ieee80211_ops rt2800soc_mac80211_ops = {
>  	.add_chanctx = ieee80211_emulate_add_chanctx,
>  	.remove_chanctx = ieee80211_emulate_remove_chanctx,
> diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00soc.c b/drivers/net/wireless/ralink/rt2x00/rt2x00soc.c
> deleted file mode 100644
> index f7f3a2340c39..000000000000
> --- a/drivers/net/wireless/ralink/rt2x00/rt2x00soc.c
> +++ /dev/null
> @@ -1,151 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0-or-later
> -/*
> -	Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com>
> -	Copyright (C) 2004 - 2009 Felix Fietkau <nbd@openwrt.org>
> -	<http://rt2x00.serialmonkey.com>
> -
> - */
> -
> -/*
> -	Module: rt2x00soc
> -	Abstract: rt2x00 generic soc device routines.
> - */
> -
> -#include <linux/bug.h>
> -#include <linux/kernel.h>
> -#include <linux/module.h>
> -#include <linux/platform_device.h>
> -#include <linux/slab.h>
> -
> -#include "rt2x00.h"
> -#include "rt2x00soc.h"
> -
> -static void rt2x00soc_free_reg(struct rt2x00_dev *rt2x00dev)
> -{
> -	kfree(rt2x00dev->rf);
> -	rt2x00dev->rf = NULL;
> -
> -	kfree(rt2x00dev->eeprom);
> -	rt2x00dev->eeprom = NULL;
> -
> -	iounmap(rt2x00dev->csr.base);
> -}
> -
> -static int rt2x00soc_alloc_reg(struct rt2x00_dev *rt2x00dev)
> -{
> -	struct platform_device *pdev = to_platform_device(rt2x00dev->dev);
> -	struct resource *res;
> -
> -	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -	if (!res)
> -		return -ENODEV;
> -
> -	rt2x00dev->csr.base = ioremap(res->start, resource_size(res));
> -	if (!rt2x00dev->csr.base)
> -		return -ENOMEM;
> -
> -	rt2x00dev->eeprom = kzalloc(rt2x00dev->ops->eeprom_size, GFP_KERNEL);
> -	if (!rt2x00dev->eeprom)
> -		goto exit;
> -
> -	rt2x00dev->rf = kzalloc(rt2x00dev->ops->rf_size, GFP_KERNEL);
> -	if (!rt2x00dev->rf)
> -		goto exit;
> -
> -	return 0;
> -
> -exit:
> -	rt2x00_probe_err("Failed to allocate registers\n");
> -	rt2x00soc_free_reg(rt2x00dev);
> -
> -	return -ENOMEM;
> -}
> -
> -int rt2x00soc_probe(struct platform_device *pdev, const struct rt2x00_ops *ops)
> -{
> -	struct ieee80211_hw *hw;
> -	struct rt2x00_dev *rt2x00dev;
> -	int retval;
> -
> -	hw = ieee80211_alloc_hw(sizeof(struct rt2x00_dev), ops->hw);
> -	if (!hw) {
> -		rt2x00_probe_err("Failed to allocate hardware\n");
> -		return -ENOMEM;
> -	}
> -
> -	platform_set_drvdata(pdev, hw);
> -
> -	rt2x00dev = hw->priv;
> -	rt2x00dev->dev = &pdev->dev;
> -	rt2x00dev->ops = ops;
> -	rt2x00dev->hw = hw;
> -	rt2x00dev->irq = platform_get_irq(pdev, 0);
> -	rt2x00dev->name = pdev->dev.driver->name;
> -
> -	rt2x00dev->clk = clk_get(&pdev->dev, NULL);
> -	if (IS_ERR(rt2x00dev->clk))
> -		rt2x00dev->clk = NULL;
> -
> -	rt2x00_set_chip_intf(rt2x00dev, RT2X00_CHIP_INTF_SOC);
> -
> -	retval = rt2x00soc_alloc_reg(rt2x00dev);
> -	if (retval)
> -		goto exit_free_device;
> -
> -	retval = rt2x00lib_probe_dev(rt2x00dev);
> -	if (retval)
> -		goto exit_free_reg;
> -
> -	return 0;
> -
> -exit_free_reg:
> -	rt2x00soc_free_reg(rt2x00dev);
> -
> -exit_free_device:
> -	ieee80211_free_hw(hw);
> -
> -	return retval;
> -}
> -EXPORT_SYMBOL_GPL(rt2x00soc_probe);
> -
> -void rt2x00soc_remove(struct platform_device *pdev)
> -{
> -	struct ieee80211_hw *hw = platform_get_drvdata(pdev);
> -	struct rt2x00_dev *rt2x00dev = hw->priv;
> -
> -	/*
> -	 * Free all allocated data.
> -	 */
> -	rt2x00lib_remove_dev(rt2x00dev);
> -	rt2x00soc_free_reg(rt2x00dev);
> -	ieee80211_free_hw(hw);
> -}
> -EXPORT_SYMBOL_GPL(rt2x00soc_remove);
> -
> -#ifdef CONFIG_PM
> -int rt2x00soc_suspend(struct platform_device *pdev, pm_message_t state)
> -{
> -	struct ieee80211_hw *hw = platform_get_drvdata(pdev);
> -	struct rt2x00_dev *rt2x00dev = hw->priv;
> -
> -	return rt2x00lib_suspend(rt2x00dev);
> -}
> -EXPORT_SYMBOL_GPL(rt2x00soc_suspend);
> -
> -int rt2x00soc_resume(struct platform_device *pdev)
> -{
> -	struct ieee80211_hw *hw = platform_get_drvdata(pdev);
> -	struct rt2x00_dev *rt2x00dev = hw->priv;
> -
> -	return rt2x00lib_resume(rt2x00dev);
> -}
> -EXPORT_SYMBOL_GPL(rt2x00soc_resume);
> -#endif /* CONFIG_PM */
> -
> -/*
> - * rt2x00soc module information.
> - */
> -MODULE_AUTHOR(DRV_PROJECT);
> -MODULE_VERSION(DRV_VERSION);
> -MODULE_DESCRIPTION("rt2x00 soc library");
> -MODULE_LICENSE("GPL");
> diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00soc.h b/drivers/net/wireless/ralink/rt2x00/rt2x00soc.h
> deleted file mode 100644
> index d6226b8a10e0..000000000000
> --- a/drivers/net/wireless/ralink/rt2x00/rt2x00soc.h
> +++ /dev/null
> @@ -1,29 +0,0 @@
> -/* SPDX-License-Identifier: GPL-2.0-or-later */
> -/*
> -	Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com>
> -	<http://rt2x00.serialmonkey.com>
> -
> - */
> -
> -/*
> -	Module: rt2x00soc
> -	Abstract: Data structures for the rt2x00soc module.
> - */
> -
> -#ifndef RT2X00SOC_H
> -#define RT2X00SOC_H
> -
> -/*
> - * SoC driver handlers.
> - */
> -int rt2x00soc_probe(struct platform_device *pdev, const struct rt2x00_ops *ops);
> -void rt2x00soc_remove(struct platform_device *pdev);
> -#ifdef CONFIG_PM
> -int rt2x00soc_suspend(struct platform_device *pdev, pm_message_t state);
> -int rt2x00soc_resume(struct platform_device *pdev);
> -#else
> -#define rt2x00soc_suspend	NULL
> -#define rt2x00soc_resume	NULL
> -#endif /* CONFIG_PM */
> -
> -#endif /* RT2X00SOC_H */
> -- 
> 2.50.0
> 

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCHv3 wireless-next 7/7] dt-bindings: net: wireless: rt2800: add
  2025-07-11  7:48       ` Krzysztof Kozlowski
@ 2025-07-12 10:40         ` Stanislaw Gruszka
  2025-07-12 16:53           ` Krzysztof Kozlowski
  0 siblings, 1 reply; 26+ messages in thread
From: Stanislaw Gruszka @ 2025-07-12 10:40 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Rosen Penev, linux-wireless, Johannes Berg, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Thomas Bogendoerfer,
	Matthias Brugger, AngeloGioacchino Del Regno,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	open list, open list:MIPS,
	moderated list:ARM/Mediatek SoC support,
	moderated list:ARM/Mediatek SoC support

Hi Krzysztof,

On Fri, Jul 11, 2025 at 09:48:49AM +0200, Krzysztof Kozlowski wrote:
> On Thu, Jul 10, 2025 at 03:40:30PM -0700, Rosen Penev wrote:
> > On Thu, Jul 10, 2025 at 2:40 PM Krzysztof Kozlowski <krzk@kernel.org> wrote:
> > >
> > > On 10/07/2025 22:08, Rosen Penev wrote:
> > > > Add device-tree bindings for the RT2800 SOC wifi device found in older
> > > > Ralink/Mediatek devices.
> > > >
> > > > Signed-off-by: Rosen Penev <rosenp@gmail.com>
> > > > ---
> > > >  .../bindings/net/wireless/ralink,rt2800.yaml  | 47 +++++++++++++++++++
> > > >  1 file changed, 47 insertions(+)
> > > >  create mode 100644 Documentation/devicetree/bindings/net/wireless/ralink,rt2800.yaml
> > > >
> > > > diff --git a/Documentation/devicetree/bindings/net/wireless/ralink,rt2800.yaml b/Documentation/devicetree/bindings/net/wireless/ralink,rt2800.yaml
> > > > new file mode 100644
> > > > index 000000000000..8c13b25bd8b4
> > > > --- /dev/null
> > > > +++ b/Documentation/devicetree/bindings/net/wireless/ralink,rt2800.yaml
> > >
> > > Filename should match compatible. You were already changing something
> > > here...
> > hrm? that makes no sense. Various drivers have multiple compatible lines.
> 
> Luckily we do not speak about drivers here. Anyway, follow standard
> review practices, you don't get special rules.

Could you please elaborate what you mean ?

I greped through Documentation/devicetree/bindings/*/*.yaml and plenty
of "compatible:" items do not match the filename. So hard to tell
what rule you are referencing, as it seems it's not really applied.

Regards
Stanislaw

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCHv3 wireless-next 7/7] dt-bindings: net: wireless: rt2800: add
  2025-07-12 10:40         ` Stanislaw Gruszka
@ 2025-07-12 16:53           ` Krzysztof Kozlowski
  2025-07-12 16:59             ` Krzysztof Kozlowski
  0 siblings, 1 reply; 26+ messages in thread
From: Krzysztof Kozlowski @ 2025-07-12 16:53 UTC (permalink / raw)
  To: Stanislaw Gruszka
  Cc: Rosen Penev, linux-wireless, Johannes Berg, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Thomas Bogendoerfer,
	Matthias Brugger, AngeloGioacchino Del Regno,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	open list, open list:MIPS,
	moderated list:ARM/Mediatek SoC support,
	moderated list:ARM/Mediatek SoC support

On 12/07/2025 12:40, Stanislaw Gruszka wrote:
> Hi Krzysztof,
> 
> On Fri, Jul 11, 2025 at 09:48:49AM +0200, Krzysztof Kozlowski wrote:
>> On Thu, Jul 10, 2025 at 03:40:30PM -0700, Rosen Penev wrote:
>>> On Thu, Jul 10, 2025 at 2:40 PM Krzysztof Kozlowski <krzk@kernel.org> wrote:
>>>>
>>>> On 10/07/2025 22:08, Rosen Penev wrote:
>>>>> Add device-tree bindings for the RT2800 SOC wifi device found in older
>>>>> Ralink/Mediatek devices.
>>>>>
>>>>> Signed-off-by: Rosen Penev <rosenp@gmail.com>
>>>>> ---
>>>>>  .../bindings/net/wireless/ralink,rt2800.yaml  | 47 +++++++++++++++++++
>>>>>  1 file changed, 47 insertions(+)
>>>>>  create mode 100644 Documentation/devicetree/bindings/net/wireless/ralink,rt2800.yaml
>>>>>
>>>>> diff --git a/Documentation/devicetree/bindings/net/wireless/ralink,rt2800.yaml b/Documentation/devicetree/bindings/net/wireless/ralink,rt2800.yaml
>>>>> new file mode 100644
>>>>> index 000000000000..8c13b25bd8b4
>>>>> --- /dev/null
>>>>> +++ b/Documentation/devicetree/bindings/net/wireless/ralink,rt2800.yaml
>>>>
>>>> Filename should match compatible. You were already changing something
>>>> here...
>>> hrm? that makes no sense. Various drivers have multiple compatible lines.
>>
>> Luckily we do not speak about drivers here. Anyway, follow standard
>> review practices, you don't get special rules.
> 
> Could you please elaborate what you mean ?

Rosen replied in abrasive way, so I am not going to dig this.

> 
> I greped through Documentation/devicetree/bindings/*/*.yaml and plenty

I assume you refer to last 2 years bindings, not something older, right?
It is really poor argument to find old files and use them as example
"they did like that".

> of "compatible:" items do not match the filename. So hard to tell

I did not ask for compatible to match filename.

> what rule you are referencing, as it seems it's not really applied.
Check reviews on the lists. It is pretty standard review. Everyone gets
it for this case here - single device, single compatible.

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCHv3 wireless-next 7/7] dt-bindings: net: wireless: rt2800: add
  2025-07-12 16:53           ` Krzysztof Kozlowski
@ 2025-07-12 16:59             ` Krzysztof Kozlowski
  2025-07-12 23:20               ` Julian Calaby
  0 siblings, 1 reply; 26+ messages in thread
From: Krzysztof Kozlowski @ 2025-07-12 16:59 UTC (permalink / raw)
  To: Stanislaw Gruszka
  Cc: Rosen Penev, linux-wireless, Johannes Berg, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Thomas Bogendoerfer,
	Matthias Brugger, AngeloGioacchino Del Regno,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	open list, open list:MIPS,
	moderated list:ARM/Mediatek SoC support,
	moderated list:ARM/Mediatek SoC support

On 12/07/2025 18:53, Krzysztof Kozlowski wrote:
> On 12/07/2025 12:40, Stanislaw Gruszka wrote:
>> Hi Krzysztof,
>>
>> On Fri, Jul 11, 2025 at 09:48:49AM +0200, Krzysztof Kozlowski wrote:
>>> On Thu, Jul 10, 2025 at 03:40:30PM -0700, Rosen Penev wrote:
>>>> On Thu, Jul 10, 2025 at 2:40 PM Krzysztof Kozlowski <krzk@kernel.org> wrote:
>>>>>
>>>>> On 10/07/2025 22:08, Rosen Penev wrote:
>>>>>> Add device-tree bindings for the RT2800 SOC wifi device found in older
>>>>>> Ralink/Mediatek devices.
>>>>>>
>>>>>> Signed-off-by: Rosen Penev <rosenp@gmail.com>
>>>>>> ---
>>>>>>  .../bindings/net/wireless/ralink,rt2800.yaml  | 47 +++++++++++++++++++
>>>>>>  1 file changed, 47 insertions(+)
>>>>>>  create mode 100644 Documentation/devicetree/bindings/net/wireless/ralink,rt2800.yaml
>>>>>>
>>>>>> diff --git a/Documentation/devicetree/bindings/net/wireless/ralink,rt2800.yaml b/Documentation/devicetree/bindings/net/wireless/ralink,rt2800.yaml
>>>>>> new file mode 100644
>>>>>> index 000000000000..8c13b25bd8b4
>>>>>> --- /dev/null
>>>>>> +++ b/Documentation/devicetree/bindings/net/wireless/ralink,rt2800.yaml
>>>>>
>>>>> Filename should match compatible. You were already changing something
>>>>> here...
>>>> hrm? that makes no sense. Various drivers have multiple compatible lines.
>>>
>>> Luckily we do not speak about drivers here. Anyway, follow standard
>>> review practices, you don't get special rules.
>>
>> Could you please elaborate what you mean ?
> 
> Rosen replied in abrasive way, so I am not going to dig this.
> 
>>
>> I greped through Documentation/devicetree/bindings/*/*.yaml and plenty
> 
> I assume you refer to last 2 years bindings, not something older, right?
> It is really poor argument to find old files and use them as example
> "they did like that".
> 
>> of "compatible:" items do not match the filename. So hard to tell
> 
> I did not ask for compatible to match filename.
> 
>> what rule you are referencing, as it seems it's not really applied.
> Check reviews on the lists. It is pretty standard review. Everyone gets
> it for this case here - single device, single compatible.

BTW, it is not hiding on the lists:

https://lore.kernel.org/linux-devicetree/?q=f%3Aherring+filename
https://lore.kernel.org/linux-devicetree/?q=f%3Akozlowski+filename

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCHv3 wireless-next 3/7] wifi: rt2800soc: allow loading from OF
  2025-07-12 10:14   ` Stanislaw Gruszka
@ 2025-07-12 19:02     ` Rosen Penev
  2025-07-13  7:15       ` Stanislaw Gruszka
  0 siblings, 1 reply; 26+ messages in thread
From: Rosen Penev @ 2025-07-12 19:02 UTC (permalink / raw)
  To: Stanislaw Gruszka
  Cc: linux-wireless, Johannes Berg, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Thomas Bogendoerfer, Matthias Brugger,
	AngeloGioacchino Del Regno,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	open list, open list:MIPS,
	moderated list:ARM/Mediatek SoC support,
	moderated list:ARM/Mediatek SoC support

On Sat, Jul 12, 2025 at 3:14 AM Stanislaw Gruszka <stf_xl@wp.pl> wrote:
>
> On Thu, Jul 10, 2025 at 01:08:16PM -0700, Rosen Penev wrote:
> > Add a single binding to help the already present dts files load the
> > driver. More are possible but there doesn't seem to be a significant
> > difference between them to justify this.
> >
> > Use wifi name per dtschema requirements.
> >
> > The data field will be used to remove the custom non static probe
> > function and use of_device_get_match_data.
> >
> > Added OF dependency to SOC CONFIG as adding of_match_table without OF
> > being present makes no sense.
> >
> > Signed-off-by: Rosen Penev <rosenp@gmail.com>
> > Reviewed-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
> > ---
> >  drivers/net/wireless/ralink/rt2x00/Kconfig     | 2 +-
> >  drivers/net/wireless/ralink/rt2x00/rt2800soc.c | 7 +++++++
> >  2 files changed, 8 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/wireless/ralink/rt2x00/Kconfig b/drivers/net/wireless/ralink/rt2x00/Kconfig
> > index 3a32ceead54f..a0dc9a751234 100644
> > --- a/drivers/net/wireless/ralink/rt2x00/Kconfig
> > +++ b/drivers/net/wireless/ralink/rt2x00/Kconfig
> > @@ -202,7 +202,7 @@ endif
> >
> >  config RT2800SOC
> >       tristate "Ralink WiSoC support"
> > -     depends on SOC_RT288X || SOC_RT305X || SOC_MT7620 || COMPILE_TEST
> > +     depends on OF && (SOC_RT288X || SOC_RT305X || SOC_MT7620 || COMPILE_TEST)
> >       select RT2X00_LIB_SOC
> >       select RT2X00_LIB_MMIO
> >       select RT2X00_LIB_CRYPTO
> > diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
> > index e73394cf6ea6..db8d01f0cdc3 100644
> > --- a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
> > +++ b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
> > @@ -243,9 +243,16 @@ static int rt2800soc_probe(struct platform_device *pdev)
> >       return rt2x00soc_probe(pdev, &rt2800soc_ops);
> >  }
> >
> > +static const struct of_device_id rt2880_wmac_match[] = {
> > +     { .compatible = "ralink,rt2880-wifi", .data = &rt2800soc_ops },
>
> Why do .data = rt2800soc_ops here and use it via of_device_get_match_data()
> in patch 5, insead of just use rt2800soc_ops directly in rt2800soc_probe ?
I see more of the former instead of the latter in drivers.
>
> Regards
> Stanislaw
>
> > +     {},
> > +};
> > +MODULE_DEVICE_TABLE(of, rt2880_wmac_match);
> > +
> >  static struct platform_driver rt2800soc_driver = {
> >       .driver         = {
> >               .name           = "rt2800_wmac",
> > +             .of_match_table = rt2880_wmac_match,
> >       },
> >       .probe          = rt2800soc_probe,
> >       .remove         = rt2x00soc_remove,
> > --
> > 2.50.0
> >

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCHv3 wireless-next 7/7] dt-bindings: net: wireless: rt2800: add
  2025-07-12 16:59             ` Krzysztof Kozlowski
@ 2025-07-12 23:20               ` Julian Calaby
  2025-07-13  8:53                 ` Krzysztof Kozlowski
  0 siblings, 1 reply; 26+ messages in thread
From: Julian Calaby @ 2025-07-12 23:20 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Rob Herring
  Cc: Stanislaw Gruszka, Rosen Penev, linux-wireless, Johannes Berg,
	Krzysztof Kozlowski, Conor Dooley, Thomas Bogendoerfer,
	Matthias Brugger, AngeloGioacchino Del Regno,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	open list, open list:MIPS,
	moderated list:ARM/Mediatek SoC support,
	moderated list:ARM/Mediatek SoC support

Hi Krzysztof and Rob,

On Sun, Jul 13, 2025 at 2:59 AM Krzysztof Kozlowski <krzk@kernel.org> wrote:
>
> On 12/07/2025 18:53, Krzysztof Kozlowski wrote:
> > On 12/07/2025 12:40, Stanislaw Gruszka wrote:
> >> Hi Krzysztof,
> >>
> >> On Fri, Jul 11, 2025 at 09:48:49AM +0200, Krzysztof Kozlowski wrote:
> >>> On Thu, Jul 10, 2025 at 03:40:30PM -0700, Rosen Penev wrote:
> >>>> On Thu, Jul 10, 2025 at 2:40 PM Krzysztof Kozlowski <krzk@kernel.org> wrote:
> >>>>>
> >>>>> On 10/07/2025 22:08, Rosen Penev wrote:
> >>>>>> Add device-tree bindings for the RT2800 SOC wifi device found in older
> >>>>>> Ralink/Mediatek devices.
> >>>>>>
> >>>>>> Signed-off-by: Rosen Penev <rosenp@gmail.com>
> >>>>>> ---
> >>>>>>  .../bindings/net/wireless/ralink,rt2800.yaml  | 47 +++++++++++++++++++
> >>>>>>  1 file changed, 47 insertions(+)
> >>>>>>  create mode 100644 Documentation/devicetree/bindings/net/wireless/ralink,rt2800.yaml
> >>>>>>
> >>>>>> diff --git a/Documentation/devicetree/bindings/net/wireless/ralink,rt2800.yaml b/Documentation/devicetree/bindings/net/wireless/ralink,rt2800.yaml
> >>>>>> new file mode 100644
> >>>>>> index 000000000000..8c13b25bd8b4
> >>>>>> --- /dev/null
> >>>>>> +++ b/Documentation/devicetree/bindings/net/wireless/ralink,rt2800.yaml
> >>>>>
> >>>>> Filename should match compatible. You were already changing something
> >>>>> here...
> >>>> hrm? that makes no sense. Various drivers have multiple compatible lines.
> >>>
> >>> Luckily we do not speak about drivers here. Anyway, follow standard
> >>> review practices, you don't get special rules.
> >>
> >> Could you please elaborate what you mean ?
> >
> > Rosen replied in abrasive way, so I am not going to dig this.
> >
> >>
> >> I greped through Documentation/devicetree/bindings/*/*.yaml and plenty
> >
> > I assume you refer to last 2 years bindings, not something older, right?
> > It is really poor argument to find old files and use them as example
> > "they did like that".
> >
> >> of "compatible:" items do not match the filename. So hard to tell
> >
> > I did not ask for compatible to match filename.
> >
> >> what rule you are referencing, as it seems it's not really applied.
> > Check reviews on the lists. It is pretty standard review. Everyone gets
> > it for this case here - single device, single compatible.
>
> BTW, it is not hiding on the lists:
>
> https://lore.kernel.org/linux-devicetree/?q=f%3Aherring+filename
> https://lore.kernel.org/linux-devicetree/?q=f%3Akozlowski+filename

I just had a quick look through the in-tree documentation on device
tree bindings and can't find this rule there.

It's good that you and Rob are consistent in applying this rule, but
pointing to the mailing list archives instead of the documentation
makes it feel like patch submissions in this space are judged by some
arbitrary set of undocumented rules.

Could you please update the documentation with the current set of
requirements so that people who are new to this space have a
consistent set of rules they can apply to their work?

I understand that Krzysztof doesn't particularly like having
discussions around the rules given his usual abrasive manner, so
having the full rules documented would be a way to shift these
conversations into something a bit more like how Greg applies stable
rules: if you get it wrong, you get a link to the documentation, which
should clarify most issues without any further discussion.

Thanks,

-- 
Julian Calaby

Email: julian.calaby@gmail.com
Profile: http://www.google.com/profiles/julian.calaby/

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCHv3 wireless-next 3/7] wifi: rt2800soc: allow loading from OF
  2025-07-12 19:02     ` Rosen Penev
@ 2025-07-13  7:15       ` Stanislaw Gruszka
  2025-07-13  8:49         ` Johannes Berg
  0 siblings, 1 reply; 26+ messages in thread
From: Stanislaw Gruszka @ 2025-07-13  7:15 UTC (permalink / raw)
  To: Rosen Penev
  Cc: linux-wireless, Johannes Berg, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Thomas Bogendoerfer, Matthias Brugger,
	AngeloGioacchino Del Regno,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	open list, open list:MIPS,
	moderated list:ARM/Mediatek SoC support,
	moderated list:ARM/Mediatek SoC support

On Sat, Jul 12, 2025 at 12:02:35PM -0700, Rosen Penev wrote:
> On Sat, Jul 12, 2025 at 3:14 AM Stanislaw Gruszka <stf_xl@wp.pl> wrote:
> >
> > On Thu, Jul 10, 2025 at 01:08:16PM -0700, Rosen Penev wrote:
> > > Add a single binding to help the already present dts files load the
> > > driver. More are possible but there doesn't seem to be a significant
> > > difference between them to justify this.
> > >
> > > Use wifi name per dtschema requirements.
> > >
> > > The data field will be used to remove the custom non static probe
> > > function and use of_device_get_match_data.
> > >
> > > Added OF dependency to SOC CONFIG as adding of_match_table without OF
> > > being present makes no sense.
> > >
> > > Signed-off-by: Rosen Penev <rosenp@gmail.com>
> > > Reviewed-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
> > > ---
> > >  drivers/net/wireless/ralink/rt2x00/Kconfig     | 2 +-
> > >  drivers/net/wireless/ralink/rt2x00/rt2800soc.c | 7 +++++++
> > >  2 files changed, 8 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/net/wireless/ralink/rt2x00/Kconfig b/drivers/net/wireless/ralink/rt2x00/Kconfig
> > > index 3a32ceead54f..a0dc9a751234 100644
> > > --- a/drivers/net/wireless/ralink/rt2x00/Kconfig
> > > +++ b/drivers/net/wireless/ralink/rt2x00/Kconfig
> > > @@ -202,7 +202,7 @@ endif
> > >
> > >  config RT2800SOC
> > >       tristate "Ralink WiSoC support"
> > > -     depends on SOC_RT288X || SOC_RT305X || SOC_MT7620 || COMPILE_TEST
> > > +     depends on OF && (SOC_RT288X || SOC_RT305X || SOC_MT7620 || COMPILE_TEST)
> > >       select RT2X00_LIB_SOC
> > >       select RT2X00_LIB_MMIO
> > >       select RT2X00_LIB_CRYPTO
> > > diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
> > > index e73394cf6ea6..db8d01f0cdc3 100644
> > > --- a/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
> > > +++ b/drivers/net/wireless/ralink/rt2x00/rt2800soc.c
> > > @@ -243,9 +243,16 @@ static int rt2800soc_probe(struct platform_device *pdev)
> > >       return rt2x00soc_probe(pdev, &rt2800soc_ops);
> > >  }
> > >
> > > +static const struct of_device_id rt2880_wmac_match[] = {
> > > +     { .compatible = "ralink,rt2880-wifi", .data = &rt2800soc_ops },
> >
> > Why do .data = rt2800soc_ops here and use it via of_device_get_match_data()
> > in patch 5, insead of just use rt2800soc_ops directly in rt2800soc_probe ?
> I see more of the former instead of the latter in drivers.

If there is no technical reason to use indirection, this can be
simplified as well. Can be done as separate patch since you already
posed v4.

Regards
Stanislaw


^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCHv3 wireless-next 3/7] wifi: rt2800soc: allow loading from OF
  2025-07-13  7:15       ` Stanislaw Gruszka
@ 2025-07-13  8:49         ` Johannes Berg
  2025-07-13 11:06           ` Johannes Berg
  0 siblings, 1 reply; 26+ messages in thread
From: Johannes Berg @ 2025-07-13  8:49 UTC (permalink / raw)
  To: Stanislaw Gruszka, Rosen Penev
  Cc: linux-wireless, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Thomas Bogendoerfer, Matthias Brugger, AngeloGioacchino Del Regno,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	open list, open list:MIPS,
	moderated list:ARM/Mediatek SoC support,
	moderated list:ARM/Mediatek SoC support

On Sun, 2025-07-13 at 09:15 +0200, Stanislaw Gruszka wrote:
> 
> Can be done as separate patch since you already
> posed v4.

Maybe I should point out that I've simply been dropping the patches
unseen because they don't even apply.

johannes

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCHv3 wireless-next 7/7] dt-bindings: net: wireless: rt2800: add
  2025-07-12 23:20               ` Julian Calaby
@ 2025-07-13  8:53                 ` Krzysztof Kozlowski
  0 siblings, 0 replies; 26+ messages in thread
From: Krzysztof Kozlowski @ 2025-07-13  8:53 UTC (permalink / raw)
  To: Julian Calaby, Rob Herring
  Cc: Stanislaw Gruszka, Rosen Penev, linux-wireless, Johannes Berg,
	Krzysztof Kozlowski, Conor Dooley, Thomas Bogendoerfer,
	Matthias Brugger, AngeloGioacchino Del Regno,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	open list, open list:MIPS,
	moderated list:ARM/Mediatek SoC support,
	moderated list:ARM/Mediatek SoC support

On 13/07/2025 01:20, Julian Calaby wrote:
> Hi Krzysztof and Rob,
> 
> On Sun, Jul 13, 2025 at 2:59 AM Krzysztof Kozlowski <krzk@kernel.org> wrote:
>>
>> On 12/07/2025 18:53, Krzysztof Kozlowski wrote:
>>> On 12/07/2025 12:40, Stanislaw Gruszka wrote:
>>>> Hi Krzysztof,
>>>>
>>>> On Fri, Jul 11, 2025 at 09:48:49AM +0200, Krzysztof Kozlowski wrote:
>>>>> On Thu, Jul 10, 2025 at 03:40:30PM -0700, Rosen Penev wrote:
>>>>>> On Thu, Jul 10, 2025 at 2:40 PM Krzysztof Kozlowski <krzk@kernel.org> wrote:
>>>>>>>
>>>>>>> On 10/07/2025 22:08, Rosen Penev wrote:
>>>>>>>> Add device-tree bindings for the RT2800 SOC wifi device found in older
>>>>>>>> Ralink/Mediatek devices.
>>>>>>>>
>>>>>>>> Signed-off-by: Rosen Penev <rosenp@gmail.com>
>>>>>>>> ---
>>>>>>>>  .../bindings/net/wireless/ralink,rt2800.yaml  | 47 +++++++++++++++++++
>>>>>>>>  1 file changed, 47 insertions(+)
>>>>>>>>  create mode 100644 Documentation/devicetree/bindings/net/wireless/ralink,rt2800.yaml
>>>>>>>>
>>>>>>>> diff --git a/Documentation/devicetree/bindings/net/wireless/ralink,rt2800.yaml b/Documentation/devicetree/bindings/net/wireless/ralink,rt2800.yaml
>>>>>>>> new file mode 100644
>>>>>>>> index 000000000000..8c13b25bd8b4
>>>>>>>> --- /dev/null
>>>>>>>> +++ b/Documentation/devicetree/bindings/net/wireless/ralink,rt2800.yaml
>>>>>>>
>>>>>>> Filename should match compatible. You were already changing something
>>>>>>> here...
>>>>>> hrm? that makes no sense. Various drivers have multiple compatible lines.
>>>>>
>>>>> Luckily we do not speak about drivers here. Anyway, follow standard
>>>>> review practices, you don't get special rules.
>>>>
>>>> Could you please elaborate what you mean ?
>>>
>>> Rosen replied in abrasive way, so I am not going to dig this.
>>>
>>>>
>>>> I greped through Documentation/devicetree/bindings/*/*.yaml and plenty
>>>
>>> I assume you refer to last 2 years bindings, not something older, right?
>>> It is really poor argument to find old files and use them as example
>>> "they did like that".
>>>
>>>> of "compatible:" items do not match the filename. So hard to tell
>>>
>>> I did not ask for compatible to match filename.
>>>
>>>> what rule you are referencing, as it seems it's not really applied.
>>> Check reviews on the lists. It is pretty standard review. Everyone gets
>>> it for this case here - single device, single compatible.
>>
>> BTW, it is not hiding on the lists:
>>
>> https://lore.kernel.org/linux-devicetree/?q=f%3Aherring+filename
>> https://lore.kernel.org/linux-devicetree/?q=f%3Akozlowski+filename
> 
> I just had a quick look through the in-tree documentation on device
> tree bindings and can't find this rule there.
> 
> It's good that you and Rob are consistent in applying this rule, but
> pointing to the mailing list archives instead of the documentation
> makes it feel like patch submissions in this space are judged by some
> arbitrary set of undocumented rules.
> 
> Could you please update the documentation with the current set of
> requirements so that people who are new to this space have a
> consistent set of rules they can apply to their work?


I agree. I already grew the docs some time ago, then few days ago and I
have in plan to keep growing it more. I'll document also this one,
thanks for the pointer.

Regardless of the missing docs, argument "I found some old code like
that" is almost never correct. And even if you find newest code like
that, you still need to consider all reviews and discussions on the
lists leading to such or some other decision. Including the most trivial
reason: we often don't care about minor details. Filename is such minor
detail, unused label in DTS example is another, even more frequent one
(we complain about it but also accept many patches with it).

Do I question every reviewer's comments like that on my patches, which I
send a lot? That I found some old code which was different than what
reviewer asked me? No.

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 26+ messages in thread

* Re: [PATCHv3 wireless-next 3/7] wifi: rt2800soc: allow loading from OF
  2025-07-13  8:49         ` Johannes Berg
@ 2025-07-13 11:06           ` Johannes Berg
  0 siblings, 0 replies; 26+ messages in thread
From: Johannes Berg @ 2025-07-13 11:06 UTC (permalink / raw)
  To: Stanislaw Gruszka, Rosen Penev
  Cc: linux-wireless, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Thomas Bogendoerfer, Matthias Brugger, AngeloGioacchino Del Regno,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	open list, open list:MIPS,
	moderated list:ARM/Mediatek SoC support,
	moderated list:ARM/Mediatek SoC support

On Sun, 2025-07-13 at 10:49 +0200, Johannes Berg wrote:
> On Sun, 2025-07-13 at 09:15 +0200, Stanislaw Gruszka wrote:
> > 
> > Can be done as separate patch since you already
> > posed v4.
> 
> Maybe I should point out that I've simply been dropping the patches
> unseen because they don't even apply.

Ah, that's because of Felix's fix, so looks it will apply now that I've
fast-forwarded wireless and wireless-next.

I'd prefer a resend though (perhaps with the small thing Stanislaw
thought might be fixed, your call) so the bot can pick it up.

johannes

^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2025-07-13 11:06 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-10 20:08 [PATCHv3 wireless-next 0/7] wifi: rt2x00: add OF bindings + cleanup Rosen Penev
2025-07-10 20:08 ` [PATCHv3 wireless-next 1/7] wifi: rt2x00: add COMPILE_TEST Rosen Penev
2025-07-12  8:59   ` Stanislaw Gruszka
2025-07-10 20:08 ` [PATCHv3 wireless-next 2/7] wifi: rt2x00: remove mod_name from platform_driver Rosen Penev
2025-07-12  8:59   ` Stanislaw Gruszka
2025-07-10 20:08 ` [PATCHv3 wireless-next 3/7] wifi: rt2800soc: allow loading from OF Rosen Penev
2025-07-12 10:14   ` Stanislaw Gruszka
2025-07-12 19:02     ` Rosen Penev
2025-07-13  7:15       ` Stanislaw Gruszka
2025-07-13  8:49         ` Johannes Berg
2025-07-13 11:06           ` Johannes Berg
2025-07-10 20:08 ` [PATCHv3 wireless-next 4/7] wifi: rt2800: move 2x00soc to 2800soc Rosen Penev
2025-07-12 10:20   ` Stanislaw Gruszka
2025-07-10 20:08 ` [PATCHv3 wireless-next 5/7] wifi: rt2x00: soc: modernize probe Rosen Penev
2025-07-11 14:01   ` Alexander Savchenko
2025-07-11 20:33     ` Rosen Penev
2025-07-10 20:08 ` [PATCHv3 wireless-next 6/7] MIPS: dts: ralink: mt7620a: add wifi Rosen Penev
2025-07-10 20:08 ` [PATCHv3 wireless-next 7/7] dt-bindings: net: wireless: rt2800: add Rosen Penev
2025-07-10 21:39   ` Krzysztof Kozlowski
2025-07-10 22:40     ` Rosen Penev
2025-07-11  7:48       ` Krzysztof Kozlowski
2025-07-12 10:40         ` Stanislaw Gruszka
2025-07-12 16:53           ` Krzysztof Kozlowski
2025-07-12 16:59             ` Krzysztof Kozlowski
2025-07-12 23:20               ` Julian Calaby
2025-07-13  8:53                 ` Krzysztof Kozlowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).