From patchwork Mon Jul 1 12:39:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Tissoires X-Patchwork-Id: 13718019 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 6FFC4158DC1; Mon, 1 Jul 2024 12:40:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719837608; cv=none; b=Xyx78ZzIbH0GH5wo1MplGw9x2EvoZdJqTqZLLlDrRH/zGqRuC0vzwjeHoTMbfhm8chXyehnvpZkvWOlC0Oh2wqkWFnHzJWXFHhhKb77y96qyy9h0IBPE0lRfK24/jcF1orV5XrjISt4x1J86Nm3xI0ZFNyu1YeQnWsB+bkVdn5Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719837608; c=relaxed/simple; bh=wUTkvXyhHibZnDuwGG5f5DWJ6ZMD2AeiGWNMkuFtnos=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=HMwdY810iHCCHfgKyqnETJLzS4u52/eZPInqdfiLJFwXKevGQh2eBDkNfJwrfaSM05OONMNoPsMy4SKyCyKK8i77rdSPMItDPnL8hsvcpKKm6P0NXUviXvVSbYSH2e7jNvO5Rcxi3nK2OmFzSe7Eu9j08uJu/0eij0p8g/3O6MY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gwsNN4RE; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="gwsNN4RE" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 94312C2BD10; Mon, 1 Jul 2024 12:40:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1719837608; bh=wUTkvXyhHibZnDuwGG5f5DWJ6ZMD2AeiGWNMkuFtnos=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=gwsNN4RE3fVi5nraG6juGC/GU5lGq5v8b8WgcpiYvgwzR7ETQvwIEepI6sLeiE548 t+q5GByqu3CWlxbTjEVbQvGGFwukpQ/otyzhMG7qlzZC5fA3MzlwRTPzKJ+lGnDotU u90o/3So0XJHN+s93L5V1jwElv0qEmV0jCMNhI9u+3OqW5zuEOnzfiV5QGdwPnXziF 7adP+MtjpixMGXgxQ2P+xDac1uiJtZubcHrObZNE3tFZJBAyBBO+QzYLRHssqyVucb 4khIfVAXVXHgkVVUdaghtWHgW96h6vHsbSMqNFbhkooEVl+FUSZYWV5JNvC+KeQZXx hpsnLjLRZS8HA== From: Benjamin Tissoires Date: Mon, 01 Jul 2024 14:39:49 +0200 Subject: [PATCH v2 1/4] selftests/hid: ensure CKI can compile our new tests on old kernels Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240701-fix-cki-v2-1-20564e2e1393@kernel.org> References: <20240701-fix-cki-v2-0-20564e2e1393@kernel.org> In-Reply-To: <20240701-fix-cki-v2-0-20564e2e1393@kernel.org> To: Jiri Kosina , Shuah Khan Cc: linux-input@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Benjamin Tissoires , kernel test robot X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1719837604; l=2168; i=bentiss@kernel.org; s=20230215; h=from:subject:message-id; bh=wUTkvXyhHibZnDuwGG5f5DWJ6ZMD2AeiGWNMkuFtnos=; b=HQnDH2nfTSNV7IEghujL2e56X8WREttd1ik4zF7a5pVjq+sQyu80g/utFKVTf4M1WYqw6jh9o x7wTP+gGa3pAIjcSIaBK8cjU/tMAqktE6PpOFI9IPNTSVh3wiKcWLE4 X-Developer-Key: i=bentiss@kernel.org; a=ed25519; pk=7D1DyAVh6ajCkuUTudt/chMuXWIJHlv2qCsRkIizvFw= In the same way than commit ae7487d112cf ("selftests/hid: ensure we can compile the tests on kernels pre-6.3") we should expose struct hid_bpf_ops when it's not available in vmlinux.h. So unexpose an eventual struct hid_bpf_ops, include vmlinux.h, and re-export struct hid_bpf_ops. Fixes: d7696738d66b ("selftests/hid: convert the hid_bpf selftests with struct_ops") Reported-by: kernel test robot Closes: https://lore.kernel.org/r/202406270328.bscLN1IF-lkp@intel.com/ Signed-off-by: Benjamin Tissoires --- tools/testing/selftests/hid/progs/hid_bpf_helpers.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tools/testing/selftests/hid/progs/hid_bpf_helpers.h b/tools/testing/selftests/hid/progs/hid_bpf_helpers.h index c72e44321764..cfe37f491906 100644 --- a/tools/testing/selftests/hid/progs/hid_bpf_helpers.h +++ b/tools/testing/selftests/hid/progs/hid_bpf_helpers.h @@ -7,6 +7,7 @@ /* "undefine" structs and enums in vmlinux.h, because we "override" them below */ #define hid_bpf_ctx hid_bpf_ctx___not_used +#define hid_bpf_ops hid_bpf_ops___not_used #define hid_report_type hid_report_type___not_used #define hid_class_request hid_class_request___not_used #define hid_bpf_attach_flags hid_bpf_attach_flags___not_used @@ -24,6 +25,7 @@ #include "vmlinux.h" #undef hid_bpf_ctx +#undef hid_bpf_ops #undef hid_report_type #undef hid_class_request #undef hid_bpf_attach_flags @@ -68,6 +70,20 @@ enum hid_class_request { HID_REQ_SET_PROTOCOL = 0x0B, }; +struct hid_bpf_ops { + int hid_id; + u32 flags; + struct list_head list; + int (*hid_device_event)(struct hid_bpf_ctx *ctx, enum hid_report_type report_type, + u64 source); + int (*hid_rdesc_fixup)(struct hid_bpf_ctx *ctx); + int (*hid_hw_request)(struct hid_bpf_ctx *ctx, unsigned char reportnum, + enum hid_report_type rtype, enum hid_class_request reqtype, + u64 source); + int (*hid_hw_output_report)(struct hid_bpf_ctx *ctx, u64 source); + struct hid_device *hdev; +}; + #ifndef BPF_F_BEFORE #define BPF_F_BEFORE (1U << 3) #endif From patchwork Mon Jul 1 12:39:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Tissoires X-Patchwork-Id: 13718020 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 42050159565; Mon, 1 Jul 2024 12:40:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719837610; cv=none; b=VgDDqOCiUfYffDRMjcQ6aqg6B+gK/GBTpbb8eKPHPB167MzPsGlMpGSnw7WV63OOlhPGxj/Tvt7v1HR7/BBPM9z4U0rH0JeEsa8J5Xs8b+LlUtbMl7itCIWZJF/A5/n06R1hImuaLrn1df0akfJ0xffWoeMRSX//FjG+OnjHzsI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719837610; c=relaxed/simple; bh=iOxhyuU9QfzIG4uPwnRgWtiT/F3Zt8W9e7IATvEoCU4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=WrMCNy4OgXM0XXqmtwXZ+Tx603mV2PnX25MaA3N+5E+8TuhgbfJLeJT/11Q5YSdqSfkytZLk83H+bje7HjYv6iiDBJbYFDq4OCymhz4ePwvmYlYmTUCNnAo66qFc0wtujkS0Bt/272L6yvlTjppduEBRm2Cx7j9Z05wqIL73tpg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=A+fjQr7I; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="A+fjQr7I" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 66301C32786; Mon, 1 Jul 2024 12:40:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1719837610; bh=iOxhyuU9QfzIG4uPwnRgWtiT/F3Zt8W9e7IATvEoCU4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=A+fjQr7Ii+Yt7clCrrB/+9ySa71DHLF4PrtaBEIsTL1jXczGOEPLn9C1bHeePHP8A moniVQlOaZSlGOgdD9f/0OgK6GC6VXvocWLMaPMEaZWzan5r5UIIH2kPI0Bica1Qb9 LnQFLyrbHXtESYYEiQCRr0GX0e2ey5l/TZ2bcM9NV9mm4Iut021JpT2N8UTFdfGRsz Px9SRJkjpIs94IQleo6ZrTAC/ml5F8t1DG94fGpqwTbPoOv5ZHUqHew0PM4lZlB9z4 CkGpQKDsuhKaIA21pulq6FX0szr14Vhsv5o4f8kWPr8ifWT5clZroWPuuHn7FJIa4L RKXMoq6rOC6hw== From: Benjamin Tissoires Date: Mon, 01 Jul 2024 14:39:50 +0200 Subject: [PATCH v2 2/4] HID: bpf: fix gcc warning and unify __u64 into u64 Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240701-fix-cki-v2-2-20564e2e1393@kernel.org> References: <20240701-fix-cki-v2-0-20564e2e1393@kernel.org> In-Reply-To: <20240701-fix-cki-v2-0-20564e2e1393@kernel.org> To: Jiri Kosina , Shuah Khan Cc: linux-input@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Benjamin Tissoires , Stephen Rothwell , kernel test robot , Mirsad Todorovac X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1719837604; l=6307; i=bentiss@kernel.org; s=20230215; h=from:subject:message-id; bh=iOxhyuU9QfzIG4uPwnRgWtiT/F3Zt8W9e7IATvEoCU4=; b=7ro7EdXJyjokBu4HziFpwoHVqZNkoTI43I9nfeVLyNTbbyuDvypzw1CcQmu3/UidI4nZ4hUOv ekqdrpDiSccDBnxhJAYMNid2UOORbKMy64jnvGymE8rjO9p46TT5aw/ X-Developer-Key: i=bentiss@kernel.org; a=ed25519; pk=7D1DyAVh6ajCkuUTudt/chMuXWIJHlv2qCsRkIizvFw= I've got multiple reports of: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]. Let's use the same trick than kernel/bpf/helpers.c to shut up that warning. Even if we were on an architecture with addresses on more than 64 bits, this isn't much of an issue as the address is not used as a pointer, but as an hash and the caller is not supposed to go back to the kernel address ever. And while we change those, make sure we use u64 instead of __u64 for consistency Reported-by: Stephen Rothwell Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202406280633.OPB5uIFj-lkp@intel.com/ Closes: https://lore.kernel.org/oe-kbuild-all/202406282304.UydSVncq-lkp@intel.com/ Closes: https://lore.kernel.org/oe-kbuild-all/202406282242.Fk738zzy-lkp@intel.com/ Reported-by: Mirsad Todorovac Fixes: 67eccf151d76 ("HID: add source argument to HID low level functions") Signed-off-by: Benjamin Tissoires --- drivers/hid/bpf/hid_bpf_dispatch.c | 6 +++--- drivers/hid/bpf/hid_bpf_struct_ops.c | 2 +- drivers/hid/hid-core.c | 4 ++-- drivers/hid/hidraw.c | 6 +++--- include/linux/hid_bpf.h | 6 +++--- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/hid/bpf/hid_bpf_dispatch.c b/drivers/hid/bpf/hid_bpf_dispatch.c index 23daf94510bb..a36e680399fe 100644 --- a/drivers/hid/bpf/hid_bpf_dispatch.c +++ b/drivers/hid/bpf/hid_bpf_dispatch.c @@ -440,7 +440,7 @@ hid_bpf_hw_request(struct hid_bpf_ctx *ctx, __u8 *buf, size_t buf__sz, size, rtype, reqtype, - (__u64)ctx, + (u64)(long)ctx, true); /* prevent infinite recursions */ if (ret > 0) @@ -483,7 +483,7 @@ hid_bpf_hw_output_report(struct hid_bpf_ctx *ctx, __u8 *buf, size_t buf__sz) if (!dma_data) return -ENOMEM; - ret = hid_ops->hid_hw_output_report(hdev, dma_data, size, (__u64)ctx, true); + ret = hid_ops->hid_hw_output_report(hdev, dma_data, size, (u64)(long)ctx, true); kfree(dma_data); return ret; @@ -505,7 +505,7 @@ __hid_bpf_input_report(struct hid_bpf_ctx *ctx, enum hid_report_type type, u8 *b if (ret) return ret; - return hid_ops->hid_input_report(ctx->hid, type, buf, size, 0, (__u64)ctx, true, + return hid_ops->hid_input_report(ctx->hid, type, buf, size, 0, (u64)(long)ctx, true, lock_already_taken); } diff --git a/drivers/hid/bpf/hid_bpf_struct_ops.c b/drivers/hid/bpf/hid_bpf_struct_ops.c index 37d2f8e2413a..b03b44ad3458 100644 --- a/drivers/hid/bpf/hid_bpf_struct_ops.c +++ b/drivers/hid/bpf/hid_bpf_struct_ops.c @@ -261,7 +261,7 @@ static void hid_bpf_unreg(void *kdata) hid_put_device(hdev); } -static int __hid_bpf_device_event(struct hid_bpf_ctx *ctx, enum hid_report_type type, __u64 source) +static int __hid_bpf_device_event(struct hid_bpf_ctx *ctx, enum hid_report_type type, u64 source) { return 0; } diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 52a75afe3e7d..0f797dab975b 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c @@ -2412,7 +2412,7 @@ int __hid_hw_raw_request(struct hid_device *hdev, unsigned char reportnum, __u8 *buf, size_t len, enum hid_report_type rtype, enum hid_class_request reqtype, - __u64 source, bool from_bpf) + u64 source, bool from_bpf) { unsigned int max_buffer_size = HID_MAX_BUFFER_SIZE; int ret; @@ -2454,7 +2454,7 @@ int hid_hw_raw_request(struct hid_device *hdev, } EXPORT_SYMBOL_GPL(hid_hw_raw_request); -int __hid_hw_output_report(struct hid_device *hdev, __u8 *buf, size_t len, __u64 source, +int __hid_hw_output_report(struct hid_device *hdev, __u8 *buf, size_t len, u64 source, bool from_bpf) { unsigned int max_buffer_size = HID_MAX_BUFFER_SIZE; diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c index c2396916cdaa..716294e40e8a 100644 --- a/drivers/hid/hidraw.c +++ b/drivers/hid/hidraw.c @@ -140,7 +140,7 @@ static ssize_t hidraw_send_report(struct file *file, const char __user *buffer, if ((report_type == HID_OUTPUT_REPORT) && !(dev->quirks & HID_QUIRK_NO_OUTPUT_REPORTS_ON_INTR_EP)) { - ret = __hid_hw_output_report(dev, buf, count, (__u64)file, false); + ret = __hid_hw_output_report(dev, buf, count, (u64)(long)file, false); /* * compatibility with old implementation of USB-HID and I2C-HID: * if the device does not support receiving output reports, @@ -151,7 +151,7 @@ static ssize_t hidraw_send_report(struct file *file, const char __user *buffer, } ret = __hid_hw_raw_request(dev, buf[0], buf, count, report_type, - HID_REQ_SET_REPORT, (__u64)file, false); + HID_REQ_SET_REPORT, (u64)(long)file, false); out_free: kfree(buf); @@ -228,7 +228,7 @@ static ssize_t hidraw_get_report(struct file *file, char __user *buffer, size_t } ret = __hid_hw_raw_request(dev, report_number, buf, count, report_type, - HID_REQ_GET_REPORT, (__u64)file, false); + HID_REQ_GET_REPORT, (u64)(long)file, false); if (ret < 0) goto out_free; diff --git a/include/linux/hid_bpf.h b/include/linux/hid_bpf.h index 93546ee7677a..3f6584014311 100644 --- a/include/linux/hid_bpf.h +++ b/include/linux/hid_bpf.h @@ -68,9 +68,9 @@ struct hid_ops { unsigned char reportnum, __u8 *buf, size_t len, enum hid_report_type rtype, enum hid_class_request reqtype, - __u64 source, bool from_bpf); + u64 source, bool from_bpf); int (*hid_hw_output_report)(struct hid_device *hdev, __u8 *buf, size_t len, - __u64 source, bool from_bpf); + u64 source, bool from_bpf); int (*hid_input_report)(struct hid_device *hid, enum hid_report_type type, u8 *data, u32 size, int interrupt, u64 source, bool from_bpf, bool lock_already_taken); @@ -115,7 +115,7 @@ struct hid_bpf_ops { * Context: Interrupt context. */ int (*hid_device_event)(struct hid_bpf_ctx *ctx, enum hid_report_type report_type, - __u64 source); + u64 source); /** * @hid_rdesc_fixup: called when the probe function parses the report descriptor From patchwork Mon Jul 1 12:39:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Tissoires X-Patchwork-Id: 13718021 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 530CD15A845; Mon, 1 Jul 2024 12:40:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719837612; cv=none; b=fYsm8H4Rd2wCfZi4bbipp8oDC9Z2U0dSg8hFFWhvNgIGn3BC+eSUI+fdp20psQZwxUrxtruZbj9B9rJHhoy9jF01MHpS7GWW860+Oeni9h406ryUPpBk6XTgyxAqiMpnzhUqtbQTim4+pOzLxAPgjV/l72mS9zB1xjRqr9N4xdw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719837612; c=relaxed/simple; bh=dsmN/zf/YtgP2EykpUG92Zxz2PvaV7++5taqu/0esKk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=hPIGoWW9ls4fvi8cYF9dQsXSmLUyKp8cxIXYA5EgVUjeoivuZqfAszgKVNWYdXRE9+gio96MC4O0eTDz2BbwlF1QjwTPF5skV4Pe4CuqzBjW2FLPKwgtIZqvijEWioer8iqDyMhc2KzyeW3IK+SCp0p0ZXIGX0g1NN+TvFAq3g0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=dGNrnIkP; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="dGNrnIkP" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8DBC8C4AF0F; Mon, 1 Jul 2024 12:40:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1719837611; bh=dsmN/zf/YtgP2EykpUG92Zxz2PvaV7++5taqu/0esKk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=dGNrnIkPj+/IK8wTGxsaidn1XFnNmcMSzDgZBXA7c7gkgiO1TyyeHNsyCEOSs8+zW kTgASKZMsxKV+94gNNv3yDDEC3i3d4RJlP+Ce2DSf1v70vlFYJtQpWETJsEikVGI6S cGtJsSU8tH9OnxDBDmbuqbvu6d/5SXI7+wVfQsVNQm1LxaJJcQf7ihDGmr/dmIBkZt SY2qBhKt0qVIQ1K4sDAQWZduVWu7lzAZ8VCFV3mzy5nclDImP0wEtxg4mH9wziDeiK b09VqO7fYiSOI7jrnLwvv4cbzVboUw5WYdYXuYMG+Uj63D321a4o+WWnHDWvNtZCDq nvZnseSmaw86g== From: Benjamin Tissoires Date: Mon, 01 Jul 2024 14:39:51 +0200 Subject: [PATCH v2 3/4] HID: bpf: doc fixes for hid_hw_request() hooks Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240701-fix-cki-v2-3-20564e2e1393@kernel.org> References: <20240701-fix-cki-v2-0-20564e2e1393@kernel.org> In-Reply-To: <20240701-fix-cki-v2-0-20564e2e1393@kernel.org> To: Jiri Kosina , Shuah Khan Cc: linux-input@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Benjamin Tissoires , Stephen Rothwell X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1719837604; l=2053; i=bentiss@kernel.org; s=20230215; h=from:subject:message-id; bh=dsmN/zf/YtgP2EykpUG92Zxz2PvaV7++5taqu/0esKk=; b=0mGPyuS8+OZXWy1HD+cL3nkge80bCLhcWj+DlxBoX7NNSyFmpOqCiwbMBNFYs2WwZraTNQaAa WrAxPZH3Z3FCseMbIFcCqOJeFRdO72g6UbI1bQ5E7HO9EveogRQMLQX X-Developer-Key: i=bentiss@kernel.org; a=ed25519; pk=7D1DyAVh6ajCkuUTudt/chMuXWIJHlv2qCsRkIizvFw= We had the following errors while doing make htmldocs: Documentation/hid/hid-bpf:185: include/linux/hid_bpf.h:144: ERROR: Unexpected indentation. Documentation/hid/hid-bpf:185: include/linux/hid_bpf.h:145: WARNING: Block quote ends without a blank line; unexpected unindent. Documentation/hid/hid-bpf:185: include/linux/hid_bpf.h:147: ERROR: Unexpected indentation. Reported-by: Stephen Rothwell Fixes: 8bd0488b5ea5 ("HID: bpf: add HID-BPF hooks for hid_hw_raw_requests") Signed-off-by: Benjamin Tissoires --- include/linux/hid_bpf.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/include/linux/hid_bpf.h b/include/linux/hid_bpf.h index 3f6584014311..c30c31b79419 100644 --- a/include/linux/hid_bpf.h +++ b/include/linux/hid_bpf.h @@ -139,12 +139,15 @@ struct hid_bpf_ops { * * ``ctx``: The HID-BPF context as &struct hid_bpf_ctx * ``reportnum``: the report number, as in hid_hw_raw_request() + * * ``rtype``: the report type (``HID_INPUT_REPORT``, ``HID_FEATURE_REPORT``, - * ``HID_OUTPUT_REPORT``) + * ``HID_OUTPUT_REPORT``) + * * ``reqtype``: the request + * * ``source``: a u64 referring to a uniq but identifiable source. If %0, the - * kernel itself emitted that call. For hidraw, ``source`` is set - * to the associated ``struct file *``. + * kernel itself emitted that call. For hidraw, ``source`` is set + * to the associated ``struct file *``. * * Return: %0 to keep processing the request by hid-core; any other value * stops hid-core from processing that event. A positive value should be @@ -153,7 +156,7 @@ struct hid_bpf_ops { */ int (*hid_hw_request)(struct hid_bpf_ctx *ctx, unsigned char reportnum, enum hid_report_type rtype, enum hid_class_request reqtype, - __u64 source); + u64 source); /** * @hid_hw_output_report: called whenever a hid_hw_output_report() call is emitted From patchwork Mon Jul 1 12:39:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Tissoires X-Patchwork-Id: 13718022 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 24DB915A87C; Mon, 1 Jul 2024 12:40:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719837614; cv=none; b=bEysZRbod8lT5E1tEkyYYmluoimmF+/xA4h1Oc4yyTQPDmnh7o71IroPp+zPIdHjwKk/Wmfx3eeKhMgagjdKRrnQJDMtbuMS7SZJpyZOLTNQaTLu36fFmvbleC2gt5AhG0fR6fVsBtCT+wupJdZvJUToJ9S/Pmb8jI/poe8Ilig= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719837614; c=relaxed/simple; bh=d7yH9YfAsU8Sr3Uu3uIuiYCXGouIBOJuEfxMH6XTfb0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=u9rA+pabUEX/8PtZu6Qw5OpWxtq1vgRJOeTRlXcPFK7uoRRXk54W3U7MWgxaLdhvKtsVOcnD5T2r3iDcUzxOLcU8CxcFaR3K7vdnTqXfHRpOdgpKVkFl2mInkp19M0gOz02U5SWVn+0RtsM3ZVI3Xlzpyj1eVewx3T/L2OIHPwM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=OxVssHLs; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="OxVssHLs" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5F6BFC2BD10; Mon, 1 Jul 2024 12:40:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1719837613; bh=d7yH9YfAsU8Sr3Uu3uIuiYCXGouIBOJuEfxMH6XTfb0=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=OxVssHLsOOJFr4MH5RlMpbyjO/kIYmyjM4THraM6JKXAHLo5b9Nx+4MqnXSpYh4qf jsBF+XQapwHA9P+hBo29hlQrkPZlPN4iiuVJFkmtqUKOdXpH0ru5cApTiGv9hZrZC9 HMY76uW/iSO8NTrKTE/DSGFQ3CcgBP+uO6KGZEP+cKbB1LjiOiXonnxn3vJqQTBXm5 T6WSOuqEOBKNa4fnZhBVubWFo3b+nzjG4UGDPBsOxrxZZe3n17OvrV6ZjGjlIO5BTI IaGnOkVtLNDNO2tBPOz0uzBIxQcLJQqNgjXgTSJY2zg8WcBeri6eRZ+O2dAyJMYmQ0 MRnCrNN1/lCkg== From: Benjamin Tissoires Date: Mon, 01 Jul 2024 14:39:52 +0200 Subject: [PATCH v2 4/4] HID: bpf: doc fixes for hid_hw_request() hooks Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240701-fix-cki-v2-4-20564e2e1393@kernel.org> References: <20240701-fix-cki-v2-0-20564e2e1393@kernel.org> In-Reply-To: <20240701-fix-cki-v2-0-20564e2e1393@kernel.org> To: Jiri Kosina , Shuah Khan Cc: linux-input@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Benjamin Tissoires , Stephen Rothwell X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1719837604; l=3801; i=bentiss@kernel.org; s=20230215; h=from:subject:message-id; bh=d7yH9YfAsU8Sr3Uu3uIuiYCXGouIBOJuEfxMH6XTfb0=; b=lRVwyNBjOsfEBiiJ7w+xL007jid0rN15OF9+h9R5Zm5GHE/IgWBsYSaY+iq4VfC0o3D6EvH9u 4L0zR1wYq3wBN4Kof28tK6Gp81Z0IZICq9vY06Pwdggu5CyKO1rP5wz X-Developer-Key: i=bentiss@kernel.org; a=ed25519; pk=7D1DyAVh6ajCkuUTudt/chMuXWIJHlv2qCsRkIizvFw= We had the following errors while doing make htmldocs: Documentation/hid/hid-bpf:185: include/linux/hid_bpf.h:167: ERROR: Unexpected indentation. Also ensure consistency with the rest of the __u64 vs u64. Reported-by: Stephen Rothwell Fixes: 9286675a2aed ("HID: bpf: add HID-BPF hooks for hid_hw_output_report") Signed-off-by: Benjamin Tissoires --- drivers/hid/bpf/hid_bpf_dispatch.c | 2 +- include/linux/hid_bpf.h | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/hid/bpf/hid_bpf_dispatch.c b/drivers/hid/bpf/hid_bpf_dispatch.c index a36e680399fe..a272a086c950 100644 --- a/drivers/hid/bpf/hid_bpf_dispatch.c +++ b/drivers/hid/bpf/hid_bpf_dispatch.c @@ -115,7 +115,7 @@ int dispatch_hid_bpf_raw_requests(struct hid_device *hdev, EXPORT_SYMBOL_GPL(dispatch_hid_bpf_raw_requests); int dispatch_hid_bpf_output_report(struct hid_device *hdev, - __u8 *buf, u32 size, __u64 source, + __u8 *buf, u32 size, u64 source, bool from_bpf) { struct hid_bpf_ctx_kern ctx_kern = { diff --git a/include/linux/hid_bpf.h b/include/linux/hid_bpf.h index c30c31b79419..9ca96fc90449 100644 --- a/include/linux/hid_bpf.h +++ b/include/linux/hid_bpf.h @@ -138,6 +138,7 @@ struct hid_bpf_ops { * It has the following arguments: * * ``ctx``: The HID-BPF context as &struct hid_bpf_ctx + * * ``reportnum``: the report number, as in hid_hw_raw_request() * * ``rtype``: the report type (``HID_INPUT_REPORT``, ``HID_FEATURE_REPORT``, @@ -165,16 +166,17 @@ struct hid_bpf_ops { * It has the following arguments: * * ``ctx``: The HID-BPF context as &struct hid_bpf_ctx + * * ``source``: a u64 referring to a uniq but identifiable source. If %0, the - * kernel itself emitted that call. For hidraw, ``source`` is set - * to the associated ``struct file *``. + * kernel itself emitted that call. For hidraw, ``source`` is set + * to the associated ``struct file *``. * * Return: %0 to keep processing the request by hid-core; any other value * stops hid-core from processing that event. A positive value should be * returned with the number of bytes written to the device; a negative error * code interrupts the processing of this call. */ - int (*hid_hw_output_report)(struct hid_bpf_ctx *ctx, __u64 source); + int (*hid_hw_output_report)(struct hid_bpf_ctx *ctx, u64 source); /* private: do not show up in the docs */ @@ -203,9 +205,9 @@ int dispatch_hid_bpf_raw_requests(struct hid_device *hdev, unsigned char reportnum, __u8 *buf, u32 size, enum hid_report_type rtype, enum hid_class_request reqtype, - __u64 source, bool from_bpf); + u64 source, bool from_bpf); int dispatch_hid_bpf_output_report(struct hid_device *hdev, __u8 *buf, u32 size, - __u64 source, bool from_bpf); + u64 source, bool from_bpf); int hid_bpf_connect_device(struct hid_device *hdev); void hid_bpf_disconnect_device(struct hid_device *hdev); void hid_bpf_destroy_device(struct hid_device *hid); @@ -221,7 +223,7 @@ static inline int dispatch_hid_bpf_raw_requests(struct hid_device *hdev, enum hid_class_request reqtype, u64 source, bool from_bpf) { return 0; } static inline int dispatch_hid_bpf_output_report(struct hid_device *hdev, __u8 *buf, u32 size, - __u64 source, bool from_bpf) { return 0; } + u64 source, bool from_bpf) { return 0; } static inline int hid_bpf_connect_device(struct hid_device *hdev) { return 0; } static inline void hid_bpf_disconnect_device(struct hid_device *hdev) {} static inline void hid_bpf_destroy_device(struct hid_device *hid) {}