On 12/11/2024 22:04, Kees Bakker wrote: > Op 30-10-2024 om 19:27 schreef Bitterblue Smith: >> These contain code shared by both RTL8821AU and RTL8812AU chips. >> >> Signed-off-by: Bitterblue Smith <rtl8821cerfe2@xxxxxxxxx> >> --- >> v2: >> - Rename rtw8821a.{c,h} to rtw88xxa.{c,h}. >> - Rename functions to use the "rtw88xxa" prefix. >> - Rename struct rtw8821a_efuse to rtw88xxa_efuse. >> - Keep only the common code in this patch. The rest is in the next >> two patches now. >> - Fix copyright year. >> - Print hw_cap in rtw88xxa_read_usb_type. >> - Use pointer to rtwdev->efuse in rtw88xxa_get_bb_swing instead of >> making a copy of the struct. >> - Make rtw88xxa_get_swing_index return 24 instead of 0 by default. >> - Use new register definitions. >> - Delete rtw8821a_query_rx_desc. Use the new rtw_rx_query_rx_desc >> function instead. >> - Use u32_get_bits instead of FIELD_GET in >> rtw88xxa_false_alarm_statistics. >> - Use existing bit definitions for REG_CR bits instead of creating new >> ones. >> - Use existing name of REG_CCK0_FAREPORT instead of adding a new name. >> - Delete unnecessary braces and semicolons in switch statements. >> - Initialise arrays with {} instead of {0}. >> - Empty functions should have the braces on separate lines. >> - Include reg.h in rtw88xxa.h. >> - Make struct rtw8821au_efuse and rtw8812au_efuse __packed. >> - Delete most macros from rtw88xxa.h. Some were moved to reg.h, some >> were unused (inherited from rtw8821c.h). >> - Fix some indentation. >> - Use the correct IQK function for 8812au in the tx power tracking. >> v1 was accidentally using the IQK function meant for 8821au. >> - Rename struct rtw8821a_phy_status_rpt to rtw_jaguar_phy_status_rpt. >> It's shared by RTL8821AU and RTL8812AU, and maybe RTL8814AU in the >> future. These are all "Jaguar" chips. >> - Make struct rtw_jaguar_phy_status_rpt __packed. >> - Access struct rtw_jaguar_phy_status_rpt with le32_get_bits instead >> of bit fields. >> >> v3: >> - No change. >> >> v4: >> - No change. >> --- >> drivers/net/wireless/realtek/rtw88/rtw88xxa.c | 1989 +++++++++++++++++ >> drivers/net/wireless/realtek/rtw88/rtw88xxa.h | 175 ++ >> 2 files changed, 2164 insertions(+) >> create mode 100644 drivers/net/wireless/realtek/rtw88/rtw88xxa.c >> create mode 100644 drivers/net/wireless/realtek/rtw88/rtw88xxa.h >> [...] > >> +static void rtw88xxau_init_queue_reserved_page(struct rtw_dev *rtwdev) >> +{ >> + const struct rtw_chip_info *chip = rtwdev->chip; >> + struct rtw_fifo_conf *fifo = &rtwdev->fifo; >> + const struct rtw_page_table *pg_tbl = NULL; >> + u16 pubq_num; >> + u32 val32; >> + >> + switch (rtw_hci_type(rtwdev)) { >> + case RTW_HCI_TYPE_PCIE: >> + pg_tbl = &chip->page_table[1]; >> + break; >> + case RTW_HCI_TYPE_USB: >> + if (rtwdev->hci.bulkout_num == 2) >> + pg_tbl = &chip->page_table[2]; >> + else if (rtwdev->hci.bulkout_num == 3) >> + pg_tbl = &chip->page_table[3]; >> + else if (rtwdev->hci.bulkout_num == 4) >> + pg_tbl = &chip->page_table[4]; >> + break; >> + case RTW_HCI_TYPE_SDIO: >> + pg_tbl = &chip->page_table[0]; >> + break; >> + default: > All other switch (rtw_hci_type(rtwdev)) in this module handle > the default with an error. Shouldn't you be doing that here too? I guess, if you want. I don't remember why there is no error here. > In the default case the code continues with pg_tbl == NULL > and thus it will crash. The default case should be impossible to reach because we don't have other interface types. And probably one of those other switch statements is executed earlier, so this function wouldn't run. >> + break; >> + } >> + >> + pubq_num = fifo->acq_pg_num - pg_tbl->hq_num - pg_tbl->lq_num - >> + pg_tbl->nq_num - pg_tbl->exq_num - pg_tbl->gapq_num; >> + >> + val32 = BIT_RQPN_NE(pg_tbl->nq_num, pg_tbl->exq_num); >> + rtw_write32(rtwdev, REG_RQPN_NPQ, val32); >> + >> + val32 = BIT_RQPN_HLP(pg_tbl->hq_num, pg_tbl->lq_num, pubq_num); >> + rtw_write32(rtwdev, REG_RQPN, val32); >> +} >> [...]