[PATCH 0/2] usbip: Cleanup of sysfs attributes.
From: Jakub Lecki
Date: Thu Jun 11 2026 - 18:11:18 EST
Hi!
This patchset is a prerequisite and a follow-up to my previous proposal
to parameterize the number of vhci controllers and the number of ports
[1], where Greg suggested that new parameters should be implemented in
sysfs/configfs.
Before doing that though, existing sysfs attributes must be cleaned up
as it's very unintuitive in present form.
First commit aims to align `usbip_debug` attribute that is shared
between drivers, to the expected usage. It controls the global debug
flag, therefore creating multiple instances of it in all of the driver's
devices makes no sense. At the same time it also allows to get rid of
manual attributes creation in vhci_hcd drivers in the next commit.
The second commit segregates the existing vhci_hcd sysfs attributes.
Before it, the first vhci device was used as an 'user interface' to the
driver. That required recognition of the first device and custom
handling in usb controller start function. With this change, the
driver-level attributes for attaching/detaching and getting number of
ports are defined as driver_attribute, and `status` attribute is
automatically created for each of vhci devices.
Thanks to that, future implementation of parametrized num_controllers
and ports will be much simpler as the fist device doesn't need to be
specially handled and doesn't control other devices which are now
handled by the driver.
[1] https://lore.kernel.org/linux-usb/20251104113248.223594-1-lec.jakub@xxxxxxxxx/
Signed-off-by: Jakub Lecki <lec.jakub@xxxxxxxxx>
---
Jakub Lecki (2):
usbip: Convert usbip_debug to driver attribute.
usbip: Cleanup of vhci_hcd attributes.
drivers/usb/usbip/stub_dev.c | 10 ++-
drivers/usb/usbip/usbip_common.c | 14 ++--
drivers/usb/usbip/usbip_common.h | 2 +-
drivers/usb/usbip/vhci.h | 6 +-
drivers/usb/usbip/vhci_hcd.c | 71 ++++++------------
drivers/usb/usbip/vhci_sysfs.c | 132 +++++-----------------------------
tools/usb/usbip/libsrc/sysfs_utils.c | 23 ++++++
tools/usb/usbip/libsrc/sysfs_utils.h | 1 +
tools/usb/usbip/libsrc/usbip_common.h | 2 +
tools/usb/usbip/libsrc/vhci_driver.c | 61 ++++++++++------
10 files changed, 126 insertions(+), 196 deletions(-)
---
base-commit: 9716c086c8e8b141d35aa61f2e96a2e83de212a7
change-id: 20260611-usbip-attribute-cleanup-7515b9ff2872
Best regards,
--
Jakub Lecki <lec.jakub@xxxxxxxxx>