Re: [PATCH v3 1/2] wifi: mwifiex: ignore ROM regulatory hint on WRT3200ACM/WRT32x

[email protected]
Newsgroups org.kernel.vger.linux-devicetree
Message-ID <[email protected]>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] A vendor/device-specific workaround property (`marvell,ignore-regulatory-hint`) is incorrectly read from the global root device tree node (`of_root`) rather than the device's own OF node. Device Tree must correctly model hardware topology by placing device-specific properties in the node representing that physical device. Placing a vendor-specific property in the root node applies it globally to the entire system. If a system contains multiple Marvell Wi-Fi adapters (e.g., one built-in and one plugged in via USB or PCIe) and only one requires the regulatory hint to be ignored, this global flag will incorrectly apply the quirk to all of them. The driver should read this property from its own device node (e.g., `adapter->dev->of_node` or `adapter->dt_node`).
--

--- Patch [1]: [PATCH v3 1/2] wifi: mwifiex: ignore ROM regulatory hint on WRT3200ACM/WRT32x ---
commit 3a34f3fd7103c1109fdfbb027f11821961b37978
Author: Georgi Valkov <[email protected]>

wifi: mwifiex: ignore ROM regulatory hint on WRT3200ACM/WRT32x

This commit introduces a device-tree flag to allow affected platforms to
ignore incorrect regulatory hints hardcoded in the mwifiex ROM. This enables
userspace to set the correct platform regulatory domain and prevents extreme
restrictions on 5 GHz and DFS channels.

[1] https://github.com/kaloz/mwlwifi/issues/173#issuecomment-307879699
[2] https://github.com/openwrt/openwrt/issues/9956

> diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
> --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
> +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
> @@ -4899,7 +4899,14 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter)
>  				country_code =
>  					mwifiex_11d_code_2_region(
>  						adapter->region_code);
> +
> +				/* Allow platforms to ignore an incorrect
> +				 * regulatory hint from ROM, so userspace
> +				 * can set the correct regulatory domain.
> +				 */
>  				if (country_code &&
> +				    !of_property_read_bool(of_root,
> +							   "marvell,ignore-regulatory-hint") &&

[Severity: Medium]
Is it intentional to read the device-specific property from the global of_root
node rather than the adapter's own device node (e.g., adapter->dev->of_node
or adapter->dt_node)?

If a system contains multiple Marvell Wi-Fi adapters and only one requires
this workaround, reading from the root node will globally apply the quirk to
all adapters in the system.

Would it be better to adhere to device tree architectural principles by
placing and reading this property in the node representing the specific
physical device?

>  				    regulatory_hint(wiphy, country_code))
>  					mwifiex_dbg(priv->adapter, ERROR,
>  						    "regulatory_hint() failed\n");

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.