wifi: rtw89: acpi: check for _DSM function support before evaluating it
PATCH 1/1 wifi: rtw89: acpi: check for _DSM function support before evaluating it
When the WiFi device has no ACPI companion, or the firmware does not implement a given rtw89 _DSM function, rtw89_acpi_evaluate_dsm() calls acpi_evaluate_dsm() anyway. ACPI core then warns on every probe:
ACPI: \: failed to evaluate _DSM e8c3a8d2-694b-004f-82bd-fe8607803aa7 rev:0 func:10 (0x1001)
ACPI: \: failed to evaluate _DSM e8c3a8d2-694b-004f-82bd-fe8607803aa7 rev:0 func:6 (0x1001)
Here the handle is NULL, and acpi_evaluate_object() returns AE_BAD_PARAMETER. All callers already treat failure as "no policy provided by the platform", so this is only noise.
Use acpi_check_dsm() first. It returns false for a NULL handle and for functions that are not advertised, so absent functions fail quietly at debug level, as rtw89_acpi_evaluate_method() already does.
Seen on an RTL8852BE in a desktop PCIe slot.
--- drivers/net/wireless/realtek/rtw89/acpi.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/net/wireless/realtek/rtw89/acpi.c +8 -2
@@ -372,11 +372,17 @@ int rtw89_acpi_evaluate_dsm(struct rtw89_dev *rtwdev,enum rtw89_acpi_dsm_func func, struct rtw89_acpi_dsm_result *res) { + acpi_handle handle = ACPI_HANDLE(rtwdev->dev);union acpi_object *obj;int ret; - obj =acpi_evaluate_dsm (ACPI_HANDLE (rtwdev->dev), &rtw89_guid, -0 , func,NULL ); +if (!acpi_check_dsm (handle, &rtw89_guid,0 ,BIT (func))) { +rtw89_debug (rtwdev,RTW89_DBG_ACPI , +"acpi dsm func %d not supported\n" , func); +return -ENOENT ; + } + + obj =acpi_evaluate_dsm (handle, &rtw89_guid,0 , func,NULL );if (!obj) {rtw89_debug (rtwdev,RTW89_DBG_ACPI ,"acpi dsm fail to evaluate func: %d\n" , func);
Signature · 1 line
2.56.0
Ping-Ke Shih
maintainerQuoted 7 lines · Rosen Penev
When the WiFi device has no ACPI companion, or the firmware does not implement a given rtw89
_DSMfunction,rtw89_acpi_evaluate_dsm()callsacpi_evaluate_dsm()anyway. ACPI core then warns on every probe:ACPI: \: failed to evaluate
_DSMe8c3a8d2-694b-004f-82bd-fe8607803aa7 rev:0 func:10 (0x1001)
ACPI: \: failed to evaluate_DSMe8c3a8d2-694b-004f-82bd-fe8607803aa7 rev:0 func:6 (0x1001)
Quoted 7 lines
Here the handle is NULL, and
acpi_evaluate_object()returnsAE_BAD_PARAMETER. All callers already treat failure as "no policy provided by the platform", so this is only noise.Use
acpi_check_dsm()first. It returns false for a NULL handle and for functions that are not advertised, so absent functions fail quietly at debug level, asrtw89_acpi_evaluate_method()already does.
The acpi_check_dsm() is to evaluate func 0 before actually accessing func. I'm not sure if all platforms will implement func 0. Do you know that?
Quoted 4 lines
Seen on an RTL8852BE in a desktop PCIe slot.
Fixes e897b0bef38a ("wifi: rtw89: introduce realtek ACPI DSM method")
Does it need a Fixes? As I see, this is not a bug.
Quoted 1 line
Signed-off-by Rosen Penev <[email protected]>
Quoted 13 lines · Ping-Ke Shih
Quoted 11 lines · Rosen Penev
When the WiFi device has no ACPI companion, or the firmware does not implement a given rtw89
_DSMfunction,rtw89_acpi_evaluate_dsm()callsacpi_evaluate_dsm()anyway. ACPI core then warns on every probe:ACPI: \: failed to evaluate
_DSMe8c3a8d2-694b-004f-82bd-fe8607803aa7 rev:0 func:10 (0x1001)
ACPI: \: failed to evaluate_DSMe8c3a8d2-694b-004f-82bd-fe8607803aa7 rev:0 func:6 (0x1001)Here the handle is NULL, and
acpi_evaluate_object()returnsAE_BAD_PARAMETER. All callers already treat failure as "no policy provided by the platform", so this is only noise.
Quoted 6 lines
Quoted 3 lines
Use
acpi_check_dsm()first. It returns false for a NULL handle and for functions that are not advertised, so absent functions fail quietly at debug level, asrtw89_acpi_evaluate_method()already does.The
acpi_check_dsm()is to evaluate func 0 before actually accessing func. I'm not sure if all platforms will implement func 0. Do you know that?
yes this was only a partial fix. Will rework.
Quoted 7 lines
Quoted 5 lines
Seen on an RTL8852BE in a desktop PCIe slot.
Fixes e897b0bef38a ("wifi: rtw89: introduce realtek ACPI DSM method")Does it need a Fixes? As I see, this is not a bug.
WIll drop.
Quoted 4 lines
Quoted 2 lines
Signed-off-by Rosen Penev <[email protected]>