From 48ab20fa34d2e487377735440c107c911dbb8192 Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Sun, 28 Sep 2008 13:19:18 +0000 Subject: [PATCH] * Don't use the multiple modules workaround under Haiku. This code is only needed on plain R5 and actually wouldn't work if the module would ever get unloaded (or reloaded afterwards). * Added comment explaining that above the concerning code. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27765 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/bus_managers/usb/usb.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/add-ons/kernel/bus_managers/usb/usb.cpp b/src/add-ons/kernel/bus_managers/usb/usb.cpp index 4443f44eea..c56360d532 100644 --- a/src/add-ons/kernel/bus_managers/usb/usb.cpp +++ b/src/add-ons/kernel/bus_managers/usb/usb.cpp @@ -24,6 +24,12 @@ bus_std_ops(int32 op, ...) if (gUSBStack) return B_OK; +#ifndef __HAIKU__ + // This code is to handle plain R5 (non-BONE) where the same module + // gets loaded multiple times (once for each exported module + // interface, the USB v2 and v3 API in our case). We don't want to + // ever create multiple stacks however, so we "share" the same stack + // for both modules by storing it's address in a shared area. void *address = NULL; area_id shared = find_area("shared usb stack"); if (shared >= B_OK && clone_area("usb stack clone", &address, @@ -32,6 +38,7 @@ bus_std_ops(int32 op, ...) TRACE(("usb_module: found shared stack at %p\n", gUSBStack)); return B_OK; } +#endif #ifdef TRACE_USB set_dprintf_enabled(true); @@ -49,14 +56,15 @@ bus_std_ops(int32 op, ...) return ENODEV; } +#ifndef __HAIKU__ + // Plain R5 workaround, see comment above. gUSBStack = stack; shared = create_area("shared usb stack", &address, B_ANY_KERNEL_ADDRESS, B_PAGE_SIZE, B_NO_LOCK, B_KERNEL_WRITE_AREA); - if (shared >= B_OK) { + if (shared >= B_OK) *((Stack **)address) = gUSBStack; - return B_OK; - } +#endif break; }