On 18/04/2024 03:49, Ping-Ke Shih wrote: > Bitterblue Smith <rtl8821cerfe2@xxxxxxxxx> wrote: >> >> On 17/04/2024 09:48, Ping-Ke Shih wrote: >>> Bitterblue Smith <rtl8821cerfe2@xxxxxxxxx> wrote: >>> >>>> @@ -228,35 +238,25 @@ static void _rtl92d_fill_h2c_command(struct ieee80211_hw *hw, >>>> break; >>>> } >>>> } >>>> + >>>> while (!bwrite_success) { >>>> wait_writeh2c_limmit--; >>>> if (wait_writeh2c_limmit == 0) { >>>> pr_err("Write H2C fail because no trigger for FW INT!\n"); >>>> break; >>>> } >>>> + >>>> boxnum = rtlhal->last_hmeboxnum; >>>> switch (boxnum) { >>>> - case 0: >>>> - box_reg = REG_HMEBOX_0; >>>> - box_extreg = REG_HMEBOX_EXT_0; >>>> - break; >>>> - case 1: >>>> - box_reg = REG_HMEBOX_1; >>>> - box_extreg = REG_HMEBOX_EXT_1; >>>> - break; >>>> - case 2: >>>> - box_reg = REG_HMEBOX_2; >>>> - box_extreg = REG_HMEBOX_EXT_2; >>>> - break; >>>> - case 3: >>>> - box_reg = REG_HMEBOX_3; >>>> - box_extreg = REG_HMEBOX_EXT_3; >>>> + case 0 ... 3: >>>> + box_reg = REG_HMEBOX_0 + boxnum * 4; >>>> + box_extreg = REG_HMEBOX_EXT_0 + boxnum * 2; >>> >>> Should be "* 4" as well? >>> >>> box_extreg = REG_HMEBOX_EXT_0 + boxnum * 4; >>> >> >> No, because they are only two bytes apart in this old chip: >> >> #define REG_HMEBOX_EXT_0 0x0088 >> #define REG_HMEBOX_EXT_1 0x008A >> #define REG_HMEBOX_EXT_2 0x008C >> #define REG_HMEBOX_EXT_3 0x008E >> > > Sorry, I misread them in rtl8188ee/reg.h. > > To clearly know what 4 and 2 are, how about to define: > > #define SIZE_OF_REG_HMEBOX 4 > #define SIZE_OF_REG_HMEBOX_EXT 2 > Sounds good.