Commit 13a2158c authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] trident: use pr_debug instead of home-brewed TRDBG

From: Muli Ben-Yehuda <mulix@mulix.org>

Yet another sound/oss/trident cleanup patch.  This one replace the TRDBG
debugging macro with the standard pr_debug.  Patch is from Eugene Teo
<eugene.teo@eugeneteo.net>, slightly modified by me to apply against
2.6.0-rc1-mm1 with the other cleanup patches applied.
parent 0d7bcc30
...@@ -37,6 +37,10 @@ ...@@ -37,6 +37,10 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* *
* History * History
* v0.14.10j
* January 3 2004 Eugene Teo <eugeneteo@eugeneteo.net>
* minor cleanup to use pr_debug instead of TRDBG since it is already
* defined in linux/kernel.h.
* v0.14.10i * v0.14.10i
* December 29 2003 Muli Ben-Yehuda <mulix@mulix.org> * December 29 2003 Muli Ben-Yehuda <mulix@mulix.org>
* major cleanup for 2.6, fix a few error patch buglets * major cleanup for 2.6, fix a few error patch buglets
...@@ -223,7 +227,7 @@ ...@@ -223,7 +227,7 @@
#include "trident.h" #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 */ /* magic numbers to protect our data structures */
#define TRIDENT_CARD_MAGIC 0x5072696E /* "Prin" */ #define TRIDENT_CARD_MAGIC 0x5072696E /* "Prin" */
...@@ -550,8 +554,8 @@ trident_enable_loop_interrupts(struct trident_card *card) ...@@ -550,8 +554,8 @@ trident_enable_loop_interrupts(struct trident_card *card)
outl(global_control, TRID_REG(card, T4D_LFO_GC_CIR)); outl(global_control, TRID_REG(card, T4D_LFO_GC_CIR));
TRDBG("trident: Enable Loop Interrupts, globctl = 0x%08X\n", pr_debug("trident: Enable Loop Interrupts, globctl = 0x%08X\n",
inl(TRID_REG(card, T4D_LFO_GC_CIR))); inl(TRID_REG(card, T4D_LFO_GC_CIR)));
return 1; return 1;
} }
...@@ -565,8 +569,8 @@ trident_disable_loop_interrupts(struct trident_card *card) ...@@ -565,8 +569,8 @@ trident_disable_loop_interrupts(struct trident_card *card)
global_control &= ~(ENDLP_IE | MIDLP_IE); global_control &= ~(ENDLP_IE | MIDLP_IE);
outl(global_control, TRID_REG(card, T4D_LFO_GC_CIR)); outl(global_control, TRID_REG(card, T4D_LFO_GC_CIR));
TRDBG("trident: Disabled Loop Interrupts, globctl = 0x%08X\n", pr_debug("trident: Disabled Loop Interrupts, globctl = 0x%08X\n",
global_control); global_control);
return 1; return 1;
} }
...@@ -584,9 +588,9 @@ trident_enable_voice_irq(struct trident_card *card, unsigned int channel) ...@@ -584,9 +588,9 @@ trident_enable_voice_irq(struct trident_card *card, unsigned int channel)
#ifdef DEBUG #ifdef DEBUG
reg = inl(TRID_REG(card, addr)); reg = inl(TRID_REG(card, addr));
TRDBG("trident: enabled IRQ on channel %d, %s = 0x%08x(addr:%X)\n", pr_debug("trident: enabled IRQ on channel %d, %s = 0x%08x(addr:%X)\n",
channel, addr == T4D_AINTEN_B ? "AINTEN_B" : "AINTEN_A", channel, addr == T4D_AINTEN_B ? "AINTEN_B" : "AINTEN_A",
reg, addr); reg, addr);
#endif /* DEBUG */ #endif /* DEBUG */
} }
...@@ -606,9 +610,9 @@ trident_disable_voice_irq(struct trident_card *card, unsigned int channel) ...@@ -606,9 +610,9 @@ trident_disable_voice_irq(struct trident_card *card, unsigned int channel)
#ifdef DEBUG #ifdef DEBUG
reg = inl(TRID_REG(card, addr)); reg = inl(TRID_REG(card, addr));
TRDBG("trident: disabled IRQ on channel %d, %s = 0x%08x(addr:%X)\n", pr_debug("trident: disabled IRQ on channel %d, %s = 0x%08x(addr:%X)\n",
channel, addr == T4D_AINTEN_B ? "AINTEN_B" : "AINTEN_A", channel, addr == T4D_AINTEN_B ? "AINTEN_B" : "AINTEN_A",
reg, addr); reg, addr);
#endif /* DEBUG */ #endif /* DEBUG */
} }
...@@ -627,9 +631,9 @@ trident_start_voice(struct trident_card *card, unsigned int channel) ...@@ -627,9 +631,9 @@ trident_start_voice(struct trident_card *card, unsigned int channel)
#ifdef DEBUG #ifdef DEBUG
reg = inl(TRID_REG(card, addr)); reg = inl(TRID_REG(card, addr));
TRDBG("trident: start voice on channel %d, %s = 0x%08x(addr:%X)\n", pr_debug("trident: start voice on channel %d, %s = 0x%08x(addr:%X)\n",
channel, addr == T4D_START_B ? "START_B" : "START_A", channel, addr == T4D_START_B ? "START_B" : "START_A",
reg, addr); reg, addr);
#endif /* DEBUG */ #endif /* DEBUG */
} }
...@@ -648,9 +652,9 @@ trident_stop_voice(struct trident_card *card, unsigned int channel) ...@@ -648,9 +652,9 @@ trident_stop_voice(struct trident_card *card, unsigned int channel)
#ifdef DEBUG #ifdef DEBUG
reg = inl(TRID_REG(card, addr)); reg = inl(TRID_REG(card, addr));
TRDBG("trident: stop voice on channel %d, %s = 0x%08x(addr:%X)\n", pr_debug("trident: stop voice on channel %d, %s = 0x%08x(addr:%X)\n",
channel, addr == T4D_STOP_B ? "STOP_B" : "STOP_A", channel, addr == T4D_STOP_B ? "STOP_B" : "STOP_A",
reg, addr); reg, addr);
#endif /* DEBUG */ #endif /* DEBUG */
} }
...@@ -670,8 +674,9 @@ trident_check_channel_interrupt(struct trident_card *card, unsigned int channel) ...@@ -670,8 +674,9 @@ trident_check_channel_interrupt(struct trident_card *card, unsigned int channel)
#ifdef DEBUG #ifdef DEBUG
if (reg & mask) if (reg & mask)
TRDBG("trident: channel %d has interrupt, %s = 0x%08x\n", pr_debug("trident: channel %d has interrupt, %s = 0x%08x\n",
channel, reg == T4D_AINT_B ? "AINT_B" : "AINT_A", reg); channel, reg == T4D_AINT_B ? "AINT_B" : "AINT_A",
reg);
#endif /* DEBUG */ #endif /* DEBUG */
return (reg & mask) ? 1 : 0; return (reg & mask) ? 1 : 0;
} }
...@@ -689,8 +694,8 @@ trident_ack_channel_interrupt(struct trident_card *card, unsigned int channel) ...@@ -689,8 +694,8 @@ trident_ack_channel_interrupt(struct trident_card *card, unsigned int channel)
#ifdef DEBUG #ifdef DEBUG
reg = inl(TRID_REG(card, T4D_AINT_B)); reg = inl(TRID_REG(card, T4D_AINT_B));
TRDBG("trident: Ack channel %d interrupt, AINT_B = 0x%08x\n", pr_debug("trident: Ack channel %d interrupt, AINT_B = 0x%08x\n",
channel, reg); channel, reg);
#endif /* DEBUG */ #endif /* DEBUG */
} }
...@@ -950,7 +955,7 @@ trident_set_dac_rate(struct trident_state *state, unsigned int rate) ...@@ -950,7 +955,7 @@ trident_set_dac_rate(struct trident_state *state, unsigned int rate)
trident_write_voice_regs(state); 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; return rate;
} }
...@@ -971,7 +976,7 @@ trident_set_adc_rate(struct trident_state *state, unsigned int rate) ...@@ -971,7 +976,7 @@ trident_set_adc_rate(struct trident_state *state, unsigned int rate)
trident_write_voice_regs(state); 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; return rate;
} }
...@@ -1018,9 +1023,9 @@ trident_play_setup(struct trident_state *state) ...@@ -1018,9 +1023,9 @@ trident_play_setup(struct trident_state *state)
/* stereo */ /* stereo */
channel->control |= CHANNEL_STEREO; channel->control |= CHANNEL_STEREO;
TRDBG("trident: trident_play_setup, LBA = 0x%08x, Delta = 0x%08x, " pr_debug("trident: trident_play_setup, LBA = 0x%08x, Delta = 0x%08x, "
"ESO = 0x%08x, Control = 0x%08x\n", channel->lba, "ESO = 0x%08x, Control = 0x%08x\n", channel->lba,
channel->delta, channel->eso, channel->control); channel->delta, channel->eso, channel->control);
trident_write_voice_regs(state); trident_write_voice_regs(state);
} }
...@@ -1105,9 +1110,9 @@ trident_rec_setup(struct trident_state *state) ...@@ -1105,9 +1110,9 @@ trident_rec_setup(struct trident_state *state)
/* stereo */ /* stereo */
channel->control |= CHANNEL_STEREO; channel->control |= CHANNEL_STEREO;
TRDBG("trident: trident_rec_setup, LBA = 0x%08x, Delat = 0x%08x, " pr_debug("trident: trident_rec_setup, LBA = 0x%08x, Delat = 0x%08x, "
"ESO = 0x%08x, Control = 0x%08x\n", channel->lba, "ESO = 0x%08x, Control = 0x%08x\n", channel->lba,
channel->delta, channel->eso, channel->control); channel->delta, channel->eso, channel->control);
trident_write_voice_regs(state); trident_write_voice_regs(state);
} }
...@@ -1141,8 +1146,8 @@ trident_get_dma_addr(struct trident_state *state) ...@@ -1141,8 +1146,8 @@ trident_get_dma_addr(struct trident_state *state)
return 0; return 0;
} }
TRDBG("trident: trident_get_dma_addr: chip reported channel: %d, " pr_debug("trident: trident_get_dma_addr: chip reported channel: %d, "
"cso = 0x%04x\n", dmabuf->channel->num, cso); "cso = 0x%04x\n", dmabuf->channel->num, cso);
/* ESO and CSO are in units of Samples, convert to byte offset */ /* ESO and CSO are in units of Samples, convert to byte offset */
cso <<= sample_shift[dmabuf->fmt]; cso <<= sample_shift[dmabuf->fmt];
...@@ -1268,8 +1273,8 @@ alloc_dmabuf(struct dmabuf *dmabuf, struct pci_dev *pci_dev, int order) ...@@ -1268,8 +1273,8 @@ alloc_dmabuf(struct dmabuf *dmabuf, struct pci_dev *pci_dev, int order)
&dmabuf->dma_handle))) &dmabuf->dma_handle)))
return -ENOMEM; return -ENOMEM;
TRDBG("trident: allocated %ld (order = %d) bytes at %p\n", pr_debug("trident: allocated %ld (order = %d) bytes at %p\n",
PAGE_SIZE << order, order, rawbuf); PAGE_SIZE << order, order, rawbuf);
dmabuf->ready = dmabuf->mapped = 0; dmabuf->ready = dmabuf->mapped = 0;
dmabuf->rawbuf = rawbuf; dmabuf->rawbuf = rawbuf;
...@@ -1415,11 +1420,11 @@ prog_dmabuf(struct trident_state *state, enum dmabuf_mode rec) ...@@ -1415,11 +1420,11 @@ prog_dmabuf(struct trident_state *state, enum dmabuf_mode rec)
/* set the ready flag for the dma buffer */ /* set the ready flag for the dma buffer */
dmabuf->ready = 1; dmabuf->ready = 1;
TRDBG("trident: prog_dmabuf(%d), sample rate = %d, " pr_debug("trident: prog_dmabuf(%d), sample rate = %d, "
"format = %d, numfrag = %d, fragsize = %d " "format = %d, numfrag = %d, fragsize = %d "
"dmasize = %d\n", dmabuf->channel->num, "dmasize = %d\n", dmabuf->channel->num,
dmabuf->rate, dmabuf->fmt, dmabuf->numfrag, dmabuf->rate, dmabuf->fmt, dmabuf->numfrag,
dmabuf->fragsize, dmabuf->dmasize); dmabuf->fragsize, dmabuf->dmasize);
} }
unlock_set_fmt(state); unlock_set_fmt(state);
return 0; return 0;
...@@ -1791,7 +1796,7 @@ cyber_address_interrupt(struct trident_card *card) ...@@ -1791,7 +1796,7 @@ cyber_address_interrupt(struct trident_card *card)
/* FIXED: read interrupt status only once */ /* FIXED: read interrupt status only once */
irq_status = inl(TRID_REG(card, T4D_AINT_A)); 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++) { for (i = 0; i < NR_HW_CH; i++) {
channel = 31 - i; channel = 31 - i;
...@@ -1799,7 +1804,7 @@ cyber_address_interrupt(struct trident_card *card) ...@@ -1799,7 +1804,7 @@ cyber_address_interrupt(struct trident_card *card)
/* clear bit by writing a 1, zeroes are ignored */ /* clear bit by writing a 1, zeroes are ignored */
outl((1 << channel), TRID_REG(card, T4D_AINT_A)); 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) { if ((state = card->states[i]) != NULL) {
trident_update_ptr(state); trident_update_ptr(state);
...@@ -1823,7 +1828,8 @@ trident_interrupt(int irq, void *dev_id, struct pt_regs *regs) ...@@ -1823,7 +1828,8 @@ trident_interrupt(int irq, void *dev_id, struct pt_regs *regs)
spin_lock(&card->lock); spin_lock(&card->lock);
event = inl(TRID_REG(card, T4D_MISCINT)); 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) { if (event & ADDRESS_IRQ) {
card->address_interrupt(card); card->address_interrupt(card);
...@@ -1864,7 +1870,7 @@ trident_read(struct file *file, char *buffer, size_t count, loff_t * ppos) ...@@ -1864,7 +1870,7 @@ trident_read(struct file *file, char *buffer, size_t count, loff_t * ppos)
unsigned swptr; unsigned swptr;
int cnt; int cnt;
TRDBG("trident: trident_read called, count = %d\n", count); pr_debug("trident: trident_read called, count = %d\n", count);
VALIDATE_STATE(state); VALIDATE_STATE(state);
if (ppos != &file->f_pos) if (ppos != &file->f_pos)
...@@ -1921,10 +1927,10 @@ trident_read(struct file *file, char *buffer, size_t count, loff_t * ppos) ...@@ -1921,10 +1927,10 @@ trident_read(struct file *file, char *buffer, size_t count, loff_t * ppos)
which results in a (potential) buffer overrun. And worse, there is which results in a (potential) buffer overrun. And worse, there is
NOTHING we can do to prevent it. */ NOTHING we can do to prevent it. */
if (!interruptible_sleep_on_timeout(&dmabuf->wait, tmo)) { if (!interruptible_sleep_on_timeout(&dmabuf->wait, tmo)) {
TRDBG(KERN_ERR "trident: recording schedule timeout, " pr_debug(KERN_ERR "trident: recording schedule timeout, "
"dmasz %u fragsz %u count %i hwptr %u swptr %u\n", "dmasz %u fragsz %u count %i hwptr %u swptr %u\n",
dmabuf->dmasize, dmabuf->fragsize, dmabuf->count, dmabuf->dmasize, dmabuf->fragsize, dmabuf->count,
dmabuf->hwptr, dmabuf->swptr); dmabuf->hwptr, dmabuf->swptr);
/* a buffer overrun, we delay the recovery until next time the /* a buffer overrun, we delay the recovery until next time the
while loop begin and we REALLY have space to record */ while loop begin and we REALLY have space to record */
...@@ -1982,7 +1988,7 @@ trident_write(struct file *file, const char *buffer, size_t count, loff_t * ppos ...@@ -1982,7 +1988,7 @@ trident_write(struct file *file, const char *buffer, size_t count, loff_t * ppos
unsigned int copy_count; unsigned int copy_count;
int lret; /* for lock_set_fmt */ 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); VALIDATE_STATE(state);
if (ppos != &file->f_pos) if (ppos != &file->f_pos)
...@@ -2054,11 +2060,11 @@ trident_write(struct file *file, const char *buffer, size_t count, loff_t * ppos ...@@ -2054,11 +2060,11 @@ trident_write(struct file *file, const char *buffer, size_t count, loff_t * ppos
/* buffer underrun. And worse, there is NOTHING we */ /* buffer underrun. And worse, there is NOTHING we */
/* can do to prevent it. */ /* can do to prevent it. */
if (!interruptible_sleep_on_timeout(&dmabuf->wait, tmo)) { if (!interruptible_sleep_on_timeout(&dmabuf->wait, tmo)) {
TRDBG(KERN_ERR "trident: playback schedule " pr_debug(KERN_ERR "trident: playback schedule "
"timeout, dmasz %u fragsz %u count %i " "timeout, dmasz %u fragsz %u count %i "
"hwptr %u swptr %u\n", dmabuf->dmasize, "hwptr %u swptr %u\n", dmabuf->dmasize,
dmabuf->fragsize, dmabuf->count, dmabuf->fragsize, dmabuf->count,
dmabuf->hwptr, dmabuf->swptr); dmabuf->hwptr, dmabuf->swptr);
/* a buffer underrun, we delay the recovery */ /* a buffer underrun, we delay the recovery */
/* until next time the while loop begin and */ /* until next time the while loop begin and */
...@@ -2249,8 +2255,8 @@ trident_ioctl(struct inode *inode, struct file *file, ...@@ -2249,8 +2255,8 @@ trident_ioctl(struct inode *inode, struct file *file,
mapped = ((file->f_mode & (FMODE_WRITE | FMODE_READ)) && dmabuf->mapped); mapped = ((file->f_mode & (FMODE_WRITE | FMODE_READ)) && dmabuf->mapped);
TRDBG("trident: trident_ioctl, command = %2d, arg = 0x%08x\n", pr_debug("trident: trident_ioctl, command = %2d, arg = 0x%08x\n",
_IOC_NR(cmd), arg ? *(int *) arg : 0); _IOC_NR(cmd), arg ? *(int *) arg : 0);
switch (cmd) { switch (cmd) {
case OSS_GETVERSION: case OSS_GETVERSION:
...@@ -2812,8 +2818,8 @@ trident_open(struct inode *inode, struct file *file) ...@@ -2812,8 +2818,8 @@ trident_open(struct inode *inode, struct file *file)
state->open_mode |= file->f_mode & (FMODE_READ | FMODE_WRITE); state->open_mode |= file->f_mode & (FMODE_READ | FMODE_WRITE);
up(&card->open_sem); up(&card->open_sem);
TRDBG("trident: open virtual channel %d, hard channel %d\n", pr_debug("trident: open virtual channel %d, hard channel %d\n",
state->virt, dmabuf->channel->num); state->virt, dmabuf->channel->num);
return 0; return 0;
} }
...@@ -2835,8 +2841,8 @@ trident_release(struct inode *inode, struct file *file) ...@@ -2835,8 +2841,8 @@ trident_release(struct inode *inode, struct file *file)
drain_dac(state, file->f_flags & O_NONBLOCK); drain_dac(state, file->f_flags & O_NONBLOCK);
} }
TRDBG("trident: closing virtual channel %d, hard channel %d\n", pr_debug("trident: closing virtual channel %d, hard channel %d\n",
state->virt, dmabuf->channel->num); state->virt, dmabuf->channel->num);
/* stop DMA state machine and free DMA buffers/channels */ /* stop DMA state machine and free DMA buffers/channels */
down(&card->open_sem); down(&card->open_sem);
...@@ -3032,7 +3038,7 @@ acquirecodecaccess(struct trident_card *card) ...@@ -3032,7 +3038,7 @@ acquirecodecaccess(struct trident_card *card)
udelay(20); udelay(20);
} }
if (!block) { if (!block) {
TRDBG("accesscodecsemaphore: try unlock\n"); pr_debug("accesscodecsemaphore: try unlock\n");
block = 1; block = 1;
goto unlock; goto unlock;
} }
...@@ -3115,7 +3121,7 @@ ali_ac97_get(struct trident_card *card, int secondary, u8 reg) ...@@ -3115,7 +3121,7 @@ ali_ac97_get(struct trident_card *card, int secondary, u8 reg)
if (ncount <= 0) if (ncount <= 0)
break; break;
if (ncount-- == 1) { 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)); aud_reg = inl(TRID_REG(card, ALI_AC97_WRITE));
outl((aud_reg & 0xffff7fff), outl((aud_reg & 0xffff7fff),
TRID_REG(card, ALI_AC97_WRITE)); TRID_REG(card, ALI_AC97_WRITE));
...@@ -3181,7 +3187,7 @@ ali_ac97_set(struct trident_card *card, int secondary, u8 reg, u16 val) ...@@ -3181,7 +3187,7 @@ ali_ac97_set(struct trident_card *card, int secondary, u8 reg, u16 val)
if (ncount <= 0) if (ncount <= 0)
break; break;
if (ncount-- == 1) { 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, outw(wcontrol & 0x7fff,
TRID_REG(card, ALI_AC97_WRITE)); TRID_REG(card, ALI_AC97_WRITE));
} }
......
...@@ -355,16 +355,4 @@ static inline unsigned ld2(unsigned int x) ...@@ -355,16 +355,4 @@ static inline unsigned ld2(unsigned int x)
return r; 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 */ #endif /* __TRID4DWAVE_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment