diff options
author | Chris Rees <crees@FreeBSD.org> | 2020-01-17 18:52:42 +0000 |
---|---|---|
committer | Chris Rees <crees@FreeBSD.org> | 2020-01-17 18:52:42 +0000 |
commit | 8aadec26f6b816521f2e034b6e69801e7f44c230 (patch) | |
tree | 09882e48411543cb84813701a4e5d84d47109b5a /audio | |
parent | cdc733f29d4704bd20b542e4b8344ab7956137b9 (diff) | |
download | ports-8aadec26f6b816521f2e034b6e69801e7f44c230.tar.gz ports-8aadec26f6b816521f2e034b6e69801e7f44c230.zip |
audio/oss: Fix build on recent FreeBSD
Replace function calls to removed function timeout.
Reviewed by: jhb
Notes
Notes:
svn path=/head/; revision=523348
Diffstat (limited to 'audio')
-rw-r--r-- | audio/oss/Makefile | 8 | ||||
-rw-r--r-- | audio/oss/files/patch-kernel_OS_FreeBSD_os__freebsd.c | 152 |
2 files changed, 121 insertions, 39 deletions
diff --git a/audio/oss/Makefile b/audio/oss/Makefile index c6691745d331..ec3e92a7029f 100644 --- a/audio/oss/Makefile +++ b/audio/oss/Makefile @@ -3,7 +3,7 @@ PORTNAME= oss DISTVERSION= 4.2-build2019 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= audio MASTER_SITES= http://www.opensound.com/developer/sources/stable/bsd/ DISTNAME= ${PORTNAME}-v${DISTVERSION}-src-bsd @@ -23,12 +23,6 @@ USES= gnome tar:bzip2 kmod pkgconfig USE_GNOME= gtk20 cairo gdkpixbuf2 USE_RC_SUBR= oss -.include <bsd.port.options.mk> - -.if ${OSVERSION} > 1300067 -BROKEN= Still uses removed timeout interface and needs updating -.endif - HAS_CONFIGURE= yes CONFIGURE_OUTSOURCE= yes CONFIGURE_ENV= HOSTCC="${CC}" diff --git a/audio/oss/files/patch-kernel_OS_FreeBSD_os__freebsd.c b/audio/oss/files/patch-kernel_OS_FreeBSD_os__freebsd.c index bab87efcef77..d095d2bab9f6 100644 --- a/audio/oss/files/patch-kernel_OS_FreeBSD_os__freebsd.c +++ b/audio/oss/files/patch-kernel_OS_FreeBSD_os__freebsd.c @@ -1,36 +1,124 @@ ---- kernel/OS/FreeBSD/os_freebsd.c.orig 2019-03-06 07:52:21 UTC +--- kernel/OS/FreeBSD/os_freebsd.c.orig 2020-01-07 14:59:06 UTC +++ kernel/OS/FreeBSD/os_freebsd.c -@@ -15,6 +15,9 @@ - #include "oss_config.h" - #include "midi_core.h" - #include <oss_pci.h> -+#include <sys/param.h> -+#include <sys/bus.h> -+#include <sys/types.h> - #include <sys/conf.h> - #include <sys/module.h> - #include <sys/proc.h> -@@ -25,6 +28,7 @@ - #include <sys/poll.h> - #include <sys/param.h> - #include <sys/filio.h> -+#include <sys/systm.h> - - /* Function prototypes */ - static d_open_t oss_open; -@@ -920,15 +924,9 @@ oss_poll (struct cdev *bsd_dev, int events, struct thr - return ev.revents; +@@ -473,7 +473,7 @@ typedef struct tmout_desc + void (*func) (void *); + void *arg; + +- struct callout_handle timer; ++ struct callout timer; + } tmout_desc_t; + + static volatile int next_id = 0; +@@ -483,12 +483,17 @@ tmout_desc_t tmouts[MAX_TMOUTS] = { {0} }; + + int timeout_random = 0x12123400; + ++static struct mtx oss_timeout_mutex; ++ + void + oss_timer_callback (void *arg) + { + int ix; ++ void (*func) (void *); + tmout_desc_t *tmout = arg; + ++ /* oss_timeout_mutex locked by callout */ ++ + timeout_random++; + + if (!tmout->active) +@@ -498,7 +503,10 @@ oss_timer_callback (void *arg) + tmout->active = 0; + tmout->timestamp = 0; + +- tmout->func (arg); ++ func = tmout->func; ++ mtx_unlock(&oss_timeout_mutex); ++ ++ func (arg); } --#if defined(D_VERSION_03) && (D_VERSION == D_VERSION_03) - static int - oss_mmap (struct cdev *bsd_dev, vm_ooffset_t offset, vm_paddr_t * paddr, - int nprot, vm_memattr_t *memattr) --#else --static int --oss_mmap (struct cdev *bsd_dev, vm_offset_t offset, vm_paddr_t * paddr, -- int nprot) --#endif + timeout_id_t +@@ -507,6 +515,8 @@ oss_timeout (void (*func) (void *), void *arg, unsigne + tmout_desc_t *tmout = NULL; + int id, n; + ++ mtx_lock(&oss_timeout_mutex); ++ + timeout_random++; + + n = 0; +@@ -527,6 +537,7 @@ oss_timeout (void (*func) (void *), void *arg, unsigne + + if (id == -1) /* No timer slots available */ + { ++ mtx_unlock(&oss_timeout_mutex); + cmn_err (CE_CONT, "Timeout table full\n"); + return 0; + } +@@ -535,8 +546,10 @@ oss_timeout (void (*func) (void *), void *arg, unsigne + tmout->arg = arg; + tmout->timestamp = id | (timeout_random & ~0xff); + +- tmout->timer = timeout (oss_timer_callback, tmout, ticks); ++ callout_reset(&tmout->timer, ticks, oss_timer_callback, tmout); + ++ mtx_unlock(&oss_timeout_mutex); ++ + return id | (timeout_random & ~0xff); + } + +@@ -550,15 +563,19 @@ oss_untimeout (timeout_id_t id) + if (ix < 0 || ix >= MAX_TMOUTS) + return; + ++ mtx_lock(&oss_timeout_mutex); ++ + timeout_random++; + tmout = &tmouts[ix]; + + if (tmout->timestamp != id) /* Expired timer */ + return; + if (tmout->active) +- untimeout (oss_timer_callback, tmout, tmout->timer); ++ callout_stop(&tmout->timer); + tmout->active = 0; + tmout->timestamp = 0; ++ ++ mtx_unlock(&oss_timeout_mutex); + } + + int +@@ -618,6 +635,7 @@ oss_get_walltime (void) + int + soundcard_attach (void) { - int retval; - int dev; ++ int i; + oss_device_t *osdev; + + if (module_lookupbyname("sound") != NULL) +@@ -649,6 +667,12 @@ soundcard_attach (void) + + oss_common_init (osdev); + ++ mtx_init(&oss_timeout_mutex, "OSS timeout", NULL, MTX_DEF); ++ ++ for (i = 0; i < MAX_TMOUTS; ++i) ++ callout_init_mtx(&tmouts[i].timer, &oss_timeout_mutex, ++ CALLOUT_RETURNUNLOCKED); ++ + return 0; + } + +@@ -659,6 +683,11 @@ soundcard_detach (void) + + if (refcount > 0 || open_devices > 0) + return EBUSY; ++ ++ for (i = 0; i < MAX_TMOUTS; ++i) ++ callout_drain(&tmouts[i].timer); ++ ++ mtx_destroy(&oss_timeout_mutex); + + oss_unload_drivers (); + |