wifi: rtw88: two small error propagation fixes
Subsystems (3)
cover wifi: rtw88: two small error propagation fixes
While updating the rtw88 sdio patches I found two more improvements for the existing code. This series targets wireless-next and is meant to be applied on top of my previous series v2 "rtw88: Add additional SDIO support bits" from [0]. I decide to target wireless-next because these patches are not fixing any issues visible to the end user. Worst case is that the code is shadowing some error codes.
The next series that I'll send after this is the addition of the rtw88 SDIO HCI and adding the first driver(s) to utilize this code.
[0] https://lore.kernel.org/lkml/[email protected]/
Martin Blumenstingl (2):
wifi: rtw88: mac: Return the original error from rtw_pwr_seq_parser()
wifi: rtw88: mac: Return the original error from
rtw_mac_power_switch()
drivers/net/wireless/realtek/rtw88/mac.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
Signature · 1 line
2.39.2
PATCH 1/2 wifi: rtw88: mac: Return the original error from rtw_pwr_seq_parser()
rtw_pwr_seq_parser() calls rtw_sub_pwr_seq_parser() which can either return -EBUSY, -EINVAL or 0. Propagate the original error code instead of unconditionally returning -EBUSY in case of an error.
--- drivers/net/wireless/realtek/rtw88/mac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/realtek/rtw88/mac.c +1 -1
@@ -236,7 +236,7 @@ static int rtw_pwr_seq_parser(struct rtw_dev *rtwdev, ret =rtw_sub_pwr_seq_parser (rtwdev, intf_mask, cut_mask, cmd);if (ret) -return -EBUSY ; +return ret; idx++; }while (1 );
Signature · 1 line
2.39.2
RE: [PATCH v1 wireless-next 1/2] wifi: rtw88: mac: Return the original error from rtw_pwr_seq_parser()
Quoted 11 lines
-----Original Message-----
From: Martin Blumenstingl <[email protected]>
Sent: Monday, February 27, 2023 6:10 AM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Ping-Ke Shih <[email protected]>; Neo Jou <[email protected]>; Martin Blumenstingl <[email protected]>
Subject: [PATCH v1 wireless-next 1/2] wifi: rtw88: mac: Return the original error fromrtw_pwr_seq_parser()
Quoted 6 lines
rtw_pwr_seq_parser()callsrtw_sub_pwr_seq_parser()which can either return-EBUSY,-EINVALor 0. Propagate the original error code instead of unconditionally returning-EBUSYin case of an error.Fixes e3037485c68e ("rtw88: new Realtek 802.11ac driver")Signed-off-by Martin Blumenstingl <[email protected]>
Quoted 19 lines
--- drivers/net/wireless/realtek/rtw88/mac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/wireless/realtek/rtw88/mac.c +1
-2@@ -236,7 +236,7 @@ static int rtw_pwr_seq_parser(struct rtw_dev *rtwdev, ret =rtw_sub_pwr_seq_parser (rtwdev, intf_mask, cut_mask, cmd);if (ret) -return -EBUSY ; +return ret; idx++; }while (1 ); --2.39.2
Re: [PATCH v1 wireless-next 1/2] wifi: rtw88: mac: Return the original error from rtw_pwr_seq_parser()
In reply to Martin BlumenstinglQuoted 7 lines · Martin Blumenstingl
rtw_pwr_seq_parser()callsrtw_sub_pwr_seq_parser()which can either return-EBUSY,-EINVALor 0. Propagate the original error code instead of unconditionally returning-EBUSYin case of an error.Fixes e3037485c68e ("rtw88: new Realtek 802.11ac driver")Signed-off-by Martin Blumenstingl <[email protected]>Reviewed-by Ping-Ke Shih <[email protected]>
2 patches applied to wireless-next.git, thanks.
b7ed9fa2cb76 wifi: rtw88: mac: Return the original error from rtw_pwr_seq_parser() 15c8e267dfa6 wifi: rtw88: mac: Return the original error from rtw_mac_power_switch()
Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
PATCH 2/2 wifi: rtw88: mac: Return the original error from rtw_mac_power_switch()
In reply to Martin Blumenstinglrtw_mac_power_switch() calls rtw_pwr_seq_parser() which can return -EINVAL, -EBUSY or 0. Propagate the original error code instead of unconditionally returning -EINVAL in case of an error.
--- drivers/net/wireless/realtek/rtw88/mac.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/wireless/realtek/rtw88/mac.c +4 -2
@@ -250,6 +250,7 @@ static int rtw_mac_power_switch(struct rtw_dev *rtwdev, bool pwr_on)const struct rtw_pwr_seq_cmd **pwr_seq;u8 rpwm;bool cur_pwr; +int ret;if (rtw_chip_wcpu_11ac (rtwdev)) { rpwm =rtw_read8 (rtwdev, rtwdev->hci.rpwm_addr);
@@ -273,8 +274,9 @@ static int rtw_mac_power_switch(struct rtw_dev *rtwdev, bool pwr_on)return -EALREADY ; pwr_seq = pwr_on ? chip->pwr_on_seq : chip->pwr_off_seq; -if (rtw_pwr_seq_parser (rtwdev, pwr_seq)) -return -EINVAL ; + ret =rtw_pwr_seq_parser (rtwdev, pwr_seq); +if (ret) +return ret;if (pwr_on)set_bit (RTW_FLAG_POWERON , rtwdev->flags);
Signature · 1 line
2.39.2
RE: [PATCH v1 wireless-next 2/2] wifi: rtw88: mac: Return the original error from rtw_mac_power_switch()
Quoted 12 lines
-----Original Message-----
From: Martin Blumenstingl <[email protected]>
Sent: Monday, February 27, 2023 6:10 AM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Ping-Ke Shih <[email protected]>; Neo Jou <[email protected]>; Martin Blumenstingl <[email protected]>
Subject: [PATCH v1 wireless-next 2/2] wifi: rtw88: mac: Return the original error fromrtw_mac_power_switch()
Quoted 6 lines
rtw_mac_power_switch()callsrtw_pwr_seq_parser()which can return-EINVAL,-EBUSYor 0. Propagate the original error code instead of unconditionally returning-EINVALin case of an error.Fixes e3037485c68e ("rtw88: new Realtek 802.11ac driver")Signed-off-by Martin Blumenstingl <[email protected]>
Quoted 17 lines
--- drivers/net/wireless/realtek/rtw88/mac.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/net/wireless/realtek/rtw88/mac.c +1
-0@@ -250,6 +250,7 @@ static int rtw_mac_power_switch(struct rtw_dev *rtwdev, bool pwr_on)const struct rtw_pwr_seq_cmd **pwr_seq;u8 rpwm;bool cur_pwr; +int ret;if (rtw_chip_wcpu_11ac (rtwdev)) { rpwm =rtw_read8 (rtwdev, rtwdev->hci.rpwm_addr);
drivers/net/wireless/realtek/rtw88/mac.c static int rtw_mac_power_switch(struct rtw_dev *rtwdev, bool pwr_on) · line 274
Quoted 1 line
drivers/net/wireless/realtek/rtw88/mac.c +0
-0@@ -273,8 +274,9 @@ static int rtw_mac_power_switch(struct rtw_dev *rtwdev, bool pwr_on)return -EALREADY ;
I think a reason why we don't propagate return value is special deal of EALREADY by caller. Since this driver becomes stable and no others use EALREADY as error code, this patchset will be okay.
Quoted 12 lines
drivers/net/wireless/realtek/rtw88/mac.c +3
-3pwr_seq = pwr_on ? chip->pwr_on_seq : chip->pwr_off_seq; -if (rtw_pwr_seq_parser (rtwdev, pwr_seq)) -return -EINVAL ; + ret =rtw_pwr_seq_parser (rtwdev, pwr_seq); +if (ret) +return ret;if (pwr_on)set_bit (RTW_FLAG_POWERON , rtwdev->flags); --2.39.2