linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] wifi: mwifiex: keep mwifiex_cfg80211_ops constant
@ 2024-08-09  9:51 Sascha Hauer
  2024-08-09 10:26 ` Kalle Valo
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Sascha Hauer @ 2024-08-09  9:51 UTC (permalink / raw)
  To: Brian Norris, Francesco Dolcini, Kalle Valo, David Lin
  Cc: linux-wireless, linux-kernel, kernel, Sascha Hauer

With host_mlme support being added mwifiex_cfg80211_ops is no longer
constant, but supplemented with the host_mlme related ops when host_mlme
support is enabled. This doesn't work with multiple adapters when only
few of then have host_mlme support. Duplicate mwifiex_cfg80211_ops
before using it and keep the original constant.

While at it mark mwifiex_cfg80211_ops const to prevent people from
changing it again during runtime.

Fixes: 36995892c271c ("wifi: mwifiex: add host mlme for client mode")
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
Kalle, the commit breaking it still sits in wireless-next. Feel free to
squash this into the original commit if convenient for you.
---
 drivers/net/wireless/marvell/mwifiex/cfg80211.c | 26 ++++++++++++++-----------
 1 file changed, 15 insertions(+), 11 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
index 722ead51e9123..e36ef075fe053 100644
--- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c
@@ -4570,7 +4570,7 @@ mwifiex_cfg80211_probe_client(struct wiphy *wiphy,
 }
 
 /* station cfg80211 operations */
-static struct cfg80211_ops mwifiex_cfg80211_ops = {
+static const struct cfg80211_ops mwifiex_cfg80211_ops = {
 	.add_virtual_intf = mwifiex_add_virtual_intf,
 	.del_virtual_intf = mwifiex_del_virtual_intf,
 	.change_virtual_intf = mwifiex_cfg80211_change_virtual_intf,
@@ -4705,24 +4705,28 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter)
 	struct mwifiex_private *priv = adapter->priv[MWIFIEX_BSS_TYPE_STA];
 	u8 *country_code;
 	u32 thr, retry;
+	struct cfg80211_ops *ops;
+
+	ops = devm_kmemdup(adapter->dev, &mwifiex_cfg80211_ops,
+			   sizeof(mwifiex_cfg80211_ops), GFP_KERNEL);
+	if (!ops)
+		return -ENOMEM;
 
 	/* create a new wiphy for use with cfg80211 */
-	wiphy = wiphy_new(&mwifiex_cfg80211_ops,
-			  sizeof(struct mwifiex_adapter *));
+	wiphy = wiphy_new(ops, sizeof(struct mwifiex_adapter *));
 	if (!wiphy) {
 		mwifiex_dbg(adapter, ERROR,
 			    "%s: creating new wiphy\n", __func__);
 		return -ENOMEM;
 	}
 	if (adapter->host_mlme_enabled) {
-		mwifiex_cfg80211_ops.auth = mwifiex_cfg80211_authenticate;
-		mwifiex_cfg80211_ops.assoc = mwifiex_cfg80211_associate;
-		mwifiex_cfg80211_ops.deauth = mwifiex_cfg80211_deauthenticate;
-		mwifiex_cfg80211_ops.disassoc = mwifiex_cfg80211_disassociate;
-		mwifiex_cfg80211_ops.disconnect = NULL;
-		mwifiex_cfg80211_ops.connect = NULL;
-		mwifiex_cfg80211_ops.probe_client =
-			mwifiex_cfg80211_probe_client;
+		ops->auth = mwifiex_cfg80211_authenticate;
+		ops->assoc = mwifiex_cfg80211_associate;
+		ops->deauth = mwifiex_cfg80211_deauthenticate;
+		ops->disassoc = mwifiex_cfg80211_disassociate;
+		ops->disconnect = NULL;
+		ops->connect = NULL;
+		ops->probe_client = mwifiex_cfg80211_probe_client;
 	}
 	wiphy->max_scan_ssids = MWIFIEX_MAX_SSID_LIST_LENGTH;
 	wiphy->max_scan_ie_len = MWIFIEX_MAX_VSIE_LEN;

---
base-commit: 4ab9f870a6335af27507d1f3bfb29635d956af48
change-id: 20240809-mwifiex-duplicate-mwifiex_cfg80211_ops-3700e6838ec3

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>


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

* Re: [PATCH] wifi: mwifiex: keep mwifiex_cfg80211_ops constant
  2024-08-09  9:51 [PATCH] wifi: mwifiex: keep mwifiex_cfg80211_ops constant Sascha Hauer
@ 2024-08-09 10:26 ` Kalle Valo
  2024-08-09 12:37 ` Francesco Dolcini
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Kalle Valo @ 2024-08-09 10:26 UTC (permalink / raw)
  To: Sascha Hauer
  Cc: Brian Norris, Francesco Dolcini, David Lin, linux-wireless,
	linux-kernel, kernel

Sascha Hauer <s.hauer@pengutronix.de> writes:

> With host_mlme support being added mwifiex_cfg80211_ops is no longer
> constant, but supplemented with the host_mlme related ops when host_mlme
> support is enabled. This doesn't work with multiple adapters when only
> few of then have host_mlme support. Duplicate mwifiex_cfg80211_ops
> before using it and keep the original constant.
>
> While at it mark mwifiex_cfg80211_ops const to prevent people from
> changing it again during runtime.
>
> Fixes: 36995892c271c ("wifi: mwifiex: add host mlme for client mode")
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
> Kalle, the commit breaking it still sits in wireless-next. Feel free to
> squash this into the original commit if convenient for you.

Thanks for the note, info like this helps a lot. We avoid rebasing
wireless trees unless there's something really critical, so squashing is
not really an option.

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

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

* Re: [PATCH] wifi: mwifiex: keep mwifiex_cfg80211_ops constant
  2024-08-09  9:51 [PATCH] wifi: mwifiex: keep mwifiex_cfg80211_ops constant Sascha Hauer
  2024-08-09 10:26 ` Kalle Valo
