platform/x86: intel-hid: fix _DSM function index handling
authorZhen Gong <zhengong@usc.edu>
Sun, 8 Nov 2020 09:23:19 +0000 (01:23 -0800)
committerHans de Goede <hdegoede@redhat.com>
Mon, 9 Nov 2020 14:16:30 +0000 (15:16 +0100)
commit97ab4516205eedde0b6565e47175d825b88d6759
tree4f111e1d32f22b7832a8c1d661e8285eae4b0ce3
parent3be3955315bdf7e4511514a520a76675a23e86e6
platform/x86: intel-hid: fix _DSM function index handling

According to the ACPI spec 9.1.1 _DSM (Device Specific Method),
intel_hid_dsm_fn_mask, acquired from function index 0, is "a buffer
containing one bit for each function index". When validitaing fn_index,
it should be compared with corresponding bit.

This buffer is usually longer than a byte. Depending on whether
INTEL_HID_DSM_HEBC_V2_FN exist, it could be either
"Buffer (0x02) { 0xFF, 0x01 }" or "Buffer (0x02) { 0xFF, 0x03 }".
Probably it won't grow larger according to the description. On older
platforms, available functions could be fewer or not supported at all,
i.e., "Buffer (One) { 0x00 }".

Signed-off-by: Zhen Gong <zhengong@usc.edu>
Link: https://lore.kernel.org/r/CAJCLVRCyp0ASdWTx-PxsrDC9zFBPw0U2AtPip+_Hpj2r5gUPwA@mail.gmail.com
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
drivers/platform/x86/intel-hid.c