From owner-svn-ports-head@freebsd.org Fri Jan 17 18:52:43 2020 Return-Path: Delivered-To: svn-ports-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 38D771F75FE; Fri, 17 Jan 2020 18:52:43 +0000 (UTC) (envelope-from crees@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47zqtz0RZsz3RHh; Fri, 17 Jan 2020 18:52:43 +0000 (UTC) (envelope-from crees@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0A78AD79B; Fri, 17 Jan 2020 18:52:43 +0000 (UTC) (envelope-from crees@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 00HIqgRm021745; Fri, 17 Jan 2020 18:52:42 GMT (envelope-from crees@FreeBSD.org) Received: (from crees@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 00HIqgsP021744; Fri, 17 Jan 2020 18:52:42 GMT (envelope-from crees@FreeBSD.org) Message-Id: <202001171852.00HIqgsP021744@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: crees set sender to crees@FreeBSD.org using -f From: Chris Rees Date: Fri, 17 Jan 2020 18:52:42 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r523348 - in head/audio/oss: . files X-SVN-Group: ports-head X-SVN-Commit-Author: crees X-SVN-Commit-Paths: in head/audio/oss: . files X-SVN-Commit-Revision: 523348 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the ports tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Jan 2020 18:52:43 -0000 Author: crees Date: Fri Jan 17 18:52:42 2020 New Revision: 523348 URL: https://svnweb.freebsd.org/changeset/ports/523348 Log: audio/oss: Fix build on recent FreeBSD Replace function calls to removed function timeout. Reviewed by: jhb Modified: head/audio/oss/Makefile head/audio/oss/files/patch-kernel_OS_FreeBSD_os__freebsd.c Modified: head/audio/oss/Makefile ============================================================================== --- head/audio/oss/Makefile Fri Jan 17 18:27:27 2020 (r523347) +++ head/audio/oss/Makefile Fri Jan 17 18:52:42 2020 (r523348) @@ -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 @@ -22,12 +22,6 @@ LIB_DEPENDS= libfontconfig.so:x11-fonts/fontconfig \ USES= gnome tar:bzip2 kmod pkgconfig USE_GNOME= gtk20 cairo gdkpixbuf2 USE_RC_SUBR= oss - -.include - -.if ${OSVERSION} > 1300067 -BROKEN= Still uses removed timeout interface and needs updating -.endif HAS_CONFIGURE= yes CONFIGURE_OUTSOURCE= yes Modified: head/audio/oss/files/patch-kernel_OS_FreeBSD_os__freebsd.c ============================================================================== --- head/audio/oss/files/patch-kernel_OS_FreeBSD_os__freebsd.c Fri Jan 17 18:27:27 2020 (r523347) +++ head/audio/oss/files/patch-kernel_OS_FreeBSD_os__freebsd.c Fri Jan 17 18:52:42 2020 (r523348) @@ -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 -+#include -+#include -+#include - #include - #include - #include -@@ -25,6 +28,7 @@ - #include - #include - #include -+#include +@@ -473,7 +473,7 @@ typedef struct tmout_desc + void (*func) (void *); + void *arg; - /* 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; +- 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 (); +