Re: [PATCH] usbip: tools: Add usbip host driver availability check

Greg KH
2026-03-11T12:13:30Z

On Tue, Mar 03, 2026 at 04:17:20PM +0800, Zongmin Zhou wrote:
> From: Zongmin Zhou <zhouzongmin@kylinos.cn>
>
> Currently, usbip_generic_driver_open() doesn't verify that the required
> kernel module (usbip-host or usbip-vudc) is actually loaded.
> The function returns success even when no driver is present,
> leading to usbipd daemon run success without driver loaded.
>
> So add a check function to ensure usbip host driver has been loaded.
>
> Signed-off-by: Zongmin Zhou <zhouzongmin@kylinos.cn>
> ---
> tools/usb/usbip/libsrc/usbip_device_driver.c | 2 ++
> tools/usb/usbip/libsrc/usbip_host_common.c | 31 ++++++++++++++++++++
> tools/usb/usbip/libsrc/usbip_host_common.h | 2 ++
> tools/usb/usbip/libsrc/usbip_host_driver.c | 2 ++
> 4 files changed, 37 insertions(+)
>
> diff --git a/tools/usb/usbip/libsrc/usbip_device_driver.c b/tools/usb/usbip/libsrc/usbip_device_driver.c
> index 927a151fa9aa..6da000fab26d 100644
> --- a/tools/usb/usbip/libsrc/usbip_device_driver.c
> +++ b/tools/usb/usbip/libsrc/usbip_device_driver.c
> @@ -147,6 +147,8 @@ static int usbip_device_driver_open(struct usbip_host_driver *hdriver)
> struct usbip_host_driver device_driver = {
> .edev_list = LIST_HEAD_INIT(device_driver.edev_list),
> .udev_subsystem = "udc",
> + .bus_type = "platform",

I think the "bus type" is changing in newer kernel versions, so be
careful about attempting to hard-code anything like this. Devices can
move around between bus types just fine, that is not how they should
ever be referenced.

thanks,

greg k-h