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.
This commit is contained in:
Warner Losh 2020-08-28 16:40:33 +00:00
parent 1cffe8b812
commit 1f7705606e
2 changed files with 1 additions and 8 deletions

View File

@ -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);
}
/*

View File

@ -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; }