From: "Bera Yüzlü" <b9788213@gmail.com>
To: tommyguo039@gmail.com
Cc: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org,
linux-staging@lists.linux.dev
Subject: Re: [PATCH v1] staging: rtl8723bs: remove GEN_CMD_CODE macro and callback array
Date: Wed, 1 Apr 2026 10:38:53 +0300 [thread overview]
Message-ID: <20260401073853.15275-1-b9788213@gmail.com> (raw)
In-Reply-To: <20260401000818.51141-1-tommyguo039@gmail.com>
On Tue, 31 Mar 2026 20:08:18 -0400, Xiyuan Guo wrote:
> The GEN_CMD_CODE macro and the rtw_cmd_callback function pointer array
> add unnecessary layers of indirection and make the code difficult to
> follow.
>
> Remove the GEN_CMD_CODE macro and replace the function pointer array
> dispatcher in rtw_cmd_thread() with a switch statement.
>
> Signed-off-by: Xiyuan Guo <tommyguo039@gmail.com>
> ---
Can't compile it :( Please compile driver with
'make M=drivers/staging/rtl8723bs' before sending your patch.
> /* call callback function for post-processed */
> - if (pcmd->cmdcode < ARRAY_SIZE(rtw_cmd_callback)) {
> - pcmd_callback = rtw_cmd_callback[pcmd->cmdcode].callback;
> - if (!pcmd_callback) {
> - rtw_free_cmd_obj(pcmd);
> - } else {
> - /* todo: !!! fill rsp_buf to pcmd->rsp if (pcmd->rsp!= NULL) */
> - pcmd_callback(pcmd->padapter, pcmd);/* need consider that free cmd_obj in rtw_cmd_callback */
> - }
> - } else {
> + switch (pcmd->cmdcode) {
> + case _Read_BBREG:
> + case _Read_RFREG:
> + rtw_getbbrfreg_cmdrsp_callback(padapter, pcmd);
> + break;
> + case _JoinBss:
> + rtw_joinbss_cmd_callback(padapter, pcmd);
> + break;
> + case _DisConnect:
> + rtw_disassoc_cmd_callback(padapter, pcmd);
> + break;
> + case _CreateBss:
> + rtw_createbss_cmd_callback(padapter, pcmd);
> + break;
> + case _SiteSurvey:
> + rtw_survey_cmd_callback(padapter, pcmd);
> + break;
> + case _SetStaKey:
> + rtw_setstaKey_cmdrsp_callback(padapter, pcmd);
> + break;
> + case _SetAssocSta:
> + rtw_setassocsta_cmdrsp_callback(padapter, pcmd);
> + break;
> + default:
> rtw_free_cmd_obj(pcmd);
> + break;
> }
> flush_signals_thread();
> goto _next;
You are deleting a TODO here.
> + _Read_MACREG, /*0*/
> + _Write_MACREG,
> + _Read_BBREG,
> + _Write_BBREG,
> + _Read_RFREG,
> + _Write_RFREG, /*5*/
> + _Read_EEPROM,
> + _Write_EEPROM,
> + _Read_EFUSE,
> + _Write_EFUSE,
> +
> + _Read_CAM, /*10*/
> + _Write_CAM,
> + _setBCNITV,
> + _setMBIDCFG,
> + _JoinBss, /*14*/
> + _DisConnect, /*15*/
> + _CreateBss,
> + _SetOpMode,
> + _SiteSurvey, /*18*/
> + _SetAuth,
> +
> + _SetKey, /*20*/
> + _SetStaKey,
> + _SetAssocSta,
> + _DelAssocSta,
> + _SetStaPwrState,
> + _SetBasicRate, /*25*/
> + _GetBasicRate,
> + _SetDataRate,
> + _GetDataRate,
> + _SetPhyInfo,
> +
> + _GetPhyInfo, /*30*/
> + _SetPhy,
> + _GetPhy,
> + _readRssi,
> + _readGain,
> + _SetAtim, /*35*/
> + _SetPwrMode,
> + _JoinbssRpt,
> + _SetRaTable,
> + _GetRaTable,
> +
> + _GetCCXReport, /*40*/
> + _GetDTMReport,
> + _GetTXRateStatistics,
> + _SetUsbSuspend,
> + _SetH2cLbk,
> + _AddBAReq, /*45*/
> + _SetChannel, /*46*/
> + _SetTxPower,
> + _SwitchAntenna,
> + _SetCrystalCap,
> + _SetSingleCarrierTx, /*50*/
> +
> + _SetSingleToneTx,/*51*/
> + _SetCarrierSuppressionTx,
> + _SetContinuousTx,
> + _SwitchBandwidth, /*54*/
> + _TX_Beacon, /*55*/
> +
> + _Set_MLME_EVT, /*56*/
> + _Set_Drv_Extra, /*57*/
> + _Set_H2C_MSG, /*58*/
> +
> + _SetChannelPlan, /*59*/
> +
> + _SetChannelSwitch, /*60*/
> + _TDLS, /*61*/
> + _ChkBMCSleepq, /*62*/
> +
> + _RunInThreadCMD, /*63*/
Why not use snake case instead?
Thanks,
Bera
next prev parent reply other threads:[~2026-04-01 7:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-01 0:08 [PATCH v1] staging: rtl8723bs: remove GEN_CMD_CODE macro and callback array Xiyuan Guo
2026-04-01 7:38 ` Bera Yüzlü [this message]
2026-04-03 8:45 ` kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260401073853.15275-1-b9788213@gmail.com \
--to=b9788213@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=tommyguo039@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox