[linux-dvb] [PATCH 1/6] DVB-Bt8xx: Clean up printks
Edgar Toernig
froese at gmx.de
Wed Mar 22 03:12:11 CET 2006
- The pll code was filling up the system log by writing
three lines of debug information each time the pll was
set. Changed the printk to dprintk.
- Add missing log levels to various printks.
- Some clean ups.
---
bt8xx/bt878.c | 55 ++++++++++++++++++++------------------------
bt8xx/dvb-bt8xx.c | 34 ++++++++++++---------------
frontends/cx24110.c | 2 -
3 files changed, 43 insertions(+), 48 deletions(-)
--- linux-2.6.16/drivers/media/dvb/bt8xx/bt878.c 2006-03-21 21:14:36 +0100
+++ linux-2.6.16/drivers/media/dvb/bt8xx/bt878.c 2006-03-22 01:04:07 +0100
@@ -78,7 +78,8 @@ EXPORT_SYMBOL(bt878);
#if defined(dprintk)
#undef dprintk
#endif
-#define dprintk if(bt878_debug) printk
+#define dprintk(args...) do { if (bt878_debug) printk(KERN_DEBUG args); } \
+ while (0)
static void bt878_mem_free(struct bt878 *bt)
{
@@ -157,7 +158,7 @@ static int bt878_make_risc(struct bt878
}
if (bt->line_count > 255) {
- printk("bt878: buffer size error!\n");
+ printk(KERN_ERR "bt878: buffer size error!\n");
return -EINVAL;
}
return 0;
@@ -288,37 +289,34 @@ static irqreturn_t bt878_irq(int irq, vo
if (astat & (BT878_ASCERR | BT878_AOCERR)) {
if (bt878_verbose) {
- printk("bt878(%d): irq%s%s risc_pc=%08x\n",
+ printk(KERN_ERR
+ "bt878(%d): irq%s%s risc_pc=%08x\n",
bt->nr,
- (astat & BT878_ASCERR) ? " SCERR" :
- "",
- (astat & BT878_AOCERR) ? " OCERR" :
- "", btread(BT878_ARISC_PC));
+ (astat & BT878_ASCERR) ? " SCERR" : "",
+ (astat & BT878_AOCERR) ? " OCERR" : "",
+ btread(BT878_ARISC_PC));
}
}
if (astat & (BT878_APABORT | BT878_ARIPERR | BT878_APPERR)) {
if (bt878_verbose) {
- printk
- ("bt878(%d): irq%s%s%s risc_pc=%08x\n",
- bt->nr,
- (astat & BT878_APABORT) ? " PABORT" :
- "",
- (astat & BT878_ARIPERR) ? " RIPERR" :
- "",
- (astat & BT878_APPERR) ? " PPERR" :
- "", btread(BT878_ARISC_PC));
+ printk(KERN_ERR
+ "bt878(%d): irq%s%s%s risc_pc=%08x\n",
+ bt->nr,
+ (astat & BT878_APABORT) ? " PABORT" : "",
+ (astat & BT878_ARIPERR) ? " RIPERR" : "",
+ (astat & BT878_APPERR) ? " PPERR" : "",
+ btread(BT878_ARISC_PC));
}
}
if (astat & (BT878_AFDSR | BT878_AFTRGT | BT878_AFBUS)) {
if (bt878_verbose) {
- printk
- ("bt878(%d): irq%s%s%s risc_pc=%08x\n",
- bt->nr,
- (astat & BT878_AFDSR) ? " FDSR" : "",
- (astat & BT878_AFTRGT) ? " FTRGT" :
- "",
- (astat & BT878_AFBUS) ? " FBUS" : "",
- btread(BT878_ARISC_PC));
+ printk(KERN_ERR
+ "bt878(%d): irq%s%s%s risc_pc=%08x\n",
+ bt->nr,
+ (astat & BT878_AFDSR) ? " FDSR" : "",
+ (astat & BT878_AFTRGT) ? " FTRGT" : "",
+ (astat & BT878_AFBUS) ? " FBUS" : "",
+ btread(BT878_ARISC_PC));
}
}
if (astat & BT878_ARISCI) {
@@ -415,8 +413,7 @@ static int __devinit bt878_probe(struct
unsigned short id;
struct cards *dvb_cards;
- printk(KERN_INFO "bt878: Bt878 AUDIO function found (%d).\n",
- bt878_num);
+ printk(KERN_INFO "bt878(%d): DVB interface found.\n", bt878_num);
if (pci_enable_device(dev))
return -EIO;
@@ -509,7 +506,7 @@ static int __devinit bt878_probe(struct
*/
if ((result = bt878_mem_alloc(bt))) {
- printk("bt878: failed to allocate memory!\n");
+ printk(KERN_ERR "bt878: failed to allocate memory!\n");
goto fail2;
}
@@ -535,7 +532,7 @@ static void __devexit bt878_remove(struc
struct bt878 *bt = pci_get_drvdata(pci_dev);
if (bt878_verbose)
- printk("bt878(%d): unloading\n", bt->nr);
+ printk(KERN_INFO "bt878(%d): unloading\n", bt->nr);
/* turn off all capturing, DMA and IRQs */
btand(~0x13, BT878_AGPIO_DMA_CTL);
@@ -595,7 +592,7 @@ static int bt878_init_module(void)
bt878_num = 0;
bt878_pci_driver_registered = 0;
- printk(KERN_INFO "bt878: AUDIO driver version %d.%d.%d loaded\n",
+ printk(KERN_INFO "bt878: DVB driver version %d.%d.%d loaded\n",
(BT878_VERSION_CODE >> 16) & 0xff,
(BT878_VERSION_CODE >> 8) & 0xff,
BT878_VERSION_CODE & 0xff);
--- linux-2.6.16/drivers/media/dvb/bt8xx/dvb-bt8xx.c 2006-03-21 21:14:36 +0100
+++ linux-2.6.16/drivers/media/dvb/bt8xx/dvb-bt8xx.c 2006-03-22 00:50:45 +0100
@@ -52,8 +52,6 @@ static void dvb_bt8xx_task(unsigned long
{
struct dvb_bt8xx_card *card = (struct dvb_bt8xx_card *)data;
- //printk("%d ", card->bt->finished_block);
-
while (card->bt->last_block != card->bt->finished_block) {
(card->bt->TS_Size ? dvb_dmx_swfilter_204 : dvb_dmx_swfilter)
(&card->demux,
@@ -198,7 +196,7 @@ static int cx24108_pll_set(struct dvb_fr
0x00120000,0x00140000};
#define XTAL 1011100 /* Hz, really 1.0111 MHz and a /10 prescaler */
- printk("cx24108 debug: entering SetTunerFreq, freq=%d\n",freq);
+ dprintk("cx24108 debug: entering SetTunerFreq, freq=%d\n",freq);
/* This is really the bit driving the tuner chip cx24108 */
@@ -209,7 +207,7 @@ static int cx24108_pll_set(struct dvb_fr
/* decide which VCO to use for the input frequency */
for(i=1;(i<sizeof(osci)/sizeof(osci[0]))&&(osci[i]<freq);i++);
- printk("cx24108 debug: select vco #%d (f=%d)\n",i,freq);
+ dprintk("cx24108 debug: select vco #%d (f=%d)\n",i,freq);
band=bandsel[i];
/* the gain values must be set by SetSymbolrate */
/* compute the pll divider needed, from Conexant data sheet,
@@ -225,7 +223,7 @@ static int cx24108_pll_set(struct dvb_fr
((a&0x1f)<<11);
/* everything is shifted left 11 bits to left-align the bits in the
32bit word. Output to the tuner goes MSB-aligned, after all */
- printk("cx24108 debug: pump=%d, n=%d, a=%d\n",pump,n,a);
+ dprintk("cx24108 debug: pump=%d, n=%d, a=%d\n",pump,n,a);
cx24110_pll_write(fe,band);
/* set vga and vca to their widest-band settings, as a precaution.
SetSymbolrate might not be called to set this up */
@@ -612,7 +610,7 @@ static void frontend_init(struct dvb_bt8
lgdt330x_reset(card);
card->fe = lgdt330x_attach(&tdvs_tua6034_config, card->i2c_adapter);
if (card->fe != NULL)
- dprintk ("dvb_bt8xx: lgdt330x detected\n");
+ dprintk("dvb_bt8xx: lgdt330x detected\n");
break;
case BTTV_BOARD_NEBULA_DIGITV:
@@ -659,7 +657,7 @@ static void frontend_init(struct dvb_bt8
/* DST is not a frontend, attaching the ASIC */
if ((dst_attach(state, &card->dvb_adapter)) == NULL) {
- printk("%s: Could not find a Twinhan DST.\n", __FUNCTION__);
+ printk(KERN_ERR "%s: Could not find a Twinhan DST.\n", __FUNCTION__);
break;
}
card->fe = &state->frontend;
@@ -680,14 +678,14 @@ static void frontend_init(struct dvb_bt8
}
if (card->fe == NULL)
- printk("dvb-bt8xx: A frontend driver was not found for device %04x/%04x subsystem %04x/%04x\n",
+ printk(KERN_ERR "dvb-bt8xx: A frontend driver was not found for device %04x/%04x subsystem %04x/%04x\n",
card->bt->dev->vendor,
card->bt->dev->device,
card->bt->dev->subsystem_vendor,
card->bt->dev->subsystem_device);
else
if (dvb_register_frontend(&card->dvb_adapter, card->fe)) {
- printk("dvb-bt8xx: Frontend registration failed!\n");
+ printk(KERN_ERR "dvb-bt8xx: Frontend registration failed!\n");
if (card->fe->ops->release)
card->fe->ops->release(card->fe);
card->fe = NULL;
@@ -699,7 +697,7 @@ static int __init dvb_bt8xx_load_card(st
int result;
if ((result = dvb_register_adapter(&card->dvb_adapter, card->card_name, THIS_MODULE)) < 0) {
- printk("dvb_bt8xx: dvb_register_adapter failed (errno = %d)\n", result);
+ printk(KERN_ERR "dvb_bt8xx: dvb_register_adapter failed (errno = %d)\n", result);
return result;
}
card->dvb_adapter.priv = card;
@@ -718,7 +716,7 @@ static int __init dvb_bt8xx_load_card(st
card->demux.write_to_decoder = NULL;
if ((result = dvb_dmx_init(&card->demux)) < 0) {
- printk("dvb_bt8xx: dvb_dmx_init failed (errno = %d)\n", result);
+ printk(KERN_ERR "dvb_bt8xx: dvb_dmx_init failed (errno = %d)\n", result);
dvb_unregister_adapter(&card->dvb_adapter);
return result;
@@ -729,7 +727,7 @@ static int __init dvb_bt8xx_load_card(st
card->dmxdev.capabilities = 0;
if ((result = dvb_dmxdev_init(&card->dmxdev, &card->dvb_adapter)) < 0) {
- printk("dvb_bt8xx: dvb_dmxdev_init failed (errno = %d)\n", result);
+ printk(KERN_ERR "dvb_bt8xx: dvb_dmxdev_init failed (errno = %d)\n", result);
dvb_dmx_release(&card->demux);
dvb_unregister_adapter(&card->dvb_adapter);
@@ -739,7 +737,7 @@ static int __init dvb_bt8xx_load_card(st
card->fe_hw.source = DMX_FRONTEND_0;
if ((result = card->demux.dmx.add_frontend(&card->demux.dmx, &card->fe_hw)) < 0) {
- printk("dvb_bt8xx: dvb_dmx_init failed (errno = %d)\n", result);
+ printk(KERN_ERR "dvb_bt8xx: dvb_dmx_init failed (errno = %d)\n", result);
dvb_dmxdev_release(&card->dmxdev);
dvb_dmx_release(&card->demux);
@@ -750,7 +748,7 @@ static int __init dvb_bt8xx_load_card(st
card->fe_mem.source = DMX_MEMORY_FE;
if ((result = card->demux.dmx.add_frontend(&card->demux.dmx, &card->fe_mem)) < 0) {
- printk("dvb_bt8xx: dvb_dmx_init failed (errno = %d)\n", result);
+ printk(KERN_ERR "dvb_bt8xx: dvb_dmx_init failed (errno = %d)\n", result);
card->demux.dmx.remove_frontend(&card->demux.dmx, &card->fe_hw);
dvb_dmxdev_release(&card->dmxdev);
@@ -760,7 +758,7 @@ static int __init dvb_bt8xx_load_card(st
}
if ((result = card->demux.dmx.connect_frontend(&card->demux.dmx, &card->fe_hw)) < 0) {
- printk("dvb_bt8xx: dvb_dmx_init failed (errno = %d)\n", result);
+ printk(KERN_ERR "dvb_bt8xx: dvb_dmx_init failed (errno = %d)\n", result);
card->demux.dmx.remove_frontend(&card->demux.dmx, &card->fe_mem);
card->demux.dmx.remove_frontend(&card->demux.dmx, &card->fe_hw);
@@ -866,15 +864,15 @@ static int dvb_bt8xx_probe(struct bttv_s
dprintk("dvb_bt8xx: identified card%d as %s\n", card->bttv_nr, card->card_name);
if (!(bttv_pci_dev = bttv_get_pcidev(card->bttv_nr))) {
- printk("dvb_bt8xx: no pci device for card %d\n", card->bttv_nr);
+ printk(KERN_ERR "dvb_bt8xx: no pci device for card %d\n", card->bttv_nr);
kfree(card);
return -EFAULT;
}
if (!(card->bt = dvb_bt8xx_878_match(card->bttv_nr, bttv_pci_dev))) {
- printk("dvb_bt8xx: unable to determine DMA core of card %d,\n",
+ printk(KERN_ERR "dvb_bt8xx: unable to determine DMA core of card %d,\n",
card->bttv_nr);
- printk("dvb_bt8xx: if you have the ALSA bt87x audio driver "
+ printk(KERN_ERR "dvb_bt8xx: if you have the ALSA bt87x audio driver "
"installed, try removing it.\n");
kfree(card);
--- linux-2.6.16/drivers/media/dvb/frontends/cx24110.c 2006-03-21 21:14:36 +0100
+++ linux-2.6.16/drivers/media/dvb/frontends/cx24110.c 2006-03-22 00:50:45 +0100
@@ -250,7 +250,7 @@ static int cx24110_set_symbolrate (struc
static const u32 bands[]={5000000UL,15000000UL,90999000UL/2};
int i;
-dprintk("cx24110 debug: entering %s(%d)\n",__FUNCTION__,srate);
+ dprintk("cx24110 debug: entering %s(%d)\n",__FUNCTION__,srate);
if (srate>90999000UL/2)
srate=90999000UL/2;
if (srate<500000)
More information about the linux-dvb
mailing list