@ 2024-08-09 12:37 ` Francesco Dolcini
  2024-08-13 16:48 ` Brian Norris
  2024-08-16 10:07 ` Kalle Valo
  3 siblings, 0 replies; 5+ messages in thread
From: Francesco Dolcini @ 2024-08-09 12:37 UTC (permalink / raw)
  To: Sascha Hauer
  Cc: Brian Norris, Francesco Dolcini, Kalle Valo, David Lin,
	linux-wireless, linux-kernel, kernel

On Fri, Aug 09, 2024 at 11:51:48AM +0200, Sascha Hauer wrote:
> With host_mlme support being added mwifiex_cfg80211_ops is no longer
> constant, but supplemented with the host_mlme related ops when host_mlme
> support is enabled. This doesn't work with multiple adapters when only
> few of then have host_mlme support. Duplicate mwifiex_cfg80211_ops
> before using it and keep the original constant.
> 
> While at it mark mwifiex_cfg80211_ops const to prevent people from
> changing it again during runtime.
> 
> Fixes: 36995892c271c ("wifi: mwifiex: add host mlme for client mode")
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>

Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>


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

* Re: [PATCH] wifi: mwifiex: keep mwifiex_cfg80211_ops constant
  2024-08-09  9:51 [PATCH] wifi: mwifiex: keep mwifiex_cfg80211_ops constant Sascha Hauer
  2024-08-09 10:26 ` Kalle Valo
  2024-08-09 12:37 ` Francesco Dolcini
@ 2024-08-13 16:48 ` Brian Norris
  2024-08-16 10:07 ` Kalle Valo
  3 siblings, 0 replies; 5+ messages in thread
From: Brian Norris @ 2024-08-13 16:48 UTC (permalink / raw)
  To: Sascha Hauer
  Cc: Francesco Dolcini, Kalle Valo, David Lin, linux-wireless,
	linux-kernel, kernel

On Fri, Aug 09, 2024 at 11:51:48AM +0200, Sascha Hauer wrote:
> With host_mlme support being added mwifiex_cfg80211_ops is no longer
> constant, but supplemented with the host_mlme related ops when host_mlme
> support is enabled. This doesn't work with multiple adapters when only
> few of then have host_mlme support. Duplicate mwifiex_cfg80211_ops
> before using it and keep the original constant.
> 
> While at it mark mwifiex_cfg80211_ops const to prevent people from
> changing it again during runtime.
> 
> Fixes: 36995892c271c ("wifi: mwifiex: add host mlme for client mode")
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>

Acked-by: Brian Norris <briannorris@chromium.org>

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

* Re: [PATCH] wifi: mwifiex: keep mwifiex_cfg80211_ops constant
  2024-08-09  9:51 [PATCH] wifi: mwifiex: keep mwifiex_cfg80211_ops constant Sascha Hauer
                   ` (2 preceding siblings ...)
  2024-08-13 16:48 ` Brian Norris
@ 2024-08-16 10:07 ` Kalle Valo
  3 siblings, 0 replies; 5+ messages in thread
From: Kalle Valo @ 2024-08-16 10:07 UTC (permalink / raw)
  To: Sascha Hauer
  Cc: Brian Norris, Francesco Dolcini, David Lin, linux-wireless,
	linux-kernel, kernel, Sascha Hauer

Sascha Hauer <s.hauer@pengutronix.de> wrote:

> With host_mlme support being added mwifiex_cfg80211_ops is no longer
> constant, but supplemented with the host_mlme related ops when host_mlme
> support is enabled. This doesn't work with multiple adapters when only
> few of then have host_mlme support. Duplicate mwifiex_cfg80211_ops
> before using it and keep the original constant.
> 
> While at it mark mwifiex_cfg80211_ops const to prevent people from
> changing it again during runtime.
> 
> Fixes: 36995892c271c ("wifi: mwifiex: add host mlme for client mode")
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> Reviewed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
> Acked-by: Brian Norris <briannorris@chromium.org>

Patch applied to wireless-next.git, thanks.

daaf0dd0398d wifi: mwifiex: keep mwifiex_cfg80211_ops constant

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/20240809-mwifiex-duplicate-mwifiex_cfg80211_ops-v1-1-23e0e6290ace@pengutronix.de/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


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

end of thread, other threads:[~2024-08-16 10:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-09  9:51 [PATCH] wifi: mwifiex: keep mwifiex_cfg80211_ops constant Sascha Hauer
2024-08-09 10:26 ` Kalle Valo
2024-08-09 12:37 ` Francesco Dolcini
2024-08-13 16:48 ` Brian Norris
2024-08-16 10:07 ` Kalle Valo

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).