In order to update the LinuxKPI USB implementation and use it with
modern device drivers, such as wireless drivers, we need to embed
LinuxKPI struct device into two USB structs. Doing so in the native
implementation is unfeasible due to dependencies.
Factor out the two structs into an internal name, and then use
an anonymous struct to include it in the actual struct. While in
the native implementation we add a (still conditional) space for
LinuxKPI variables, in LinuxKPI we include the LinuxKPI-specifc
memrber fields from a second struct giving us the same memory layout
on both sides but hiding the actual LinuxKPI fields from the native
implementation entirely.
We use CTASSERT to make sure the array sizes in the native
implementation stay large enough.
Using this update the LinuxKPI USB implementation. It is largely based
on the previous (some parts removed), properly typed, some hacks removed,
and updated forward by 10-15 years. There is also a clear separation
between what is a public KPI and what is internal (helper) code.
URBs are now reference counted, and we populate some dev/kobj bits.
In order to distinguish the change we also move the implementation
from linux_usb.c to linuxkpi_usb.c.
This has been an ongoing (side) effort for several years.
It lacks any kind of review or guidance from a professional USB developer
and has only been undergone basic testing using a LinuxKPI-based wireless
driver, at least passing packets now.
At this point no consumers of the old implementation are still known.
Should there be any we will have to see if bringing back missing
functionality or non-official KPI will help without updating the old
code.
Sponsored by: The FreeBSD Foundation
MFC after: 3 days