From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E63A9378836 for ; Thu, 29 Jan 2026 06:55:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769669758; cv=none; b=Q1+vVmXJi1TbXAisz25aRa7fZBmgfToD90v8e16dgTFnHR6/r8lhYqNaAuD+Zn4LfyhtJWMSE9W6xwubHNuXRZNMIVYf9UjorWw8ctwjdY6qs6KHca26WuJfm1VjzPfmFO5MLz8hc0AtAM4WAstvKeFTjjidELo3qWgjm5IxtFE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769669758; c=relaxed/simple; bh=gUko5UOFFyVYjTJn5ab9npyLP+v/e6zW8uA8irQInCU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=JsPI0ynhBME9gcgUBo0sgVFjMdAtoOAnfGfO2W0gWo2RWCst9nUi6wkf2r43qHmIPBbLFDu91TpG9QQ7CJHxG38VfbGno+OAcWacw+0V4JAhO4m28yvf44Uw7i5vA6bzWyXeUTrIN97vxb0UYPA432AjlX0Q4MKLlPqioZ2xwrE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=sHCMlODI; arc=none smtp.client-ip=209.85.128.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="sHCMlODI" Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-47d59da3d81so12001865e9.0 for ; Wed, 28 Jan 2026 22:55:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1769669755; x=1770274555; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=ati3vG62O1RcEHZqIG23DMy57RyekTsTte70sZ8uPDg=; b=sHCMlODI3lptoGepzO2iiGOnRr+w+0halDKWNEF4t8eQ+JSPuLh+r4eTF3EbGwgf30 Im1ihVmReyqfx9wrnmYcCuZSpZiQqGDujoUI1KaBTjfnNKgRtwFMhYHVvZ6sKMiEBrhC f2Agd5Y1HmuSuDUuPNIWF8LKbzRwtUqf9ylntgoXW9aCas3vAbvqMz9AEzmkaEiNwbuA 2wcieaV7b18sWoxsp7CzRlYftZm4VQz4pmPXL7Em7ehBqChD/Zbw2q4xw+GNRQ1Kc9yv 5R9CyjTEQ0xrhcF2nNtBehXpMUrdhkncb5xVyikGEsXeBMsXUZtP9fDv7eb3MEWxi9kk TdiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769669755; x=1770274555; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ati3vG62O1RcEHZqIG23DMy57RyekTsTte70sZ8uPDg=; b=JJNERPEsd5TISVrYpoBeyUpRFUvPyhx8kjlKBomzr5Xljn5oxxHwKvZCfx6GOkOtos Z0EnQyoIkmU9sZJ0yDaYIVAiCAfIOTzQX5IGc/yJOEKEOb9SZsIMSN4yyBiH2je79BIM WGi1OF71gBs6IoUzP8okDH6d05ucjljYmPNgYS+G2gIBpI1F5Um1h2zza0HNUMHTwmvx scWokjzUGkRmIvm+VB/ZSNf83mZpGXz8/FaarNXbD7om3daAwnnTyvZO/FfMtvm32rYa v3Hz5MhvrjiJeYCAcFAwrlVVETpUTx2sD5LJpmk4nWFlGkfFIARquAmgk/tZOW1k/nTJ 4KtA== X-Forwarded-Encrypted: i=1; AJvYcCVTTHM6MN8QJ1+SsL6CTXy/Vww+YLVRmBAisPL5ORixXQWfm7dXXspl2UUfkhTTlzZbyvkJdyXi7wcnHsY=@vger.kernel.org X-Gm-Message-State: AOJu0Yylpk9of2AEeGJFLlmFuzTSf7dqvFr+XoroUpGhi9vOHBk6ljGv SqmP6G7Ll6yuT9YUnK24s850hoa/coqnyyNWeS7m5ZqyXXRJIP0LoXBI+rSLialK1tZcmeETd32 ld9FY X-Gm-Gg: AZuq6aIiUsZhT+6WOo0GacvvkWbO9JTjrhHS6VDQmMlpNc8vd1HAs7v+AI7N6PD6Kl2 BuDNRcxiHNGvQ9/FnTY5H6XsQzP2AbMHIKoBha+CtvqulSyfCawjNwM4NFATobWPpYQypuxwbKX lQ+SKDjurnj2yae3VBHZAUi1zBbnT+ADyBKShpHBmvO8EHWoR250aeD/kXI0Hc/Z2yPAfmgWrd3 rhmbF/JhF9IT1zx2xz4f52pPBHUFFjNh2FXznx7iLKTo40PfhTebIFJgyQJKj9jG772sRxHGSaU /7+luIXNHfFPMrzv4WnZ6nD80x/Uv72fV/n3Mq098cYG0V5o+mC3NseZuWtWMASJDc02YArHRjB I65inVyq9b/yCYGVcHkGnmNxM+eg6p0CsXOxbD8DjSflbNVi/Y+/IxcQl0HkP6+ONxtxuvZYqRW dezPMg2Do5c/PA+r6a X-Received: by 2002:a05:600c:3b29:b0:475:d9de:952e with SMTP id 5b1f17b1804b1-48082891d3cmr20586175e9.1.1769669755209; Wed, 28 Jan 2026 22:55:55 -0800 (PST) Received: from localhost ([196.207.164.177]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-481a5d55d38sm2973585e9.6.2026.01.28.22.55.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jan 2026 22:55:54 -0800 (PST) Date: Thu, 29 Jan 2026 09:55:51 +0300 From: Dan Carpenter To: Michael Huang Cc: Greg Kroah-Hartman , Joe Perches , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH] staging: rtl8723bs: refactor BSS Coexistence channel report logic Message-ID: References: <20260128204510.53433-1-tehsiu.huang@gmail.com> 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=us-ascii Content-Disposition: inline In-Reply-To: <20260128204510.53433-1-tehsiu.huang@gmail.com> On Wed, Jan 28, 2026 at 12:45:10PM -0800, Michael Huang wrote: > Refactor the 'ICS' array in issue_action_BSSCoexistPacket() to improve > readability and maintainability. This addresses technical debt related > to magic numbers and ambiguous array usage. > > The original implementation used a multi-purpose 2D array (ICS[8][15]) > where magic numbers were prevalent and the first element of each row > was overloaded as a status flag. This patch: > > - Introduces descriptive macros: BSS_COEX_MAX_CLASSES, > BSS_COEX_MAX_CHANNELS, and BSS_COEX_MAX_INFO_LEN. > - Splits the overloaded array into two distinct boolean arrays: > 'class_active' (for group status) and 'ch_present' (for channel data). > - Converts the logic to use 'bool' types and 0-indexed loops, > conforming to standard C programming practices. > - Adds defensive boundary checks (ch > 0 && ch < MAX) to ensure > robustness against unexpected channel data. > > This refactoring maintains the current 2.4GHz reporting behavior while > providing a structured and extensible foundation for future Operating > Class support according to IEEE 802.11 specifications. > > Signed-off-by: Michael Huang > --- > drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 41 +++++++------------ > .../staging/rtl8723bs/include/rtw_mlme_ext.h | 3 ++ > 2 files changed, 18 insertions(+), 26 deletions(-) > > diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c > index 884fcce50d9c..481295224f14 100644 > --- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c > +++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c > @@ -3587,8 +3587,9 @@ static void issue_action_BSSCoexistPacket(struct adapter *padapter) > struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv); > struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; > struct __queue *queue = &(pmlmepriv->scanned_queue); > - u8 InfoContent[16] = {0}; > - u8 ICS[8][15]; > + u8 InfoContent[BSS_COEX_MAX_INFO_LEN] = {0}; > + bool class_active[BSS_COEX_MAX_CLASSES] = {false}; We only ever set the first element in the class_active[] array. #puzzled > + bool ch_present[BSS_COEX_MAX_CLASSES][BSS_COEX_MAX_CHANNELS] = {{false}}; Btw, use "= {};" to initialize arrays to zero. It's not standard C, but it's kernel C. regards, dan carpenter