From: sashiko-bot@kernel.org
To: "Michael Reeves" <michael.reeves077@gmail.com>
Cc: devicetree@vger.kernel.org, linux-input@vger.kernel.org,
robh@kernel.org, conor+dt@kernel.org, dmitry.torokhov@gmail.com
Subject: Re: [PATCH v5 5/8] HID: apple: Add support for DockChannel HID keyboards
Date: Sun, 08 Nov 2026 07:38:42 +0000 [thread overview]
Message-ID: <sashiko-outbox-203630@kernel.org> (raw)
In-Reply-To: <20261108-b4-apple-mtp-keyboard-v5-5-e2c97b82669a@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] HID: apple: redundant apple_match() duplicates
hid_check_device_match()
--
commit 9add0dddf8a7b243671bc6303c493d3097cdd737
Author: Michael Reeves <michael.reeves077@gmail.com>
HID: apple: Add support for DockChannel HID keyboards
This commit adds HID_GROUP_APPLE_DOCKCHANNEL and matches host-bus Apple
DockChannel keyboards in hid-apple using the modern Magic Keyboard
function-key translation table.
> diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c
> index 5b32fb8c77f3f..d0059a3c0ac7e 100644
> --- a/drivers/hid/hid-apple.c
> +++ b/drivers/hid/hid-apple.c
[ ... ]
> @@ -1025,6 +1035,18 @@ static void apple_remove(struct hid_device *hdev)
> hid_hw_stop(hdev);
> }
>
> +static bool apple_match(struct hid_device *hdev, bool ignore_special_driver)
> +{
> + if (ignore_special_driver ||
> + (hdev->quirks & HID_QUIRK_IGNORE_SPECIAL_DRIVER))
> + return false;
> +
> + if (hdev->group == HID_GROUP_APPLE_DOCKCHANNEL)
> + return apple_is_dockchannel_keyboard(hdev);
> +
> + return true;
> +}
> +
> static const struct hid_device_id apple_devices[] = {
> { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_MIGHTYMOUSE),
> .driver_data = APPLE_MIGHTYMOUSE | APPLE_INVERT_HWHEEL },
> @@ -1250,6 +1272,9 @@ static const struct hid_device_id apple_devices[] = {
> .driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK },
> { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_TOUCHBAR_BACKLIGHT),
> .driver_data = APPLE_MAGIC_BACKLIGHT },
> + { HID_DEVICE(BUS_HOST, HID_GROUP_APPLE_DOCKCHANNEL,
> + HID_ANY_ID, HID_ANY_ID),
> + .driver_data = APPLE_HAS_FN | APPLE_ISO_TILDE_QUIRK },
>
> { }
> };
> @@ -1258,6 +1283,7 @@ MODULE_DEVICE_TABLE(hid, apple_devices);
> static struct hid_driver apple_driver = {
> .name = "apple",
> .id_table = apple_devices,
> + .match = apple_match,
[Severity: Low]
Is apple_match() needed here?
hid_check_device_match() first matches against apple_devices[], where the
HID_DEVICE(BUS_HOST, HID_GROUP_APPLE_DOCKCHANNEL, ...) entry already
requires hdev->bus == BUS_HOST and hdev->group ==
HID_GROUP_APPLE_DOCKCHANNEL. When hdrv->match is NULL,
hid_check_device_match() also enforces !hid_ignore_special_drivers and
!(hdev->quirks & HID_QUIRK_IGNORE_SPECIAL_DRIVER) itself:
drivers/hid/hid-core.c:hid_check_device_match() {
*id = hid_match_device(hdev, hdrv);
if (!*id)
return false;
if (hdrv->match)
return hdrv->match(hdev, hid_ignore_special_drivers);
/*
* hid-generic implements .match(), so we must be dealing with a
* different HID driver here, and can simply check if
* hid_ignore_special_drivers or HID_QUIRK_IGNORE_SPECIAL_DRIVER
* are set or not.
*/
return !hid_ignore_special_drivers && !(hdev->quirks & HID_QUIRK_IGNORE_SPECIAL_DRIVER);
}
Setting .match on apple_driver duplicates those checks and causes
__hid_bus_driver_added() to run __hid_bus_reprobe_drivers() across all HID
devices whenever any HID driver is registered.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261108-b4-apple-mtp-keyboard-v5-0-e2c97b82669a@gmail.com?part=5
next prev parent reply other threads:[~2026-11-08 7:38 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-08 7:25 [PATCH v5 0/8] Add support for Apple Silicon DockChannel internal keyboards Michael Reeves via B4 Relay
2026-11-08 7:25 ` [PATCH v5 1/8] dt-bindings: mailbox: apple: Add DockChannel mailbox Michael Reeves via B4 Relay
2026-11-08 7:25 ` [PATCH v5 2/8] dt-bindings: input: apple: Add DockChannel HID transport Michael Reeves via B4 Relay
2026-11-10 9:20 ` Krzysztof Kozlowski
2026-11-10 11:26 ` Michael Reeves
2026-11-10 11:30 ` Krzysztof Kozlowski
2026-11-11 1:57 ` Michael Reeves
2026-11-08 7:25 ` [PATCH v5 3/8] mailbox: apple: Add DockChannel FIFO controller Michael Reeves via B4 Relay
2026-11-08 7:45 ` sashiko-bot
2026-11-08 7:25 ` [PATCH v5 4/8] soc: apple: rtkit: Add tracekit endpoint Michael Reeves via B4 Relay
2026-11-08 7:25 ` [PATCH v5 5/8] HID: apple: Add support for DockChannel HID keyboards Michael Reeves via B4 Relay
2026-11-08 7:38 ` sashiko-bot [this message]
2026-11-08 7:25 ` [PATCH v5 6/8] HID: apple: Add DockChannel HID transport driver Michael Reeves via B4 Relay
2026-11-08 7:48 ` sashiko-bot
2026-11-08 7:25 ` [PATCH v5 7/8] arm64: dts: apple: Add MTP DockChannel HID nodes Michael Reeves via B4 Relay
2026-11-08 7:40 ` sashiko-bot
2026-11-08 7:48 ` Michael Reeves
2026-11-08 7:25 ` [PATCH v5 8/8] arm64: dts: apple: Enable DockChannel HID on M2 and M3 laptops Michael Reeves via B4 Relay
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-203630@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=michael.reeves077@gmail.com \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox