From: Ben Gras Date: Thu, 9 Jun 2011 14:57:51 +0000 (+0200) Subject: fixed clang warnings in drivers/ X-Git-Tag: v3.2.0~537 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/man.rndc-confgen.html?a=commitdiff_plain;h=b19820774e03c366925928bac684b5c065d007ac;p=minix.git fixed clang warnings in drivers/ . changed debug statements system for audio/ to do so --- diff --git a/common/include/minix/audio_fw.h b/common/include/minix/audio_fw.h index f0c040739..d13126714 100644 --- a/common/include/minix/audio_fw.h +++ b/common/include/minix/audio_fw.h @@ -6,18 +6,6 @@ #include -/* change to DEBUG to 1 to print debug info and error messages */ - -#define DEBUG 0 - -#if DEBUG -#define dprint printf -#else -#define dprint (void) -#endif -#define error printf - - _PROTOTYPE( int drv_init, (void) ); _PROTOTYPE( int drv_init_hw, (void) ); _PROTOTYPE( int drv_reset, (void) ); diff --git a/drivers/ahci/ahci.c b/drivers/ahci/ahci.c index e36763f57..49f1d3d00 100644 --- a/drivers/ahci/ahci.c +++ b/drivers/ahci/ahci.c @@ -110,6 +110,7 @@ #include #include #include +#include #include #include #include diff --git a/drivers/audio/es1371/AC97.c b/drivers/audio/es1371/AC97.c index 5ca447073..19c84c09f 100644 --- a/drivers/audio/es1371/AC97.c +++ b/drivers/audio/es1371/AC97.c @@ -6,11 +6,8 @@ /* AC97 Mixer and Mode control function prototypes */ -FORWARD _PROTOTYPE( int AC97_read, - (const DEV_STRUCT * pCC, u16_t wAddr, u16_t *data) ); FORWARD _PROTOTYPE( int AC97_write, (const DEV_STRUCT * pCC, u16_t wAddr, u16_t wData) ); -FORWARD _PROTOTYPE( void set_src_sync_state, (int state) ); FORWARD _PROTOTYPE( int AC97_write_unsynced, (const DEV_STRUCT * pCC, u16_t wAddr, u16_t wData) ); FORWARD _PROTOTYPE( int AC97_read_unsynced, @@ -58,6 +55,7 @@ static u32_t SrcSyncState = 0x00010000UL; static DEV_STRUCT *dev; +#if 0 PRIVATE void set_src_sync_state (int state) { if (state < 0) @@ -67,6 +65,7 @@ PRIVATE void set_src_sync_state (int state) SrcSyncState &= 0x00070000Ul; } } +#endif PRIVATE int AC97_write (const DEV_STRUCT * pCC, u16_t wAddr, u16_t wData) @@ -133,6 +132,7 @@ u16_t wBaseAddr = pCC->base; } +#if 0 PRIVATE int AC97_read (const DEV_STRUCT * pCC, u16_t wAddr, u16_t *data) { u32_t dtemp, i; @@ -204,6 +204,7 @@ u16_t base = pCC->base; return 0; } +#endif PRIVATE int AC97_write_unsynced (const DEV_STRUCT * pCC, u16_t wAddr, diff --git a/drivers/audio/sb16/mixer.c b/drivers/audio/sb16/mixer.c index f276b1e87..e46acc8c0 100644 --- a/drivers/audio/sb16/mixer.c +++ b/drivers/audio/sb16/mixer.c @@ -42,14 +42,14 @@ PUBLIC int mixer_init() { mixer_set(MIXER_DAC_LEVEL, 0x10); /* write something to it */ if(mixer_get(MIXER_DAC_LEVEL) != 0x10) { - dprint("sb16: Mixer not detected\n"); + Dprint(("sb16: Mixer not detected\n")); return EIO; } /* Enable Automatic Gain Control */ mixer_set(MIXER_AGC, 0x01); - dprint("Mixer detected\n"); + Dprint(("Mixer detected\n")); return OK; } diff --git a/drivers/audio/sb16/sb16.c b/drivers/audio/sb16/sb16.c index 0e6f49463..5b1ee1cdf 100644 --- a/drivers/audio/sb16/sb16.c +++ b/drivers/audio/sb16/sb16.c @@ -75,10 +75,10 @@ PUBLIC int drv_init(void) { PUBLIC int drv_init_hw(void) { int i; int DspVersion[2]; - dprint("drv_init_hw():\n"); + Dprint(("drv_init_hw():\n")); if(drv_reset () != OK) { - dprint("sb16: No SoundBlaster card detected\n"); + Dprint(("sb16: No SoundBlaster card detected\n")); return -1; } @@ -97,11 +97,11 @@ PUBLIC int drv_init_hw(void) { } if(DspVersion[0] < 4) { - dprint("sb16: No SoundBlaster 16 compatible card detected\n"); + Dprint(("sb16: No SoundBlaster 16 compatible card detected\n")); return -1; } - dprint("sb16: SoundBlaster DSP version %d.%d detected!\n", DspVersion[0], DspVersion[1]); + Dprint(("sb16: SoundBlaster DSP version %d.%d detected!\n", DspVersion[0], DspVersion[1])); /* set SB to use our IRQ and DMA channels */ mixer_set(MIXER_SET_IRQ, (1 << (SB_IRQ / 2 - 1))); @@ -116,7 +116,7 @@ PUBLIC int drv_init_hw(void) { PUBLIC int drv_reset(void) { int i; - dprint("drv_reset():\n"); + Dprint(("drv_reset():\n")); sb16_outb(DSP_RESET, 1); for(i = 0; i < 1000; i++); /* wait a while */ @@ -132,7 +132,7 @@ PUBLIC int drv_reset(void) { PUBLIC int drv_start(int channel, int DmaMode) { - dprint("drv_start():\n"); + Dprint(("drv_start():\n")); drv_reset(); @@ -180,7 +180,7 @@ PUBLIC int drv_start(int channel, int DmaMode) { PUBLIC int drv_stop(int sub_dev) { if(running) { - dprint("drv_stop():\n"); + Dprint(("drv_stop():\n")); dsp_command((DspBits == 8 ? DSP_CMD_DMA8HALT : DSP_CMD_DMA16HALT)); running = FALSE; drv_reenable_int(sub_dev); @@ -191,7 +191,7 @@ PUBLIC int drv_stop(int sub_dev) { PUBLIC int drv_set_dma(u32_t dma, u32_t length, int chan) { - dprint("drv_set_dma():\n"); + Dprint(("drv_set_dma():\n")); DmaPhys = dma; return OK; } @@ -199,7 +199,7 @@ PUBLIC int drv_set_dma(u32_t dma, u32_t length, int chan) { PUBLIC int drv_reenable_int(int chan) { - dprint("drv_reenable_int()\n"); + Dprint(("drv_reenable_int()\n")); sb16_inb((DspBits == 8 ? DSP_DATA_AVL : DSP_DATA16_AVL)); return OK; } @@ -233,7 +233,7 @@ PUBLIC int drv_resume(int chan) { PUBLIC int drv_io_ctl(int request, void *val, int *len, int sub_dev) { - dprint("dsp_ioctl: got ioctl %d, argument: %d sub_dev: %d\n", request, val, sub_dev); + Dprint(("dsp_ioctl: got ioctl %d, argument: %d sub_dev: %d\n", request, val, sub_dev)); if(sub_dev == AUDIO) { return dsp_ioctl(request, val, len); @@ -247,7 +247,7 @@ PUBLIC int drv_io_ctl(int request, void *val, int *len, int sub_dev) { PUBLIC int drv_get_irq(char *irq) { - dprint("drv_get_irq():\n"); + Dprint(("drv_get_irq():\n")); *irq = SB_IRQ; return OK; } @@ -255,7 +255,7 @@ PUBLIC int drv_get_irq(char *irq) { PUBLIC int drv_get_frag_size(u32_t *frag_size, int sub_dev) { - dprint("drv_get_frag_size():\n"); + Dprint(("drv_get_frag_size():\n")); *frag_size = DspFragmentSize; return OK; } @@ -284,7 +284,7 @@ PRIVATE int dsp_ioctl(int request, void *val, int *len) { PRIVATE void dsp_dma_setup(phys_bytes address, int count, int DmaMode) { pvb_pair_t pvb[9]; - dprint("Setting up %d bit DMA\n", DspBits); + Dprint(("Setting up %d bit DMA\n", DspBits)); if(DspBits == 8) { /* 8 bit sound */ count--; @@ -327,7 +327,7 @@ PRIVATE void dsp_dma_setup(phys_bytes address, int count, int DmaMode) { PRIVATE int dsp_set_size(unsigned int size) { - dprint("dsp_set_size(): set fragment size to %u\n", size); + Dprint(("dsp_set_size(): set fragment size to %u\n", size)); /* Sanity checks */ if(size < sub_dev[AUDIO].MinFragmentSize || size > sub_dev[AUDIO].DmaSize / sub_dev[AUDIO].NrOfDmaFragments || size % 2 != 0) { @@ -342,7 +342,7 @@ PRIVATE int dsp_set_size(unsigned int size) { PRIVATE int dsp_set_speed(unsigned int speed) { - dprint("sb16: setting speed to %u, stereo = %d\n", speed, DspStereo); + Dprint(("sb16: setting speed to %u, stereo = %d\n", speed, DspStereo)); if(speed < DSP_MIN_SPEED || speed > DSP_MAX_SPEED) { return EPERM; @@ -395,7 +395,7 @@ PRIVATE int dsp_set_bits(unsigned int bits) { PRIVATE int dsp_set_sign(unsigned int sign) { - dprint("sb16: set sign to %u\n", sign); + Dprint(("sb16: set sign to %u\n", sign)); DspSign = (sign > 0 ? 1 : 0); @@ -422,7 +422,7 @@ PUBLIC int dsp_command(int value) { } } - dprint("sb16: SoundBlaster: DSP Command(%x) timeout\n", value); + Dprint(("sb16: SoundBlaster: DSP Command(%x) timeout\n", value)); return -1; } diff --git a/drivers/audio/sb16/sb16.h b/drivers/audio/sb16/sb16.h index 7adbbc5a5..d8f52c121 100644 --- a/drivers/audio/sb16/sb16.h +++ b/drivers/audio/sb16/sb16.h @@ -4,6 +4,12 @@ #include #include +#if DEBUG +#define Dprint(args) printf args +#else +#define Dprint(args) +#endif + #define AUDIO 0 #define MIXER 1 diff --git a/drivers/dp8390/dp8390.c b/drivers/dp8390/dp8390.c index bb1c51c51..9b29ecd41 100644 --- a/drivers/dp8390/dp8390.c +++ b/drivers/dp8390/dp8390.c @@ -125,10 +125,6 @@ _PROTOTYPE( static void do_vir_insb, (port_t port, int proc, vir_bytes buf, size_t size) ); _PROTOTYPE( static void do_vir_insw, (port_t port, int proc, vir_bytes buf, size_t size) ); -_PROTOTYPE( static void do_vir_outsb, (port_t port, int proc, - vir_bytes buf, size_t size) ); -_PROTOTYPE( static void do_vir_outsw, (port_t port, int proc, - vir_bytes buf, size_t size) ); /* SEF functions and variables. */ FORWARD _PROTOTYPE( void sef_local_startup, (void) ); @@ -1902,24 +1898,6 @@ static void do_vir_insw(port_t port, int proc, vir_bytes buf, size_t size) panic("sys_sdevio failed: %d", r); } -static void do_vir_outsb(port_t port, int proc, vir_bytes buf, size_t size) -{ - int r; - - r= sys_outsb(port, proc, (void *) buf, size); - if (r != OK) - panic("sys_sdevio failed: %d", r); -} - -static void do_vir_outsw(port_t port, int proc, vir_bytes buf, size_t size) -{ - int r; - - r= sys_outsw(port, proc, (void *) buf, size); - if (r != OK) - panic("sys_sdevio failed: %d", r); -} - /* * $PchId: dp8390.c,v 1.25 2005/02/10 17:32:07 philip Exp $ */ diff --git a/drivers/dp8390/rtl8029.c b/drivers/dp8390/rtl8029.c index b3b47e37b..6741cd25a 100644 --- a/drivers/dp8390/rtl8029.c +++ b/drivers/dp8390/rtl8029.c @@ -142,7 +142,6 @@ static void rtl_init(dep) dpeth_t *dep; { u8_t reg_a, reg_b, cr, config0, config2, config3; - int i; #if DEBUG printf("rtl_init called\n"); diff --git a/drivers/dpeth/8390.c b/drivers/dpeth/8390.c index b9c31ca05..1a396ffc2 100644 --- a/drivers/dpeth/8390.c +++ b/drivers/dpeth/8390.c @@ -135,13 +135,13 @@ static void mem_nic2user(dpeth_t * dep, int pageno, int pktsize) */ static void mem_user2nic(dpeth_t *dep, int pageno, int pktsize) { +#if 1 + panic("mem_user2nic: not converted to safecopies"); +#else phys_bytes offset, phys_user; iovec_dat_s_t *iovp = &dep->de_write_iovec; int bytes, ix = 0; - panic("mem_user2nic: not converted to safecopies"); -#if 0 - /* Computes shared memory address */ offset = pageno * DP_PAGESIZE; @@ -387,7 +387,6 @@ static void ns_reset(dpeth_t * dep) static void ns_recv(dpeth_t *dep, int fromint, int size) { dp_rcvhdr_t header; - dp_rcvhdr_t dummy; unsigned pageno, curr, next; vir_bytes length; int packet_processed = FALSE; diff --git a/drivers/filter/driver.c b/drivers/filter/driver.c index f99c17e7b..62abaf0dc 100644 --- a/drivers/filter/driver.c +++ b/drivers/filter/driver.c @@ -958,7 +958,7 @@ int read_write(u64_t pos, char *bufa, char *bufb, size_t *sizep, int request) * OR if we did NOT exceed the disk size, then we should * report the driver for acting strangely! */ - if (sizes[0] < 0 || sizes[0] > *sizep || + if (sizes[0] > *sizep || cmp64(add64u(pos, sizes[0]), disk_size) < 0) return bad_driver(DRIVER_MAIN, BD_PROTO, EFAULT); @@ -980,7 +980,7 @@ int read_write(u64_t pos, char *bufa, char *bufb, size_t *sizep, int request) printf("Filter: truncated reply from backup driver\n"); /* As above */ - if (sizes[1] < 0 || sizes[1] > *sizep || + if (sizes[1] > *sizep || cmp64(add64u(pos, sizes[1]), disk_size) < 0) return bad_driver(DRIVER_BACKUP, BD_PROTO, EFAULT); diff --git a/drivers/filter/util.c b/drivers/filter/util.c index af3135e37..55fbec736 100644 --- a/drivers/filter/util.c +++ b/drivers/filter/util.c @@ -83,11 +83,3 @@ clock_t flt_alarm(clock_t dt) return next_alarm; } -/*===========================================================================* - * got_alarm * - *===========================================================================*/ -static void got_alarm(int sig) -{ - /* Do nothing. */ -} - diff --git a/drivers/fxp/fxp.c b/drivers/fxp/fxp.c index dfbbbb85f..155990e69 100644 --- a/drivers/fxp/fxp.c +++ b/drivers/fxp/fxp.c @@ -60,7 +60,7 @@ PRIVATE struct pcitab pcitab_fxp[]= typedef int irq_hook_t; /* ignore interrupt for the moment */ -#define interrupt(x) 0 +#define interrupt(x) do { } while(0) PRIVATE union tmpbuf { @@ -421,7 +421,6 @@ message *mp; static void fxp_pci_conf() { static char envvar[] = FXP_ENVVAR "#"; - static char envfmt[] = "*:d.d.d"; fxp_t *fp; long v; @@ -627,7 +626,6 @@ static int fxp_probe(fxp_t *fp, int skip) *===========================================================================*/ static void fxp_conf_hw(fxp_t *fp) { - int i; int mwi, ext_stat1, ext_stat2, lim_fifo, i82503, fc; fp->fxp_mode= FM_DISABLED; /* Superfluous */ diff --git a/drivers/lance/lance.c b/drivers/lance/lance.c index 528a40bb9..38fb9a771 100644 --- a/drivers/lance/lance.c +++ b/drivers/lance/lance.c @@ -645,7 +645,7 @@ ec_conf_t *ecp; static void ec_init(ec) ether_card_t *ec; { - int i, r; + int r; /* General initialization */ ec->flags = ECF_EMPTY; diff --git a/drivers/memory/memory.c b/drivers/memory/memory.c index ff2f58c70..c38a4b837 100644 --- a/drivers/memory/memory.c +++ b/drivers/memory/memory.c @@ -121,7 +121,6 @@ PRIVATE void sef_local_startup() PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info) { /* Initialize the memory driver. */ - u32_t ramdev_size; int i, s; /* Initialize all minor devices one by one. */ @@ -381,8 +380,6 @@ PRIVATE int m_do_close(dp, m_ptr) struct driver *dp; message *m_ptr; { - int r; - if (m_prepare(m_ptr->DEVICE) == NULL) return(ENXIO); if(m_device < 0 || m_device >= NR_DEVS) { diff --git a/drivers/orinoco/hermes.c b/drivers/orinoco/hermes.c index 158cb2e37..70d03924a 100644 --- a/drivers/orinoco/hermes.c +++ b/drivers/orinoco/hermes.c @@ -477,7 +477,7 @@ int hermes_bap_pread (hermes_t * hw, int bap, void *buf, unsigned len, int err = 0; /* reading (and writing) data goes a word a time, so should be even */ - if ((len < 0) || (len % 2)) { + if ((len % 2)) { printf("Hermes: Error in length to be read\n"); return -EINVAL; } @@ -522,7 +522,7 @@ int hermes_bap_pwrite (hermes_t * hw, int bap, const void *buf, unsigned len, int dreg = bap ? HERMES_DATA1 : HERMES_DATA0; int err = 0; - if ((len < 0) || (len % 2)) { + if ((len % 2)) { printf("Hermes: Error in length to be written\n"); return -EINVAL; } @@ -592,7 +592,7 @@ int hermes_read_ltv (hermes_t * hw, int bap, u16_t rid, unsigned bufsize, u16_t rlength, rtype; unsigned nwords; - if ((bufsize < 0) || (bufsize % 2)) { + if ((bufsize % 2)) { printf("Hermes: error in bufsize\n"); return -EINVAL; } diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 3a630ccef..b9eb5f808 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -12,6 +12,7 @@ Created: Jan 2000 by Philip Homburg #include #include #include +#include #include #include "pci.h" diff --git a/drivers/ramdisk/Makefile b/drivers/ramdisk/Makefile index 4a47f281b..4f648b210 100644 --- a/drivers/ramdisk/Makefile +++ b/drivers/ramdisk/Makefile @@ -152,13 +152,13 @@ rs.single: ../../etc/rs.single proto.gen: $(PROGRAMS) $(SCRIPTS) $(MAKEDEV) proto.sh proto sh -e proto.sh >proto.gen -.if ${OBJECT_FMT} == "ELF" -proto.gen: elfstrip - -.PHONY: elfstrip - -elfstrip: $(PROGRAMS) - ${ELFSTRIP} $(PROGRAMS) -.endif +#.if ${OBJECT_FMT} == "ELF" +#proto.gen: elfstrip +# +#.PHONY: elfstrip +# +#elfstrip: $(PROGRAMS) +# ${ELFSTRIP} $(PROGRAMS) +#.endif .include diff --git a/drivers/rtl8139/rtl8139.c b/drivers/rtl8139/rtl8139.c index 74a85479e..96ffeefb4 100644 --- a/drivers/rtl8139/rtl8139.c +++ b/drivers/rtl8139/rtl8139.c @@ -461,7 +461,6 @@ int skip; u16_t vid, did; u32_t bar; u8_t ilr; - char *dname; if ((rep->re_pcibus | rep->re_pcidev | rep->re_pcifunc) != 0) { @@ -864,7 +863,6 @@ static void rl_readv_s(const message *mp, int from_int) int i, j, n, o, s, s1, count, size; port_t port; unsigned amount, totlen, packlen; - phys_bytes dst_phys; u16_t d_start, d_end; u32_t l, rxstat = 0x12345678; re_t *rep; diff --git a/drivers/rtl8169/rtl8169.c b/drivers/rtl8169/rtl8169.c index cfb0e3c9a..465c87fc1 100644 --- a/drivers/rtl8169/rtl8169.c +++ b/drivers/rtl8169/rtl8169.c @@ -252,7 +252,6 @@ _PROTOTYPE( static void reply, (re_t *rep) ); _PROTOTYPE( static void mess_reply, (message *req, message *reply) ); _PROTOTYPE( static void check_int_events, (void) ); _PROTOTYPE( static void do_hard_int, (void) ); -_PROTOTYPE( static void rtl8169_dump, (void) ); _PROTOTYPE( static void dump_phy, (const re_t *rep) ); _PROTOTYPE( static void rl_handler, (re_t *rep) ); _PROTOTYPE( static void rl_watchdog_f, (timer_t *tp) ); @@ -474,6 +473,7 @@ static void rtl8169_update_stat(re_t *rep) rep->v_dtcc_buf->Tx1Col + rep->v_dtcc_buf->TxMCol; } +#if 0 /*===========================================================================* * rtl8169_dump * *===========================================================================*/ @@ -560,6 +560,7 @@ static void rtl8169_dump(void) printf("tx_head :%8d busy %d\t", rep->re_tx_head, rep->re_tx[rep->re_tx_head].ret_busy); } +#endif /*===========================================================================* * do_init * @@ -1003,7 +1004,6 @@ re_t *rep; port_t port; u32_t t; int i; - clock_t t0, t1; port = rep->re_base_port; diff --git a/drivers/ti1225/ti1225.c b/drivers/ti1225/ti1225.c index dceae8aa2..e33d70967 100644 --- a/drivers/ti1225/ti1225.c +++ b/drivers/ti1225/ti1225.c @@ -54,8 +54,6 @@ PRIVATE int debug; FORWARD _PROTOTYPE( void hw_init, (struct port *pp) ); FORWARD _PROTOTYPE( void map_regs, (struct port *pp, u32_t base) ); FORWARD _PROTOTYPE( void do_int, (struct port *pp) ); -FORWARD _PROTOTYPE( void do_outb, (port_t port, u8_t value) ); -FORWARD _PROTOTYPE( u8_t do_inb, (port_t port) ); /* SEF functions and variables. */ FORWARD _PROTOTYPE( void sef_local_startup, (void) ); @@ -185,7 +183,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info) PRIVATE void hw_init(struct port *pp) { - int r, devind, irq; + int devind; u8_t v8; u16_t v16; u32_t v32; @@ -312,7 +310,7 @@ PRIVATE void map_regs(struct port *pp, u32_t base) PRIVATE void do_int(struct port *pp) { - int r, devind, vcc_5v, vcc_3v, vcc_Xv, vcc_Yv, + int devind, vcc_5v, vcc_3v, vcc_Xv, vcc_Yv, socket_5v, socket_3v, socket_Xv, socket_Yv; spin_t spin; u32_t csr_event, csr_present, csr_control; @@ -492,25 +490,3 @@ PRIVATE void do_int(struct port *pp) } - -PRIVATE u8_t do_inb(port_t port) -{ - int r; - u32_t value; - - r= sys_inb(port, &value); - if (r != OK) - panic("sys_inb failed: %d", r); - return value; -} - -PRIVATE void do_outb(port_t port, u8_t value) -{ - int r; - - r= sys_outb(port, value); - if (r != OK) - panic("sys_outb failed: %d", r); -} - - diff --git a/lib/libaudiodriver/audio_fw.c b/lib/libaudiodriver/audio_fw.c index fa388340d..a0ac41b82 100644 --- a/lib/libaudiodriver/audio_fw.c +++ b/lib/libaudiodriver/audio_fw.c @@ -108,7 +108,7 @@ PUBLIC int main(int argc, char *argv[]) msg_hardware(); break; default: - dprint("%s: %d uncaught notify!\n", + printf("%s: %d uncaught notify!\n", drv.DriverName, mess.m_type); } @@ -167,7 +167,7 @@ PUBLIC int main(int argc, char *argv[]) send(caller, &repl_mess); continue; default: - dprint("%s: %d uncaught msg!\n", + printf("%s: %d uncaught msg!\n", drv.DriverName, mess.m_type); continue; } @@ -233,13 +233,13 @@ PRIVATE int init_driver(void) { /* initialize hardware*/ if (drv_init_hw() != OK) { - error("%s: Could not initialize hardware\n", drv.DriverName); + printf("%s: Could not initialize hardware\n", drv.DriverName); return EIO; } /* get irq from device driver...*/ if (drv_get_irq(&irq) != OK) { - error("%s: init driver couldn't get IRQ", drv.DriverName); + printf("%s: init driver couldn't get IRQ", drv.DriverName); return EIO; } /* TODO: execute the rest of this function only once @@ -249,7 +249,7 @@ PRIVATE int init_driver(void) { /* ...and register interrupt vector */ if ((i=sys_irqsetpolicy(irq, 0, &irq_hook_id )) != OK){ - error("%s: init driver couldn't set IRQ policy: %d", drv.DriverName, i); + printf("%s: init driver couldn't set IRQ policy: %d", drv.DriverName, i); return EIO; } irq_hook_set = TRUE; /* now signal handler knows it must unregister policy*/ @@ -276,15 +276,15 @@ PRIVATE void sef_cb_signal_handler(int signo) } if (irq_hook_set) { if (sys_irqdisable(&irq_hook_id) != OK) { - error("Could not disable IRQ\n"); + printf("Could not disable IRQ\n"); } /* get irq from device driver*/ if (drv_get_irq(&irq) != OK) { - error("Msg SIG_STOP Couldn't get IRQ"); + printf("Msg SIG_STOP Couldn't get IRQ"); } /* remove the policy */ if (sys_irqrmpolicy(&irq_hook_id) != OK) { - error("%s: Could not disable IRQ\n",drv.DriverName); + printf("%s: Could not disable IRQ\n",drv.DriverName); } } } @@ -293,8 +293,6 @@ PRIVATE int msg_open (int minor_dev_nr) { int r, read_chan, write_chan, io_ctl; special_file_t* special_file_ptr; - dprint("%s: msg_open() special file %d\n", drv.DriverName, minor_dev_nr); - special_file_ptr = get_special_file(minor_dev_nr); if(special_file_ptr == NULL) { return EIO; @@ -305,19 +303,19 @@ PRIVATE int msg_open (int minor_dev_nr) { io_ctl = special_file_ptr->io_ctl; if (read_chan==NO_CHANNEL && write_chan==NO_CHANNEL && io_ctl==NO_CHANNEL) { - error("%s: No channel specified for minor device %d!\n", + printf("%s: No channel specified for minor device %d!\n", drv.DriverName, minor_dev_nr); return EIO; } if (read_chan == write_chan && read_chan != NO_CHANNEL) { - error("%s: Read and write channels are equal: %d!\n", + printf("%s: Read and write channels are equal: %d!\n", drv.DriverName, minor_dev_nr); return EIO; } /* init driver */ if (!device_available) { if (init_driver() != OK) { - error("%s: Couldn't init driver!\n", drv.DriverName); + printf("%s: Couldn't init driver!\n", drv.DriverName); return EIO; } else { device_available = TRUE; @@ -349,12 +347,12 @@ PRIVATE int open_sub_dev(int sub_dev_nr, int dma_mode) { /* Only one open at a time per sub device */ if (sub_dev_ptr->Opened) { - error("%s: Sub device %d is already opened\n", + printf("%s: Sub device %d is already opened\n", drv.DriverName, sub_dev_nr); return EBUSY; } if (sub_dev_ptr->DmaBusy) { - error("%s: Sub device %d is still busy\n", drv.DriverName, sub_dev_nr); + printf("%s: Sub device %d is still busy\n", drv.DriverName, sub_dev_nr); return EBUSY; } /* Setup variables */ @@ -384,8 +382,6 @@ PRIVATE int msg_close(int minor_dev_nr) { int r, read_chan, write_chan, io_ctl; special_file_t* special_file_ptr; - dprint("%s: msg_close() minor device %d\n", drv.DriverName, minor_dev_nr); - special_file_ptr = get_special_file(minor_dev_nr); if(special_file_ptr == NULL) { return EIO; @@ -446,8 +442,6 @@ PRIVATE int msg_ioctl(const message *m_ptr) sub_dev_t *sub_dev_ptr; special_file_t* special_file_ptr; - dprint("%s: msg_ioctl() device %d\n", drv.DriverName, m_ptr->DEVICE); - special_file_ptr = get_special_file(m_ptr->DEVICE); if(special_file_ptr == NULL) { return EIO; @@ -456,14 +450,14 @@ PRIVATE int msg_ioctl(const message *m_ptr) chan = special_file_ptr->io_ctl; if (chan == NO_CHANNEL) { - error("%s: No io control channel specified!\n", drv.DriverName); + printf("%s: No io control channel specified!\n", drv.DriverName); return EIO; } /* get pointer to sub device data */ sub_dev_ptr = &sub_dev[chan]; if(!sub_dev_ptr->Opened) { - error("%s: io control impossible - not opened!\n", drv.DriverName); + printf("%s: io control impossible - not opened!\n", drv.DriverName); return EIO; } @@ -508,13 +502,11 @@ PRIVATE void msg_write(const message *m_ptr) int chan; sub_dev_t *sub_dev_ptr; special_file_t* special_file_ptr; - dprint("%s: msg_write() device %d\n", drv.DriverName, m_ptr->DEVICE); - special_file_ptr = get_special_file(m_ptr->DEVICE); chan = special_file_ptr->write_chan; if (chan == NO_CHANNEL) { - error("%s: No write channel specified!\n", drv.DriverName); + printf("%s: No write channel specified!\n", drv.DriverName); reply(DEV_REVIVE, m_ptr->m_source, m_ptr->USER_ENDPT, EIO); return; } @@ -523,18 +515,18 @@ PRIVATE void msg_write(const message *m_ptr) if (!sub_dev_ptr->DmaBusy) { /* get fragment size on first write */ if (drv_get_frag_size(&(sub_dev_ptr->FragSize), sub_dev_ptr->Nr) != OK){ - error("%s; Failed to get fragment size!\n", drv.DriverName); + printf("%s; Failed to get fragment size!\n", drv.DriverName); return; } } if(m_ptr->COUNT != sub_dev_ptr->FragSize) { - error("Fragment size does not match user's buffer length\n"); + printf("Fragment size does not match user's buffer length\n"); reply(DEV_REVIVE, m_ptr->m_source, m_ptr->USER_ENDPT, EINVAL); return; } /* if we are busy with something else than writing, return EBUSY */ if(sub_dev_ptr->DmaBusy && sub_dev_ptr->DmaMode != DEV_WRITE_S) { - error("Already busy with something else then writing\n"); + printf("Already busy with something else then writing\n"); reply(DEV_REVIVE, m_ptr->m_source, m_ptr->USER_ENDPT, EBUSY); return; } @@ -547,7 +539,6 @@ PRIVATE void msg_write(const message *m_ptr) data_from_user(sub_dev_ptr); if(!sub_dev_ptr->DmaBusy) { /* Dma tranfer not yet started */ - dprint("starting audio device\n"); get_started(sub_dev_ptr); sub_dev_ptr->DmaMode = DEV_WRITE_S; /* Dma mode is writing */ } @@ -559,13 +550,11 @@ PRIVATE void msg_read(message *m_ptr) int chan; sub_dev_t *sub_dev_ptr; special_file_t* special_file_ptr; - dprint("%s: msg_read() device %d\n", drv.DriverName, m_ptr->DEVICE); - special_file_ptr = get_special_file(m_ptr->DEVICE); chan = special_file_ptr->read_chan; if (chan == NO_CHANNEL) { - error("%s: No read channel specified!\n", drv.DriverName); + printf("%s: No read channel specified!\n", drv.DriverName); reply(DEV_REVIVE, m_ptr->m_source, m_ptr->USER_ENDPT, EIO); return; } @@ -574,7 +563,7 @@ PRIVATE void msg_read(message *m_ptr) if (!sub_dev_ptr->DmaBusy) { /* get fragment size on first read */ if (drv_get_frag_size(&(sub_dev_ptr->FragSize), sub_dev_ptr->Nr) != OK){ - error("%s: Could not retrieve fragment size!\n", drv.DriverName); + printf("%s: Could not retrieve fragment size!\n", drv.DriverName); reply(DEV_REVIVE, m_ptr->m_source, m_ptr->USER_ENDPT, EIO); return; @@ -582,7 +571,7 @@ PRIVATE void msg_read(message *m_ptr) } if(m_ptr->COUNT != sub_dev_ptr->FragSize) { reply(DEV_REVIVE, m_ptr->m_source, m_ptr->USER_ENDPT, EINVAL); - error("fragment size does not match message size\n"); + printf("fragment size does not match message size\n"); return; } /* if we are busy with something else than reading, reply EBUSY */ @@ -610,8 +599,6 @@ PRIVATE void msg_hardware(void) { u32_t i; - dprint("%s: handling hardware message\n", drv.DriverName); - /* while we have an interrupt */ while ( drv_int_sum()) { /* loop over all sub devices */ @@ -629,7 +616,7 @@ PRIVATE void msg_hardware(void) { * re-enable out interrupt after every interrupt. */ if ((sys_irqenable(&irq_hook_id)) != OK) { - error("%s: msg_hardware: Couldn't enable IRQ\n", drv.DriverName); + printf("%s: msg_hardware: Couldn't enable IRQ\n", drv.DriverName); } } @@ -638,7 +625,6 @@ PRIVATE void msg_status(message *m_ptr) { int i; - dprint("got a status message\n"); for (i = 0; i < drv.NrOfSubDevices; i++) { if(sub_dev[i].ReadyToRevive) @@ -671,15 +657,12 @@ PRIVATE void handle_int_write(int sub_dev_nr) sub_dev_ptr = &sub_dev[sub_dev_nr]; - dprint("Finished playing dma[%d] ", sub_dev_ptr->DmaReadNext); sub_dev_ptr->DmaReadNext = (sub_dev_ptr->DmaReadNext + 1) % sub_dev_ptr->NrOfDmaFragments; sub_dev_ptr->DmaLength -= 1; if (sub_dev_ptr->BufLength != 0) { /* Data in extra buf, copy to Dma buf */ - dprint(" buf[%d] -> dma[%d] ", - sub_dev_ptr->BufReadNext, sub_dev_ptr->DmaFillNext); memcpy(sub_dev_ptr->DmaPtr + sub_dev_ptr->DmaFillNext * sub_dev_ptr->FragSize, sub_dev_ptr->ExtraBuf + @@ -701,25 +684,20 @@ PRIVATE void handle_int_write(int sub_dev_nr) if(sub_dev_ptr->DmaLength == 0) { /* Dma buffer empty, stop Dma transfer */ sub_dev_ptr->OutOfData = TRUE; /* we're out of data */ - dprint("No more work...!\n"); if (!sub_dev_ptr->Opened) { close_sub_dev(sub_dev_ptr->Nr); - dprint("Stopping sub device %d\n", sub_dev_ptr->Nr); return; } - dprint("Pausing sub device %d\n",sub_dev_ptr->Nr); drv_pause(sub_dev_ptr->Nr); return; } - dprint("\n"); - /* confirm and reenable interrupt from this sub dev */ drv_reenable_int(sub_dev_nr); #if 0 /* reenable irq_hook*/ if (sys_irqenable(&irq_hook_id != OK) { - error("%s Couldn't enable IRQ\n", drv.DriverName); + printf("%s Couldn't enable IRQ\n", drv.DriverName); } #endif } @@ -732,7 +710,6 @@ PRIVATE void handle_int_read(int sub_dev_nr) sub_dev_ptr = &sub_dev[sub_dev_nr]; - dprint("Device filled dma[%d]\n", sub_dev_ptr->DmaFillNext); sub_dev_ptr->DmaLength += 1; sub_dev_ptr->DmaFillNext = (sub_dev_ptr->DmaFillNext + 1) % sub_dev_ptr->NrOfDmaFragments; @@ -744,7 +721,7 @@ PRIVATE void handle_int_read(int sub_dev_nr) /* if dma buffer full */ if (sub_dev_ptr->BufLength == sub_dev_ptr->NrOfExtraBuffers) { - error("All buffers full, we have a problem.\n"); + printf("All buffers full, we have a problem.\n"); drv_stop(sub_dev_nr); /* stop the sub device */ sub_dev_ptr->DmaBusy = FALSE; sub_dev_ptr->ReviveStatus = 0; /* no data for user, @@ -754,8 +731,6 @@ PRIVATE void handle_int_read(int sub_dev_nr) } else { /* dma full, still room in extra buf; copy from dma to extra buf */ - dprint("dma full: going to copy buf[%d] <- dma[%d]\n", - sub_dev_ptr->BufFillNext, sub_dev_ptr->DmaReadNext); memcpy(sub_dev_ptr->ExtraBuf + sub_dev_ptr->BufFillNext * sub_dev_ptr->FragSize, sub_dev_ptr->DmaPtr + @@ -774,7 +749,7 @@ PRIVATE void handle_int_read(int sub_dev_nr) #if 0 /* reenable irq_hook*/ if (sys_irqenable(&irq_hook_id) != OK) { - error("%s: Couldn't reenable IRQ", drv.DriverName); + printf("%s: Couldn't reenable IRQ", drv.DriverName); } #endif } @@ -785,12 +760,12 @@ PRIVATE int get_started(sub_dev_t *sub_dev_ptr) { /* enable interrupt messages from MINIX */ if ((i=sys_irqenable(&irq_hook_id)) != OK) { - error("%s: Couldn't enable IRQs: error code %u",drv.DriverName, (unsigned int) i); + printf("%s: Couldn't enable IRQs: error code %u",drv.DriverName, (unsigned int) i); return EIO; } /* let the lower part of the driver start the device */ if (drv_start(sub_dev_ptr->Nr, sub_dev_ptr->DmaMode) != OK) { - error("%s: Could not start device %d\n", + printf("%s: Could not start device %d\n", drv.DriverName, sub_dev_ptr->Nr); } @@ -822,7 +797,6 @@ PRIVATE void data_from_user(sub_dev_t *subdev) (phys_bytes)subdev->FragSize, D); - dprint(" user -> dma[%d]\n", subdev->DmaFillNext); subdev->DmaLength += 1; subdev->DmaFillNext = (subdev->DmaFillNext + 1) % subdev->NrOfDmaFragments; @@ -835,7 +809,6 @@ PRIVATE void data_from_user(sub_dev_t *subdev) subdev->BufFillNext * subdev->FragSize, (phys_bytes)subdev->FragSize, D); - dprint(" user -> buf[%d]\n", subdev->BufFillNext); subdev->BufLength += 1; subdev->BufFillNext = @@ -847,7 +820,7 @@ PRIVATE void data_from_user(sub_dev_t *subdev) drv_reenable_int(subdev->Nr); /* reenable irq_hook*/ if ((sys_irqenable(&irq_hook_id)) != OK) { - error("%s: Couldn't enable IRQ", drv.DriverName); + printf("%s: Couldn't enable IRQ", drv.DriverName); } drv_resume(subdev->Nr); /* resume resume the sub device */ } @@ -890,8 +863,6 @@ PRIVATE void data_to_user(sub_dev_t *sub_dev_ptr) sub_dev_ptr->BufReadNext * sub_dev_ptr->FragSize, (phys_bytes)sub_dev_ptr->FragSize, D); - dprint(" copied buf[%d] to user\n", sub_dev_ptr->BufReadNext); - /* adjust the buffer status variables */ sub_dev_ptr->BufReadNext = (sub_dev_ptr->BufReadNext + 1) % sub_dev_ptr->NrOfExtraBuffers; @@ -905,8 +876,6 @@ PRIVATE void data_to_user(sub_dev_t *sub_dev_ptr) sub_dev_ptr->DmaReadNext * sub_dev_ptr->FragSize, (phys_bytes)sub_dev_ptr->FragSize, D); - dprint(" copied dma[%d] to user\n", sub_dev_ptr->DmaReadNext); - /* adjust the buffer status variables */ sub_dev_ptr->DmaReadNext = (sub_dev_ptr->DmaReadNext + 1) % sub_dev_ptr->NrOfDmaFragments; @@ -946,7 +915,7 @@ PRIVATE int init_buffers(sub_dev_t *sub_dev_ptr) size= sub_dev_ptr->DmaSize + 64 * 1024; base= alloc_contig(size, AC_ALIGN4K, &ph); if (!base) { - error("%s: failed to allocate dma buffer for a channel\n", + printf("%s: failed to allocate dma buffer for a channel\n", drv.DriverName); return EIO; } @@ -958,7 +927,7 @@ PRIVATE int init_buffers(sub_dev_t *sub_dev_ptr) if (!(sub_dev_ptr->ExtraBuf = malloc(sub_dev_ptr->NrOfExtraBuffers * sub_dev_ptr->DmaSize / sub_dev_ptr->NrOfDmaFragments))) { - error("%s failed to allocate extra buffer for a channel\n", + printf("%s failed to allocate extra buffer for a channel\n", drv.DriverName); return EIO; } @@ -986,7 +955,7 @@ PRIVATE int init_buffers(sub_dev_t *sub_dev_ptr) return OK; #else /* CHIP != INTEL */ - error("%s: init_buffers() failed, CHIP != INTEL", drv.DriverName); + printf("%s: init_buffers() failed, CHIP != INTEL", drv.DriverName); return EIO; #endif /* CHIP == INTEL */ } @@ -1017,7 +986,7 @@ PRIVATE special_file_t* get_special_file(int minor_dev_nr) { } } - error("%s: No subdevice specified for minor device %d!\n", + printf("%s: No subdevice specified for minor device %d!\n", drv.DriverName, minor_dev_nr); return NULL;