From nobody Sat Oct 24 14:13:33 2026 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=136.143.188.112 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1792422197; b=CYzcrsV2ogycaPcs6qCchjGd5TwQ5v4r4fhl3Qe25rOO7nOffoi8lzmFJ9q+3fRgKQ6K j9/eUa6D27mkb9IZC9O6X63sPloIPaNby1IOrvDf+ns03fN+1OinP0/6WVsFtvYXGe+ru 5ZZUb2+QeJ5mMO5g9nM7SwDHJ9Eude8viF6Op6oXyPv0dGK4oOU6fmFJd9FWfZMfpFyL2 zaYwjnvrj53AH7Ugrac0bhxfYkYR1vsSHet+YoeC0BvX3bPL742Kss+sM2jV5pQeLEuup noBcdt4NWn6hI21q5vqPUCCPMHeiXbiZhgjBYW+IC/RiKPpHayxGZQOxOJACUOqie5w== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792422197; h=DMARC-Filter:DKIM-Signature:Received:From:Date:Subject:MIME-Version: Content-Type:Content-Transfer-Encoding:Message-Id:References: In-Reply-To:To:Cc:X-Mailer:X-ZohoMailClient; bh=ReRS4ZShNiHqof3Nd8ldDThiBg0uWWLo8oSubqtXzPw=; b=TYcj3Ce8IwtulIcXUPyzf85qJ+iTH5Awj+DXddi9ESfLprpjrdc6fqzfX8pbIIHuOJWc zLkLXBRTME2Dg0tZG7syeoTR6UrdmHOqBXciahTGr1TVt9VkPaWMkJsdU/u/FPcwiAvJC 5VSGs+sDTduR2jj53Kr4S5wkLZ/R/1CxbP9byzjMnn4Qo03Mp4BrKLUg31UX0lzBYvkE1 8F6O09vJPD0pmTwcocu3o002UDfESUZlwa7JoKXwbNm81S13O0xwzGJ7hoV+sHwxW8pee nflyULzWaQms0AXTw2TBQZWcaAJfxWuZmWXlp+UYdFxtctCCiRtVrs7+5XmzqFGjcXg== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass header.from=rong.moe; spf=pass smtp.mailfrom=rong.moe; dkim=pass header.d=rong.moe header.i=i@rong.moe header.a=rsa-sha256 header.s=zmail2048 header.b=og1VQhRa; arc=pass header.oldest-pass=0 smtp.remote-ip=136.143.188.112 Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B717D607D379; Mon, 19 Oct 2026 15:03:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org B717D607D379 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=rong.moe Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rong.moe Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=rong.moe header.i=i@rong.moe header.a=rsa-sha256 header.s=zmail2048 header.b=og1VQhRa ARC-Seal: i=1; a=rsa-sha256; t=1792422178; cv=none; d=zohomail.com; s=zohoarc; b=Vk5DC4eH9degSumq8VHdGQuo3n8pdRMnqCp5EOKeKajHUpCthzc/MUIkaS63vlYiJWGZ5u8GPF0lsm2nhnORFU1Z1rYMe+DmYPo4NtMJlHFYBXQWg/2GJzzfax4UYxwf5EkwE3+j41oi/u1XYqyWeLNDjT+SstinQhoQ/6t1xok= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1792422178; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=ReRS4ZShNiHqof3Nd8ldDThiBg0uWWLo8oSubqtXzPw=; b=DufN+gMns12A2ja1DISQ+zqIDRlBxk9N9PyQxq2GxmFw0/mzYph623+3z4MrOia+NozVBVHbPF560eZXX/TEafdcyI9I73F8tTF4V4HKAuIi1yQ9eNH3KdfY1zzydixlJs1KQAC7qp1e1fil2LtALNAVlu1EmnRxR1YeLHcZTNg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=rong.moe; spf=pass smtp.mailfrom=i@rong.moe; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1792422178; s=zmail2048; d=rong.moe; i=i@rong.moe; h=From:From:Date:Date:Subject:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Message-Id:In-Reply-To:To:To:Cc:Cc:Reply-To; bh=ReRS4ZShNiHqof3Nd8ldDThiBg0uWWLo8oSubqtXzPw=; b=og1VQhRaPgP5q9VWvnlWd0i8eNQu/ikTpxx5t1clhplp9LZSsEcTrOn4Wo5e0LP8 KpI7zPIYzV2grKrKfPol0x+9JhL2uYusjPPcxquJH+YHM9yup8xdCxiXjf+hWgNKawZ 6DsDKnqOfH7A3glCDOyOXAa3L4wBdWQ6nm+V/9ZMIZT6pYZtQzNa5eAmQbbwEiPR6uQ 355t/xxPa+GF9t+VQQvad9r2gO1m7qJsvLMs3l21xh/yPAhsL7T937H+L3oq8UQOb/F d4nB2xpqF6gKDZXqkOcn9dOlX3G3+DNleCJAwaOZQdLecRyZpig7NYRFPHA5aKjzoOE FUlMBWoBLw== Received: by smtp.zohomail.com with SMTPS id 1792422174220856.6185355186998; Mon, 19 Oct 2026 08:02:54 -0700 (PDT) From: Rong Zhang Date: Mon, 19 Oct 2026 23:02:23 +0800 Subject: [PATCH v5 01/12] platform/wmi: Introduce wmidev_exists() X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20261019-lwmi-wmi-new-api-v5-1-71557d28d058@rong.moe> References: <20261019-lwmi-wmi-new-api-v5-0-71557d28d058@rong.moe> In-Reply-To: <20261019-lwmi-wmi-new-api-v5-0-71557d28d058@rong.moe> To: Mark Pearson , "Derek J. Clark" , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Armin Wolf Cc: Charles , Navon John Lukose , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, Rong Zhang X-Mailer: b4 0.17-dev-6be7c X-ZohoMailClient: External From: Armin Wolf Some WMI drivers need to be able to detect the existence of WMI devices matching a given GUID in order to determine the availability of optional features. Using wmi_has_guid() for this will not work for WMI devices that cannot be used with the legacy GUID-based API (aka have WMI_GUID_DUPLICATED set). Introduce wmidev_exists() that also checks WMI devices that are only available to the bus-based API. Also mark wmi_has_guid() as deprecated because only WMI drivers using the legacy GUID-based API will continue to have use for it. Signed-off-by: Armin Wolf Tested-by: Mark Pearson Reviewed-by: Mark Pearson Tested-by: Navon John Lukose Reviewed-by: Derek J. Clark Signed-off-by: Rong Zhang Reported-by: Charles Reported-by: Navon John Lukose Suggested-by: Derek J. Clark Suggested-by: Mark Pearson --- Changes in v2: - New patch in the series as discussed at https://msgid.link/83776200-4A60-4756-A99F-D5A3BB4D834A@rong.moe --- drivers/platform/wmi/core.c | 33 +++++++++++++++++++++++++++++---- include/linux/wmi.h | 3 +++ 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/drivers/platform/wmi/core.c b/drivers/platform/wmi/core.c index 529825dcfbfe..a99da9b7039d 100644 --- a/drivers/platform/wmi/core.c +++ b/drivers/platform/wmi/core.c @@ -145,7 +145,7 @@ static inline void get_acpi_method_name(const struct wm= i_block *wblock, buffer[4] =3D '\0'; } =20 -static int wmidev_match_guid(struct device *dev, const void *data) +static int wmidev_match_guid_legacy(struct device *dev, const void *data) { struct wmi_block *wblock =3D dev_to_wblock(dev); const guid_t *guid =3D data; @@ -218,7 +218,7 @@ static struct wmi_device *wmi_find_device_by_guid(const= char *guid_string) if (ret < 0) return ERR_PTR(ret); =20 - dev =3D bus_find_device(&wmi_bus_type, NULL, &guid, wmidev_match_guid); + dev =3D bus_find_device(&wmi_bus_type, NULL, &guid, wmidev_match_guid_leg= acy); if (!dev) return ERR_PTR(-ENODEV); =20 @@ -800,10 +800,10 @@ acpi_status wmi_remove_notify_handler(const char *gui= d) EXPORT_SYMBOL_GPL(wmi_remove_notify_handler); =20 /** - * wmi_has_guid - Check if a GUID is available + * wmi_has_guid - Check if a GUID is available (deprecated) * @guid_string: 36 char string of the form fa50ff2b-f2e8-45de-83fa-65417f= 2f49ba * - * Check if a given GUID is defined by _WDG. + * Check if a given GUID is available and usable with the legacy GUID-base= d API. * * Return: True if GUID is available, false otherwise. */ @@ -821,6 +821,31 @@ bool wmi_has_guid(const char *guid_string) } EXPORT_SYMBOL_GPL(wmi_has_guid); =20 +static int wmidev_match_guid(struct device *dev, void *data) +{ + struct wmi_block *wblock =3D dev_to_wblock(dev); + const guid_t *guid =3D data; + + if (guid_equal(guid, &wblock->gblock.guid)) + return 1; + + return 0; +} + +/** + * wmidev_exists - Check if a WMI device with a given GUID exists + * @guid: GUID of the WMI device to search for + * + * Check if a WMI device with a given GUID exists at the given moment. + * + * Return: True if a matching WMI device exists, false otherwise. + */ +bool wmidev_exists(const guid_t *guid) +{ + return bus_for_each_dev(&wmi_bus_type, NULL, (void *)guid, wmidev_match_g= uid) =3D=3D 1; +} +EXPORT_SYMBOL_GPL(wmidev_exists); + /** * wmi_get_acpi_device_uid() - Get _UID name of ACPI device that defines G= UID (deprecated) * @guid_string: 36 char string of the form fa50ff2b-f2e8-45de-83fa-65417f= 2f49ba diff --git a/include/linux/wmi.h b/include/linux/wmi.h index defcb624a7e2..3dd223f2ff18 100644 --- a/include/linux/wmi.h +++ b/include/linux/wmi.h @@ -13,6 +13,7 @@ #include #include #include +#include =20 /** * struct wmi_device - WMI device structure @@ -83,6 +84,8 @@ acpi_status wmidev_block_set(struct wmi_device *wdev, u8 = instance, const struct =20 u8 wmidev_instance_count(struct wmi_device *wdev); =20 +bool wmidev_exists(const guid_t *guid); + /** * struct wmi_driver - WMI driver structure * @driver: Driver model structure --=20 2.55.0 From nobody Sat Oct 24 14:13:33 2026 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=136.143.188.112 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1792422207; b=DXa79jSwTcURqIf865eRiO1pvx0LNeonPyI1pgEgxkW+hVw1dwm6ial3TmfL+t5aLk+W YXeSWAb7gpAKn2jstWxix3P0oJxElVIcVT0BYuzlr3b3P2jAPlQ4X67Jet6rJzmVsJjnd v/X+uS9cKZI+PXL6NcHWkJHJf9VbNHwpWt0uhnFXoy0m5GQ/GYy2OW2bVgXHxB/mkzRMl DQI9wLCdEC08x2ihbjKCL3xECCe/42ZmV6GjtHFuwy6UPYJbzTJf1Jacuj1+0ZPwE48lJ UZkCxIRp1EAiazDK913ue7yQ2bXdi+eatMu2WXuSq8uhFLkmAjNoAjXi4//do5rWV+w== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792422207; h=DMARC-Filter:DKIM-Signature:Received:From:Date:Subject:MIME-Version: Content-Type:Content-Transfer-Encoding:Message-Id:References: In-Reply-To:To:Cc:X-Mailer:X-ZohoMailClient; bh=0UkI+p2KaBppYji0GomycRUpxyn5jorwQt7/VnBco3Q=; b=cLZl9ftc3dq4F9Xl/EonNInrfuMg4sz7RGlO5S1lsjjq56LbXl8Vl6+O6GP7cFGXIVF1 6H7SXE9vN6QkOrvwFP86Ds1MJENEdtv0APWnIlatFvrkanniKAfGhCgebnhbBfILTVqh5 9Dto1V1o865Fc6z2K/j4FaBbvga9ARJ5iob3hviy8nsdggK+WJ0L56qA/yWQxId98Vq0O k6eNCBZZIj/z1KPNDrZjt470aC2iXXILtCA7jVGg5iRXFHlFfZycua6xC6PKbMH35TR8D 27nryaZH5NEGp9VZvstPkeV0u0HjMlVZVgWKTlR0hfhk0EqPidtSHftx1fQJUUFmljA== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass header.from=rong.moe; spf=pass smtp.mailfrom=rong.moe; dkim=pass header.d=rong.moe header.i=i@rong.moe header.a=rsa-sha256 header.s=zmail2048 header.b=pJzxqwWk; arc=pass header.oldest-pass=0 smtp.remote-ip=136.143.188.112 Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2E4C2607D37F; Mon, 19 Oct 2026 15:03:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 2E4C2607D37F Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=rong.moe Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rong.moe Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=rong.moe header.i=i@rong.moe header.a=rsa-sha256 header.s=zmail2048 header.b=pJzxqwWk ARC-Seal: i=1; a=rsa-sha256; t=1792422182; cv=none; d=zohomail.com; s=zohoarc; b=NTCNK8fAaaUFkJGoktH/bsfTmThkZ0m5WtOpTkkfSe0j3JJTZkLdWCrykEurJKFxbnHgVe5spCP4JLvmQi9Sau0n1lQ7s4NiLYIkYiL4dMVjjSvqpH6EOzp5+stP3GTnpTBhAA3Sl9rXtdIQCOQMBn0cnGAuXOkLRAk3n/nEfoA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1792422182; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=0UkI+p2KaBppYji0GomycRUpxyn5jorwQt7/VnBco3Q=; b=HX8GWlD/NBSM0ikdrZoVF5Pa68kVN1YVaitjnH2F0KhJAIRWLiSbXUtZPK8PaSzwjDRZyIfJf0P7RCwxDGNK9tn9jknLTJ0+bLC7EnLh0ALEtmJYPDQbpo/mxfmO9mhfMQhpXyaOiuxP9TwuaSXZRatWyV28d0UohdTsq5I58WY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=rong.moe; spf=pass smtp.mailfrom=i@rong.moe; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1792422182; s=zmail2048; d=rong.moe; i=i@rong.moe; h=From:From:Date:Date:Subject:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Message-Id:In-Reply-To:To:To:Cc:Cc:Reply-To; bh=0UkI+p2KaBppYji0GomycRUpxyn5jorwQt7/VnBco3Q=; b=pJzxqwWk9HJvgbQW8lNZ5hzLr54im2BVSymDHCth5qaoOBYUH5nHbn94PgVLlBaj XnwWjVTgHN9UQc5typjD//1Cp8GlA3rDIVk8MrDlg3m+bfYn4BS1cflZm250jPSasjK 4DW8Lmmkj0u2qb168U+cGVj2YADKlG005JiSnbWlOz8Epozf9K0D2pkX0QVf2cVTgks QJ/qoH4jy4Zpw3u4VA1BlSMJ4O35AriT/6kd/jl6EJ9E9PZJ+8wsuIFGdtHPFo46luI 63lhiGLUG7xyERZdMeB4yCAZTVgCGyJDnlhxj4zCDUv/OlWgc3BUOGoIsH1wCcPPHyV pA+6nve6Ww== Received: by smtp.zohomail.com with SMTPS id 179242217902539.017621314283474; Mon, 19 Oct 2026 08:02:59 -0700 (PDT) From: Rong Zhang Date: Mon, 19 Oct 2026 23:02:24 +0800 Subject: [PATCH v5 02/12] platform/x86: lenovo-wmi-capdata: Do not stop the AC notifier chain on error X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20261019-lwmi-wmi-new-api-v5-2-71557d28d058@rong.moe> References: <20261019-lwmi-wmi-new-api-v5-0-71557d28d058@rong.moe> In-Reply-To: <20261019-lwmi-wmi-new-api-v5-0-71557d28d058@rong.moe> To: Mark Pearson , "Derek J. Clark" , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Armin Wolf Cc: Charles , Navon John Lukose , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, Rong Zhang , stable@vger.kernel.org X-Mailer: b4 0.17-dev-6be7c X-ZohoMailClient: External Returning NOTIFY_BAD to the AC notifier chain stops it by preventing later notifier blocks from being called, but our error is non-fatal for other AC notifier blocks, which should continue to consume the event. Return NOTIFY_DONE and add a dev_warn() on error, so that the AC notifier chain continues. This also aligns with hp-wmi. The function documentation was copied from elsewhere and makes no sense here, so correct it as well. Fixes: e1a5fe662b59 ("platform/x86: Add Lenovo Capability Data 01 WMI Drive= r") Cc: stable@vger.kernel.org Tested-by: Navon John Lukose Reviewed-by: Derek J. Clark Reviewed-by: Mark Pearson Signed-off-by: Rong Zhang Reported-by: Charles Reported-by: Navon John Lukose Suggested-by: Derek J. Clark Suggested-by: Mark Pearson --- Changes in v2: - New patch in the series --- drivers/platform/x86/lenovo/wmi-capdata.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/platform/x86/lenovo/wmi-capdata.c b/drivers/platform/x= 86/lenovo/wmi-capdata.c index d5e961566136..58787da959b4 100644 --- a/drivers/platform/x86/lenovo/wmi-capdata.c +++ b/drivers/platform/x86/lenovo/wmi-capdata.c @@ -774,13 +774,11 @@ static int lwmi_cd_setup(struct lwmi_cd_priv *priv, e= num lwmi_cd_type type) =20 /** * lwmi_cd01_notifier_call() - Call method for cd01 notifier. - * block call chain. - * @nb: The notifier_block registered to lenovo-wmi-events driver. + * @nb: The cd01 ACPI notifier_block. * @action: Unused. * @data: The ACPI event. * - * For LWMI_EVENT_THERMAL_MODE, set current_mode and notify platform_profi= le - * of a change. + * Refresh cached capdata on AC status change. * * Return: notifier_block status. */ @@ -799,8 +797,16 @@ static int lwmi_cd01_notifier_call(struct notifier_blo= ck *nb, unsigned long acti switch (event->type) { case ACPI_AC_NOTIFY_STATUS: ret =3D lwmi_cd_cache(priv); - if (ret) - return NOTIFY_BAD; + if (ret) { + dev_warn(&priv->wdev->dev, + "failed to refresh capdata on AC change: %d\n", ret); + + /* + * Our error is non-fatal for others, and we still want + * the other event consumers to process it. + */ + return NOTIFY_DONE; + } =20 return NOTIFY_OK; default: --=20 2.55.0 From nobody Sat Oct 24 14:13:33 2026 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=136.143.188.112 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1792422219; b=WmuShnUal4xs+Ak2cVF67Mjk4SXlLMpN50aQ49tAt/WsghJo1raL1uObh6fkjnybdTXn 692bLOTAUxWgGLkXrtzeZWil2h0h/FRuIwstRYhhMGJhazKEhj5RutbDxIUbVo9Lzw+Rv ER8OwhwZtt+lN4+XrmpVlFYULjE/VByRigCk2D84e+L2CY0cqpOuILw2CgT335dBq/bny 76LC7ncvZ6U2LVi7o4Mx8Aeqb0VjOvrDrpa7Kub7vY0Ua84KKrJOTw/7PFdOn/ax+ntVE PqmkKENoFimBTrWiXcXb5DdiBNhH2vsIhy1L87tRHH4VD+8X4/DrwcqdTK9FeNBgzag== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792422219; h=DMARC-Filter:DKIM-Signature:Received:From:Date:Subject:MIME-Version: Content-Type:Content-Transfer-Encoding:Message-Id:References: In-Reply-To:To:Cc:X-Mailer:X-ZohoMailClient; bh=PdMAha2bu9bIn+TvAIBbdJnVTbjJLN/vn9wKaWr7N2A=; b=jfMZQ83j0UPTuknCxLh7KVaN6s6ZTnTL9CbZaSvanxkyhBNe+LU0oRJ2uKhCk0ZlMqvX 0fUFCS6xuTAzyNG/72FAOzTaptKLH5yDFlPEJf/N3xCsQCctE8aA8guGR97M8yfUMwMY6 x7yJ1W2vHjhA+u3Jy73/sxvnxhz0znzWII6M6Dps6mkBVKYut2EiqfDgEeK+gVOdfVvri o5hfI0u5TCD7r6j6F1If3NJYvdwl3Wr+G+j/2gTyoVyVB4iW0DggJ+Ql8cS5l7AUPdvjc BIsoFxvw+adHiQCcLh2iaDPqAW84dFsg258VeTFCP3SYmibXzr5UhYvm5aMC2z9ecsw== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass header.from=rong.moe; spf=pass smtp.mailfrom=rong.moe; dkim=pass header.d=rong.moe header.i=i@rong.moe header.a=rsa-sha256 header.s=zmail2048 header.b=DmtQ4vse; arc=pass header.oldest-pass=0 smtp.remote-ip=136.143.188.112 Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 41EE6607DC53; Mon, 19 Oct 2026 15:03:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 41EE6607DC53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=rong.moe Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rong.moe Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=rong.moe header.i=i@rong.moe header.a=rsa-sha256 header.s=zmail2048 header.b=DmtQ4vse ARC-Seal: i=1; a=rsa-sha256; t=1792422185; cv=none; d=zohomail.com; s=zohoarc; b=dWNNbBaEHC0Gq/6gTc8LqnNXhdIwWR+e3P8XUdlLO9R7uER4J534p3jwRCzzrFIueS9yfRZ/+ahJfyf2gku1sWPXjyNp7n8S1ZZakR8rSnAeUydeBVTAugR1oYsX25oZqXh9ljxO5GzdG9PYmu0bIrGq3Lg+DEc2qovfAKWshXA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1792422185; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=PdMAha2bu9bIn+TvAIBbdJnVTbjJLN/vn9wKaWr7N2A=; b=eZN2eb5+b9ugYhcv+n4kEtffUCqHYnmoVvN7YsoXes9YXd+tryKADFWVDw1lhUnEfatwNoujrgECZkxTL6ARm/ekNXTo7Arx+C95mgFOYfbLQCtv5ZKC1XLaGXvO/Bcc5YZNC0szRfZjpN9AHULWsoiAqel6yo7ePqjHzVjYeiI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=rong.moe; spf=pass smtp.mailfrom=i@rong.moe; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1792422185; s=zmail2048; d=rong.moe; i=i@rong.moe; h=From:From:Date:Date:Subject:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Message-Id:In-Reply-To:To:To:Cc:Cc:Reply-To; bh=PdMAha2bu9bIn+TvAIBbdJnVTbjJLN/vn9wKaWr7N2A=; b=DmtQ4vse8Rj81Y2etdD3oXuTcirjmGCTfH4IuD1WqK9G/I3fuAxhV6Bnv/Lj85kb tlxw55hnGCMSRX1h8rsYrz5I8D7lp8wqek0s+jNpnhpzXC9ArlXeV+FTM46fX4wimB9 VEBHRhxXtvWeXxNA10/71ESA/aZryUz6RDCKErTyH6wuXYf+pjSYrGTu/histUBtxnZ HuzW1kCrVaAX6h4mwSTMSFpsrdeDtWboa5hfqsgAHZB3i2lAT4kvuhmSRZA3gLkgxqt 8x+vsPQQ+RIcuA9iOV/GOeLiTXm2AAO3p2UYAk5nP7gZVu/XkPKS1Lf1oGcREnDWenW W0zaTweSfw== Received: by smtp.zohomail.com with SMTPS id 179242218273654.14301423763561; Mon, 19 Oct 2026 08:03:02 -0700 (PDT) From: Rong Zhang Date: Mon, 19 Oct 2026 23:02:25 +0800 Subject: [PATCH v5 03/12] platform/x86: lenovo-wmi-capdata: Only allocate sub-master info when necessary X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20261019-lwmi-wmi-new-api-v5-3-71557d28d058@rong.moe> References: <20261019-lwmi-wmi-new-api-v5-0-71557d28d058@rong.moe> In-Reply-To: <20261019-lwmi-wmi-new-api-v5-0-71557d28d058@rong.moe> To: Mark Pearson , "Derek J. Clark" , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Armin Wolf Cc: Charles , Navon John Lukose , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, Rong Zhang X-Mailer: b4 0.17-dev-6be7c X-ZohoMailClient: External When capdata00 declares no fan test support, there is no need to allocate sub-master info as it's basically unused except for the priv->sub_master->sub_component_list =3D=3D ERR_PTR(-ENODEV) placeholder. Therefore, only allocate priv->sub_master when necessary, otherwise its absence implies the absence of sub-component. With that, PTR_ERR(sub_component_list) =3D=3D -ENODEV is repurposed for the following changes to represent stubbed sub-component. Tested-by: Navon John Lukose Reviewed-by: Derek J. Clark Reviewed-by: Mark Pearson Signed-off-by: Rong Zhang Reported-by: Charles Reported-by: Navon John Lukose Suggested-by: Derek J. Clark Suggested-by: Mark Pearson --- Changes in v3: - Shorten the comments of struct lwmi_cd_priv's members (thanks Derek J. Clark) --- drivers/platform/x86/lenovo/wmi-capdata.c | 34 +++++++++++++++++----------= ---- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/drivers/platform/x86/lenovo/wmi-capdata.c b/drivers/platform/x= 86/lenovo/wmi-capdata.c index 58787da959b4..fbe2ba627ff5 100644 --- a/drivers/platform/x86/lenovo/wmi-capdata.c +++ b/drivers/platform/x86/lenovo/wmi-capdata.c @@ -101,9 +101,9 @@ struct lwmi_cd_priv { struct lwmi_cd_sub_master_priv { struct device *master_dev; cd_list_cb_t master_cb; - struct cd_list *sub_component_list; /* ERR_PTR(-ENODEV) implies no sub-c= omponent. */ + struct cd_list *sub_component_list; /* ERR_PTR(-ENODEV): stubbed sub-com= ponent. */ bool registered; /* Has the sub-master been registere= d? */ - } *sub_master; + } *sub_master; /* NULL: no sub-component. */ }; =20 struct cd_list { @@ -258,6 +258,12 @@ static int lwmi_cd_component_bind(struct device *cd_de= v, case LENOVO_CAPABILITY_DATA_00: binder->cd00_list =3D priv->list; =20 + /* Missing sub-master info implies missing sub-component. */ + if (!priv->sub_master) { + binder->cd_fan_list_cb(om_dev, NULL); + break; + } + priv->sub_master->master_dev =3D om_dev; priv->sub_master->master_cb =3D binder->cd_fan_list_cb; lwmi_cd_call_master_cb(priv); @@ -288,13 +294,9 @@ static void lwmi_cd_component_unbind(struct device *cd= _dev, { struct lwmi_cd_priv *priv =3D dev_get_drvdata(cd_dev); =20 - switch (priv->list->type) { - case LENOVO_CAPABILITY_DATA_00: + if (priv->sub_master) { priv->sub_master->master_dev =3D NULL; priv->sub_master->master_cb =3D NULL; - return; - default: - return; } } =20 @@ -369,17 +371,19 @@ static int lwmi_cd_sub_master_add(struct lwmi_cd_priv= *priv, struct component_match *master_match =3D NULL; int ret; =20 + /* + * If the sub-master has no sub-component, there is no need to allocate + * or register the sub-master. The master callback will be called with + * NULL on master <-> sub-master bind to inform the master about the + * absence of sub-component. + */ + if (sub_component_type =3D=3D CD_TYPE_NONE) + return 0; + priv->sub_master =3D devm_kzalloc(&priv->wdev->dev, sizeof(*priv->sub_mas= ter), GFP_KERNEL); if (!priv->sub_master) return -ENOMEM; =20 - if (sub_component_type =3D=3D CD_TYPE_NONE) { - /* The master callback will be called with NULL on bind. */ - priv->sub_master->sub_component_list =3D ERR_PTR(-ENODEV); - priv->sub_master->registered =3D false; - return 0; - } - /* * lwmi_cd_match() needs a pointer to enum lwmi_cd_type, but on-stack * data cannot be used here. Steal one from lwmi_cd_table. @@ -404,7 +408,7 @@ static int lwmi_cd_sub_master_add(struct lwmi_cd_priv *= priv, */ static void lwmi_cd_sub_master_del(struct lwmi_cd_priv *priv) { - if (!priv->sub_master->registered) + if (!priv->sub_master || !priv->sub_master->registered) return; =20 component_master_del(&priv->wdev->dev, &lwmi_cd_sub_master_ops); --=20 2.55.0 From nobody Sat Oct 24 14:13:33 2026 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=136.143.188.112 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1792422230; b=G5AIOveYtX9oeYO8Tg8KK6PkLAsMrARJvfzVXe1lOlA1rgU6PFsS4uXalxWU9e6C2GId FO5pElylrFlM7g1dS7hQbxC1N9jr7/m+oTjU83Lq00kxr1t/uxAek3xAup4XI0tXEqH15 CRvJo1NE4T7VpNGzgMek4j0z+pvzPHbL9UusJTsXd4SsSLt+Z+Ubbn9HYP8J3uMxeLXqo TrV7FbPiEqDvQtA5GwwioZRHv+v1b1Sj44dWeuq4ZtvTxzTNo8uDPGDHhk+5SpqxNMYaO kawnkC8fpS647H3h4ayP4mSn9od/Kqru6owtrVnFBe39/ZcHLy8idH8W1WFr3YSF4ZA== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792422230; h=DMARC-Filter:DKIM-Signature:Received:From:Date:Subject:MIME-Version: Content-Type:Content-Transfer-Encoding:Message-Id:References: In-Reply-To:To:Cc:X-Mailer:X-ZohoMailClient; bh=lax5mvzMdQMj5q0NwoMYFOyVhPZc0MFLMC9gpb4+qck=; b=vUHWXKY0uYq4W8NvooaGfImzTI2Dr+HA7WNQ3awZYJFkm1JIciTdXDKQZyY/1JAwvfKN 1UcM/VE4gi5zGXng1GEPgexKK4L190j3ULV0SLfhJnWIR7Zgtb5ULEXwL8uY37nqAYzHE pngqiPGCtEvB8ST+V9h4IIBIeHARbTNeQ39KaqD90yWUovmZd78myKRM8G0VEuddKsedl 6jCdTkv7RHJp+3PY4gUmmBpKE2UhugBEQuVzRvEj4xkZmHuK3KeP+EqcDPqLOcij3VQAe MOomkjKQnagXp/Pb/52xEA6uHwY91jGojjSFk367txY2XUHdpymoNyo0rpVpsz2HvDA== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass header.from=rong.moe; spf=pass smtp.mailfrom=rong.moe; dkim=pass header.d=rong.moe header.i=i@rong.moe header.a=rsa-sha256 header.s=zmail2048 header.b=dDbrNC3F; arc=pass header.oldest-pass=0 smtp.remote-ip=136.143.188.112 Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 24A20607DC60; Mon, 19 Oct 2026 15:03:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 24A20607DC60 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=rong.moe Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rong.moe Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=rong.moe header.i=i@rong.moe header.a=rsa-sha256 header.s=zmail2048 header.b=dDbrNC3F ARC-Seal: i=1; a=rsa-sha256; t=1792422189; cv=none; d=zohomail.com; s=zohoarc; b=aPh5a5Q8tHv8aIibJjHEsGSnaLUbyMKW0cPbsnGMe/SmTANsCUDGNJ/s5Lvukhnm4GQMXFXFBGZEyiJdzZUSIVd6X3yICs1MBlmfgzOGq9UPP9E0f0txjygjKAc4mWyM4F8X+wgOlScdarpWJw6/1AeSUYpjH/KDRtntm+6ngq0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1792422189; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=lax5mvzMdQMj5q0NwoMYFOyVhPZc0MFLMC9gpb4+qck=; b=CYyzQbvrIlTN6sH/BPvasq3f3NzvTMdnBwo/4ehA8xt0ll5HvZ7u2FTNd4FxD0rNSmJA643xher/ZVuvffM5SHvkmNF0teIOSBs4H8kRAUxES0jpWwBfiYatJsnNKkzQiBfn21yevxR11iuhJVyazbF9XjIQaMvIuOm9Ak5Fxbw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=rong.moe; spf=pass smtp.mailfrom=i@rong.moe; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1792422189; s=zmail2048; d=rong.moe; i=i@rong.moe; h=From:From:Date:Date:Subject:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Message-Id:In-Reply-To:To:To:Cc:Cc:Reply-To; bh=lax5mvzMdQMj5q0NwoMYFOyVhPZc0MFLMC9gpb4+qck=; b=dDbrNC3FBeG5X2pbUTwlt8+YiEqnib6+avkP1aorTfRHATIArQbjn3K6z/ArCF8i suu4riixTWpp+pOEPuXxiMeig6GXzKGzl1ckqniPOCv3my9GgTl3pwUu6NDSh7exbof OhUtUdGp2AUxGKjpwlPXpTHFB9qwsLNF2ExoMby4YTEKHoz0wE7xl0hvuUfll1+15JB oKTX5hazQR6ByYe7kpUKfH6bZtlq+MfkQAeLUGBkV9Yyecc6RFKUSm7LYbUEpwRdB3X 0pqEDvd0QTXunN7NBitqu9iB156cJaL0dMrSYYYZF/zvX6dsYAVz8BH2hbe2gi9B5mL zi+XpHM9YQ== Received: by smtp.zohomail.com with SMTPS id 179242218698720.98992502407168; Mon, 19 Oct 2026 08:03:06 -0700 (PDT) From: Rong Zhang Date: Mon, 19 Oct 2026 23:02:26 +0800 Subject: [PATCH v5 04/12] platform/x86: lenovo-wmi-capdata: Store a pointer to component info X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20261019-lwmi-wmi-new-api-v5-4-71557d28d058@rong.moe> References: <20261019-lwmi-wmi-new-api-v5-0-71557d28d058@rong.moe> In-Reply-To: <20261019-lwmi-wmi-new-api-v5-0-71557d28d058@rong.moe> To: Mark Pearson , "Derek J. Clark" , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Armin Wolf Cc: Charles , Navon John Lukose , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, Rong Zhang X-Mailer: b4 0.17-dev-6be7c X-ZohoMailClient: External In the following changes, priv->list will become optional (i.e., NULLable). IOW, the type of the component cannot be reliable retrieved from priv->list->type. Store a pointer to component info so that the component type is always available. In this manner, priv->list->type can be eliminated. Note that the component type check in lwmi_cd*_get_data() must be removed due to it being called without the availability of priv. Removing it should be fine as the capdata APIs are really internal methods and their caller, i.e., lenovo-wmi-other, always passes a matched list. This also eliminates the need to pass the component type along setup functions. Tested-by: Navon John Lukose Reviewed-by: Derek J. Clark Reviewed-by: Mark Pearson Signed-off-by: Rong Zhang Reported-by: Charles Reported-by: Navon John Lukose Suggested-by: Derek J. Clark Suggested-by: Mark Pearson --- drivers/platform/x86/lenovo/wmi-capdata.c | 44 +++++++++++++--------------= ---- 1 file changed, 19 insertions(+), 25 deletions(-) diff --git a/drivers/platform/x86/lenovo/wmi-capdata.c b/drivers/platform/x= 86/lenovo/wmi-capdata.c index fbe2ba627ff5..5748859f8101 100644 --- a/drivers/platform/x86/lenovo/wmi-capdata.c +++ b/drivers/platform/x86/lenovo/wmi-capdata.c @@ -87,6 +87,7 @@ static const struct lwmi_cd_info { =20 struct lwmi_cd_priv { struct notifier_block acpi_nb; /* ACPI events */ + const struct lwmi_cd_info *info; struct wmi_device *wdev; struct cd_list *list; struct dentry *debugfs_dir; @@ -108,7 +109,6 @@ struct lwmi_cd_priv { =20 struct cd_list { struct mutex list_mutex; /* list R/W mutex */ - enum lwmi_cd_type type; u8 count; =20 union { @@ -137,7 +137,7 @@ static int lwmi_cd_match(struct device *dev, void *type) return false; =20 priv =3D dev_get_drvdata(dev); - return priv->list->type =3D=3D *(enum lwmi_cd_type *)type; + return priv->info->type =3D=3D *(enum lwmi_cd_type *)type; } =20 /** @@ -254,7 +254,7 @@ static int lwmi_cd_component_bind(struct device *cd_dev, struct lwmi_cd_priv *priv =3D dev_get_drvdata(cd_dev); struct lwmi_cd_binder *binder =3D data; =20 - switch (priv->list->type) { + switch (priv->info->type) { case LENOVO_CAPABILITY_DATA_00: binder->cd00_list =3D priv->list; =20 @@ -452,14 +452,11 @@ static const struct component_ops lwmi_cd_sub_compone= nt_ops =3D { * * Return: 0 on success, or -EINVAL. */ -#define DEF_LWMI_CDXX_GET_DATA(_cdxx, _cd_type, _output_t) \ +#define DEF_LWMI_CDXX_GET_DATA(_cdxx, _output_t) \ int lwmi_##_cdxx##_get_data(struct cd_list *list, u32 attribute_id, _outp= ut_t *output) \ { \ u8 idx; \ \ - if (WARN_ON(list->type !=3D _cd_type)) \ - return -EINVAL; \ - \ guard(mutex)(&list->list_mutex); \ for (idx =3D 0; idx < list->count; idx++) { \ if (list->_cdxx[idx].id !=3D attribute_id) \ @@ -470,13 +467,13 @@ static const struct component_ops lwmi_cd_sub_compone= nt_ops =3D { return -EINVAL; \ } =20 -DEF_LWMI_CDXX_GET_DATA(cd00, LENOVO_CAPABILITY_DATA_00, struct capdata00); +DEF_LWMI_CDXX_GET_DATA(cd00, struct capdata00); EXPORT_SYMBOL_NS_GPL(lwmi_cd00_get_data, "LENOVO_WMI_CAPDATA"); =20 -DEF_LWMI_CDXX_GET_DATA(cd01, LENOVO_CAPABILITY_DATA_01, struct capdata01); +DEF_LWMI_CDXX_GET_DATA(cd01, struct capdata01); EXPORT_SYMBOL_NS_GPL(lwmi_cd01_get_data, "LENOVO_WMI_CAPDATA"); =20 -DEF_LWMI_CDXX_GET_DATA(cd_fan, LENOVO_FAN_TEST_DATA, struct capdata_fan); +DEF_LWMI_CDXX_GET_DATA(cd_fan, struct capdata_fan); EXPORT_SYMBOL_NS_GPL(lwmi_cd_fan_get_data, "LENOVO_WMI_CAPDATA"); =20 /* =3D=3D=3D=3D=3D=3D=3D=3D debugfs =3D=3D=3D=3D=3D=3D=3D=3D */ @@ -550,15 +547,14 @@ static int lwmi_cd_debugfs_show(struct seq_file *s, v= oid *data) =20 guard(mutex)(&priv->list->list_mutex); =20 - /* lwmi_cd_alloc() ensured priv->list->type must be a valid type. */ for (idx =3D 0; idx < priv->list->count; idx++) { - seq_printf(s, "%s[%u]:\n", lwmi_cd_table[priv->list->type].name, idx); + seq_printf(s, "%s[%u]:\n", priv->info->name, idx); =20 - if (priv->list->type =3D=3D LENOVO_CAPABILITY_DATA_00) + if (priv->info->type =3D=3D LENOVO_CAPABILITY_DATA_00) lwmi_cd00_show(s, &priv->list->cd00[idx]); - else if (priv->list->type =3D=3D LENOVO_CAPABILITY_DATA_01) + else if (priv->info->type =3D=3D LENOVO_CAPABILITY_DATA_01) lwmi_cd01_show(s, &priv->list->cd01[idx]); - else if (priv->list->type =3D=3D LENOVO_FAN_TEST_DATA) + else if (priv->info->type =3D=3D LENOVO_FAN_TEST_DATA) lwmi_cd_fan_show(s, &priv->list->cd_fan[idx]); } =20 @@ -603,7 +599,7 @@ static int lwmi_cd_cache(struct lwmi_cd_priv *priv) int idx; void *p; =20 - switch (priv->list->type) { + switch (priv->info->type) { case LENOVO_CAPABILITY_DATA_00: p =3D &priv->list->cd00[0]; size =3D sizeof(priv->list->cd00[0]); @@ -706,14 +702,13 @@ static int lwmi_cd_fan_list_alloc_cache(struct lwmi_c= d_priv *priv, struct cd_lis /** * lwmi_cd_alloc() - Allocate a cd_list struct in drvdata * @priv: lenovo-wmi-capdata driver data. - * @type: The type of capability data. * * Allocate a cd_list struct large enough to contain data from all WMI data * blocks provided by the interface. * * Return: 0 on success, or an error. */ -static int lwmi_cd_alloc(struct lwmi_cd_priv *priv, enum lwmi_cd_type type) +static int lwmi_cd_alloc(struct lwmi_cd_priv *priv) { struct cd_list *list; size_t list_size; @@ -721,7 +716,7 @@ static int lwmi_cd_alloc(struct lwmi_cd_priv *priv, enu= m lwmi_cd_type type) =20 count =3D wmidev_instance_count(priv->wdev); =20 - switch (type) { + switch (priv->info->type) { case LENOVO_CAPABILITY_DATA_00: list_size =3D struct_size(list, cd00, count); break; @@ -747,7 +742,6 @@ static int lwmi_cd_alloc(struct lwmi_cd_priv *priv, enu= m lwmi_cd_type type) if (ret) return ret; =20 - list->type =3D type; list->count =3D count; priv->list =3D list; =20 @@ -757,7 +751,6 @@ static int lwmi_cd_alloc(struct lwmi_cd_priv *priv, enu= m lwmi_cd_type type) /** * lwmi_cd_setup() - Cache all WMI data block information * @priv: lenovo-wmi-capdata driver data. - * @type: The type of capability data. * * Allocate a cd_list struct large enough to contain data from all WMI data * blocks provided by the interface. Then loop through each data block and @@ -765,11 +758,11 @@ static int lwmi_cd_alloc(struct lwmi_cd_priv *priv, e= num lwmi_cd_type type) * * Return: 0 on success, or an error code. */ -static int lwmi_cd_setup(struct lwmi_cd_priv *priv, enum lwmi_cd_type type) +static int lwmi_cd_setup(struct lwmi_cd_priv *priv) { int ret; =20 - ret =3D lwmi_cd_alloc(priv, type); + ret =3D lwmi_cd_alloc(priv); if (ret) return ret; =20 @@ -842,10 +835,11 @@ static int lwmi_cd_probe(struct wmi_device *wdev, con= st void *context) if (!priv) return -ENOMEM; =20 + priv->info =3D info; priv->wdev =3D wdev; dev_set_drvdata(&wdev->dev, priv); =20 - ret =3D lwmi_cd_setup(priv, info->type); + ret =3D lwmi_cd_setup(priv); if (ret) goto out; =20 @@ -911,7 +905,7 @@ static void lwmi_cd_remove(struct wmi_device *wdev) =20 lwmi_cd_debugfs_remove(priv); =20 - switch (priv->list->type) { + switch (priv->info->type) { case LENOVO_CAPABILITY_DATA_00: lwmi_cd_sub_master_del(priv); fallthrough; --=20 2.55.0 From nobody Sat Oct 24 14:13:33 2026 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=136.143.188.112 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1792422241; b=Ewj06rTB906I8pxFkiWO19i1tBHXYiei4CExdLFjKtl4m9ca5Tg7WAu+i5+uk8UN1PR+ 7pOwsyDGvIPkNDhnI9LO0iV+9G/2ywe6kyvYiD6BGatpOrHNp1Me4M/vo0BovxD2dT0/8 gwOwW8gg2gboUuNUl1WXeLxPKJw0JBDKDG6iOeqgQcWKBUmiIeMDAXlpohrHN5ws9w9Te We1AIyOB7Z/6MacHQ5V9GwfjogeGn4MTz0liA/Yg6jf1TI+lFs8o2YyD92REHLl4MkSGa 1PGomgwZjR5DCTprdjkATrSuVRTr/QOqGr3tDeQcJ25fAZeVfuI1hwx0YtsXOQNEGVQ== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792422241; h=DMARC-Filter:DKIM-Signature:Received:From:Date:Subject:MIME-Version: Content-Type:Content-Transfer-Encoding:Message-Id:References: In-Reply-To:To:Cc:X-Mailer:X-ZohoMailClient; bh=Gcyo/x+7dSKQKoLvMY1mobH5f1e7zJvCCB0MCLbeP+w=; b=Hpp+z+zRFg6ye4uKpdo+dYvwDQxocNp+vR6lkn4ZQWSguFwNJZGHLnUrs07vH09tee02 5DprWaycZl9CJ6lCqW1cucaiYNmG1Zcm4u+CbJUuIZR3cFhDQsFPEphjlthAHdBWUSS2w qPG5G7+hOJ2ztYoRS9dso3IOjP+iG2b1z2sq9neV4wNeb6d5y1vHzkeTZA7ok5GOv6vRW wtq4WUuoXYAZKvmK2ZO2GlKgZD1sfymtBw4xR0GKpXwGi7twBRnIZyTG0/LvIgTqcwmIG a4QEAyAYyFG/khRXy1WenHICWyBqbTUkv7v+fsQEVui4eL2DkW/63ablORyJKEGR+Yw== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass header.from=rong.moe; spf=pass smtp.mailfrom=rong.moe; dkim=pass header.d=rong.moe header.i=i@rong.moe header.a=rsa-sha256 header.s=zmail2048 header.b=VoDhipSD; arc=pass header.oldest-pass=0 smtp.remote-ip=136.143.188.112 Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 518B9607DC77; Mon, 19 Oct 2026 15:04:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 518B9607DC77 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=rong.moe Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rong.moe Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=rong.moe header.i=i@rong.moe header.a=rsa-sha256 header.s=zmail2048 header.b=VoDhipSD ARC-Seal: i=1; a=rsa-sha256; t=1792422193; cv=none; d=zohomail.com; s=zohoarc; b=Bqu0yagmjCb0/3ixkEDVf4E3QdM9HCgwy8sJrW3IrvvmzL1oeQQFz39RN/osvRH8g3cXHWe/hmG4KDnRT2m0Atg5660Z1szww3iadT9eujJKHGdyzDkDqJfoOl8Lacs1VQTTL2ZWWXoy5++WyJQ+kJTyzykzJXxgIUuwy74Jwd8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1792422193; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=Gcyo/x+7dSKQKoLvMY1mobH5f1e7zJvCCB0MCLbeP+w=; b=GiLVAeDg58xjTM0a6Kz7cZImgWSuUOGE0fvGRtUUl9YXvZWRLAMDtBfABp/qXnDUWKv5kAVTBV8lvIAbIiSG5onUEiFSAfcWejQbytelIrWLuqv91bXasG5dFqXB01YvG3MtTmzLSx9E2hkX8OdVlyoyr0SUA6qfr1Ed47szwHM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=rong.moe; spf=pass smtp.mailfrom=i@rong.moe; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1792422193; s=zmail2048; d=rong.moe; i=i@rong.moe; h=From:From:Date:Date:Subject:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Message-Id:In-Reply-To:To:To:Cc:Cc:Reply-To; bh=Gcyo/x+7dSKQKoLvMY1mobH5f1e7zJvCCB0MCLbeP+w=; b=VoDhipSDM5583y3C3rxGMbo06zhNXgyqlgLmzp5/9y2DgqixEE94WGAtXhIaaJYu +3pLNiqZCCN/Uleo12OF0J1DXdlDJeV5mOcD1RAbEaFmbyFVZFYgYzm5on3zfb989Jb BvvyG4ADKNC2sfgkBAtBDDML3LlIcjsIqO5pVitsBn8DSBoBqnoK5COJ8uY8KYJO1b7 tWIh9rZcgKGAbfueVenLnkvHkv0EOlImyJ/mghTQDASVoKDxzruzSB/d9MAsZuogSCK gFjLpFTnZjA+JNVRXO3XQa7NeRqJTzJktq+84Jv4ft9mGhXGJ2I4cpdczfOWFvExMes 7OXytgqIaw== Received: by smtp.zohomail.com with SMTPS id 179242219054699.15617082516553; Mon, 19 Oct 2026 08:03:10 -0700 (PDT) From: Rong Zhang Date: Mon, 19 Oct 2026 23:02:27 +0800 Subject: [PATCH v5 05/12] platform/x86: lenovo-wmi-capdata: Defer mutex initialization X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20261019-lwmi-wmi-new-api-v5-5-71557d28d058@rong.moe> References: <20261019-lwmi-wmi-new-api-v5-0-71557d28d058@rong.moe> In-Reply-To: <20261019-lwmi-wmi-new-api-v5-0-71557d28d058@rong.moe> To: Mark Pearson , "Derek J. Clark" , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Armin Wolf Cc: Charles , Navon John Lukose , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, Rong Zhang X-Mailer: b4 0.17-dev-6be7c X-ZohoMailClient: External In the following changes, priv->list may be freed if the first call to lwmi_cd_cache() fails due to WMI/ACPI errors, so the list_mutex must be initialized after it in order not to break lockdep, as there is no devm_mutex_destroy(). Considering that the first call to lwmi_cd_cache() doesn't need serialization as there is no other reader or writer this early, the initialization of list_mutex can be deferred. Therefore, initialize list_mutex only after the first call to lwmi_cd_cache() succeeds, otherwise it remains uninitialized and can be devm_kfree()-ed. Tested-by: Navon John Lukose Reviewed-by: Derek J. Clark Reviewed-by: Mark Pearson Signed-off-by: Rong Zhang Reported-by: Charles Reported-by: Navon John Lukose Suggested-by: Derek J. Clark Suggested-by: Mark Pearson --- Changes in v2: - Synchronize the initialization with release-acquire barriers (thanks Ilpo J=C3=A4rvinen) --- drivers/platform/x86/lenovo/wmi-capdata.c | 86 +++++++++++++++++++++++----= ---- 1 file changed, 65 insertions(+), 21 deletions(-) diff --git a/drivers/platform/x86/lenovo/wmi-capdata.c b/drivers/platform/x= 86/lenovo/wmi-capdata.c index 5748859f8101..3ef8879d8587 100644 --- a/drivers/platform/x86/lenovo/wmi-capdata.c +++ b/drivers/platform/x86/lenovo/wmi-capdata.c @@ -48,6 +48,8 @@ #include #include =20 +#include + #include "wmi-capdata.h" #include "wmi-helpers.h" =20 @@ -91,6 +93,7 @@ struct lwmi_cd_priv { struct wmi_device *wdev; struct cd_list *list; struct dentry *debugfs_dir; + bool initialized; =20 /* * A capdata device may be a component master of another capdata device. @@ -586,14 +589,14 @@ static void lwmi_cd_debugfs_remove(struct lwmi_cd_pri= v *priv) /* =3D=3D=3D=3D=3D=3D=3D=3D WMI interface =3D=3D=3D=3D=3D=3D=3D=3D */ =20 /** - * lwmi_cd_cache() - Cache all WMI data block information + * __lwmi_cd_cache() - Cache all WMI data block information locklessly * @priv: lenovo-wmi-capdata driver data. * - * Loop through each WMI data block and cache the data. + * Loop through each WMI data block and cache the data locklessly. * * Return: 0 on success, or an error. */ -static int lwmi_cd_cache(struct lwmi_cd_priv *priv) +static int __lwmi_cd_cache(struct lwmi_cd_priv *priv) { size_t size; int idx; @@ -615,7 +618,6 @@ static int lwmi_cd_cache(struct lwmi_cd_priv *priv) return -EINVAL; } =20 - guard(mutex)(&priv->list->list_mutex); for (idx =3D 0; idx < priv->list->count; idx++, p +=3D size) { union acpi_object *ret_obj __free(kfree) =3D NULL; =20 @@ -633,14 +635,38 @@ static int lwmi_cd_cache(struct lwmi_cd_priv *priv) return 0; } =20 +/** + * lwmi_cd_cache() - Cache all WMI data block information + * @priv: lenovo-wmi-capdata driver data. + * + * Loop through each WMI data block and cache the data. + * + * Return: 0 on success, or an error. + */ +static int lwmi_cd_cache(struct lwmi_cd_priv *priv) +{ + /* Synchronize mutex initialization. Paired with lwmi_cd_finalize(). */ + if (!smp_load_acquire(&priv->initialized)) + return __lwmi_cd_cache(priv); + + switch (priv->info->type) { + case LENOVO_CAPABILITY_DATA_01: + break; + default: + return -EINVAL; + } + + guard(mutex)(&priv->list->list_mutex); + return __lwmi_cd_cache(priv); +} + /** * lwmi_cd_fan_list_alloc_cache() - Alloc and cache Fan Test Data list * @priv: lenovo-wmi-capdata driver data. - * @listptr: Pointer to returned cd_list pointer. * - * Return: count of fans found, or an error. + * Return: 0 on success, or an error. */ -static int lwmi_cd_fan_list_alloc_cache(struct lwmi_cd_priv *priv, struct = cd_list **listptr) +static int lwmi_cd_fan_list_alloc_cache(struct lwmi_cd_priv *priv) { struct cd_list *list; size_t size; @@ -686,6 +712,9 @@ static int lwmi_cd_fan_list_alloc_cache(struct lwmi_cd_= priv *priv, struct cd_lis if (!list) return -ENOMEM; =20 + list->count =3D count; + priv->list =3D list; + for (idx =3D 0; idx < count; idx++) { /* Do not calculate array index using count, as it may be truncated. */ list->cd_fan[idx] =3D (struct capdata_fan) { @@ -695,8 +724,7 @@ static int lwmi_cd_fan_list_alloc_cache(struct lwmi_cd_= priv *priv, struct cd_lis }; } =20 - *listptr =3D list; - return count; + return 0; } =20 /** @@ -712,7 +740,7 @@ static int lwmi_cd_alloc(struct lwmi_cd_priv *priv) { struct cd_list *list; size_t list_size; - int count, ret; + int count; =20 count =3D wmidev_instance_count(priv->wdev); =20 @@ -724,11 +752,7 @@ static int lwmi_cd_alloc(struct lwmi_cd_priv *priv) list_size =3D struct_size(list, cd01, count); break; case LENOVO_FAN_TEST_DATA: - count =3D lwmi_cd_fan_list_alloc_cache(priv, &list); - if (count < 0) - return count; - - goto got_list; + return lwmi_cd_fan_list_alloc_cache(priv); default: return -EINVAL; } @@ -737,17 +761,33 @@ static int lwmi_cd_alloc(struct lwmi_cd_priv *priv) if (!list) return -ENOMEM; =20 -got_list: - ret =3D devm_mutex_init(&priv->wdev->dev, &list->list_mutex); - if (ret) - return ret; - list->count =3D count; priv->list =3D list; =20 return 0; } =20 +/** + * lwmi_cd_finalize() - Finalize the capability data initialization + * @priv: lenovo-wmi-capdata driver data. + * + * Return: 0 on success, or an error code. + */ +static int lwmi_cd_finalize(struct lwmi_cd_priv *priv) +{ + int ret; + + if (priv->list) { + ret =3D devm_mutex_init(&priv->wdev->dev, &priv->list->list_mutex); + if (ret) + return ret; + } + + /* Synchronize mutex initialization. Paired with lwmi_cd_cache(). */ + smp_store_release(&priv->initialized, 1); + return 0; +} + /** * lwmi_cd_setup() - Cache all WMI data block information * @priv: lenovo-wmi-capdata driver data. @@ -766,7 +806,11 @@ static int lwmi_cd_setup(struct lwmi_cd_priv *priv) if (ret) return ret; =20 - return lwmi_cd_cache(priv); + ret =3D lwmi_cd_cache(priv); + if (ret) + return ret; + + return lwmi_cd_finalize(priv); } =20 /** --=20 2.55.0 From nobody Sat Oct 24 14:13:33 2026 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=136.143.188.112 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1792422252; b=XNDLmdts8c3WmxhXcFj/zgfRAJsAt2fCJBPpoR4ApRnaY9TtY3yzxX/x39NIxjTNZRi3 ckrg1RL3QLk7+RODFJCKaooE6GqSVDfHxG9YN7MXT+MkbfkqpiBeyfDJRGvcTcl3MrebM MiQhKAvj1rru9c2upZCvfzj1lK6R4Td4xSNfv7g3gCh8ucnC/+90ALBfBYaD7cFYTLRXb TaREFmOrL0yLdWCKRzCN8NylGATY71Z5xOMyPlFEizSntju6maoh2zBG5eAwDyLreu9Lf 4KvibbkvjjqfLD6VC7pUPCCFQW/B5pM60Hyh8WLQUxpqYmQ6sLaaBzQdGe78mEnTYDw== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792422252; h=DMARC-Filter:DKIM-Signature:Received:From:Date:Subject:MIME-Version: Content-Type:Content-Transfer-Encoding:Message-Id:References: In-Reply-To:To:Cc:X-Mailer:X-ZohoMailClient; bh=omVTKij4X4glQVWORkAGhbDtdBZqVSiTbkudax5EPv0=; b=PMl68EG9YsW+0Ne0EUlSHHVEQKFsBr3SHPyoqoANb7wxMxQit2HfM9rod51mjP2xvv0b qO3voHiXVDbTlHs2dmbD4dE4jvmTShEHmYM2TbUlZ735l8n6gtt6Hq7Q9ZeymG/c9gsL8 1/p6mzITAAJDzAfGq7Dq931TE/1ecukm7YWhLvI6AdqWpUXU1OeSPYHisljMFNhjF9xuQ 63AzdWIPUo/fweh91whaMzR3b+YPZfr/Qfmo/Dh1qUc2dCQWWuBuOg9k+iS/0D3QQPVjV krVuL4QQVzRbGXjESSRwdazK3mCUVXa25fowSELmv9SZ/+Fs8rdldtv5D0EZKA4xb0Q== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass header.from=rong.moe; spf=pass smtp.mailfrom=rong.moe; dkim=pass header.d=rong.moe header.i=i@rong.moe header.a=rsa-sha256 header.s=zmail2048 header.b=MTffdrbj; arc=pass header.oldest-pass=0 smtp.remote-ip=136.143.188.112 Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 622B6607F481; Mon, 19 Oct 2026 15:04:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 622B6607F481 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=rong.moe Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rong.moe Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=rong.moe header.i=i@rong.moe header.a=rsa-sha256 header.s=zmail2048 header.b=MTffdrbj ARC-Seal: i=1; a=rsa-sha256; t=1792422197; cv=none; d=zohomail.com; s=zohoarc; b=PfBJ1nXk0T/orR3Zl5lobuqusL+dj+a/raVB4cNtimkhzAsXKvmN1q7kzSiebPLTKi2MFvoVJt+lZznb22BbrE88dQ/wpgxZUpsz1qjex3tFkYKT++26kjw9uga8MQ5btoRCT563c5S1x9d4glMl/T9QhXLYRqgPhGjvGSLlc9A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1792422197; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=omVTKij4X4glQVWORkAGhbDtdBZqVSiTbkudax5EPv0=; b=NhPT5Qhgyde3vJ9M+TF0+WebBYkmy7+vri3M4QGsNCH2gCWwz+PSx8pXPIBwFuNNG56C4y+rJRlirMBWItW5/oYEuVMkJgOHH8ffYPLCOzqh5WuOkhDwY/vC83kuVBFvPS1jy6d0TddUXvZqKtCqXkhkpiEEI+MnafPhXR5zj6M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=rong.moe; spf=pass smtp.mailfrom=i@rong.moe; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1792422197; s=zmail2048; d=rong.moe; i=i@rong.moe; h=From:From:Date:Date:Subject:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Message-Id:In-Reply-To:To:To:Cc:Cc:Reply-To; bh=omVTKij4X4glQVWORkAGhbDtdBZqVSiTbkudax5EPv0=; b=MTffdrbjzVwk0SAhK0bWtbHWYPxUUMTVqVvBF8jdZosnCwiQVbkrXyjvHhnlJYNF hNskQ85sM2DQ4sMxBqrup280otnFpeZ4EROLcJjS06KJBerZQg4zvD7Vy1HuGW4Ivsc qLRe7BXWJIxjFeIu2WF2hiOGlrhA5aYQWv7GzrQtgBfLWdXnNpjR9q2G6VquaL8cIo/ AymYTLV5hRGouXPzXd+XWnMPW1keygAys20WvqnP3OXWT4x0mFHF+5DNzT56jiUKemZ PREbncuiSfd6KI6Jb579XknbxHIgPyFg5fkGyyLC8ALBO2/owIVQPUnE88qZYCE+rik YBHPvOEqBQ== Received: by smtp.zohomail.com with SMTPS id 1792422193677321.60863692689475; Mon, 19 Oct 2026 08:03:13 -0700 (PDT) From: Rong Zhang Date: Mon, 19 Oct 2026 23:02:28 +0800 Subject: [PATCH v5 06/12] platform/x86: lenovo-wmi-{capdata,other}: Only allocate capdata list when necessary X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20261019-lwmi-wmi-new-api-v5-6-71557d28d058@rong.moe> References: <20261019-lwmi-wmi-new-api-v5-0-71557d28d058@rong.moe> In-Reply-To: <20261019-lwmi-wmi-new-api-v5-0-71557d28d058@rong.moe> To: Mark Pearson , "Derek J. Clark" , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Armin Wolf Cc: Charles , Navon John Lukose , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, Rong Zhang X-Mailer: b4 0.17-dev-6be7c X-ZohoMailClient: External When no capability data is available, there is no need to allocate capability data list as it's basically unused except for the priv->list->count =3D=3D 0 placeholder. Therefore, only allocate priv->list when necessary, otherwise its absence implies the absence of capability data. In this manner, lenovo-wmi-other can skip registering unavailable functionalities accordingly. Meanwhile, skip creating the debugfs directory as it provides nothing when there is no capability data. Tested-by: Navon John Lukose Reviewed-by: Derek J. Clark Reviewed-by: Mark Pearson Signed-off-by: Rong Zhang Reported-by: Charles Reported-by: Navon John Lukose Suggested-by: Derek J. Clark Suggested-by: Mark Pearson --- Changes in v2: - Refine line wrap (thanks Ilpo J=C3=A4rvinen) --- drivers/platform/x86/lenovo/wmi-capdata.c | 42 ++++++++++++++++++++++-----= ---- drivers/platform/x86/lenovo/wmi-other.c | 24 +++++++++++------- 2 files changed, 45 insertions(+), 21 deletions(-) diff --git a/drivers/platform/x86/lenovo/wmi-capdata.c b/drivers/platform/x= 86/lenovo/wmi-capdata.c index 3ef8879d8587..3c09bb9e3d46 100644 --- a/drivers/platform/x86/lenovo/wmi-capdata.c +++ b/drivers/platform/x86/lenovo/wmi-capdata.c @@ -313,8 +313,8 @@ static const struct component_ops lwmi_cd_component_ops= =3D { * @dev: The sub-master capdata basic device. * * Call component_bind_all to bind the sub-component device to the sub-mas= ter - * device. On success, collect the pointer to the sub-component list and t= ry - * to call the master callback. + * device. On success, collect the pointer (or ERR_PTR(-ENODEV) if it's st= ubbed) + * to the sub-component list and try to call the master callback. * * Return: 0 on success, or an error code. */ @@ -328,7 +328,7 @@ static int lwmi_cd_sub_master_bind(struct device *dev) if (ret) return ret; =20 - priv->sub_master->sub_component_list =3D sub_component_list; + priv->sub_master->sub_component_list =3D sub_component_list ?: ERR_PTR(-E= NODEV); lwmi_cd_call_master_cb(priv); =20 return 0; @@ -460,6 +460,9 @@ static const struct component_ops lwmi_cd_sub_component= _ops =3D { { \ u8 idx; \ \ + if (WARN_ON(!list)) \ + return -EINVAL; \ + \ guard(mutex)(&list->list_mutex); \ for (idx =3D 0; idx < list->count; idx++) { \ if (list->_cdxx[idx].id !=3D attribute_id) \ @@ -571,6 +574,9 @@ DEFINE_SHOW_ATTRIBUTE(lwmi_cd_debugfs); */ static void lwmi_cd_debugfs_add(struct lwmi_cd_priv *priv) { + if (!priv->list) + return; + priv->debugfs_dir =3D lwmi_debugfs_create_dir(priv->wdev); =20 debugfs_create_file("capdata", 0444, priv->debugfs_dir, priv, &lwmi_cd_de= bugfs_fops); @@ -582,6 +588,7 @@ static void lwmi_cd_debugfs_add(struct lwmi_cd_priv *pr= iv) */ static void lwmi_cd_debugfs_remove(struct lwmi_cd_priv *priv) { + /* Debugfs can handle NULL dir, no need to check. */ debugfs_remove_recursive(priv->debugfs_dir); priv->debugfs_dir =3D NULL; } @@ -645,6 +652,9 @@ static int __lwmi_cd_cache(struct lwmi_cd_priv *priv) */ static int lwmi_cd_cache(struct lwmi_cd_priv *priv) { + if (!priv->list) + return 0; + /* Synchronize mutex initialization. Paired with lwmi_cd_finalize(). */ if (!smp_load_acquire(&priv->initialized)) return __lwmi_cd_cache(priv); @@ -708,6 +718,9 @@ static int lwmi_cd_fan_list_alloc_cache(struct lwmi_cd_= priv *priv) count =3D 0; } =20 + if (!count) + return 0; + list =3D devm_kzalloc(&priv->wdev->dev, struct_size(list, cd_fan, count),= GFP_KERNEL); if (!list) return -ENOMEM; @@ -743,6 +756,8 @@ static int lwmi_cd_alloc(struct lwmi_cd_priv *priv) int count; =20 count =3D wmidev_instance_count(priv->wdev); + if (!count) + return 0; =20 switch (priv->info->type) { case LENOVO_CAPABILITY_DATA_00: @@ -892,7 +907,8 @@ static int lwmi_cd_probe(struct wmi_device *wdev, const= void *context) enum lwmi_cd_type sub_component_type =3D LENOVO_FAN_TEST_DATA; struct capdata00 capdata00; =20 - ret =3D lwmi_cd00_get_data(priv->list, LWMI_ATTR_ID_FAN_TEST, &capdata00= ); + ret =3D priv->list ? lwmi_cd00_get_data(priv->list, LWMI_ATTR_ID_FAN_TES= T, + &capdata00) : -ENODATA; if (ret || !(capdata00.supported & LWMI_SUPP_VALID)) { dev_dbg(&wdev->dev, "capdata00 declares no fan test support\n"); sub_component_type =3D CD_TYPE_NONE; @@ -913,14 +929,16 @@ static int lwmi_cd_probe(struct wmi_device *wdev, con= st void *context) case LENOVO_CAPABILITY_DATA_01: priv->acpi_nb.notifier_call =3D lwmi_cd01_notifier_call; =20 - ret =3D register_acpi_notifier(&priv->acpi_nb); - if (ret) - goto out; + if (priv->list) { + ret =3D register_acpi_notifier(&priv->acpi_nb); + if (ret) + goto out; =20 - ret =3D devm_add_action_or_reset(&wdev->dev, lwmi_cd01_unregister, - &priv->acpi_nb); - if (ret) - goto out; + ret =3D devm_add_action_or_reset(&wdev->dev, lwmi_cd01_unregister, + &priv->acpi_nb); + if (ret) + goto out; + } =20 ret =3D component_add(&wdev->dev, &lwmi_cd_component_ops); goto out; @@ -938,7 +956,7 @@ static int lwmi_cd_probe(struct wmi_device *wdev, const= void *context) lwmi_cd_debugfs_add(priv); =20 dev_dbg(&wdev->dev, "registered %s with %u items\n", - info->name, priv->list->count); + info->name, priv->list ? priv->list->count : 0); } return ret; } diff --git a/drivers/platform/x86/lenovo/wmi-other.c b/drivers/platform/x86= /lenovo/wmi-other.c index fbb32bf404f2..147e182685a1 100644 --- a/drivers/platform/x86/lenovo/wmi-other.c +++ b/drivers/platform/x86/lenovo/wmi-other.c @@ -1619,11 +1619,14 @@ static void lwmi_om_fw_attr_remove(struct lwmi_om_p= riv *priv) * lenovo-wmi-other master driver, with a callback to collect fan info from * capdata_fan. On success, assign the capability data list pointers to the * driver data struct for later access. These pointers are only valid whil= e the - * capdata interfaces exist. Finally, collect fan info from capdata00 and - * register all firmware attribute groups. Note that the HWMON device is - * registered only if all fan info is collected. Hence, it is not register= ed - * here. See lwmi_om_fan_info_collect_cd00() and - * lwmi_om_fan_info_collect_cd_fan(). + * capdata interfaces exist. + * + * If capdata00 is bound, collect fan info from capdata00 and register the= power + * supply extension. Note that the HWMON device is registered only if all = fan + * info is collected. Hence, it is not registered here. See + * lwmi_om_fan_info_collect_cd00() and lwmi_om_fan_info_collect_cd_fan(). + * + * If capdata01 is bound, register all firmware attribute groups. * * Return: 0 on success, or an error code. */ @@ -1643,16 +1646,19 @@ static int lwmi_om_master_bind(struct device *dev) =20 priv->cd00_list =3D binder.cd00_list; priv->cd01_list =3D binder.cd01_list; - if (!priv->cd00_list || !priv->cd01_list) { + if (!priv->cd00_list && !priv->cd01_list) { component_unbind_all(dev, NULL); =20 return -ENODEV; } =20 - lwmi_om_fan_info_collect_cd00(priv); - lwmi_om_psy_ext_init(priv); + if (priv->cd00_list) { + lwmi_om_fan_info_collect_cd00(priv); + lwmi_om_psy_ext_init(priv); + } =20 - lwmi_om_fw_attr_add(priv); + if (priv->cd01_list) + lwmi_om_fw_attr_add(priv); =20 return 0; } --=20 2.55.0 From nobody Sat Oct 24 14:13:33 2026 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=136.143.188.112 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1792422264; b=vp8M62UWYfGUMkBQPs1GTFEiqKWzFNUU3H4mSetIevomHnfAx0Y1oHkALMOW+6moVX1P Sqzstoerzd4pZ+od4SSaYYdMDNElT4WZRWuEHC/yVbgGKeZyT7xusanB0+sWrONJX3EBz Q8hpUARlv0MhIxDL+w4spPoum7gEsBh3br4kAtItSBfIwdwWGZgkPdUWygfzqZkimq90Z o9xko/mjo63RIJJzXS2liCYmrY8V/i8p2P7iPA0aLcRogfO7inIFdBU12cb2ZEB8ZBPHu fJhffSIejPCQUiwm/gdTghdsAHUesgGHIz2uhNEOciP9MqMOmLBSkIBNQQkRmcNZrsg== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792422264; h=DMARC-Filter:DKIM-Signature:Received:From:Date:Subject:MIME-Version: Content-Type:Content-Transfer-Encoding:Message-Id:References: In-Reply-To:To:Cc:X-Mailer:X-ZohoMailClient; bh=nh/d9YGOUnrPb5+WwUayy5FjQkM3ryZWi/UNPLivMJQ=; b=zPp2fXwRSGzCb/loTLOOvutirZLkcJgBDrs7C+IopyYokla7CQd0H0XZUAVoM3IwEcW8 KYUn3mE0BIxLto0ercSsA1oT/GNz14/0vltHiXcHdKRhZzte2W8VQIaZgRkbUrQ9JP4Qq 4miU5NdzI+Gx8dVxWlUyHK0VERXKALfTOGpkNZkun2NHMzXVBoW6kd4er2M5wy/KkntQU 2hC9bBD7FAq5lCKZP324okguHmpGY6nzAKF4gx7h2ThcN0wzTdxS5bxc8YqP9YjySEM1R hhRqgss7njJ20jifbqioLm3jgBnfeYLBjacSCljhhs3qfnAtZpBULUiJs8gvE5mR8RA== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass header.from=rong.moe; spf=pass smtp.mailfrom=rong.moe; dkim=pass header.d=rong.moe header.i=i@rong.moe header.a=rsa-sha256 header.s=zmail2048 header.b=XaTRAzBh; arc=pass header.oldest-pass=0 smtp.remote-ip=136.143.188.112 Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CEC2F607F488; Mon, 19 Oct 2026 15:04:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org CEC2F607F488 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=rong.moe Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rong.moe Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=rong.moe header.i=i@rong.moe header.a=rsa-sha256 header.s=zmail2048 header.b=XaTRAzBh ARC-Seal: i=1; a=rsa-sha256; t=1792422201; cv=none; d=zohomail.com; s=zohoarc; b=NhDO/WAYO86H0nE2NVG1aQbAPnYk03g0OgZCuTZvhtRpAq7PwPiFdMhJllYv6SpRRBOxEMGooVPRhG93ns0yDLqu46MLKO2iH/ArYaK4cy7PuDaO/2zLT3OPi/OE6DwdQqhGyLyjQlaqKctCDUoOApFIleiVJc8REsD7PvBWV2Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1792422201; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=nh/d9YGOUnrPb5+WwUayy5FjQkM3ryZWi/UNPLivMJQ=; b=O0rnW16uJyEs+8bNaj9UvSr/NI2256PDFlJJmZmfogw74nZSF2vbI0+KQjkKjvc6IKnXHKHI+cO50gmnl4ZEQvcwBL1GSwdK5M3kc0BcgxA80BhlN/usHxK9G1Ko4ZNdeMaWm59HG9XC5/KGdw0/NWWsfzfQcz0EJQJaZXQ6Kiw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=rong.moe; spf=pass smtp.mailfrom=i@rong.moe; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1792422201; s=zmail2048; d=rong.moe; i=i@rong.moe; h=From:From:Date:Date:Subject:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Message-Id:In-Reply-To:To:To:Cc:Cc:Reply-To; bh=nh/d9YGOUnrPb5+WwUayy5FjQkM3ryZWi/UNPLivMJQ=; b=XaTRAzBhEungRT4Qn863L3GhnIkpNE3LrRuxluWqVCas3q3iYmqnfCs59COq+T+r mcqeuZMiEhplc3MQdjhHnB3Q5nUCaDrrjcUG850k0JVostpORkUhhVKvROzeIe8C/mU uqexktNI0/5i94gEuhM6J16kn7VpOre3i0s9HRPeHZfbnfZQmPUIcv+Ccfjbd1jizsU STtJfZk/YY6xMTZjYIgjQjM6fsfU4sDRlXaEGl4UL3aZ4tZcaE2NPzbPQCbzGXT4ut+ ojgsKxOUyTjVNLSeMxCqAzCUM/lrmG3qCv6pRjrVD9x5ihUiH8JbRmiFnGGGLEbO47y Jswj25nMPw== Received: by smtp.zohomail.com with SMTPS id 1792422197370674.1238567662286; Mon, 19 Oct 2026 08:03:17 -0700 (PDT) From: Rong Zhang Date: Mon, 19 Oct 2026 23:02:29 +0800 Subject: [PATCH v5 07/12] platform/x86: lenovo-wmi-capdata: Adopt new WMI API X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20261019-lwmi-wmi-new-api-v5-7-71557d28d058@rong.moe> References: <20261019-lwmi-wmi-new-api-v5-0-71557d28d058@rong.moe> In-Reply-To: <20261019-lwmi-wmi-new-api-v5-0-71557d28d058@rong.moe> To: Mark Pearson , "Derek J. Clark" , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Armin Wolf Cc: Charles , Navon John Lukose , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, Rong Zhang X-Mailer: b4 0.17-dev-6be7c X-ZohoMailClient: External The new WMI API supports multiple ACPI types by converting them into a unified buffer that satisfies alignment and size requirements. Adopt it to make our life easier. Note that the new WMI API only accepts a few ACPI types to conform to the behavior of the Windows WMI-ACPI driver. By adopting the new API, we intentionally rejects improper ACPI types instead of silently ignoring them. Meanwhile, considering that `struct_size(block, data, count * 3)' may overflow when calculating `count * 3', ignore Fan Test Data with count > U8_MAX instead of capping `count'. Reviewed-by: Armin Wolf Tested-by: Navon John Lukose Reviewed-by: Derek J. Clark Reviewed-by: Mark Pearson Signed-off-by: Rong Zhang Reported-by: Charles Reported-by: Navon John Lukose Suggested-by: Derek J. Clark Suggested-by: Mark Pearson --- Changes in v5: - Move the definition of struct cd_fan_block outside of lwmi_cd_fan_list_alloc_cache() and rename it lwmi_cd_fan_block (thanks Ilpo J=C3=A4rvinen) Changes in v4: - Fix typo (thanks Mark Pearson) Changes in v3: - Leave struct cd_fan_block's __packed attribute as is (thanks Armin Wolf) --- drivers/platform/x86/lenovo/wmi-capdata.c | 76 ++++++++++++++-------------= ---- 1 file changed, 34 insertions(+), 42 deletions(-) diff --git a/drivers/platform/x86/lenovo/wmi-capdata.c b/drivers/platform/x= 86/lenovo/wmi-capdata.c index 3c09bb9e3d46..0efe37644627 100644 --- a/drivers/platform/x86/lenovo/wmi-capdata.c +++ b/drivers/platform/x86/lenovo/wmi-capdata.c @@ -626,17 +626,19 @@ static int __lwmi_cd_cache(struct lwmi_cd_priv *priv) } =20 for (idx =3D 0; idx < priv->list->count; idx++, p +=3D size) { - union acpi_object *ret_obj __free(kfree) =3D NULL; + struct wmi_buffer wbuf; + int ret; =20 - ret_obj =3D wmidev_block_query(priv->wdev, idx); - if (!ret_obj) - return -ENODEV; - - if (ret_obj->type !=3D ACPI_TYPE_BUFFER || - ret_obj->buffer.length < size) + ret =3D wmidev_query_block(priv->wdev, idx, &wbuf, size); + if (ret =3D=3D -ENODATA) /* The block is too short, probably stubbed. */ continue; + if (ret) + return ret; + + /* Capdata 01 is an extension to capdata 00. */ + struct capdata00 *capdata __free(kfree) =3D wbuf.data; =20 - memcpy(p, ret_obj->buffer.pointer, size); + memcpy(p, capdata, size); } =20 return 0; @@ -670,6 +672,11 @@ static int lwmi_cd_cache(struct lwmi_cd_priv *priv) return __lwmi_cd_cache(priv); } =20 +struct lwmi_cd_fan_block { + u32 nr; + u32 data[]; /* id[nr], max_rpm[nr], min_rpm[nr] */ +} __packed; + /** * lwmi_cd_fan_list_alloc_cache() - Alloc and cache Fan Test Data list * @priv: lenovo-wmi-capdata driver data. @@ -678,43 +685,29 @@ static int lwmi_cd_cache(struct lwmi_cd_priv *priv) */ static int lwmi_cd_fan_list_alloc_cache(struct lwmi_cd_priv *priv) { + struct wmi_buffer wbuf; struct cd_list *list; - size_t size; + int ret, idx; u32 count; - int idx; =20 - /* Emit unaligned access to u8 buffer with __packed. */ - struct cd_fan_block { - u32 nr; - u32 data[]; /* id[nr], max_rpm[nr], min_rpm[nr] */ - } __packed * block; + ret =3D wmidev_query_block(priv->wdev, 0, &wbuf, sizeof(struct lwmi_cd_fa= n_block)); + if (ret =3D=3D -ENODATA) /* The block is too short, probably stubbed. */ + return 0; + if (ret) + return ret; =20 - union acpi_object *ret_obj __free(kfree) =3D wmidev_block_query(priv->wde= v, 0); - if (!ret_obj) - return -ENODEV; + struct lwmi_cd_fan_block *block __free(kfree) =3D wbuf.data; =20 - if (ret_obj->type =3D=3D ACPI_TYPE_BUFFER) { - block =3D (struct cd_fan_block *)ret_obj->buffer.pointer; - size =3D ret_obj->buffer.length; + count =3D block->nr; =20 - count =3D size >=3D sizeof(*block) ? block->nr : 0; - if (size < struct_size(block, data, count * 3)) { - dev_warn(&priv->wdev->dev, - "incomplete fan test data block: %zu < %zu, ignoring\n", - size, struct_size(block, data, count * 3)); - count =3D 0; - } else if (count > U8_MAX) { - dev_warn(&priv->wdev->dev, - "too many fans reported: %u > %u, truncating\n", - count, U8_MAX); - count =3D U8_MAX; - } - } else { - /* - * This is usually caused by a dummy ACPI method. Do not return an error - * as failing to probe this device will result in sub-master device being - * unbound. This behavior aligns with lwmi_cd_cache(). - */ + if (count > U8_MAX) { + dev_warn(&priv->wdev->dev, + "too many fans reported: %u > %u, ignoring\n", count, U8_MAX); + count =3D 0; + } else if (wbuf.length < struct_size(block, data, count * 3)) { + dev_warn(&priv->wdev->dev, + "incomplete fan test data block: %zu < %zu (%u fans), ignoring\n", + wbuf.length, struct_size(block, data, count * 3), count); count =3D 0; } =20 @@ -729,11 +722,10 @@ static int lwmi_cd_fan_list_alloc_cache(struct lwmi_c= d_priv *priv) priv->list =3D list; =20 for (idx =3D 0; idx < count; idx++) { - /* Do not calculate array index using count, as it may be truncated. */ list->cd_fan[idx] =3D (struct capdata_fan) { .id =3D block->data[idx], - .max_rpm =3D block->data[idx + block->nr], - .min_rpm =3D block->data[idx + (2 * block->nr)], + .max_rpm =3D block->data[idx + count], + .min_rpm =3D block->data[idx + (2 * count)], }; } =20 --=20 2.55.0 From nobody Sat Oct 24 14:13:33 2026 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=136.143.188.112 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1792422275; b=3SeI3s6Y8V8+3CW1EEa9H2dQCCBUircEwCozwNeybu7icJbkkljCeKHE9+Jfl9FqEb5g UuzbJcPkzGVq5D1LRpgcFZ4BzHtA1ch/g/AgnL2xv+o7eiS9gJdeH0Y1pv8CvVKh1hB+N RdghAMbn63ZSEhzJZ0/EY8g31YkaYzSh6W5XeX8gFSOnrfMIHds9fT5zVF0faMjEy69Il vlaqkOnhjB0x0G+MQZx4YpkEnPQV59RSh2pYba1jby1U/197zhumTa0kTOJdNt/X1ex3G rZ/SMYieZIKfN8snHqx0J3yMteYj/RqENSARzingzCo8pmINUNPMTrKlaut15MbkKQg== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792422275; h=DMARC-Filter:DKIM-Signature:Received:From:Date:Subject:MIME-Version: Content-Type:Content-Transfer-Encoding:Message-Id:References: In-Reply-To:To:Cc:X-Mailer:X-ZohoMailClient; bh=pDkeAjEf7CBlFjh3CVcYW7A4XwN4/HsXPRkdenR0yqE=; b=YmUgURFNcJd+rI41kNsxsU/fcGje5iFHsJSM/UB2LFXacm/pWk+5qec8zonB+wKcsLeW jVZNhg/SYu4RFVy3mK43IfY2qFP86tIJIHjHTpb5Xa2yMBitk+Woxeyux+XrWGD1rme+z 77XaVFTlJt8apno274v618DMXquuGuRUWYWMDQHT30JRuptg2srPrWpVNXtGyGHaAI1AO v+QtxPsp4oiMt6tkztIYMC79bEJoZ+Sh53ADh7slW604DF1gGb00+Ax7O7O/LQcQ2bfg4 KaCWfigwme8YzdvlSazrU+7KgaGAY745pr6tLciU2Bf9zQ4V1gdvYS7oqkkn7PbQcdA== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass header.from=rong.moe; spf=pass smtp.mailfrom=rong.moe; dkim=pass header.d=rong.moe header.i=i@rong.moe header.a=rsa-sha256 header.s=zmail2048 header.b=QMWd3xZU; arc=pass header.oldest-pass=0 smtp.remote-ip=136.143.188.112 Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8ABE1607F49B; Mon, 19 Oct 2026 15:04:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 8ABE1607F49B Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=rong.moe Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rong.moe Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=rong.moe header.i=i@rong.moe header.a=rsa-sha256 header.s=zmail2048 header.b=QMWd3xZU ARC-Seal: i=1; a=rsa-sha256; t=1792422206; cv=none; d=zohomail.com; s=zohoarc; b=nmCakz1O1AeAjarAkOuSjGk6tCbJLr64lwoFaBTkbUQpE/hHcD2DXFLUTIax0BC3ztCqUa6Bw9x8vU6Bqdb9P5UBsIRNNDpT9xBVkbXwVCnlL/2IfnWOOe8W4rBTcbLWdGM5WNHCK56Q+zu+8J2/oj/jk9Q+SY0AfcVxCwmz4yc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1792422206; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=pDkeAjEf7CBlFjh3CVcYW7A4XwN4/HsXPRkdenR0yqE=; b=NxXC46FwT2rXI0McmcNWdX7l82Q70Za6gEdor1kFpMPsB0pHbmTdQaeD/ietmEZ6nKLXI8J+MUEEFoCi07ZlYlTvnYcjfoXuU32aPpR1SYoxm84HddA5w5zav5/Vjz5/PsnDT/el6mdZgek5hMjbXBj7HrlwvyPy31Cu0/ff9gM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=rong.moe; spf=pass smtp.mailfrom=i@rong.moe; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1792422206; s=zmail2048; d=rong.moe; i=i@rong.moe; h=From:From:Date:Date:Subject:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Message-Id:In-Reply-To:To:To:Cc:Cc:Reply-To; bh=pDkeAjEf7CBlFjh3CVcYW7A4XwN4/HsXPRkdenR0yqE=; b=QMWd3xZUTbnZoDQ4Zna6Wcl3khNnt08q6G9Sioh9GZSRAQ5iQKbJQxbAXPhultk+ ZbsMVYPe+tYXHFV38sXoL3fge56ktUecweNEqhofIRmxcNT/lJRBkWGNnRyB/zDQcXf P+wyINou7ThEpCV+GZlXuPwUgLehSGpU/mfz1o2o/LkbaFxHxkE9iJXZEICKWg9Ek4+ eAmcdJBaDm69f8ILMeA2QNP358FOKdn6PlE0p9a7jn5HrdyfNe/hLM+f7ZTJmkpCh9n KggQLJqv/1bWavObpQihMMlBJvmu33JIWSgoe9VnXSM6r8R1wNv5SX/r1A6jkl5lBvR n0ABzWOWGA== Received: by smtp.zohomail.com with SMTPS id 17924222012321005.8235513667192; Mon, 19 Oct 2026 08:03:21 -0700 (PDT) From: Rong Zhang Date: Mon, 19 Oct 2026 23:02:30 +0800 Subject: [PATCH v5 08/12] platform/x86: lenovo-wmi-capdata: Register component even on WMI error X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20261019-lwmi-wmi-new-api-v5-8-71557d28d058@rong.moe> References: <20261019-lwmi-wmi-new-api-v5-0-71557d28d058@rong.moe> In-Reply-To: <20261019-lwmi-wmi-new-api-v5-0-71557d28d058@rong.moe> To: Mark Pearson , "Derek J. Clark" , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Armin Wolf Cc: Charles , Navon John Lukose , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, Rong Zhang X-Mailer: b4 0.17-dev-6be7c X-ZohoMailClient: External Some devices do not support LENOVO_CAPABILITY_DATA_01 and define the query method as a stub that returns zero buffer. Unfortunately, some devices do not implement the stub properly, causing WMI errors (including ACPI errors). The current lenovo-wmi-* implementation enforces the binding between LENOVO_CAPABILITY_DATA_00+01 and LENOVO_OTHER_MODE because of a limitation of the device component framework. When the capdata device bailing out due to a WMI error, lenovo-wmi-other becomes unbound and unable to provide firmware-attributes or hwmon device for the other functional capdata device. Therefore, errors must be non-fatal in order not to break the assumptions made by the device component framework. Stub the capdata device by releasing the capability data list in this case. After that, NULL list will be passed to lenovo-wmi-other on bind. The latter will provide whatever is available, or unbind the components if nothing is available. A stubbed capdata device releases or skips allocating most resources, e.g., the capability data list and the debugfs directory. The device itself is only used to satisfy the component dependency of lenovo-wmi- other and coordinate with the latter about the absence of the capability data. Reported-by: Charles Closes: https://msgid.link/CAKtz0s8UYRQYW_0bh=3D0TMx47Axm-W-muEay-r3rqUBS1N= HMPVw@mail.gmail.com/ Tested-by: Navon John Lukose Reviewed-by: Derek J. Clark Reviewed-by: Mark Pearson Signed-off-by: Rong Zhang Reported-by: Navon John Lukose Suggested-by: Derek J. Clark Suggested-by: Mark Pearson --- Changes in v2: - Replace the term "poison" with "stub" (thanks Ilpo J=C3=A4rvinen) --- drivers/platform/x86/lenovo/wmi-capdata.c | 94 +++++++++++++++++++++++++++= ++-- 1 file changed, 90 insertions(+), 4 deletions(-) diff --git a/drivers/platform/x86/lenovo/wmi-capdata.c b/drivers/platform/x= 86/lenovo/wmi-capdata.c index 0efe37644627..7310b72e8c2f 100644 --- a/drivers/platform/x86/lenovo/wmi-capdata.c +++ b/drivers/platform/x86/lenovo/wmi-capdata.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -38,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -45,6 +47,7 @@ #include #include #include +#include #include #include =20 @@ -447,7 +450,7 @@ static const struct component_ops lwmi_cd_sub_component= _ops =3D { /* * lwmi_cd*_get_data - Get the data of the specified attribute * @list: The lenovo-wmi-capdata pointer to its cd_list struct. - * @attribute_id: The capdata attribute ID to be found. + * @attribute_id: The capdata attribute ID (non-zero) to be found. * @output: Pointer to a capdata* struct to return the data. * * Retrieves the capability data struct pointer for the given @@ -460,7 +463,7 @@ static const struct component_ops lwmi_cd_sub_component= _ops =3D { { \ u8 idx; \ \ - if (WARN_ON(!list)) \ + if (WARN_ON(!list || !attribute_id)) \ return -EINVAL; \ \ guard(mutex)(&list->list_mutex); \ @@ -595,6 +598,89 @@ static void lwmi_cd_debugfs_remove(struct lwmi_cd_priv= *priv) =20 /* =3D=3D=3D=3D=3D=3D=3D=3D WMI interface =3D=3D=3D=3D=3D=3D=3D=3D */ =20 +/** + * lwmi_cd_stub() - Stub the device by not providing any capability data + * @priv: lenovo-wmi-capdata driver data. + * @err: The occurred error. + * + * The Other Mode driver binds to both Capability Data 00 and 01. If eithe= r 00 + * or 01 fails to probe, the Other Mode device will fail to provide fw-att= r or + * hwmon/power_supply_ext devices for the other functional capdata device. + * + * Therefore, errors must be non-fatal in order not to break the assumptio= ns + * made by the device component framework, so that the Other Mode device c= an + * provide whatever is functional. + * + * After stubbing the device, a NULL list will be passed to the Other Mode + * device on bind. + * + * Return: 0 if the @err is suppressed, otherwise its propagated as is. + */ +static int lwmi_cd_stub(struct lwmi_cd_priv *priv, int err) +{ + /* + * No barrier is required in any possible code paths: + * - called from lwmi_cd_cache(): a proper barrier has been employed + * - called from lwmi_cd_fan_list_alloc_cache(): early setup does not + * require synchronization, and priv->initialized must be false + */ + bool initialized =3D READ_ONCE(priv->initialized); + + dev_warn(&priv->wdev->dev, "%s %s (%u items) due to error: %d\n", + initialized ? "clearing" : "stubbing", priv->info->name, + priv->list ? priv->list->count : 0, err); + + /* Simply print the warning message. */ + if (!priv->list) + return initialized ? err : 0; + + /* + * Stub the device on initialization errors. + * + * Note that if a transient error occurs during initialization, there is + * nothing we can do to re-enable the functionalities of the Other Mode + * driver even if a successful runtime notifier call making the relevant + * capdata emerge, as registering functionalities without the protection + * of the component framework is unsafe. Therefore, registering the + * notifier for a stubbed device is meaningless, and we don't need to + * distinguish transient and pernament errors during initialization. + * + * For runtime errors (see below), the registered functionalities + * (fw-attr) become temporarily unavailable due to the unavailablilty of + * the relevant capdata, and will recover after a successful runtime + * notifier call. + */ + if (!initialized) { + devm_kfree(&priv->wdev->dev, priv->list); + priv->list =3D NULL; + + return 0; + } + + /* + * Runtime errors are transient. Simply clear all cached data and + * propagate the error. + * + * Since a valid attribute id is never 0 (the firmware also untilize the + * fact to stub some capabilities according to platform metadata), + * clearing the cached data effectively makes all attributes temporarily + * unavailable until the next notifier call. + */ + + lockdep_assert_held(&priv->list->list_mutex); + + switch (priv->info->type) { + case LENOVO_CAPABILITY_DATA_01: + memset(priv->list->cd01, 0, + flex_array_size(priv->list, cd01, priv->list->count)); + break; + default: + unreachable(); + } + + return err; +} + /** * __lwmi_cd_cache() - Cache all WMI data block information locklessly * @priv: lenovo-wmi-capdata driver data. @@ -633,7 +719,7 @@ static int __lwmi_cd_cache(struct lwmi_cd_priv *priv) if (ret =3D=3D -ENODATA) /* The block is too short, probably stubbed. */ continue; if (ret) - return ret; + return lwmi_cd_stub(priv, ret); =20 /* Capdata 01 is an extension to capdata 00. */ struct capdata00 *capdata __free(kfree) =3D wbuf.data; @@ -694,7 +780,7 @@ static int lwmi_cd_fan_list_alloc_cache(struct lwmi_cd_= priv *priv) if (ret =3D=3D -ENODATA) /* The block is too short, probably stubbed. */ return 0; if (ret) - return ret; + return lwmi_cd_stub(priv, ret); /* Print the warning message. */ =20 struct lwmi_cd_fan_block *block __free(kfree) =3D wbuf.data; =20 --=20 2.55.0 From nobody Sat Oct 24 14:13:33 2026 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=136.143.188.112 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1792422285; b=NCkz3hrJRTqBqr7QpjKnzVrE0mnn9GN7/x9NzXMv/h01dmkUWIOl6BwN55f4rWVxdrkc UQKaJhWxMUcRTWAqvC8Rr/nu2hRx1Gk7j7aD3cjrKlkEb1+XkMiV+sdceP2G11UyntBOp fzm873NP6u3/1fd8PZ5j6RQvENeMg6PtBr15WyAKal8mQzhVP83qlnHTCsYXCNdZfdFSc 9VE0vLOBhyaSi/Dvs1FmoGm+RNg+YHye/wZ0UQNgoYraq/r1TSuTXvYGvg75pB2nhbH8u CZBUaF8d73FskFQyHzqcslHkzdEMIqH/Ig1Nt/jWsa45rNkv5eQyc7CRcU8uIhUzq+Q== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792422285; h=DMARC-Filter:DKIM-Signature:Received:From:Date:Subject:MIME-Version: Content-Type:Content-Transfer-Encoding:Message-Id:References: In-Reply-To:To:Cc:X-Mailer:X-ZohoMailClient; bh=kLKrJjfCzoHcACnO33I+JPBo3vVugR5O9pIj/Gs+qHE=; b=IcI/3PEd2QdvDxRfg0b+WyforDdetyHZCIo1Zi6n/xGGnaHbtiTMw8tIpZ11AWv3fACt y9pEcyIOEPU0+GqZNeN3K0RVWU0NDCME30iNaaf/nIMYUz6YMZkARSrP2h6z9v8udX6y9 uZ0iFeDPFTHmAqNvdwaWHyh3ZCc18eFJAyyZpZfJYh3LEEBEvcTTcjUh9doPo+589REtB d7PbZhCt2ZNr63QbZmfKhvlz5kykEx4OFouTvjUiOZqRn8Y9LePSshLWJRuS7yfN2Fgx+ UftYMqT4jjQXKCmXR3k+TfsG4O3QvUMDAK3ZIqrB0VOUh804q0ALE3YzpWDTsyZ0/pw== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass header.from=rong.moe; spf=pass smtp.mailfrom=rong.moe; dkim=pass header.d=rong.moe header.i=i@rong.moe header.a=rsa-sha256 header.s=zmail2048 header.b=DarmpvQP; arc=pass header.oldest-pass=0 smtp.remote-ip=136.143.188.112 Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BC18D607F4A4; Mon, 19 Oct 2026 15:04:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org BC18D607F4A4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=rong.moe Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rong.moe Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=rong.moe header.i=i@rong.moe header.a=rsa-sha256 header.s=zmail2048 header.b=DarmpvQP ARC-Seal: i=1; a=rsa-sha256; t=1792422211; cv=none; d=zohomail.com; s=zohoarc; b=cSn4m9sUI5TdPRQapCJSWOZ6urEVHJe3MIt7osRi99I0YloRW7Y1l4ZOXjiQtZ+HXUYDpU148zdSSFuD12v13R6dsed//3SD5D7rrcbUAAixfxZ5rbPJboYPdolx8nA3K9P0GQfvuJV3eG56D1y9FEUpuO1GfRoGDNW8d7DLPmI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1792422211; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=kLKrJjfCzoHcACnO33I+JPBo3vVugR5O9pIj/Gs+qHE=; b=n8OSVZ5x1sNJXGBrEs0VKOD9HHMVoeR3Xd0m3qUU3B+u5j2kLtIQyKkRaWkCUO0itYdyJW9J9/4Mc9I9jhjQdqQZqrDSQFgrqlYuMEsA+t0JE6/vCu2AhF0awZyvn5/HFNvnlgh6JUz4V/VJp4SDcBiINZpyUGueBqW4y/USCb4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=rong.moe; spf=pass smtp.mailfrom=i@rong.moe; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1792422211; s=zmail2048; d=rong.moe; i=i@rong.moe; h=From:From:Date:Date:Subject:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Message-Id:In-Reply-To:To:To:Cc:Cc:Reply-To; bh=kLKrJjfCzoHcACnO33I+JPBo3vVugR5O9pIj/Gs+qHE=; b=DarmpvQP3yXyxhBhyYqsBCWHF+wM6d8JE88p1CcHJ7HZmXHrDf6SJHvRCxyIdJi4 3ynAhy2JQuI31xjxi6RjW/Y52XEETKWK7K6RLFiFld74kNAu8yndSss3Pqoh/i0iK5L oXcorugdipfiSP8JIjxrudCKcowVW7KsDzaMoQJQyhbu89s3z93g6aMlUafG/xUenxK EZ6aAVIOqdFZKYfuPTKelKBWF3XWNw2cqV8wsKLnchjNu7j59WU+w5d0OTW0+09Snrc E3hGQBgYIYk+SbpNc2MkDIraHlVjdPv2W8JRsALUx/hkQXd6d3WpGbTNdXGDJ8tMnrS sFz86Hw/4A== Received: by smtp.zohomail.com with SMTPS id 1792422206249245.80756612073742; Mon, 19 Oct 2026 08:03:26 -0700 (PDT) From: Rong Zhang Date: Mon, 19 Oct 2026 23:02:31 +0800 Subject: [PATCH v5 09/12] platform/x86: lenovo-wmi-capdata: Detect stubbed capdata device X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20261019-lwmi-wmi-new-api-v5-9-71557d28d058@rong.moe> References: <20261019-lwmi-wmi-new-api-v5-0-71557d28d058@rong.moe> In-Reply-To: <20261019-lwmi-wmi-new-api-v5-0-71557d28d058@rong.moe> To: Mark Pearson , "Derek J. Clark" , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Armin Wolf Cc: Charles , Navon John Lukose , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, Rong Zhang X-Mailer: b4 0.17-dev-6be7c X-ZohoMailClient: External Some devices may stub the capdata device's WMI query method because it doesn't support the relevant interfaces at all. For example, most ThinkBook devices doesn't support GameZone or Other Mode thermal tuning, so capdata 01 is useless and stubbed. Keeping the capability data list with empty data is meaningless and causes lenovo-wmi-other to call lwmi_cd*_get_data() to retrieve nonexistent capdata in vain. Therefore, stub the device and release (or skip allocating) needless resources, e.g., the capability data list and the debugfs directory. Tested-by: Navon John Lukose Reviewed-by: Derek J. Clark Reviewed-by: Mark Pearson Signed-off-by: Rong Zhang Reported-by: Charles Reported-by: Navon John Lukose Suggested-by: Derek J. Clark Suggested-by: Mark Pearson --- Changes in v2: - Replace the term "poison" with "stub" (thanks Ilpo J=C3=A4rvinen) --- drivers/platform/x86/lenovo/wmi-capdata.c | 33 +++++++++++++++++++++++++++= ++++ 1 file changed, 33 insertions(+) diff --git a/drivers/platform/x86/lenovo/wmi-capdata.c b/drivers/platform/x= 86/lenovo/wmi-capdata.c index 7310b72e8c2f..b86bc7a57a04 100644 --- a/drivers/platform/x86/lenovo/wmi-capdata.c +++ b/drivers/platform/x86/lenovo/wmi-capdata.c @@ -691,6 +691,7 @@ static int lwmi_cd_stub(struct lwmi_cd_priv *priv, int = err) */ static int __lwmi_cd_cache(struct lwmi_cd_priv *priv) { + bool got_data =3D false; size_t size; int idx; void *p; @@ -725,8 +726,31 @@ static int __lwmi_cd_cache(struct lwmi_cd_priv *priv) struct capdata00 *capdata __free(kfree) =3D wbuf.data; =20 memcpy(p, capdata, size); + + /* + * A valid attribute always has a non-zero id. IOW, a zero id + * implies a stubbed item (or the query method being stubbed). + * + * The stubbed item is still copied to the cache slot anyway, in + * case the firmware dynamically stubs the capdata item after + * switching Game Zone mode. In this manner, the previously + * exposed capdata can be void. + */ + if (capdata->id) + got_data =3D true; } =20 + /* + * Some devices may stub the query method because it doesn't support the + * relevant interfaces at all. For example, most ThinkBook devices + * doesn't support Game Zone or Other Mode thermal tuning, so capdata 01 + * is useless and stubbed. + * + * Stub the device and release needless resources. + */ + if (!got_data) + return lwmi_cd_stub(priv, -ENODATA); + return 0; } =20 @@ -772,6 +796,7 @@ struct lwmi_cd_fan_block { static int lwmi_cd_fan_list_alloc_cache(struct lwmi_cd_priv *priv) { struct wmi_buffer wbuf; + bool got_data =3D false; struct cd_list *list; int ret, idx; u32 count; @@ -808,13 +833,21 @@ static int lwmi_cd_fan_list_alloc_cache(struct lwmi_c= d_priv *priv) priv->list =3D list; =20 for (idx =3D 0; idx < count; idx++) { + if (!block->data[idx]) /* Ignore stub. */ + continue; + list->cd_fan[idx] =3D (struct capdata_fan) { .id =3D block->data[idx], .max_rpm =3D block->data[idx + count], .min_rpm =3D block->data[idx + (2 * count)], }; + + got_data =3D true; } =20 + if (!got_data) + return lwmi_cd_stub(priv, -ENODATA); + return 0; } =20 --=20 2.55.0 From nobody Sat Oct 24 14:13:33 2026 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=136.143.188.112 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1792422295; b=qhtqRKytf/6G35Jh7rtl6zp6HispEREc4ZD+3L4JIsX2XWWgQ2FUkL6YTUaSFtPRhvUA Ztz60EU2uw67hkmvpVco5W+A1w7Kd8IwRopu7oyoxNu9IafR7fx2vQVScyV8kpZgweFr2 wf4z5ziU+pbL/kNhP+0p+SMuRxL+wVYKmA/gY6onUsDQU8ZxwdSilG/OZuSyyr5u3TK/D joe/NmDyK0mIGzj44iEW17seRRWr+COAqmsxHzNKjg187A43QrgibT8nJEkGDN9LkT1eN HRAvFbPLMI/MWmYN9nV3Fwm/WAB/k4TzP9p8UntD1Z8aZQ4YP1OSDgH9T1Idma2hn4A== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792422295; h=DMARC-Filter:DKIM-Signature:Received:From:Date:Subject:MIME-Version: Content-Type:Content-Transfer-Encoding:Message-Id:References: In-Reply-To:To:Cc:X-Mailer:X-ZohoMailClient; bh=tVy0gnupGubIpiytEwQub+oESnTSCskkEVD4mfSWPhA=; b=QEskkCTL4uWmTZgUQWIk0PqydRvzY5ZSjK5QCrg4Ls5/Gv28YHUXMxETWpgZRGC/NMCd 0+w7VUA4kZvHxrL1CM/O/uOWzhUP06CqTjBDXfowG0/ajgDMivg+wjMtC8uYiZ1PNtE4D 62js6GFc30VZgXBI4AsbKS640B9lhOTDilWeN+x7zeh1VegYpsIq430ReSUQcxveOVSae lui5KdEUXao79/NnqhaVx+FR4/VEOFMxeon8WbHcNfrNmLuiJLZi7QL4VxKGDAx3UqKAe Ga9BJVvdN2P7nJ2NvD7yNF60mFOICm9mAEGdQP/mj/8V/jnPLMXRxzBqEYjaHxyppKA== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass header.from=rong.moe; spf=pass smtp.mailfrom=rong.moe; dkim=pass header.d=rong.moe header.i=i@rong.moe header.a=rsa-sha256 header.s=zmail2048 header.b=o+Ar1s16; arc=pass header.oldest-pass=0 smtp.remote-ip=136.143.188.112 Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5BC1C607F4AE; Mon, 19 Oct 2026 15:04:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 5BC1C607F4AE Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=rong.moe Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rong.moe Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=rong.moe header.i=i@rong.moe header.a=rsa-sha256 header.s=zmail2048 header.b=o+Ar1s16 ARC-Seal: i=1; a=rsa-sha256; t=1792422216; cv=none; d=zohomail.com; s=zohoarc; b=SRBhQdbbf41+MA4nVKXNDcU8Lo1M5bZxrIVOacjUsOk/vgzh51a2Xa0UPksamOw6ifzeoUjmmri/ATlY4elg9e8MUl/AgDChCr8oH9fVQ4YKO3hq/lQ1W2qJflIEGhDDx865F2MQ6Ah/sJyK3cBnMwXTgJsdQMkwaktJc2VfjhI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1792422216; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=tVy0gnupGubIpiytEwQub+oESnTSCskkEVD4mfSWPhA=; b=IA/QVZK8K9pvJEPtNDXbiT+IXDGO07AWP4CrWLHKrFmwqxd+foxy3NuuGbjubwwPSglVFH605kLZaH5y3BSKuJ0+Jk9TU7IgENVrCLMFTj2+ui8rVXLYcUKSGUSOANFy3F/Re99XyXDhfHIYjdSZZH9NRZy78aoxt3QFk28JqP0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=rong.moe; spf=pass smtp.mailfrom=i@rong.moe; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1792422216; s=zmail2048; d=rong.moe; i=i@rong.moe; h=From:From:Date:Date:Subject:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Message-Id:In-Reply-To:To:To:Cc:Cc:Reply-To; bh=tVy0gnupGubIpiytEwQub+oESnTSCskkEVD4mfSWPhA=; b=o+Ar1s16pzwXQA1lJIw7bFsimyN/eYqpvCZJpMr2PD+H87gUARx/88CyfUl8SCYW +WGp22wuPg2mCCyy8LbGY+gLbz3mk/Iegr3MM+sH/x/hke/o/1JXEujIuQjB4+FenIT MYfmygJtjpPO2iXaNdhoGhruwsokfb/2Ug/x2HyWhwuva/Gkxmya7Upppf6PWKPke/W ejSEQpVQSQruhiWpDUMTVJGuKle5DoWP3+2onWwn0MqLA1rnPiLrJZfkPsJyOc3fZR+ Ge4cZB38AlVGXIooKWJaTu5Ur0Q0M86xwDSFZNTiiOGMJKxGwTg3duYyqWsnXYB9twg Frwly9Mp5Q== Received: by smtp.zohomail.com with SMTPS id 1792422210683726.0108029779062; Mon, 19 Oct 2026 08:03:30 -0700 (PDT) From: Rong Zhang Date: Mon, 19 Oct 2026 23:02:32 +0800 Subject: [PATCH v5 10/12] platform/x86: lenovo-wmi-capdata: Do not match missing components X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20261019-lwmi-wmi-new-api-v5-10-71557d28d058@rong.moe> References: <20261019-lwmi-wmi-new-api-v5-0-71557d28d058@rong.moe> In-Reply-To: <20261019-lwmi-wmi-new-api-v5-0-71557d28d058@rong.moe> To: Mark Pearson , "Derek J. Clark" , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Armin Wolf Cc: Charles , Navon John Lukose , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, Rong Zhang X-Mailer: b4 0.17-dev-6be7c X-ZohoMailClient: External Some devices do not support LENOVO_CAPABILITY_DATA_01. They either do not have the corresponding WMI GUID, or do not implement the query method. In both cases, the WMI core does not create the corresponding WMI device, leaving the component master (i.e., lenovo-wmi-other) waits for the missing component forever. Identify missing components using the new wmidev_exists() interface, and skip adding them to the match list, so that all components in the list must present, fulfilling the binding requirement. Reported-by: Navon John Lukose Closes: https://msgid.link/20260928190901.1369497-1-navonjohnlukose@gmail.c= om Suggested-by: Mark Pearson Link: https://msgid.link/9789f452-d7eb-4f1e-8a13-7335332193a7@app.fastmail.= com Tested-by: Navon John Lukose Reviewed-by: Derek J. Clark Reviewed-by: Mark Pearson Signed-off-by: Rong Zhang Reported-by: Charles Suggested-by: Derek J. Clark --- Changes in v4: - Pass the error from guid_parse() to matchptr Changes in v2: - New patch in the series to solve the report made by Navon --- drivers/platform/x86/lenovo/wmi-capdata.c | 41 +++++++++++++++++++++++++++= ---- 1 file changed, 36 insertions(+), 5 deletions(-) diff --git a/drivers/platform/x86/lenovo/wmi-capdata.c b/drivers/platform/x= 86/lenovo/wmi-capdata.c index b86bc7a57a04..1d44ff83e157 100644 --- a/drivers/platform/x86/lenovo/wmi-capdata.c +++ b/drivers/platform/x86/lenovo/wmi-capdata.c @@ -49,6 +49,7 @@ #include #include #include +#include #include =20 #include @@ -75,14 +76,19 @@ enum lwmi_cd_type { CD_TYPE_NONE =3D -1, }; =20 -#define LWMI_CD_TABLE_ITEM(_type) \ - [_type] =3D { \ - .name =3D #_type, \ - .type =3D _type, \ +static const struct wmi_device_id lwmi_cd_id_table[]; + +/* Save some .rodata space by reusing the GUID strings from the id table. = */ +#define LWMI_CD_TABLE_ITEM(_type) \ + [_type] =3D { \ + .name =3D #_type, \ + .guid_string =3D lwmi_cd_id_table[_type].guid_string, \ + .type =3D _type, \ } =20 static const struct lwmi_cd_info { const char *name; + const char *guid_string; enum lwmi_cd_type type; } lwmi_cd_table[] =3D { LWMI_CD_TABLE_ITEM(LENOVO_CAPABILITY_DATA_00), @@ -153,24 +159,49 @@ static int lwmi_cd_match(struct device *dev, void *ty= pe) * * Adds all component matches to the list stored in @matchptr for the @mas= ter * device. @matchptr must be initialized to NULL. + * + * Missing components are not added to the match list, or else the master = waits + * for them forever. For some components, their existence can be determine= d by + * querying other components, so they are handled as sub-components and th= us not + * matched here. For components with no existence declaration, wmidev_exis= ts() + * is used to determine their existence. + * + * If all components are missing, ERR_PTR(-ENXIO) is returned through @mat= chptr. */ void lwmi_cd_match_add_all(struct device *master, struct component_match *= *matchptr) { - int i; + bool matched =3D false; + int ret, i; =20 if (WARN_ON(*matchptr)) return; =20 for (i =3D 0; i < ARRAY_SIZE(lwmi_cd_table); i++) { + guid_t guid; + /* Skip sub-components. */ if (lwmi_cd_table[i].type =3D=3D LENOVO_FAN_TEST_DATA) continue; =20 + ret =3D guid_parse(lwmi_cd_table[i].guid_string, &guid); + if (ret < 0) { + *matchptr =3D ERR_PTR(ret); + return; + } + + if (!wmidev_exists(&guid)) + continue; + component_match_add(master, matchptr, lwmi_cd_match, (void *)&lwmi_cd_table[i].type); if (IS_ERR(*matchptr)) return; + + matched =3D true; } + + if (!matched) + *matchptr =3D ERR_PTR(-ENXIO); } EXPORT_SYMBOL_NS_GPL(lwmi_cd_match_add_all, "LENOVO_WMI_CAPDATA"); =20 --=20 2.55.0 From nobody Sat Oct 24 14:13:33 2026 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=136.143.188.112 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1792422306; b=KhdEQawTXDq1/jr2GxLCOPytCXnP/yimIhgsACoVkMPeQIkXZO0GBqoZnXE8UPXcJkJQ xs5y25WyEDdYE5dRCHUARLrjvWCcf670LN98ey9hMlL6dcvn47zwKZsTNT25jFQx4qFX9 8ds6DLkTQcFYdE/nAvsE5JllcFa3eXHH65F7dA6JXAIocBECh9k0dvhSQRGiKjjCNyGpL GPpGx5QdJb7vwxsb51GVmjQX9gRGLX5s0hHVz7Q2O8YeBdVldoETM+2JAHx9JvV3IMPh+ oPq9mSO8ojDt0LQ5dHmmx68pwflCsiSnPUDE2nDBXX2EsGcfTg4NELeTok5mb0m+4Lg== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792422306; h=DMARC-Filter:DKIM-Signature:Received:From:Date:Subject:MIME-Version: Content-Type:Content-Transfer-Encoding:Message-Id:References: In-Reply-To:To:Cc:X-Mailer:X-ZohoMailClient; bh=FnTa9xUrHpkEZLnF/C/Uhf2QRS6M/PPDbqmx71vQSBI=; b=NqfUrgSz0VquD2LChGZ56DgRUUw2aVYqvjmuHMIN1XR4hAmOo0aSjZnQFKOymKoQoU9S /K8OSkWCFLEwSLdWRPlaccFXqZAIRbwRp+nO/y+Y4/FMb/mp4/cvoLCQ+2Y4biAEgizBX zPvzMPsV10eAyux8MrV+tzev7ixV2jV1zGk+MA0ICTJD+w2RwT5+vWbkHDcB8HqU+Tk5V JaE6E1ioJV9Dvd06syG6YyIBaQuBDKxRg3mcsS46jOofCCFYbeBdEfgEBCI8Djr1yMxnd PBAomFK/gk23S9O2Cqv0UAvNqb4CTl+Cv8H3ydCYVLUhNGKRfG639i6ncd1yz19zwSw== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass header.from=rong.moe; spf=pass smtp.mailfrom=rong.moe; dkim=pass header.d=rong.moe header.i=i@rong.moe header.a=rsa-sha256 header.s=zmail2048 header.b=OazP6l3+; arc=pass header.oldest-pass=0 smtp.remote-ip=136.143.188.112 Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 46B4B607F4BB; Mon, 19 Oct 2026 15:05:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 46B4B607F4BB Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=rong.moe Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rong.moe Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=rong.moe header.i=i@rong.moe header.a=rsa-sha256 header.s=zmail2048 header.b=OazP6l3+ ARC-Seal: i=1; a=rsa-sha256; t=1792422221; cv=none; d=zohomail.com; s=zohoarc; b=OWTvOStEtrydX6runmwaOj72222u12oXwLH748Vd7xkQWzwq8JV1Jjhh4GWVl8diUm91f55aUsvzoF8yR9iGj+pFKeixzAkYnXtZus6rw5ywt56ishZeYuU2XMbsCRDAwdqOW2RqiaRff2ZklD3r7IqZrgr0POFKQx/XTVJwo+o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1792422221; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=FnTa9xUrHpkEZLnF/C/Uhf2QRS6M/PPDbqmx71vQSBI=; b=gnuqSx8srvGv02rdgDybrUGhxhSsCSsGv06aIsJpMyXtEHXWrp+6vk45RiW+k9QaMPsU3U1oEgR47lli5Y0BM1DVXmxAp7cUs1prPm4MDwXECCECdcdtzpr7qfKtTzs5kGsfy5Ufvt78IdFmOS2fl9cfdIYgFuTYMByhc61CSgU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=rong.moe; spf=pass smtp.mailfrom=i@rong.moe; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1792422221; s=zmail2048; d=rong.moe; i=i@rong.moe; h=From:From:Date:Date:Subject:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Message-Id:In-Reply-To:To:To:Cc:Cc:Reply-To; bh=FnTa9xUrHpkEZLnF/C/Uhf2QRS6M/PPDbqmx71vQSBI=; b=OazP6l3+l5WRNO5R7EPj3+A2Lrau6F/20Kb9mBtZORCLr4WN7rmnmypnQovJCeSQ HqlRCQsaTyZGqvcBZH6kSMoOpnPgoft7vz6bfZbS4m3YVLz8fPooZQPcYmrVfB+Y9RF UdAN8FfxFQQ4Y5CNz1BRgxpyatU355ckn134e63todQXl5PjXOr/7QfY7GxPB8QfeJj KR/X0Kg+P6QDbsJdotLo4V3HkxeqzruB/ZpADgCxUVPkJBKUjbJi47nk+gHPazPSYlP fr7ekizoUPP+b62G4rxvAkmQuiKTnTW9Ye3F3XpAwxLEf11D60dj/Zp9qQYIMPOXuRV PT8S7LBtHw== Received: by smtp.zohomail.com with SMTPS id 1792422215333737.0129824035191; Mon, 19 Oct 2026 08:03:35 -0700 (PDT) From: Rong Zhang Date: Mon, 19 Oct 2026 23:02:33 +0800 Subject: [PATCH v5 11/12] platform/x86: lenovo-wmi-helpers: Adopt new WMI API X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20261019-lwmi-wmi-new-api-v5-11-71557d28d058@rong.moe> References: <20261019-lwmi-wmi-new-api-v5-0-71557d28d058@rong.moe> In-Reply-To: <20261019-lwmi-wmi-new-api-v5-0-71557d28d058@rong.moe> To: Mark Pearson , "Derek J. Clark" , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Armin Wolf Cc: Charles , Navon John Lukose , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, Rong Zhang X-Mailer: b4 0.17-dev-6be7c X-ZohoMailClient: External The new WMI API supports multiple ACPI types by converting them into a unified buffer that satisfies alignment and size requirements. Adopt it to make our life easier. Note that the Windows WMI-ACPI driver converts all ACPI objects into a common buffer format, so adopting the new API intentionally accepts more ACPI types as a followup of commit 465dc9da8ff6 ("platform/x86: lenovo-wmi-helpers: Convert returned buffer into u32"). Suggested-by: Armin Wolf Link: https://lore.kernel.org/r/f1787927-b655-4321-b9d9-bc12353c72db@gmx.de/ Reviewed-by: Armin Wolf Tested-by: Navon John Lukose Reviewed-by: Derek J. Clark Reviewed-by: Mark Pearson Signed-off-by: Rong Zhang Reported-by: Charles Reported-by: Navon John Lukose Suggested-by: Derek J. Clark Suggested-by: Mark Pearson --- drivers/platform/x86/lenovo/wmi-helpers.c | 61 ++++++++++++---------------= ---- 1 file changed, 23 insertions(+), 38 deletions(-) diff --git a/drivers/platform/x86/lenovo/wmi-helpers.c b/drivers/platform/x= 86/lenovo/wmi-helpers.c index 8f5766c391eb..687caa226263 100644 --- a/drivers/platform/x86/lenovo/wmi-helpers.c +++ b/drivers/platform/x86/lenovo/wmi-helpers.c @@ -24,9 +24,10 @@ #include #include #include -#include #include =20 +#include + #include "wmi-helpers.h" =20 /* Thermal mode notifier chain. */ @@ -42,49 +43,33 @@ static BLOCKING_NOTIFIER_HEAD(tm_chain_head); * @size: Length of the buffer. * @retval: Pointer for the return value to be assigned. * - * Calls wmidev_evaluate_method for Lenovo WMI devices that return an ACPI - * integer. Validates the return value type and assigns the value to the - * retval pointer. + * Calls the specified WMI method for Lenovo WMI devices that return a WMI + * integer. Validates the return value and assigns it to @retval when it's= not + * NULL, otherwise the return value is not validated. * * Return: 0 on success, or an error code. */ int lwmi_dev_evaluate_int(struct wmi_device *wdev, u8 instance, u32 method= _id, unsigned char *buf, size_t size, u32 *retval) { - struct acpi_buffer output =3D { ACPI_ALLOCATE_BUFFER, NULL }; - struct acpi_buffer input =3D { size, buf }; - acpi_status status; - - status =3D wmidev_evaluate_method(wdev, instance, method_id, &input, - &output); - if (ACPI_FAILURE(status)) - return -EIO; - - union acpi_object *ret_obj __free(kfree) =3D output.pointer; - - if (retval) { - if (!ret_obj) - return -ENODATA; - - switch (ret_obj->type) { - /* - * The ACPI method may simply return a buffer when a u32 - * is expected. This is valid on Windows as its WMI-ACPI - * driver converts everything to a common buffer. - */ - case ACPI_TYPE_BUFFER: - if (ret_obj->buffer.length < sizeof(u32)) - return -ENXIO; - - *retval =3D get_unaligned_le32(ret_obj->buffer.pointer); - return 0; - case ACPI_TYPE_INTEGER: - *retval =3D (u32)ret_obj->integer.value; - return 0; - default: - return -ENXIO; - } - } + struct wmi_buffer input =3D { + .length =3D size, + .data =3D buf, + }; + struct wmi_buffer output; + int ret; + + if (!retval) + return wmidev_invoke_procedure(wdev, instance, method_id, &input); + + ret =3D wmidev_invoke_method(wdev, instance, method_id, &input, + &output, sizeof(__le32)); + if (ret) + return ret; + + __le32 *valp __free(kfree) =3D output.data; + + *retval =3D le32_to_cpu(*valp); =20 return 0; }; --=20 2.55.0 From nobody Sat Oct 24 14:13:33 2026 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=136.143.188.112 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1792422316; b=S8cdWcqUxuJY376jDznpXaV77VqA2xA6tC3+h9BX1kOCSgmSU04+gPGYbvbHf4l+rPY8 DeFhLlK5QHMG/JiZUbAe2KOQrki/wNvKMlabJ1lW2VpzsBz1S/HB145TPAXjOD3KfwWjU G40e1LW2e3ptSkHjbBkOcyYs2COBH5CyWgyTpPSaANqFr0EHMWY1gbRH1//zpHpEjzV1/ +ajOwHzu1r2Xd9PYUmz7bjUOQJgz1T55hwiDXqi0CcUmsNzl2tN0GMvyHrc9bHeLvmean eZVEaoB4kgObMhnYOqmnDuHqYMHbkhD7onEAKE84xkDSWr/i4fcbfCm1CKQh+uagg8w== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792422316; h=DMARC-Filter:DKIM-Signature:Received:From:Date:Subject:MIME-Version: Content-Type:Content-Transfer-Encoding:Message-Id:References: In-Reply-To:To:Cc:X-Mailer:X-ZohoMailClient; bh=Wi8+H/G5z2Klnggdqj6icJPrOMSRqT84gK35GtwV0ME=; b=5jlsQjXC7/xGIzvSyShQsOfzWE8WkdcX36/HeTxOIWumqdMehi8seeRdoQ19/N5QBLXG cPr1UjxGbaXtR7toX12c+6LuvW4zV/752DrfH23O6Hg0P+0fqhQfwLQvmEjmKWAn1NBjK AVMdvf+ZhiVePfTtMtXgovopG1PzPTJwN7Vz8Ttz/NzGwOLTn7RKkjkI6zNZnBB8uauDQ n0qK+QSYvRfn4xQOYwJlMQVSC+D+tKlRAdgypjiWSsVWwddIbJSIolbhb9qWP2neLEt9u fZOOAWpIsxnA9+mF+FZzPHBTloUcZMeghN8aTQC6nAChORYjvRuREjuDzf7WhyeAzVA== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass header.from=rong.moe; spf=pass smtp.mailfrom=rong.moe; dkim=pass header.d=rong.moe header.i=i@rong.moe header.a=rsa-sha256 header.s=zmail2048 header.b=Tom32fIo; arc=pass header.oldest-pass=0 smtp.remote-ip=136.143.188.112 Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 556C0607F4BF; Mon, 19 Oct 2026 15:05:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 556C0607F4BF Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=rong.moe Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rong.moe Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=rong.moe header.i=i@rong.moe header.a=rsa-sha256 header.s=zmail2048 header.b=Tom32fIo ARC-Seal: i=1; a=rsa-sha256; t=1792422228; cv=none; d=zohomail.com; s=zohoarc; b=gQjSOO6PoPF33zl5P5DXL6CeYlL/NjQHwh5+LsFm7tZPsQkWrwMVyw86HAZRqkzul2j0G08uQLDQOsayYiyXTW7URDyna2nnnqtO02YwVdYybRKFN+qq6WHNxpHSe59ICDRZK3tO7tlF+uSs+VcZVnpzEFVZBgrkMlAC4LQTnzQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1792422228; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=Wi8+H/G5z2Klnggdqj6icJPrOMSRqT84gK35GtwV0ME=; b=jxUBk/Ou/PYmfZBeWH7ge5mqgRRV/mmBtoS5lRzJQvYuq6I806F6JZ+EDCmuabRyl7j94G3NZE/3QkOKYiAh8bFKaPeYbMbrtsUn4Qx+uHmx7H406zYvGRvKSMGfEsYRKW9zUIA9XyIcewVedi4UGDS5ZBr6nrI+RPUKG9nNRm4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=rong.moe; spf=pass smtp.mailfrom=i@rong.moe; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1792422227; s=zmail2048; d=rong.moe; i=i@rong.moe; h=From:From:Date:Date:Subject:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Message-Id:In-Reply-To:To:To:Cc:Cc:Reply-To; bh=Wi8+H/G5z2Klnggdqj6icJPrOMSRqT84gK35GtwV0ME=; b=Tom32fIogiWB2BQqkSzHQOiZfN9+6ElEN+D8CnTzrDhXKCH+UJJiB2A6K1fk1qy1 gPjU4P69NoMQ48dk5pN02FOCoWDSqTZvP6ep+Ecmhg76vHP/o/HOD8o7EW3DBCW8Qce R7oSe+cz0VQ7b0+ZDXfsTBXxMQFsftdQbda67kHRCzOKTh7jWW9x5j/GdQCvf53crOp pFjkdSLugBBXlOSGfj7FD3FG5LZQ5GzINhZc8Fk8fEfhBM9u6zmYWDIw8Ajy1hg4cKT kJCKB43NI4+AzMzkBAdArU3ZQfl/oqP6ic9CPWg4caRyjcnNTCen+1GIPaAeOps2NBH U9pSAPI6Kg== Received: by smtp.zohomail.com with SMTPS id 1792422219113783.2114368613321; Mon, 19 Oct 2026 08:03:39 -0700 (PDT) From: Rong Zhang Date: Mon, 19 Oct 2026 23:02:34 +0800 Subject: [PATCH v5 12/12] MAINTAINERS: Add myself as a LENOVO drivers co-maintainer X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20261019-lwmi-wmi-new-api-v5-12-71557d28d058@rong.moe> References: <20261019-lwmi-wmi-new-api-v5-0-71557d28d058@rong.moe> In-Reply-To: <20261019-lwmi-wmi-new-api-v5-0-71557d28d058@rong.moe> To: Mark Pearson , "Derek J. Clark" , Hans de Goede , =?utf-8?q?Ilpo_J=C3=A4rvinen?= , Armin Wolf Cc: Charles , Navon John Lukose , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, Rong Zhang X-Mailer: b4 0.17-dev-6be7c X-ZohoMailClient: External I regularly review patches and resolve bug reports posted on the pdx86 mailing list or the kernel Bugzilla to improve LENOVO drivers (including lenovo-wmi-* and ideapad-laptop) along with Derek J. Clark and Mark Pearson. I've been submitting patches to add new features and fix issues on my devices, too. Add myself as a LENOVO drivers co-maintainer to reflect this. Suggested-by: Derek J. Clark Link: https://msgid.link/782FE636-A06A-4E12-9563-786374805947@gmail.com Reviewed-by: Mark Pearson Reviewed-by: Derek J. Clark Signed-off-by: Rong Zhang Reported-by: Charles Reported-by: Navon John Lukose Suggested-by: Mark Pearson --- MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/MAINTAINERS b/MAINTAINERS index 782389bd5cd3..8b47944f02a5 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -14805,6 +14805,7 @@ F: drivers/usb/misc/legousbtower.c LENOVO drivers M: Mark Pearson M: Derek J. Clark +M: Rong Zhang L: platform-driver-x86@vger.kernel.org S: Maintained F: Documentation/wmi/devices/lenovo-wmi-gamezone.rst --=20 2.55.0