cleanup: use pr_debug instead of home-brewed TRDBG
PATCH 1/1 cleanup: use pr_debug instead of home-brewed TRDBG
Howdy,
Yet another sound/oss/trident cleanup patch. This one replace the TRDBG debugging macro with the standard pr_debug. Patch is from Eugene Teo <[email protected]>, slightly modified by me to apply against 2.6.0-rc1-mm1 with the other cleanup patches applied.
Patch compiles and tested. Please apply. No whitespace has been added in the creation of this patch (I hope).
Incidentally, I had a patch to do this in 2.5, and then someone "synched the driver with 2.4" and restored the TRDBG macro. I was too amused to fix it at the time, but now is a good time to do it. I wonder if we can kill it this time...
Cheers,
Muli
sound/oss/trident.c +67 -61
@@ -37,6 +37,10 @@* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * History +* v0.14.10j +* January 3 2004 Eugene Teo <[email protected]> +* minor cleanup to use pr_debug instead of TRDBG since it is already +* defined in linux/kernel.h. * v0.14.10i * December 29 2003 Muli Ben-Yehuda <[email protected]> * major cleanup for 2.6, fix a few error patch buglets
@@ -223,7 +227,7 @@#include "trident.h" -#define DRIVER_VERSION "0.14.10i-2.6" +#define DRIVER_VERSION "0.14.10j-2.6"/* magic numbers to protect our data structures */ #define TRIDENT_CARD_MAGIC 0x5072696E/* "Prin" */
@@ -550,8 +554,8 @@outl (global_control,TRID_REG (card,T4D_LFO_GC_CIR )); -TRDBG ("trident: Enable Loop Interrupts, globctl = 0x%08X\n" , -inl (TRID_REG (card,T4D_LFO_GC_CIR ))); +pr_debug ("trident: Enable Loop Interrupts, globctl = 0x%08X\n" , +inl (TRID_REG (card,T4D_LFO_GC_CIR )));return 1 ; }
@@ -565,8 +569,8 @@ global_control &= ~(ENDLP_IE |MIDLP_IE );outl (global_control,TRID_REG (card,T4D_LFO_GC_CIR )); -TRDBG ("trident: Disabled Loop Interrupts, globctl = 0x%08X\n" , - global_control); +pr_debug ("trident: Disabled Loop Interrupts, globctl = 0x%08X\n" , + global_control);return 1 ; }
@@ -584,9 +588,9 @@#ifdef DEBUG reg =inl (TRID_REG (card, addr)); -TRDBG ("trident: enabled IRQ on channel %d, %s = 0x%08x(addr:%X)\n" , - channel, addr ==T4D_AINTEN_B ?"AINTEN_B" :"AINTEN_A" , - reg, addr); +pr_debug ("trident: enabled IRQ on channel %d, %s = 0x%08x(addr:%X)\n" , + channel, addr ==T4D_AINTEN_B ?"AINTEN_B" :"AINTEN_A" , + reg, addr);#endif /* DEBUG */ }
@@ -606,9 +610,9 @@#ifdef DEBUG reg =inl (TRID_REG (card, addr)); -TRDBG ("trident: disabled IRQ on channel %d, %s = 0x%08x(addr:%X)\n" , - channel, addr ==T4D_AINTEN_B ?"AINTEN_B" :"AINTEN_A" , - reg, addr); +pr_debug ("trident: disabled IRQ on channel %d, %s = 0x%08x(addr:%X)\n" , + channel, addr ==T4D_AINTEN_B ?"AINTEN_B" :"AINTEN_A" , + reg, addr);#endif /* DEBUG */ }
@@ -627,9 +631,9 @@#ifdef DEBUG reg =inl (TRID_REG (card, addr)); -TRDBG ("trident: start voice on channel %d, %s = 0x%08x(addr:%X)\n" , - channel, addr ==T4D_START_B ?"START_B" :"START_A" , - reg, addr); +pr_debug ("trident: start voice on channel %d, %s = 0x%08x(addr:%X)\n" , + channel, addr ==T4D_START_B ?"START_B" :"START_A" , + reg, addr);#endif /* DEBUG */ }
@@ -648,9 +652,9 @@#ifdef DEBUG reg =inl (TRID_REG (card, addr)); -TRDBG ("trident: stop voice on channel %d, %s = 0x%08x(addr:%X)\n" , - channel, addr ==T4D_STOP_B ?"STOP_B" :"STOP_A" , - reg, addr); +pr_debug ("trident: stop voice on channel %d, %s = 0x%08x(addr:%X)\n" , + channel, addr ==T4D_STOP_B ?"STOP_B" :"STOP_A" , + reg, addr);#endif /* DEBUG */ }
@@ -670,8 +674,9 @@#ifdef DEBUG if (reg & mask) -TRDBG ("trident: channel %d has interrupt, %s = 0x%08x\n" , - channel, reg ==T4D_AINT_B ?"AINT_B" :"AINT_A" , reg); +pr_debug ("trident: channel %d has interrupt, %s = 0x%08x\n" , + channel, reg ==T4D_AINT_B ?"AINT_B" :"AINT_A" , + reg);#endif /* DEBUG */ return (reg & mask) ?1 :0 ; }
@@ -689,8 +694,8 @@#ifdef DEBUG reg =inl (TRID_REG (card,T4D_AINT_B )); -TRDBG ("trident: Ack channel %d interrupt, AINT_B = 0x%08x\n" , - channel, reg); +pr_debug ("trident: Ack channel %d interrupt, AINT_B = 0x%08x\n" , + channel, reg);#endif /* DEBUG */ }
@@ -950,7 +955,7 @@trident_write_voice_regs (state); -TRDBG ("trident: called trident_set_dac_rate : rate = %d\n" , rate); +pr_debug ("trident: called trident_set_dac_rate : rate = %d\n" , rate);return rate; }
@@ -971,7 +976,7 @@trident_write_voice_regs (state); -TRDBG ("trident: called trident_set_adc_rate : rate = %d\n" , rate); +pr_debug ("trident: called trident_set_adc_rate : rate = %d\n" , rate);return rate; }
@@ -1018,9 +1023,9 @@/* stereo */ channel->control |=CHANNEL_STEREO ; -TRDBG ("trident: trident_play_setup, LBA = 0x%08x, Delta = 0x%08x, " -"ESO = 0x%08x, Control = 0x%08x\n" , channel->lba, - channel->delta, channel->eso, channel->control); +pr_debug ("trident: trident_play_setup, LBA = 0x%08x, Delta = 0x%08x, " +"ESO = 0x%08x, Control = 0x%08x\n" , channel->lba, + channel->delta, channel->eso, channel->control);trident_write_voice_regs (state); }
@@ -1105,9 +1110,9 @@/* stereo */ channel->control |=CHANNEL_STEREO ; -TRDBG ("trident: trident_rec_setup, LBA = 0x%08x, Delat = 0x%08x, " -"ESO = 0x%08x, Control = 0x%08x\n" , channel->lba, - channel->delta, channel->eso, channel->control); +pr_debug ("trident: trident_rec_setup, LBA = 0x%08x, Delat = 0x%08x, " +"ESO = 0x%08x, Control = 0x%08x\n" , channel->lba, + channel->delta, channel->eso, channel->control);trident_write_voice_regs (state); }
@@ -1141,8 +1146,8 @@return 0 ; } -TRDBG ("trident: trident_get_dma_addr: chip reported channel: %d, " -"cso = 0x%04x\n" , dmabuf->channel->num, cso); +pr_debug ("trident: trident_get_dma_addr: chip reported channel: %d, " +"cso = 0x%04x\n" , dmabuf->channel->num, cso);/* ESO and CSO are in units of Samples, convert to byte offset */ cso <<= sample_shift[dmabuf->fmt];
@@ -1268,8 +1273,8 @@ &dmabuf->dma_handle)))return -ENOMEM ; -TRDBG ("trident: allocated %ld (order = %d) bytes at %p\n" , -PAGE_SIZE << order, order, rawbuf); +pr_debug ("trident: allocated %ld (order = %d) bytes at %p\n" , +PAGE_SIZE << order, order, rawbuf); dmabuf->ready = dmabuf->mapped =0 ; dmabuf->rawbuf = rawbuf;
@@ -1415,11 +1420,11 @@/* set the ready flag for the dma buffer */ dmabuf->ready =1 ; -TRDBG ("trident: prog_dmabuf(%d), sample rate = %d, " -"format = %d, numfrag = %d, fragsize = %d " -"dmasize = %d\n" , dmabuf->channel->num, - dmabuf->rate, dmabuf->fmt, dmabuf->numfrag, - dmabuf->fragsize, dmabuf->dmasize); +pr_debug ("trident: prog_dmabuf(%d), sample rate = %d, " +"format = %d, numfrag = %d, fragsize = %d " +"dmasize = %d\n" , dmabuf->channel->num, + dmabuf->rate, dmabuf->fmt, dmabuf->numfrag, + dmabuf->fragsize, dmabuf->dmasize); }unlock_set_fmt (state);return 0 ;
@@ -1791,7 +1796,7 @@/* FIXED: read interrupt status only once */ irq_status =inl (TRID_REG (card,T4D_AINT_A )); -TRDBG ("cyber_address_interrupt: irq_status 0x%X\n" , irq_status); +pr_debug ("cyber_address_interrupt: irq_status 0x%X\n" , irq_status);for (i =0 ; i <NR_HW_CH ; i++) { channel =31 - i;
@@ -1799,7 +1804,7 @@/* clear bit by writing a 1, zeroes are ignored */ outl ((1 << channel),TRID_REG (card,T4D_AINT_A )); -TRDBG ("cyber_interrupt: channel %d\n" , channel); +pr_debug ("cyber_interrupt: channel %d\n" , channel);if ((state = card->states[i]) !=NULL ) {trident_update_ptr (state);
@@ -1823,7 +1828,8 @@spin_lock (&card->lock); event =inl (TRID_REG (card,T4D_MISCINT )); -TRDBG ("trident: trident_interrupt called, MISCINT = 0x%08x\n" , event); +pr_debug ("trident: trident_interrupt called, MISCINT = 0x%08x\n" , + event);if (event &ADDRESS_IRQ ) { card->address_interrupt (card);
@@ -1864,7 +1870,7 @@unsigned swptr;int cnt; -TRDBG ("trident: trident_read called, count = %d\n" , count); +pr_debug ("trident: trident_read called, count = %d\n" , count);VALIDATE_STATE (state);if (ppos != &file->f_pos)
@@ -1921,10 +1927,10 @@which results in a (potential) buffer overrun. And worse, there is NOTHING we can do to prevent it. */ if (!interruptible_sleep_on_timeout (&dmabuf->wait, tmo)) { -TRDBG (KERN_ERR "trident: recording schedule timeout, " -"dmasz %u fragsz %u count %i hwptr %u swptr %u\n" , - dmabuf->dmasize, dmabuf->fragsize, dmabuf->count, - dmabuf->hwptr, dmabuf->swptr); +pr_debug (KERN_ERR "trident: recording schedule timeout, " +"dmasz %u fragsz %u count %i hwptr %u swptr %u\n" , + dmabuf->dmasize, dmabuf->fragsize, dmabuf->count, + dmabuf->hwptr, dmabuf->swptr);/* a buffer overrun, we delay the recovery until next time the while loop begin and we REALLY have space to record */
@@ -1982,7 +1988,7 @@unsigned int copy_count;int lret;/* for lock_set_fmt */ -TRDBG ("trident: trident_write called, count = %d\n" , count); +pr_debug ("trident: trident_write called, count = %d\n" , count);VALIDATE_STATE (state);if (ppos != &file->f_pos)
@@ -2054,11 +2060,11 @@/* buffer underrun. And worse, there is NOTHING we */ /* can do to prevent it. */ if (!interruptible_sleep_on_timeout (&dmabuf->wait, tmo)) { -TRDBG (KERN_ERR "trident: playback schedule " -"timeout, dmasz %u fragsz %u count %i " -"hwptr %u swptr %u\n" , dmabuf->dmasize, - dmabuf->fragsize, dmabuf->count, - dmabuf->hwptr, dmabuf->swptr); +pr_debug (KERN_ERR "trident: playback schedule " +"timeout, dmasz %u fragsz %u count %i " +"hwptr %u swptr %u\n" , dmabuf->dmasize, + dmabuf->fragsize, dmabuf->count, + dmabuf->hwptr, dmabuf->swptr);/* a buffer underrun, we delay the recovery */ /* until next time the while loop begin and */
@@ -2249,8 +2255,8 @@ mapped = ((file->f_mode & (FMODE_WRITE |FMODE_READ )) && dmabuf->mapped); -TRDBG ("trident: trident_ioctl, command = %2d, arg = 0x%08x\n" , -_IOC_NR (cmd), arg ? *(int *) arg :0 ); +pr_debug ("trident: trident_ioctl, command = %2d, arg = 0x%08x\n" , +_IOC_NR (cmd), arg ? *(int *) arg :0 );switch (cmd) {case OSS_GETVERSION :
@@ -2812,8 +2818,8 @@ state->open_mode |= file->f_mode & (FMODE_READ |FMODE_WRITE );up (&card->open_sem); -TRDBG ("trident: open virtual channel %d, hard channel %d\n" , - state->virt, dmabuf->channel->num); +pr_debug ("trident: open virtual channel %d, hard channel %d\n" , + state->virt, dmabuf->channel->num);return 0 ; }
@@ -2835,8 +2841,8 @@drain_dac (state, file->f_flags &O_NONBLOCK ); } -TRDBG ("trident: closing virtual channel %d, hard channel %d\n" , - state->virt, dmabuf->channel->num); +pr_debug ("trident: closing virtual channel %d, hard channel %d\n" , + state->virt, dmabuf->channel->num);/* stop DMA state machine and free DMA buffers/channels */ down (&card->open_sem);
@@ -3032,7 +3038,7 @@udelay (20 ); }if (!block) { -TRDBG ("accesscodecsemaphore: try unlock\n" ); +pr_debug ("accesscodecsemaphore: try unlock\n" ); block =1 ; goto unlock; }
@@ -3115,7 +3121,7 @@if (ncount <=0 )break ;if (ncount-- ==1 ) { -TRDBG ("ali_ac97_read :try clear busy flag\n" ); +pr_debug ("ali_ac97_read :try clear busy flag\n" ); aud_reg =inl (TRID_REG (card,ALI_AC97_WRITE ));outl ((aud_reg &0xffff7fff ),TRID_REG (card,ALI_AC97_WRITE ));
@@ -3181,7 +3187,7 @@if (ncount <=0 )break ;if (ncount-- ==1 ) { -TRDBG ("ali_ac97_set :try clear busy flag!!\n" ); +pr_debug ("ali_ac97_set :try clear busy flag!!\n" );outw (wcontrol &0x7fff ,TRID_REG (card,ALI_AC97_WRITE )); }
sound/oss/trident.h +0 -12
@@ -355,16 +355,4 @@ return r; } -#ifdef DEBUG - -#define TRDBG(msg, args...) do { \ - printk(DEBUG msg , ##args ); \ -} while (0) - -#else /* !defined(DEBUG) */ - -#define TRDBG(msg, args...) do { } while (0) - -#endif /* DEBUG */ -#endif /* __TRID4DWAVE_H */
Signature · 4 lines
Muli Ben-Yehuda http://www.mulix.org | http://mulix.livejournal.com/ "the nucleus of linux oscillates my world" - gccbot@#offtopic