From nobody Thu Apr 16 09:12:07 2026 Received: from out-171.mta0.migadu.com (out-171.mta0.migadu.com [91.218.175.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7A94331716E for ; Sat, 28 Feb 2026 19:10:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772305826; cv=none; b=HsthumNm8Uwfj1JjYSlhilsaEZ+0vWC5q2xzTBSmtEaM1CueHXBen4wktuf2/i2/eGvwkRvM1cxCC6Q+WE/FJfdMByaclIDYmNr0pp3wkRDn9c+gf+tMVNlJYkCqb8ANZvL0UEiKHaNOvcNMUrBz5oURTvWJ3LR8snHWQqzin/U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772305826; c=relaxed/simple; bh=zgNG83WO+5qFxYkeXCc8cWN8flAQFaJPnmP22z8TkWw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Xw4VNrNotMJwj8wndE5tm6vC8zk0oDbDIYMwOCq/uYiK4zY12lDCaqxv6tZH3LsOy/0ttwIIGb7lduH/zfXcT2KKbfGWMSX2Inz6mS3DS+HcDFa7n4ULRZmbzLpYR0TRUlNX+7BZHUiZ/0G7PkK+Er8Ytc/DBf9OZCmyeoPyIH4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=vgv2bG5M; arc=none smtp.client-ip=91.218.175.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="vgv2bG5M" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1772305822; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=d8ZWoUXilN7rq9eoSEwgxiKdI4SoSqyZwtNrXIWLO24=; b=vgv2bG5MpfQfQGbbkU4fWvs/UsA9NIJPDMwlubJt7H3rWs/ACZpLtwmlmDq8aeQFJESEQz Otf/BvIBE+TACiL+8rRodG40TwQjhagUJy+MCY836VZUevzpCJhPK7MsNZfJ6vJLisEptS +8ewRRZit/No08BwnSN68G2MIHhKyZc= From: Denis Benato To: linux-kernel@vger.kernel.org Cc: linux-input@vger.kernel.org, "Benjamin Tissoires" , "Jiri Kosina" , "Luke D . Jones" , "Mateusz Schyboll" , "Denis Benato" , "Denis Benato" Subject: [PATCH v2 1/7] HID: asus: fix code style of comments and brackets Date: Sat, 28 Feb 2026 20:10:04 +0100 Message-ID: <20260228191010.3830758-2-denis.benato@linux.dev> In-Reply-To: <20260228191010.3830758-1-denis.benato@linux.dev> References: <20260228191010.3830758-1-denis.benato@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" In asus_raw_event there is code that would violate checkpatch script such as unaligned closing comments and superfluous graph parenthesis: fix these stylistic issues. Also remove an empty comment spanning two lines. This commit does not change runtime behavior. Signed-off-by: Denis Benato --- drivers/hid/hid-asus.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c index ffbfaff9f117..5fcb06b16167 100644 --- a/drivers/hid/hid-asus.c +++ b/drivers/hid/hid-asus.c @@ -20,9 +20,6 @@ * Copyright (c) 2016 Frederik Wenigwieser */ =20 -/* - */ - #include #include #include @@ -359,7 +356,7 @@ static int asus_event(struct hid_device *hdev, struct h= id_field *field, struct hid_usage *usage, __s32 value) { struct asus_drvdata *drvdata =3D hid_get_drvdata(hdev); -=09 + if ((usage->hid & HID_USAGE_PAGE) =3D=3D HID_UP_ASUSVENDOR && (usage->hid & HID_USAGE) !=3D 0x00 && (usage->hid & HID_USAGE) !=3D 0xff && !usage->type) { @@ -448,21 +445,18 @@ static int asus_raw_event(struct hid_device *hdev, /* * G713 and G733 send these codes on some keypresses, depending on * the key pressed it can trigger a shutdown event if not caught. - */ - if (data[0] =3D=3D 0x02 && data[1] =3D=3D 0x30) { + */ + if (data[0] =3D=3D 0x02 && data[1] =3D=3D 0x30) return -1; - } } =20 if (drvdata->quirks & QUIRK_ROG_CLAYMORE_II_KEYBOARD) { /* * CLAYMORE II keyboard sends this packet when it goes to sleep * this causes the whole system to go into suspend. - */ - - if(size =3D=3D 2 && data[0] =3D=3D 0x02 && data[1] =3D=3D 0x00) { + */ + if (size =3D=3D 2 && data[0] =3D=3D 0x02 && data[1] =3D=3D 0x00) return -1; - } } =20 return 0; --=20 2.53.0 From nobody Thu Apr 16 09:12:07 2026 Received: from out-184.mta0.migadu.com (out-184.mta0.migadu.com [91.218.175.184]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4DA443F932B for ; Sat, 28 Feb 2026 19:10:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.184 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772305826; cv=none; b=PsVjx+y2J04EP8t2fPqQZ5gcMI6M2dLmzUj1xFEYOI6pxiPzm1lxZGh9mtQWAlS8ot0uBRpEIlI7yfY8sdmtBakMBWDzDPlRY9bVCyB4pwsjAfsyKkXUTw3wuOUSJMh05JpokI01DMOmRHnjrjDdW/bbhO3ep0ZLvZ6XgDPSdEk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772305826; c=relaxed/simple; bh=UkDBhIPsFIFYiXHUVq8yfYf8INQMI/qy7cSepFB2xJs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LvXqkYxcmN1L1RT0QQKlIWzNJVL0Rd/HB2RqXsZs1ntzfVwnwZ4tPMIAtje3LHDgSSrxTtm2eA7kscEtnTrf8IpUuGj31G/2RK55V4ojDlh4Q/ryiX53/cVd2JaX8fCVQnzzM68qM1uQEKtAmytE1OBsPoXy2HEebN0KGrEbkUg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=ZPGPlQ+/; arc=none smtp.client-ip=91.218.175.184 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="ZPGPlQ+/" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1772305823; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=k/6nhFAzqdch83HyRN7Z7ZoNORIKsdmbyNN7EKa4jaY=; b=ZPGPlQ+/MboKfK/1mb4L11Vps+tMlc3EUQ9Z+PI6kqJs7x0O7p6zjZNob+NhNCQjBrJMV2 rP11bTYZac51tEMTU3H0QF05O5YN+VZvFvfD+fre5vXSAuVJUabcdU6yG5N7ZmDSNOlFaQ 1F6gUIPWFdrYjoKP+xlC8vr5YBTui9I= From: Denis Benato To: linux-kernel@vger.kernel.org Cc: linux-input@vger.kernel.org, "Benjamin Tissoires" , "Jiri Kosina" , "Luke D . Jones" , "Mateusz Schyboll" , "Denis Benato" , "Denis Benato" Subject: [PATCH v2 2/7] HID: asus: add xg mobile 2022 external hardware support Date: Sat, 28 Feb 2026 20:10:05 +0100 Message-ID: <20260228191010.3830758-3-denis.benato@linux.dev> In-Reply-To: <20260228191010.3830758-1-denis.benato@linux.dev> References: <20260228191010.3830758-1-denis.benato@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" XG mobile station 2022 has a different PID than the 2023 model: add it that model to hid-asus. Signed-off-by: Denis Benato --- drivers/hid/hid-asus.c | 3 +++ drivers/hid/hid-ids.h | 1 + 2 files changed, 4 insertions(+) diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c index 5fcb06b16167..fbcf38b15290 100644 --- a/drivers/hid/hid-asus.c +++ b/drivers/hid/hid-asus.c @@ -1515,6 +1515,9 @@ static const struct hid_device_id asus_devices[] =3D { { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_ROG_NKEY_ALLY_X), QUIRK_USE_KBD_BACKLIGHT | QUIRK_ROG_NKEY_KEYBOARD | QUIRK_ROG_ALLY_XPAD= }, + { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, + USB_DEVICE_ID_ASUSTEK_XGM_2022), + }, { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_XGM_2023), }, diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index 4ab7640b119a..5e85921049e0 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h @@ -229,6 +229,7 @@ #define USB_DEVICE_ID_ASUSTEK_ROG_NKEY_ALLY_X 0x1b4c #define USB_DEVICE_ID_ASUSTEK_ROG_CLAYMORE_II_KEYBOARD 0x196b #define USB_DEVICE_ID_ASUSTEK_FX503VD_KEYBOARD 0x1869 +#define USB_DEVICE_ID_ASUSTEK_XGM_2022 0x1970 #define USB_DEVICE_ID_ASUSTEK_XGM_2023 0x1a9a =20 #define USB_VENDOR_ID_ATEN 0x0557 --=20 2.53.0 From nobody Thu Apr 16 09:12:07 2026 Received: from out-183.mta0.migadu.com (out-183.mta0.migadu.com [91.218.175.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 092E93F9339 for ; Sat, 28 Feb 2026 19:10:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.183 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772305827; cv=none; b=XpYg58aBzJQGP3olmEvEkYXkj0ZXlnhkfrgDdO6hoT6bOuZsp1M0s7+B1Zxf6H8Qqr2LuXgxyi67GMIeKMoePJ/MptxvBmF4GH0idcf7tnqwGMdgAlHbV+eFp4z2WJDuay4FwrGcZ2LHg8hOdiXggtQGLR1P/+gXKCfJX/dKe6U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772305827; c=relaxed/simple; bh=yHtNrxb6RKeEMvwyoM6DYSEQq5BjHIRjmQEhkK00GiU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=DMVTlIz6kaFrOuUoZ/NFU3LdT8uV4YBaRgf2y87rKFd+gc+yrUy1sp80mTQwzrVRfkK3gir+8zFja7AocnhWlHHkrKLoe5tpyDDv7vo6qNHrT5jYEjneocFqq9pkxU1c4jTdnXKFovQPNOr/KlYUuvTBoA0ov4QaXLDRewSkUh0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=PjVld2OE; arc=none smtp.client-ip=91.218.175.183 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="PjVld2OE" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1772305824; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cZ0ptMQdDcnwROywUM/EVbQICnD3WeNoaINlJhVc+bo=; b=PjVld2OEEb19FJ/u8Z73WiTKx7UDM5qJG06V8bDrz+QhVMqVckVswtxu/c6gxeAs2mWAJb 8dNTZCSZ5xVzBSLsWlOiUA4/8pDkNI681ucQgoyBASw7KaLL45Uj2qOKW/8qudbKy/R8Q5 vS2tpQT00xxt6AkDcEHIoCMZRfEYdMA= From: Denis Benato To: linux-kernel@vger.kernel.org Cc: linux-input@vger.kernel.org, "Benjamin Tissoires" , "Jiri Kosina" , "Luke D . Jones" , "Mateusz Schyboll" , "Denis Benato" , "Denis Benato" Subject: [PATCH v2 3/7] HID: asus: fix compiler warning about unused variables Date: Sat, 28 Feb 2026 20:10:06 +0100 Message-ID: <20260228191010.3830758-4-denis.benato@linux.dev> In-Reply-To: <20260228191010.3830758-1-denis.benato@linux.dev> References: <20260228191010.3830758-1-denis.benato@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" In the function asus_has_report_id there are 3 unused variables clang warns about: remove them. Fixes:0919db9f3583 ("HID: asus: always fully initialize devices") Signed-off-by: Denis Benato --- drivers/hid/hid-asus.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c index fbcf38b15290..2b4411399571 100644 --- a/drivers/hid/hid-asus.c +++ b/drivers/hid/hid-asus.c @@ -723,10 +723,9 @@ static void validate_mcu_fw_version(struct hid_device = *hdev, int idProduct) =20 static bool asus_has_report_id(struct hid_device *hdev, u16 report_id) { - int t, f, u, err =3D 0; struct hid_report *report; =20 - for (t =3D HID_INPUT_REPORT; t <=3D HID_FEATURE_REPORT; t++) { + for (int t =3D HID_INPUT_REPORT; t <=3D HID_FEATURE_REPORT; t++) { list_for_each_entry(report, &hdev->report_enum[t].report_list, list) { if (report->id =3D=3D report_id) return true; --=20 2.53.0 From nobody Thu Apr 16 09:12:07 2026 Received: from out-174.mta0.migadu.com (out-174.mta0.migadu.com [91.218.175.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 593313F933E for ; Sat, 28 Feb 2026 19:10:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772305827; cv=none; b=GzakuwscRXdBB/Vx/IWHwbT909puc5pn/zB1ww1AenrXshlvJfssUhixkBI+rDuNx6Wy/yrI+DmZL8Zwl/DComzGXDAGcSaw952eU7nZ0Secr/uYKDlCqaNlrP662BPdQf7858zWtyuuloEuDVrs87okb2loTxAno7z870N5ljI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772305827; c=relaxed/simple; bh=RLfUS5tra/gyyd3lDFT3Jo+sr3I3Gar7nGUgIP4tNNs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XeBbArGI62ClVFfFQSFylZ72RQZaSxwyvSy6U5+EBu7UrAZDPaQ2ktwsT25sEJzbUKyCbEHb+jZp3YYFLu4cR0Lp2Dkgr2ITnF8qd9uAaRpuNHcw83QqsncATfD1HMHEa5ZRvhnEoqmdsRebET5jNhN4Aa2GS6KI7IvzQrIFums= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=fss56nmY; arc=none smtp.client-ip=91.218.175.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="fss56nmY" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1772305825; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0/JjveZr9Jn4MeDPTXiAb+xofPvVBJSGHbnUYefB24Q=; b=fss56nmY0Eu1+BT5YM+hB3ZsFEpfRXr47o9fxNzx+QTYpAMEyup/o6jthnoviVIBJDWqO0 jK1IKfaVdETm0Osq/yK+Cf6X9EKC8gyAYytTPoT4U7vKwV1BzadS+BdRDTgWMn7O2f46RN 0ZVzYtp8z9o5DazNVbstvK+YQwRaXjE= From: Denis Benato To: linux-kernel@vger.kernel.org Cc: linux-input@vger.kernel.org, "Benjamin Tissoires" , "Jiri Kosina" , "Luke D . Jones" , "Mateusz Schyboll" , "Denis Benato" , "Denis Benato" Subject: [PATCH v2 4/7] HID: asus: make asus_resume adhere to linux kernel coding standards Date: Sat, 28 Feb 2026 20:10:07 +0100 Message-ID: <20260228191010.3830758-5-denis.benato@linux.dev> In-Reply-To: <20260228191010.3830758-1-denis.benato@linux.dev> References: <20260228191010.3830758-1-denis.benato@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" Linux kernel coding standars requires functions opening brackets to be in a newline: move the opening bracket of asus_resume in its own line. Fixes: 546edbd26cff ("HID: hid-asus: reset the backlight brightness level o= n resume") Signed-off-by: Denis Benato --- drivers/hid/hid-asus.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c index 2b4411399571..48731b48523d 100644 --- a/drivers/hid/hid-asus.c +++ b/drivers/hid/hid-asus.c @@ -1171,7 +1171,8 @@ static int asus_start_multitouch(struct hid_device *h= dev) return 0; } =20 -static int __maybe_unused asus_resume(struct hid_device *hdev) { +static int __maybe_unused asus_resume(struct hid_device *hdev) +{ struct asus_drvdata *drvdata =3D hid_get_drvdata(hdev); int ret =3D 0; =20 --=20 2.53.0 From nobody Thu Apr 16 09:12:07 2026 Received: from out-171.mta0.migadu.com (out-171.mta0.migadu.com [91.218.175.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1D6D23F934A for ; Sat, 28 Feb 2026 19:10:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772305828; cv=none; b=Cv5wgLxgAVCUBL2jAhQRh+pYWy+7XD+G0FB3SKzvFPHchToKx6Jz//eWwIUGOXQD0/UbUrIPHbbjdRL5xPAG7PXiKB2/djLtp65G6DI3Dc5Eg4up/W77EK4DYMux+zwm8sgG3BewVD7IN2YUgEX6JIVO/jqXo/Z8kQrt2bXrbBI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772305828; c=relaxed/simple; bh=U+az3bT1AYgBcTljnpuWypo+kAStQk3yFB3Djebb93o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sFmvcQbHpLGnn1SrR0aofcNrV83cfMQocIIhhww9zfz4SHZ0RSTGeA7UC/PxY1/jVv4uz7ziWaFyCZ/2BCjB/1tvw2Mq1agcz82kNmKZz6tmthmlL4tnX+OLp5gsKX3MAH5l4EBU171AZzk6UfG2pkzdNfSypwSIsYmhHPYzsS8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=SVusoXwa; arc=none smtp.client-ip=91.218.175.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="SVusoXwa" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1772305825; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fvEOHLWvDNrnFXRyl44q9Fr3axr6UKIlXV2yTXMFFwo=; b=SVusoXwa/Vc+4kgl5UFccHQT6/9TLgxEfWG7hQ/KR7+3SvUj1hZE8Cc8Zy538Sk3M6Q9Dy baAcPKJrYlHIsjhqqfTJzMlimqrMqPABIlf6xyZj7JY0FrudjPqaRKfwGoerO2dM/ytu19 1KJGFglW0IIkiCdZfhbUOpQsKz3Bbgs= From: Denis Benato To: linux-kernel@vger.kernel.org Cc: linux-input@vger.kernel.org, "Benjamin Tissoires" , "Jiri Kosina" , "Luke D . Jones" , "Mateusz Schyboll" , "Denis Benato" , "Denis Benato" Subject: [PATCH v2 5/7] HID: asus: simplify and improve asus_kbd_set_report() Date: Sat, 28 Feb 2026 20:10:08 +0100 Message-ID: <20260228191010.3830758-6-denis.benato@linux.dev> In-Reply-To: <20260228191010.3830758-1-denis.benato@linux.dev> References: <20260228191010.3830758-1-denis.benato@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" Make the function shorter and easier to read using __free, and also fix a misaligned comment closing tag. The __free macro from cleanup.h is already used in the driver, but its include is missing: add it. Signed-off-by: Denis Benato --- drivers/hid/hid-asus.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c index 48731b48523d..4fa8e72c6855 100644 --- a/drivers/hid/hid-asus.c +++ b/drivers/hid/hid-asus.c @@ -21,6 +21,7 @@ */ =20 #include +#include #include #include #include @@ -464,23 +465,16 @@ static int asus_raw_event(struct hid_device *hdev, =20 static int asus_kbd_set_report(struct hid_device *hdev, const u8 *buf, siz= e_t buf_size) { - unsigned char *dmabuf; - int ret; - - dmabuf =3D kmemdup(buf, buf_size, GFP_KERNEL); + u8 *dmabuf __free(kfree) =3D kmemdup(buf, buf_size, GFP_KERNEL); if (!dmabuf) return -ENOMEM; =20 /* * The report ID should be set from the incoming buffer due to LED and key * interfaces having different pages - */ - ret =3D hid_hw_raw_request(hdev, buf[0], dmabuf, - buf_size, HID_FEATURE_REPORT, - HID_REQ_SET_REPORT); - kfree(dmabuf); - - return ret; + */ + return hid_hw_raw_request(hdev, buf[0], dmabuf, buf_size, HID_FEATURE_REP= ORT, + HID_REQ_SET_REPORT); } =20 static int asus_kbd_init(struct hid_device *hdev, u8 report_id) --=20 2.53.0 From nobody Thu Apr 16 09:12:07 2026 Received: from out-178.mta0.migadu.com (out-178.mta0.migadu.com [91.218.175.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5E6433F9AB2 for ; Sat, 28 Feb 2026 19:10:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.178 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772305829; cv=none; b=Et4iuW4MkIqAxuloqHejHEMVFFyVn8tPXjE6ZiW5P2QVLWIPpMtQN9uji4h6h7hacB6t50/elj6zbwj1gyIR2W1Zum+YcHXnx4jcnF4P2/gyrTgsEv+8FWA5IVNlqjCqRBxYJyF0HCR6jXCSDoI/0F8Q1WeA5oD7TxRoEb4gnYI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772305829; c=relaxed/simple; bh=ahbdmih7WQ0iTC46oVpFlRhVysCbDuhJxLFvU0ArxBg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eRm9GhEMxkne7WqB8pq51cMzAUApYaRVRo/c9b6abF7AeLZa9KbQZkuh1LHu+kEJQ74HgSvGnc2mOql4KKUknMHWi8j2WBOzU2U2mvJpDKgcml9NlAWpKMdulORgCOSHuaGpl1aopRLFjWlisSc0nUxVIhtS2D+Zu9A3Biyc1gY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=tiP5O7oC; arc=none smtp.client-ip=91.218.175.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="tiP5O7oC" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1772305826; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1stq13byh5E4uEMWZJeQMnQj/VCCrTTUyF6+AOc0Hyc=; b=tiP5O7oCvLJIr3J+H24Yb0BWjcIR4SlXluOqY1p2XMgkqUyp4F05tGSqfu+2KXlob9uZbi rnnvjLInVJ3kUxjdKoGMA46LWjhc8vFp4JtIYEtASSzqQEwVi8Kd03RvCHWLOxo/OtdozB LXml4ZfJ3jaMFHyQDItkySbxVYMrIqc= From: Denis Benato To: linux-kernel@vger.kernel.org Cc: linux-input@vger.kernel.org, "Benjamin Tissoires" , "Jiri Kosina" , "Luke D . Jones" , "Mateusz Schyboll" , "Denis Benato" , "Denis Benato" Subject: [PATCH v2 6/7] HID: asus: do not abort probe when not necessary Date: Sat, 28 Feb 2026 20:10:09 +0100 Message-ID: <20260228191010.3830758-7-denis.benato@linux.dev> In-Reply-To: <20260228191010.3830758-1-denis.benato@linux.dev> References: <20260228191010.3830758-1-denis.benato@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" In order to avoid dereferencing a NULL pointer asus_probe is aborted early and control of some asus devices is transferred over hid-generic after erroring out even when such NULL dereference cannot happen: only early abort when the NULL dereference can happen. Also make the code shorter and more adherent to coding standards removing square brackets enclosing single-line if-else statements. Fixes: d3af6ca9a8c3 ("HID: asus: fix UAF via HID_CLAIMED_INPUT validation") Signed-off-by: Denis Benato --- drivers/hid/hid-asus.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c index 4fa8e72c6855..5780e70aebd5 100644 --- a/drivers/hid/hid-asus.c +++ b/drivers/hid/hid-asus.c @@ -1323,22 +1323,17 @@ static int asus_probe(struct hid_device *hdev, cons= t struct hid_device_id *id) * were freed during registration due to no usages being mapped, * leaving drvdata->input pointing to freed memory. */ - if (!drvdata->input || !(hdev->claimed & HID_CLAIMED_INPUT)) { - hid_err(hdev, "Asus input not registered\n"); - ret =3D -ENOMEM; - goto err_stop_hw; - } - - if (drvdata->tp) { - drvdata->input->name =3D "Asus TouchPad"; - } else { - drvdata->input->name =3D "Asus Keyboard"; - } + if (drvdata->input && (hdev->claimed & HID_CLAIMED_INPUT)) { + if (drvdata->tp) + drvdata->input->name =3D "Asus TouchPad"; + else + drvdata->input->name =3D "Asus Keyboard"; =20 - if (drvdata->tp) { - ret =3D asus_start_multitouch(hdev); - if (ret) - goto err_stop_hw; + if (drvdata->tp) { + ret =3D asus_start_multitouch(hdev); + if (ret) + goto err_stop_hw; + } } =20 return 0; --=20 2.53.0 From nobody Thu Apr 16 09:12:07 2026 Received: from out-171.mta0.migadu.com (out-171.mta0.migadu.com [91.218.175.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6871C3F9AB5 for ; Sat, 28 Feb 2026 19:10:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772305829; cv=none; b=WiO4qNiQrWVnydkAdYfGlAOK3FoVVX4n4vHr8WEC5phlZVJZWr2JY3WLlbk707BPKEU2VCZPrYwuqoCJKmNGJd8ozc1HbaPCO2b4D+OUjdCGMmvpusbzGhRARN36gRBciT4z1Hro/w+zS7Xcc/zNxA9pKBgNK4zTq/LcZXQg91c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772305829; c=relaxed/simple; bh=+hO6iQf23aDHJWjlmmPPmW0kYzSr2lluvlArNaY6iJQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VOhjNvmTWNK193sslVvL5+xAvhS3vhwxqyv6dqCNXClMoeYQ4haFL/8O8/D8TZAh32YNGhIHuIyVEYMfAS9ybbFg7wqFWMmVKXnVaz4v/6oSzfA7qbxqF5aJl2gt3OuimEvI7rBMonmIAlebzz6sy4Bvu5KA3d8w42zO+Chf9sA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=r7eXozvH; arc=none smtp.client-ip=91.218.175.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="r7eXozvH" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1772305827; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hK9pvyiMFiVuWdo7FDW6CctiOnWHX4mo/tf9t+wwwNk=; b=r7eXozvHQ32tE5sARGteH4/yX20HjUb5quDUCkbpSTmnNIWIbc/wdRAmf+GRWjBe3hd6Es 3O+qQ6jBhkrPARTvqYmx14iYfvGkTf3WQY283BxbkeXBnNvx3PpY9m0wydz6wBozIg+Kf9 e+wIoVq3niYw/ZrfwR4WtJHrLpew+xY= From: Denis Benato To: linux-kernel@vger.kernel.org Cc: linux-input@vger.kernel.org, "Benjamin Tissoires" , "Jiri Kosina" , "Luke D . Jones" , "Mateusz Schyboll" , "Denis Benato" , "Denis Benato" Subject: [PATCH v2 7/7] HID: asus: do not try to initialize the backlight if the enpoint doesn't support it Date: Sat, 28 Feb 2026 20:10:10 +0100 Message-ID: <20260228191010.3830758-8-denis.benato@linux.dev> In-Reply-To: <20260228191010.3830758-1-denis.benato@linux.dev> References: <20260228191010.3830758-1-denis.benato@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" Avoid possibly printing a warning about the inability to initialize the backlight if the hid endpoint doesn't support it. Also fix and move an incorrect check in asus_kbd_register_leds(): that same check is now used as a precondition to call that function. Fixes: 0919db9f3583 ("HID: asus: always fully initialize devices") Signed-off-by: Denis Benato --- drivers/hid/hid-asus.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c index 5780e70aebd5..9291f23c10b7 100644 --- a/drivers/hid/hid-asus.c +++ b/drivers/hid/hid-asus.c @@ -737,10 +737,6 @@ static int asus_kbd_register_leds(struct hid_device *h= dev) unsigned char kbd_func; int ret; =20 - /* Laptops keyboard backlight is always at 0x5a */ - if (asus_has_report_id(hdev, FEATURE_KBD_REPORT_ID)) - return -ENODEV; - /* Get keyboard functions */ ret =3D asus_kbd_get_functions(hdev, &kbd_func, FEATURE_KBD_REPORT_ID); if (ret < 0) @@ -1306,8 +1302,10 @@ static int asus_probe(struct hid_device *hdev, const= struct hid_device_id *id) } } =20 + /* Laptops keyboard backlight is always at 0x5a */ if (is_vendor && (drvdata->quirks & QUIRK_USE_KBD_BACKLIGHT) && - asus_kbd_register_leds(hdev)) + (asus_has_report_id(hdev, FEATURE_KBD_REPORT_ID)) && + (asus_kbd_register_leds(hdev))) hid_warn(hdev, "Failed to initialize backlight.\n"); =20 /* --=20 2.53.0