From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 81B19C83F10 for ; Sat, 12 Jul 2025 10:23:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=61F+GlsgsQKOVx2NEzbmz5vCdf2PV5lBMexPsqNrBkQ=; b=H8Pb1vkREZE6Zzxv6T7l2AvEig 3fMrKXtvt9aux5EdLfau/cbLsYqIv8QY+bkxOYRbDC56dEroc67tPZGRgLyM39ORjohZOnAhjPcMD 5CAeV9Jlf6GBbNs+3Y4BHcb5ixQITFQtMEkV0jxK6K8UyC0x5hBr082CBKSKZARiUm7CBsXdGQQVo l3rvj6IlGVU/KwuyNHa3YyAjzsi5fjDxcny49+C/FnU97hisgZ8DbJLTqjJtCs0QGy/GSCBtuQYRO u3drX0IRvHyiOu1GmMBdBzMcJ2uZWHLL3P6sXviH6W12GuIUupIZnPljoY2gFw92MnRDn307a/H3o IsLID+hg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1uaXNp-0000000GWtW-0Yxu; Sat, 12 Jul 2025 10:23:05 +0000 Received: from mx4.wp.pl ([212.77.101.11]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1uaXLQ-0000000GWjj-1TBF for linux-arm-kernel@lists.infradead.org; Sat, 12 Jul 2025 10:20:37 +0000 Received: (wp-smtpd smtp.wp.pl 26666 invoked from network); 12 Jul 2025 12:20:31 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wp.pl; s=20241105; t=1752315631; bh=61F+GlsgsQKOVx2NEzbmz5vCdf2PV5lBMexPsqNrBkQ=; h=From:To:Cc:Subject; b=rns9txDPIyaDIIsiivzTQMlNs5p/IPt+fjF/uYD8RzmaF6g1fOzG0fAIbC9NCAeLE gMrPgclwF8D152O1w5YlGhVu6XzeF8fJRF0qFq9vCVGi+iyvnnHb5MEKwKnY7mBqa6 jVzi5Jpl5e4dCb1c4Sx5OHUQxaaMVrnNZipHtsFJ/dVp5fomAFlQwHUl3QoyNVNgh5 krWlX10Z2xob1wmXce+kLp+RNxuBFTkDyUU8Jcpzz3HtrMXop0y8UhtT9gO3+zv7y3 4AtkoslPThsgZfafMIeVg2JMhWXYtHYLXQ0ga1HrIZqapaI/EK2B15oFF/oLj6JxgA bxwGNzTih4GgA== Received: from 89-64-3-180.dynamic.play.pl (HELO localhost) (stf_xl@wp.pl@[89.64.3.180]) (envelope-sender ) by smtp.wp.pl (WP-SMTPD) with ECDHE-RSA-AES256-GCM-SHA384 encrypted SMTP for ; 12 Jul 2025 12:20:31 +0200 Date: Sat, 12 Jul 2025 12:20:31 +0200 From: Stanislaw Gruszka To: Rosen Penev Cc: linux-wireless@vger.kernel.org, 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" Subject: Re: [PATCHv3 wireless-next 4/7] wifi: rt2800: move 2x00soc to 2800soc Message-ID: <20250712102031.GA13264@wp.pl> References: <20250710200820.262295-1-rosenp@gmail.com> <20250710200820.262295-5-rosenp@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20250710200820.262295-5-rosenp@gmail.com> X-WP-MailID: d421b79413c679fd27ca1628dcc50f56 X-WP-AV: skaner antywirusowy Poczty Wirtualnej Polski X-WP-SPAM: NO 0000002 [4QGC] X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250712_032036_540667_91B88145 X-CRM114-Status: GOOD ( 25.00 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 Acked-by: Stanislaw Gruszka > --- > 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 > - Copyright (C) 2004 - 2009 Felix Fietkau > - > - > - */ > - > -/* > - Module: rt2x00soc > - Abstract: rt2x00 generic soc device routines. > - */ > - > -#include > -#include > -#include > -#include > -#include > - > -#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 > - > - > - */ > - > -/* > - 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 >