aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjoern A. Zeeb <bz@FreeBSD.org>2024-09-04 19:21:36 +0000
committerBjoern A. Zeeb <bz@FreeBSD.org>2024-09-24 22:53:28 +0000
commit5b8f97d8db82e031c409d29313939423b7aac2cb (patch)
treebfde36f3526298f9f1e699c160ece35985cf6bb9
parenta00c3a94bf6436f1c412cd8fe66ef224621dab11 (diff)
usb: change LIST to SLIST to avoid LinuxKPI conflicts
In order to better integrate modern LinuxKPI USB this tries to reduce a contention point of "LIST". Given there is no need to use a LIST here change it to SLIST to avoid conflicts. It is a workaround which does not solve the actual problem (overlapping namespaces) but it helps us a lot for now. Sponsored by: The FreeBSD Foundation X-MFC? unclear Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D46534
-rw-r--r--sys/dev/usb/controller/usb_controller.c6
-rw-r--r--sys/dev/usb/usb_bus.h2
-rw-r--r--sys/dev/usb/usb_dev.h2
-rw-r--r--sys/dev/usb/usb_device.c14
-rw-r--r--sys/dev/usb/usb_device.h2
5 files changed, 13 insertions, 13 deletions
diff --git a/sys/dev/usb/controller/usb_controller.c b/sys/dev/usb/controller/usb_controller.c
index 838bd6bf7621..d717ad56adea 100644
--- a/sys/dev/usb/controller/usb_controller.c
+++ b/sys/dev/usb/controller/usb_controller.c
@@ -653,8 +653,8 @@ usb_bus_cleanup(struct usb_proc_msg *pm)
bus = ((struct usb_bus_msg *)pm)->bus;
- while ((pd = LIST_FIRST(&bus->pd_cleanup_list)) != NULL) {
- LIST_REMOVE(pd, pd_next);
+ while ((pd = SLIST_FIRST(&bus->pd_cleanup_list)) != NULL) {
+ SLIST_REMOVE(&bus->pd_cleanup_list, pd, usb_fs_privdata, pd_next);
USB_BUS_UNLOCK(bus);
usb_destroy_dev_sync(pd);
@@ -847,7 +847,7 @@ usb_attach_sub(device_t dev, struct usb_bus *bus)
bus->shutdown_msg[1].bus = bus;
#if USB_HAVE_UGEN
- LIST_INIT(&bus->pd_cleanup_list);
+ SLIST_INIT(&bus->pd_cleanup_list);
bus->cleanup_msg[0].hdr.pm_callback = &usb_bus_cleanup;
bus->cleanup_msg[0].bus = bus;
bus->cleanup_msg[1].hdr.pm_callback = &usb_bus_cleanup;
diff --git a/sys/dev/usb/usb_bus.h b/sys/dev/usb/usb_bus.h
index b9197d3cd84a..ad7b661c2ac0 100644
--- a/sys/dev/usb/usb_bus.h
+++ b/sys/dev/usb/usb_bus.h
@@ -86,7 +86,7 @@ struct usb_bus {
struct usb_bus_msg shutdown_msg[2];
#if USB_HAVE_UGEN
struct usb_bus_msg cleanup_msg[2];
- LIST_HEAD(,usb_fs_privdata) pd_cleanup_list;
+ SLIST_HEAD(,usb_fs_privdata) pd_cleanup_list;
#endif
/*
* This mutex protects the USB hardware:
diff --git a/sys/dev/usb/usb_dev.h b/sys/dev/usb/usb_dev.h
index 08ceb2555942..381fa1654c95 100644
--- a/sys/dev/usb/usb_dev.h
+++ b/sys/dev/usb/usb_dev.h
@@ -96,7 +96,7 @@ struct usb_fs_privdata {
int fifo_index;
struct cdev *cdev;
- LIST_ENTRY(usb_fs_privdata) pd_next;
+ SLIST_ENTRY(usb_fs_privdata) pd_next;
};
/*
diff --git a/sys/dev/usb/usb_device.c b/sys/dev/usb/usb_device.c
index dd571fcef299..0f3c6a959ad2 100644
--- a/sys/dev/usb/usb_device.c
+++ b/sys/dev/usb/usb_device.c
@@ -1880,7 +1880,7 @@ usb_alloc_device(device_t parent_dev, struct usb_bus *bus,
snprintf(udev->ugen_name, sizeof(udev->ugen_name),
USB_GENERIC_NAME "%u.%u", device_get_unit(bus->bdev),
device_index);
- LIST_INIT(&udev->pd_list);
+ SLIST_INIT(&udev->pd_list);
/* Create the control endpoint device */
udev->ctrl_dev = usb_make_dev(udev, NULL, 0, 0,
@@ -2190,7 +2190,7 @@ usb_destroy_dev(struct usb_fs_privdata *pd)
delist_dev(pd->cdev);
USB_BUS_LOCK(bus);
- LIST_INSERT_HEAD(&bus->pd_cleanup_list, pd, pd_next);
+ SLIST_INSERT_HEAD(&bus->pd_cleanup_list, pd, pd_next);
/* get cleanup going */
usb_proc_msignal(USB_BUS_EXPLORE_PROC(bus),
&bus->cleanup_msg[0], &bus->cleanup_msg[1]);
@@ -2207,7 +2207,7 @@ usb_cdev_create(struct usb_device *udev)
int inmode, outmode, inmask, outmask, mode;
uint8_t ep;
- KASSERT(LIST_FIRST(&udev->pd_list) == NULL, ("stale cdev entries"));
+ KASSERT(SLIST_FIRST(&udev->pd_list) == NULL, ("stale cdev entries"));
DPRINTFN(2, "Creating device nodes\n");
@@ -2254,7 +2254,7 @@ usb_cdev_create(struct usb_device *udev)
mode, UID_ROOT, GID_OPERATOR, 0600);
if (pd != NULL)
- LIST_INSERT_HEAD(&udev->pd_list, pd, pd_next);
+ SLIST_INSERT_HEAD(&udev->pd_list, pd, pd_next);
}
}
@@ -2265,10 +2265,10 @@ usb_cdev_free(struct usb_device *udev)
DPRINTFN(2, "Freeing device nodes\n");
- while ((pd = LIST_FIRST(&udev->pd_list)) != NULL) {
+ while ((pd = SLIST_FIRST(&udev->pd_list)) != NULL) {
KASSERT(pd->cdev->si_drv1 == pd, ("privdata corrupt"));
- LIST_REMOVE(pd, pd_next);
+ SLIST_REMOVE(&udev->pd_list, pd, usb_fs_privdata, pd_next);
usb_destroy_dev(pd);
}
@@ -2358,7 +2358,7 @@ usb_free_device(struct usb_device *udev, uint8_t flag)
mtx_destroy(&udev->device_mtx);
#if USB_HAVE_UGEN
- KASSERT(LIST_FIRST(&udev->pd_list) == NULL, ("leaked cdev entries"));
+ KASSERT(SLIST_FIRST(&udev->pd_list) == NULL, ("leaked cdev entries"));
#endif
/* Uninitialise device */
diff --git a/sys/dev/usb/usb_device.h b/sys/dev/usb/usb_device.h
index 3fc5efb049fc..87596cc1d2bd 100644
--- a/sys/dev/usb/usb_device.h
+++ b/sys/dev/usb/usb_device.h
@@ -225,7 +225,7 @@ struct usb_device {
struct usb_fifo *fifo[USB_FIFO_MAX];
struct usb_symlink *ugen_symlink; /* our generic symlink */
struct usb_fs_privdata *ctrl_dev; /* Control Endpoint 0 device node */
- LIST_HEAD(,usb_fs_privdata) pd_list;
+ SLIST_HEAD(,usb_fs_privdata) pd_list;
char ugen_name[20]; /* name of ugenX.X device */
#endif
usb_ticks_t plugtime; /* copy of "ticks" */