From: "Uwe Kleine-König" <u.kleine-koenig@baylibre.com>
To: Jiri Kosina <jikos@kernel.org>,
Benjamin Tissoires <bentiss@kernel.org>,
Guenter Roeck <linux@roeck-us.net>
Cc: linux-input@vger.kernel.org, Danilo Krummrich <dakr@kernel.org>,
Bjorn Helgaas <bhelgaas@google.com>,
Takashi Sakamoto <o-takashi@sakamocchi.jp>,
Geert Uytterhoeven <geert@linux-m68k.org>,
Aleksa Savic <savicaleksa83@gmail.com>,
linux-kernel@vger.kernel.org, Ping Cheng <ping.cheng@wacom.com>,
Jason Gerecke <jason.gerecke@wacom.com>,
linux-hwmon@vger.kernel.org,
Pawel Zalewski <pzalewski@thegoodpenguin.co.uk>,
"Christian A. Ehrhardt" <lk@c--e.de>
Subject: [PATCH v1 0/9] HID: Make driver_data in hid_device_id a union
Date: Wed, 25 Nov 2026 08:21:32 +0100 [thread overview]
Message-ID: <cover.1795589119.git.u.kleine-koenig@baylibre.com> (raw)
Hello,
the 5th patch of this series replaces .driver_data of struct
hid_device_id by an anonymous union. Drivers that store pointers in
.driver_data can benefit from that by less casting and still more
implicit type safety as something like:
struct sometype *driver_data = id->driver_data_ptr;
is catched by the compiler to lack a `const`.
The (IMHO tiny) downside is that with that union initialisations must be
done using designated (i.e. named) initializers. The first four patches
implement that for the few drivers that don't do that yet, which IMHO
could stand as improvements on its own. Patches #6 and later convert
drivers that store pointers in .driver_data to the new .driver_data_ptr.
All patches intend to have no effect on the build result, so this is
only about easier source code and tighter compiler checks.
My original motivation to work on this is that the result also works on
machines with CHERI support that have sizeof(unsigned long) <
sizeof(void *). It's still a long way to get these running mainline
Linux but the nice thing about this series is that it works towards such
a future and improves the code for non-CHERI architectures, too.
Some of the existing initializers use an unusual coding style. In the
first patch I converted that to a more common indentation while updating
to designated initializers, in the quirks patch I mostly kept the
existing style. If you have a strong opinion there or think the
opportunity should be taken to convert all such arrays, I can do that.
This conversion is also the main reason that this series doesn't have a
diffstat with nearly an equal number of insertions and deletions.
The dependencies are as follows:
- patch #5 (HID: core: Make driver_data in hid_device_id a union)
depends on patches #1 - #4
- patches #6 and later (...: Benefit from pointer typed driver_data in
hid_device_id) depend on patch #5.
I would expect that all but maybe the last patch go in via the HID tree.
I can resend patch #9 to hwmon when its dependencies landed in the
mainline.
I build tested this series on top of next-20261123 using allmodconfig on
arc, sh, alpha, arm64, x86_64, s390, riscv, mips, powerpc, loongarch,
sparc, m68k and parisc and there were no build regressions.
Best regards
Uwe
Uwe Kleine-König (9):
HID: asus: Use designated initializer for hid_device_id
HID: i2c-hid: Use designated initializer for hid_device_id
HID: input: Use designated initializer for hid_device_id
HID: quirks: Use designated initializer for hid_device_id
HID: core: Make driver_data in hid_device_id a union
HID: steelseries: Benefit from pointer typed driver_data in
hid_device_id
HID: tmff: Benefit from pointer typed driver_data in hid_device_id
HID: wacom: Benefit from pointer typed driver_data in hid_device_id
hwmon: (asus_rog_ryujin) Benefit from pointer typed driver_data in
hid_device_id
drivers/hid/hid-asus.c | 199 ++++++-----
drivers/hid/hid-input.c | 114 ++++---
drivers/hid/hid-quirks.c | 400 +++++++++++------------
drivers/hid/hid-steelseries-arctis.c | 39 ++-
drivers/hid/hid-tmff.c | 22 +-
drivers/hid/i2c-hid/i2c-hid-dmi-quirks.c | 2 +-
drivers/hid/wacom_sys.c | 8 +-
drivers/hid/wacom_wac.c | 10 +-
drivers/hwmon/asus_rog_ryujin.c | 14 +-
include/linux/device-id/hid.h | 5 +-
10 files changed, 438 insertions(+), 375 deletions(-)
base-commit: 3191063649dbf7c0d0b768e1f3655e4c5fc6edb5
--
2.47.3
next reply other threads:[~2026-11-25 7:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 7:21 Uwe Kleine-König [this message]
2026-11-25 7:21 ` [PATCH v1 5/9] HID: core: " Uwe Kleine-König
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=cover.1795589119.git.u.kleine-koenig@baylibre.com \
--to=u.kleine-koenig@baylibre.com \
--cc=bentiss@kernel.org \
--cc=bhelgaas@google.com \
--cc=dakr@kernel.org \
--cc=geert@linux-m68k.org \
--cc=jason.gerecke@wacom.com \
--cc=jikos@kernel.org \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=lk@c--e.de \
--cc=o-takashi@sakamocchi.jp \
--cc=ping.cheng@wacom.com \
--cc=pzalewski@thegoodpenguin.co.uk \
--cc=savicaleksa83@gmail.com \
/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
all inboxes | Powered by JetHome®