Subject: kern/3328: Garbage collect unused routines in audio driver
To: None <gnats-bugs@gnats.netbsd.org>
From: Lennart Augustsson <augustss@cs.chalmers.se>
List: netbsd-bugs
Date: 03/13/1997 18:24:06
>Number: 3328
>Category: kern
>Synopsis: Garbage collect unused routines in audio driver
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: kern-bug-people (Kernel Bug People)
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Thu Mar 13 09:35:01 1997
>Last-Modified:
>Originator: Lennart Augustsson
>Organization:
Department of Computing Science, Chalmers University
>Release: <NetBSD-current source date>
>Environment:
System: NetBSD calvin.cs.chalmers.se 1.2C NetBSD 1.2C (CALVIN) #114: Sun Mar 9 01:29:33 MET 1997 augustss@calvin.cs.chalmers.se:/usr/src/sys/arch/i386/compile/CALVIN i386
>Description:
The interface between the high and low level audio drivers
define two functions cont_input() and cont_output().
They are unused by the high level driver and most low level
drivers treat them as no-ops. Why? Well, it's rather unclear
what they should. As I see it, there is no point in trying
to resume a DMA operation that has been halted (which presumable
is what they should do).
These routines just clutter the code; they should go away.
>How-To-Repeat:
Read the source :-)
>Fix:
Apply this patch.
diff -c -r old/arch/arm32/mainbus/lmcaudio.c ./arch/arm32/mainbus/lmcaudio.c
*** old/arch/arm32/mainbus/lmcaudio.c Thu Mar 13 13:17:34 1997
--- ./arch/arm32/mainbus/lmcaudio.c Thu Mar 13 18:12:38 1997
***************
*** 361,368 ****
int lmcaudio_start_input __P((void *, void *, int, void (*)(), void *));
int lmcaudio_halt_output __P((void *));
int lmcaudio_halt_input __P((void *));
- int lmcaudio_cont_output __P((void *));
- int lmcaudio_cont_input __P((void *));
int lmcaudio_speaker_ctl __P((void *, int));
int lmcaudio_getdev __P((void *, struct audio_device *));
int lmcaudio_setfd __P((void *, int));
--- 361,366 ----
***************
*** 645,670 ****
}
int
- lmcaudio_cont_output(addr)
- void *addr;
- {
- #ifdef DEBUG
- printf ( "DEBUG: lmcaudio_halt_output\n" );
- #endif
- return EIO;
- }
-
- int
- lmcaudio_cont_input(addr)
- void *addr;
- {
- #ifdef DEBUG
- printf ( "DEBUG: lmcaudio_halt_output\n" );
- #endif
- return EIO;
- }
-
- int
lmcaudio_speaker_ctl(addr, newstate)
void *addr;
int newstate;
--- 643,648 ----
***************
*** 755,762 ****
lmcaudio_start_input,
lmcaudio_halt_output,
lmcaudio_halt_input,
- lmcaudio_cont_output,
- lmcaudio_cont_input,
lmcaudio_speaker_ctl,
lmcaudio_getdev,
lmcaudio_setfd,
--- 733,738 ----
diff -c -r old/arch/arm32/mainbus/vidcaudio.c ./arch/arm32/mainbus/vidcaudio.c
*** old/arch/arm32/mainbus/vidcaudio.c Thu Mar 13 13:17:35 1997
--- ./arch/arm32/mainbus/vidcaudio.c Thu Mar 13 18:12:15 1997
***************
*** 321,328 ****
int vidcaudio_start_input __P((void *, void *, int, void (*)(), void *));
int vidcaudio_halt_output __P((void *));
int vidcaudio_halt_input __P((void *));
- int vidcaudio_cont_output __P((void *));
- int vidcaudio_cont_input __P((void *));
int vidcaudio_speaker_ctl __P((void *, int));
int vidcaudio_getdev __P((void *, struct audio_device *));
int vidcaudio_setfd __P((void *, int));
--- 321,326 ----
***************
*** 547,568 ****
return EIO;
}
- int vidcaudio_cont_output ( void *addr )
- {
- #ifdef DEBUG
- printf ( "DEBUG: vidcaudio_halt_output\n" );
- #endif
- return EIO;
- }
-
- int vidcaudio_cont_input ( void *addr )
- {
- #ifdef DEBUG
- printf ( "DEBUG: vidcaudio_halt_output\n" );
- #endif
- return EIO;
- }
-
int vidcaudio_speaker_ctl ( void *addr, int newstate )
{
#ifdef DEBUG
--- 545,550 ----
***************
*** 625,632 ****
vidcaudio_start_input,
vidcaudio_halt_output,
vidcaudio_halt_input,
- vidcaudio_cont_output,
- vidcaudio_cont_input,
vidcaudio_speaker_ctl,
vidcaudio_getdev,
vidcaudio_setfd,
--- 607,612 ----
diff -c -r old/arch/sparc/dev/amd7930.c ./arch/sparc/dev/amd7930.c
*** old/arch/sparc/dev/amd7930.c Thu Mar 13 13:20:04 1997
--- ./arch/sparc/dev/amd7930.c Thu Mar 13 18:11:45 1997
***************
*** 228,235 ****
void *));
int amd7930_halt_output __P((void *));
int amd7930_halt_input __P((void *));
- int amd7930_cont_output __P((void *));
- int amd7930_cont_input __P((void *));
int amd7930_getdev __P((void *, struct audio_device *));
int amd7930_setfd __P((void *, int));
int amd7930_set_port __P((void *, mixer_ctrl_t *));
--- 228,233 ----
***************
*** 264,271 ****
amd7930_start_input,
amd7930_halt_output,
amd7930_halt_input,
- amd7930_cont_output,
- amd7930_cont_input,
NULL,
amd7930_getdev,
amd7930_setfd,
--- 262,267 ----
***************
*** 716,737 ****
amd->dr = AMD_INIT_PMS_ACTIVE | AMD_INIT_INT_DISABLE;
sc->sc_locked = 0;
- return(0);
- }
-
- int
- amd7930_cont_output(addr)
- void *addr;
- {
- DPRINTF(("amd7930_cont_output: never called, what should it do?!\n"));
- return(0);
- }
-
- int
- amd7930_cont_input(addr)
- void *addr;
- {
- DPRINTF(("amd7930_cont_input: never called, what should it do?!\n"));
return(0);
}
--- 712,717 ----
diff -c -r old/dev/audio.c ./dev/audio.c
*** old/dev/audio.c Thu Mar 13 13:20:49 1997
--- ./dev/audio.c Thu Mar 13 18:04:02 1997
***************
*** 227,234 ****
hwp->start_input == 0 ||
hwp->halt_output == 0 ||
hwp->halt_input == 0 ||
- hwp->cont_output == 0 ||
- hwp->cont_input == 0 ||
hwp->getdev == 0 ||
hwp->set_port == 0 ||
hwp->get_port == 0 ||
--- 227,232 ----
diff -c -r old/dev/audio_if.h ./dev/audio_if.h
*** old/dev/audio_if.h Thu Mar 13 17:44:46 1997
--- ./dev/audio_if.h Thu Mar 13 18:04:19 1997
***************
*** 96,103 ****
void (*)(void *), void *));
int (*halt_output)__P((void *));
int (*halt_input)__P((void *));
- int (*cont_output)__P((void *));
- int (*cont_input)__P((void *));
int (*speaker_ctl)__P((void *, int));
#define SPKR_ON 1
--- 96,101 ----
diff -c -r old/dev/isa/ad1848.c ./dev/isa/ad1848.c
*** old/dev/isa/ad1848.c Thu Mar 13 18:05:26 1997
--- ./dev/isa/ad1848.c Thu Mar 13 18:13:06 1997
***************
*** 1435,1470 ****
return(0);
}
- int
- ad1848_cont_out_dma(addr)
- void *addr;
- {
- register struct ad1848_softc *sc = addr;
- u_char reg;
-
- DPRINTF(("ad1848: ad1848_cont_out_dma %s\n", sc->sc_locked?"(locked)":""));
-
- reg = ad_read(sc, SP_INTERFACE_CONFIG);
- ad_write(sc, SP_INTERFACE_CONFIG, (reg | PLAYBACK_ENABLE));
-
- return(0);
- }
-
- int
- ad1848_cont_in_dma(addr)
- void *addr;
- {
- register struct ad1848_softc *sc = addr;
- u_char reg;
-
- DPRINTF(("ad1848: ad1848_cont_in_dma %s\n", sc->sc_locked?"(locked)":""));
-
- reg = ad_read(sc, SP_INTERFACE_CONFIG);
- ad_write(sc, SP_INTERFACE_CONFIG, (reg | CAPTURE_ENABLE));
-
- return(0);
- }
-
/*
* DMA input/output are called at splaudio().
*/
--- 1435,1440 ----
diff -c -r old/dev/isa/gus.c ./dev/isa/gus.c
*** old/dev/isa/gus.c Thu Mar 13 13:21:34 1997
--- ./dev/isa/gus.c Thu Mar 13 18:10:13 1997
***************
*** 385,392 ****
int gus_dma_input __P((void *, void *, int, void (*)(void *), void *));
int gus_halt_out_dma __P((void *));
int gus_halt_in_dma __P((void *));
- int gus_cont_out_dma __P((void *));
- int gus_cont_in_dma __P((void *));
int gus_speaker_ctl __P((void *, int));
int gusmax_set_precision __P((void *, u_int));
int gusmax_get_precision __P((void *));
--- 385,390 ----
***************
*** 396,403 ****
int gusmax_dma_input __P((void *, void *, int, void (*)(void *), void *));
int gusmax_halt_out_dma __P((void *));
int gusmax_halt_in_dma __P((void *));
- int gusmax_cont_out_dma __P((void *));
- int gusmax_cont_in_dma __P((void *));
int gusmax_speaker_ctl __P((void *, int));
int gusmax_set_out_port __P((void *, int));
int gusmax_get_out_port __P((void *));
--- 394,399 ----
***************
*** 648,655 ****
gus_dma_input,
gus_halt_out_dma,
gus_halt_in_dma,
- gus_cont_out_dma,
- gus_cont_in_dma,
gus_speaker_ctl,
--- 644,649 ----
***************
*** 3029,3036 ****
gusmax_dma_input,
gusmax_halt_out_dma,
gusmax_halt_in_dma,
- gusmax_cont_out_dma,
- gusmax_cont_in_dma,
gusmax_speaker_ctl,
--- 3023,3028 ----
***************
*** 3326,3347 ****
return gus_halt_in_dma(sc->parent);
}
- int
- gusmax_cont_out_dma(addr)
- void * addr;
- {
- register struct ad1848_softc *sc = addr;
- return gus_cont_out_dma(sc->parent);
- }
-
- int
- gusmax_cont_in_dma(addr)
- void * addr;
- {
- register struct ad1848_softc *sc = addr;
- return gus_cont_in_dma(sc->parent);
- }
-
/*
* Stop any DMA output. Called at splgus().
*/
--- 3318,3323 ----
***************
*** 3405,3427 ****
return 0;
}
-
- int
- gus_cont_out_dma(addr)
- void * addr;
- {
- DPRINTF(("gus_cont_out_dma called\n"));
- return EOPNOTSUPP;
- }
-
- int
- gus_cont_in_dma(addr)
- void * addr;
- {
- DPRINTF(("gus_cont_in_dma called\n"));
- return EOPNOTSUPP;
- }
-
STATIC int
gus_setfd(addr, flag)
--- 3381,3386 ----
diff -c -r old/dev/isa/pas.c ./dev/isa/pas.c
*** old/dev/isa/pas.c Thu Mar 13 13:21:36 1997
--- ./dev/isa/pas.c Thu Mar 13 18:10:35 1997
***************
*** 128,135 ****
sbdsp_dma_input,
sbdsp_haltdma,
sbdsp_haltdma,
- sbdsp_contdma,
- sbdsp_contdma,
sbdsp_speaker_ctl,
pas_getdev,
sbdsp_setfd,
--- 128,133 ----
diff -c -r old/dev/isa/pss.c ./dev/isa/pss.c
*** old/dev/isa/pss.c Thu Mar 13 13:21:42 1997
--- ./dev/isa/pss.c Thu Mar 13 18:11:01 1997
***************
*** 237,244 ****
ad1848_dma_input,
ad1848_halt_out_dma,
ad1848_halt_in_dma,
- ad1848_cont_out_dma,
- ad1848_cont_in_dma,
pss_speaker_ctl,
pss_getdev,
pss_setfd,
--- 237,242 ----
diff -c -r old/dev/isa/sb.c ./dev/isa/sb.c
*** old/dev/isa/sb.c Thu Mar 13 13:21:44 1997
--- ./dev/isa/sb.c Thu Mar 13 18:11:15 1997
***************
*** 109,116 ****
sbdsp_dma_input,
sbdsp_haltdma,
sbdsp_haltdma,
- sbdsp_contdma,
- sbdsp_contdma,
sbdsp_speaker_ctl,
sb_getdev,
sbdsp_setfd,
--- 109,114 ----
diff -c -r old/dev/isa/sbdsp.c ./dev/isa/sbdsp.c
*** old/dev/isa/sbdsp.c Thu Mar 13 18:17:48 1997
--- ./dev/isa/sbdsp.c Thu Mar 13 18:17:53 1997
***************
*** 953,960 ****
}
/*
! * Halt a DMA in progress. A low-speed transfer can be
! * resumed with sbdsp_contdma().
*/
int
sbdsp_haltdma(addr)
--- 953,959 ----
}
/*
! * Halt a DMA in progress.
*/
int
sbdsp_haltdma(addr)
***************
*** 966,984 ****
sbdsp_reset(sc);
return 0;
- }
-
- int
- sbdsp_contdma(addr)
- void *addr;
- {
- register struct sbdsp_softc *sc = addr;
-
- DPRINTF(("sbdsp_contdma: sc=0x%x\n", sc));
-
- /* XXX how do we reinitialize the DMA controller state? do we care? */
- (void)sbdsp_wdsp(sc, SB_DSP_CONT);
- return(0);
}
int
--- 965,970 ----
diff -c -r old/dev/isa/sbdspvar.h ./dev/isa/sbdspvar.h
*** old/dev/isa/sbdspvar.h Thu Mar 13 18:14:50 1997
--- ./dev/isa/sbdspvar.h Thu Mar 13 18:14:55 1997
***************
*** 186,192 ****
int sbdsp_dma_input __P((void *, void *, int, void (*)(void *), void*));
int sbdsp_haltdma __P((void *));
- int sbdsp_contdma __P((void *));
void sbdsp_compress __P((int, u_char *, int));
void sbdsp_expand __P((int, u_char *, int));
--- 186,191 ----
diff -c -r old/dev/isa/wss.c ./dev/isa/wss.c
*** old/dev/isa/wss.c Thu Mar 13 17:44:46 1997
--- ./dev/isa/wss.c Thu Mar 13 18:08:50 1997
***************
*** 182,189 ****
ad1848_dma_input,
ad1848_halt_out_dma,
ad1848_halt_in_dma,
- ad1848_cont_out_dma,
- ad1848_cont_in_dma,
NULL,
wss_getdev,
wss_setfd,
--- 182,187 ----
>Audit-Trail:
>Unformatted: