From nobody Fri Dec 19 00:24:35 2025 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2EF7F802 for ; Mon, 24 Mar 2025 13:24:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742822661; cv=none; b=ZDfVTPtYN/FehS2m5uxLhyv4oYzPiEqvl2iL6WmrYcOItrUMJZlHpEwUZtUR51Z8fA7V0ynxpSL/RthQcdQ0QgCH+jNzfKROVBWTKoo8aR+TwgfvoQhQDpwPBlhM88pV9qU+Oa/6gn6rjx5UtOWw9J6gYAaHp2rjeeb0/NLAIio= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742822661; c=relaxed/simple; bh=vgSog7ia/akrXqtyaMhLsb1dQPWkb43Fj97lsrxPZIE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=CX1sca0jAJhM+MhdV8j3ZGBqw5gHytoHokEUvJHYjWLFjr9YTeaNLFxuCUMuG5OmtifCLfdCuyzwx+4UeLxHa4STukyyRFkr8iry78P4yp/2CJU3Gu3+apPFpmTy/+COV2Jm+is2RlGQGaem3RN963Lh+sYxenQ+3VxC91Q9iHA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1twhmm-0003sN-76; Mon, 24 Mar 2025 14:24:12 +0100 Received: from dude02.red.stw.pengutronix.de ([2a0a:edc0:0:1101:1d::28]) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1twhml-001PyR-0N; Mon, 24 Mar 2025 14:24:11 +0100 Received: from localhost ([::1] helo=dude02.red.stw.pengutronix.de) by dude02.red.stw.pengutronix.de with esmtp (Exim 4.96) (envelope-from ) id 1twhml-004Vqr-1L; Mon, 24 Mar 2025 14:24:11 +0100 From: Sascha Hauer Date: Mon, 24 Mar 2025 14:24:10 +0100 Subject: [PATCH wireless-next v5 09/10] wifi: mwifiex: move common settings out of switch/case Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250324-mwifiex-cleanup-1-v5-9-1128a2be02af@pengutronix.de> References: <20250324-mwifiex-cleanup-1-v5-0-1128a2be02af@pengutronix.de> In-Reply-To: <20250324-mwifiex-cleanup-1-v5-0-1128a2be02af@pengutronix.de> To: Brian Norris , Francesco Dolcini Cc: Johannes Berg , linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, David Lin , kernel@pengutronix.de, Sascha Hauer X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1742822651; l=2972; i=s.hauer@pengutronix.de; s=20230412; h=from:subject:message-id; bh=vgSog7ia/akrXqtyaMhLsb1dQPWkb43Fj97lsrxPZIE=; b=FWiJwk3z5diNS003UHUgJ8GAed493S4jPddOPybMbP1dhRn2XYeBwIONp9G4/7bg7n60kGWJc D5ynWsjxdtTC7ojNRZL/eOKGoqiEpU8sieht70QsPZ25R2fWsCodtNo X-Developer-Key: i=s.hauer@pengutronix.de; a=ed25519; pk=4kuc9ocmECiBJKWxYgqyhtZOHj5AWi7+d0n/UjhkwTg= X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: s.hauer@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org In mwifiex_add_virtual_intf() several settings done in a switch/case are the same in all cases. Move them out of the switch/case to deduplicate the code. bss_started is not initialized in all switch/case branches, but it is only used in AP mode in the driver, so it doesn't hurt to move its initialization out of the switch/case as well. Signed-off-by: Sascha Hauer Reviewed-by: Francesco Dolcini --- drivers/net/wireless/marvell/mwifiex/cfg80211.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/= wireless/marvell/mwifiex/cfg80211.c index 1d9bc8f980c8d..5d6f4d2922b64 100644 --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c @@ -3007,7 +3007,6 @@ struct wireless_dev *mwifiex_add_virtual_intf(struct = wiphy *wiphy, return ERR_PTR(-EFAULT); } =20 - priv->wdev.wiphy =3D wiphy; priv->wdev.iftype =3D NL80211_IFTYPE_STATION; =20 if (type =3D=3D NL80211_IFTYPE_UNSPECIFIED) @@ -3016,8 +3015,6 @@ struct wireless_dev *mwifiex_add_virtual_intf(struct = wiphy *wiphy, priv->bss_mode =3D type; =20 priv->bss_type =3D MWIFIEX_BSS_TYPE_STA; - priv->frame_type =3D MWIFIEX_DATA_FRAME_TYPE_ETH_II; - priv->bss_priority =3D 0; priv->bss_role =3D MWIFIEX_BSS_ROLE_STA; =20 break; @@ -3037,14 +3034,10 @@ struct wireless_dev *mwifiex_add_virtual_intf(struc= t wiphy *wiphy, return ERR_PTR(-EFAULT); } =20 - priv->wdev.wiphy =3D wiphy; priv->wdev.iftype =3D NL80211_IFTYPE_AP; =20 priv->bss_type =3D MWIFIEX_BSS_TYPE_UAP; - priv->frame_type =3D MWIFIEX_DATA_FRAME_TYPE_ETH_II; - priv->bss_priority =3D 0; priv->bss_role =3D MWIFIEX_BSS_ROLE_UAP; - priv->bss_started =3D 0; priv->bss_mode =3D type; =20 break; @@ -3064,7 +3057,6 @@ struct wireless_dev *mwifiex_add_virtual_intf(struct = wiphy *wiphy, return ERR_PTR(-EFAULT); } =20 - priv->wdev.wiphy =3D wiphy; /* At start-up, wpa_supplicant tries to change the interface * to NL80211_IFTYPE_STATION if it is not managed mode. */ @@ -3077,10 +3069,7 @@ struct wireless_dev *mwifiex_add_virtual_intf(struct= wiphy *wiphy, */ priv->bss_type =3D MWIFIEX_BSS_TYPE_P2P; =20 - priv->frame_type =3D MWIFIEX_DATA_FRAME_TYPE_ETH_II; - priv->bss_priority =3D 0; priv->bss_role =3D MWIFIEX_BSS_ROLE_STA; - priv->bss_started =3D 0; =20 if (mwifiex_cfg80211_init_p2p_client(priv)) { memset(&priv->wdev, 0, sizeof(priv->wdev)); @@ -3094,6 +3083,11 @@ struct wireless_dev *mwifiex_add_virtual_intf(struct= wiphy *wiphy, return ERR_PTR(-EINVAL); } =20 + priv->wdev.wiphy =3D wiphy; + priv->bss_priority =3D 0; + priv->bss_started =3D 0; + priv->frame_type =3D MWIFIEX_DATA_FRAME_TYPE_ETH_II; + dev =3D alloc_netdev_mqs(sizeof(struct mwifiex_private *), name, name_assign_type, ether_setup, IEEE80211_NUM_ACS, 1); --=20 2.39.5