From 1f7705606e8286960a2cea3d514a1deb5339047f Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Fri, 28 Aug 2020 16:40:33 +0000 Subject: [PATCH] Remove splclock(). It's not useful to keep. splclock is used in one driver (spkr) to control access to timer_spkr_* routines. However, nothing else does. So it shows no useful locking info to someone that would want to lock spkr. NOTE: I think there's races with timer_spkr_{acquire,release} since there's no interlock in those routines, despite there being a spin lock to protect the clock. Current other users appear to use no extra locking protocol, though they themselves appear to be at least attempting to make sure that only a single thread calls these routines. I suspect the right answer is to update these routines to take/release the clock spin lock since they are short and to the point, but that's beyond the scope of this commit. --- sys/dev/speaker/spkr.c | 8 +------- sys/sys/systm.h | 1 - 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/sys/dev/speaker/spkr.c b/sys/dev/speaker/spkr.c index 9b5746d6cf92..5cef331eae5f 100644 --- a/sys/dev/speaker/spkr.c +++ b/sys/dev/speaker/spkr.c @@ -65,7 +65,7 @@ static void playstring(char *cp, size_t slen); static void tone(unsigned int thz, unsigned int centisecs) { - int sps, timo; + int timo; if (thz <= 0) return; @@ -75,14 +75,10 @@ tone(unsigned int thz, unsigned int centisecs) #endif /* DEBUG */ /* set timer to generate clicks at given frequency in Hertz */ - sps = splclock(); - if (timer_spkr_acquire()) { /* enter list of waiting procs ??? */ - splx(sps); return; } - splx(sps); disable_intr(); timer_spkr_setfreq(thz); enable_intr(); @@ -95,9 +91,7 @@ tone(unsigned int thz, unsigned int centisecs) timo = centisecs * hz / 100; if (timo > 0) tsleep(&endtone, SPKRPRI | PCATCH, "spkrtn", timo); - sps = splclock(); timer_spkr_release(); - splx(sps); } /* diff --git a/sys/sys/systm.h b/sys/sys/systm.h index 2a71e2416fb2..466765fa906a 100644 --- a/sys/sys/systm.h +++ b/sys/sys/systm.h @@ -497,7 +497,6 @@ void kern_reboot(int) __dead2; void shutdown_nice(int); /* Stubs for obsolete functions that used to be for interrupt management */ -static __inline intrmask_t splclock(void) { return 0; } static __inline intrmask_t splhigh(void) { return 0; } static __inline intrmask_t splimp(void) { return 0; } static __inline intrmask_t splnet(void) { return 0; }