Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 1 Jun 2026 21:44:14 +0000
From:      John F Carr <jfc@MIT.EDU>
To:        "freebsd-drivers@freebsd.org" <freebsd-drivers@FreeBSD.org>
Subject:   Providing struct device for Linux USB drivers
Message-ID:  <46754738-2FFD-4799-AF68-0F12E1D96C1A@mit.edu>

index | next in thread | raw e-mail

I am trying to get the USB part of the rtw89 driver working.
This driver uses the Linux 2.6.24 USB interface, which is
newer than LinuxKPI supports.

The rtw89 driver expects struct usb_interface to contain a field

  struct device dev;

A struct device is 256 bytes, much larger than the existing
80 byte struct usb_interface.  Is that too much bloat?  The
number of these structures is not very large.

Alternatively, I could add a pointer instead of a value,
  struct device *dev;
The struct device object would be allocated in
usb_linux_create_usb_device and freed and nulled in
usb_linux_detach.  With this approach the KPI is not purely
source compatible.  The driver change is as simple as
removing an "&".

For PCI, LinuxKPI provides a struct device by interposing a
struct pci_dev between the FreeBSD structure and the Linux
driver.  For USB the structure name is expected to be
"usb_interface", which is already used.

Any thoughts?

John Carr



home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?46754738-2FFD-4799-AF68-0F12E1D96C1A>