Linux Input/HID development
 help / color / mirror / Atom feed
* [PATCH v1 0/9] HID: Make driver_data in hid_device_id a union
@ 2026-11-25  7:21 Uwe Kleine-König
  2026-11-25  7:21 ` [PATCH v1 1/9] HID: asus: Use designated initializer for hid_device_id Uwe Kleine-König
                   ` (9 more replies)
  0 siblings, 10 replies; 13+ messages in thread
From: Uwe Kleine-König @ 2026-11-25  7:21 UTC (permalink / raw)
  To: Jiri Kosina, Benjamin Tissoires, Guenter Roeck
  Cc: linux-input, Danilo Krummrich, Bjorn Helgaas, Takashi Sakamoto,
	Geert Uytterhoeven, Aleksa Savic, linux-kernel, Ping Cheng,
	Jason Gerecke, linux-hwmon, Pawel Zalewski, Christian A. Ehrhardt

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


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2026-11-25 14:23 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-25  7:21 [PATCH v1 0/9] HID: Make driver_data in hid_device_id a union Uwe Kleine-König
2026-11-25  7:21 ` [PATCH v1 1/9] HID: asus: Use designated initializer for hid_device_id Uwe Kleine-König
2026-11-25  7:21 ` [PATCH v1 2/9] HID: i2c-hid: " Uwe Kleine-König
2026-11-25  7:21 ` [PATCH v1 3/9] HID: input: " Uwe Kleine-König
2026-11-25  7:21 ` [PATCH v1 4/9] HID: quirks: " Uwe Kleine-König
2026-11-25  7:21 ` [PATCH v1 5/9] HID: core: Make driver_data in hid_device_id a union Uwe Kleine-König
2026-11-25  7:21 ` [PATCH v1 6/9] HID: steelseries: Benefit from pointer typed driver_data in hid_device_id Uwe Kleine-König
2026-11-25  7:21 ` [PATCH v1 7/9] HID: tmff: " Uwe Kleine-König
2026-11-25  7:21 ` [PATCH v1 8/9] HID: wacom: " Uwe Kleine-König
2026-11-25  7:34   ` sashiko-bot
2026-11-25 11:46     ` Uwe Kleine-König
2026-11-25  7:21 ` [PATCH v1 9/9] hwmon: (asus_rog_ryujin) " Uwe Kleine-König
2026-11-25 14:23 ` [PATCH v1 0/9] HID: Make driver_data in hid_device_id a union Pawel Zalewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox