aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/zoran_device.c
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2007-07-17 17:29:41 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-10-09 21:02:57 -0400
commit18b548ca580838a2cc5813a941e6dab28660bb22 (patch)
tree58b2a76ff9108c4e458543d1965e02457843757c /drivers/media/video/zoran_device.c
parent63116febb9233743279a05be510ab8524f5f6242 (diff)
V4L/DVB (5884): zr36067: clean up debug function
Debugging cleanups to the zr36067 driver: * Use module_param_named() to declare the debug parameter, so we can use a single global variable to handle the debug level. This makes the driver a bit smaller (by 648 bytes on x86_64), thanks to one less level of indirection on every use. * Change the debug parameter sysfs permissions, so that the debug level can be adjusted at runtime, as is done in many other media/video drivers. * The debug level is between 0 and 5, not 0 and 4. * Move the zr_debug export and dprintk macro definition to a header file so that we don't have to define them in each source file. * Simplify a duplicate test on zr_debug. Note that zr_debug was subsequently renamed to debug_zr36067 to avoid possible conflicts with other Zoran device drivers, on a suggestion by Trent Piepho. Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Trent Piepho <xyzzy@speakeasy.org> Acked-by: Ronald S. Bultje <rbultje@ronald.bitfreak.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/zoran_device.c')
-rw-r--r--drivers/media/video/zoran_device.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/drivers/media/video/zoran_device.c b/drivers/media/video/zoran_device.c
index ba2f4ed29483..dc1ec20fb266 100644
--- a/drivers/media/video/zoran_device.c
+++ b/drivers/media/video/zoran_device.c
@@ -52,6 +52,7 @@
52#include "videocodec.h" 52#include "videocodec.h"
53#include "zoran.h" 53#include "zoran.h"
54#include "zoran_device.h" 54#include "zoran_device.h"
55#include "zoran_card.h"
55 56
56#define IRQ_MASK ( ZR36057_ISR_GIRQ0 | \ 57#define IRQ_MASK ( ZR36057_ISR_GIRQ0 | \
57 ZR36057_ISR_GIRQ1 | \ 58 ZR36057_ISR_GIRQ1 | \
@@ -59,14 +60,6 @@
59 60
60extern const struct zoran_format zoran_formats[]; 61extern const struct zoran_format zoran_formats[];
61 62
62extern int *zr_debug;
63
64#define dprintk(num, format, args...) \
65 do { \
66 if (*zr_debug >= num) \
67 printk(format, ##args); \
68 } while (0)
69
70static int lml33dpath = 0; /* 1 will use digital path in capture 63static int lml33dpath = 0; /* 1 will use digital path in capture
71 * mode instead of analog. It can be 64 * mode instead of analog. It can be
72 * used for picture adjustments using 65 * used for picture adjustments using
@@ -174,7 +167,7 @@ post_office_read (struct zoran *zr,
174static void 167static void
175dump_guests (struct zoran *zr) 168dump_guests (struct zoran *zr)
176{ 169{
177 if (*zr_debug > 2) { 170 if (zr36067_debug > 2) {
178 int i, guest[8]; 171 int i, guest[8];
179 172
180 for (i = 1; i < 8; i++) { // Don't read jpeg codec here 173 for (i = 1; i < 8; i++) { // Don't read jpeg codec here
@@ -1271,7 +1264,7 @@ error_handler (struct zoran *zr,
1271 zr->num_errors++; 1264 zr->num_errors++;
1272 1265
1273 /* Report error */ 1266 /* Report error */
1274 if (*zr_debug > 1 && zr->num_errors <= 8) { 1267 if (zr36067_debug > 1 && zr->num_errors <= 8) {
1275 long frame; 1268 long frame;
1276 frame = 1269 frame =
1277 zr->jpg_pend[zr->jpg_dma_tail & BUZ_MASK_FRAME]; 1270 zr->jpg_pend[zr->jpg_dma_tail & BUZ_MASK_FRAME];
@@ -1531,7 +1524,7 @@ zoran_irq (int irq,
1531 1524
1532 if (zr->codec_mode == BUZ_MODE_MOTION_DECOMPRESS || 1525 if (zr->codec_mode == BUZ_MODE_MOTION_DECOMPRESS ||
1533 zr->codec_mode == BUZ_MODE_MOTION_COMPRESS) { 1526 zr->codec_mode == BUZ_MODE_MOTION_COMPRESS) {
1534 if (*zr_debug > 1 && 1527 if (zr36067_debug > 1 &&
1535 (!zr->frame_num || zr->JPEG_error)) { 1528 (!zr->frame_num || zr->JPEG_error)) {
1536 printk(KERN_INFO 1529 printk(KERN_INFO
1537 "%s: first frame ready: state=0x%08x odd_even=%d field_per_buff=%d delay=%d\n", 1530 "%s: first frame ready: state=0x%08x odd_even=%d field_per_buff=%d delay=%d\n",
@@ -1568,7 +1561,7 @@ zoran_irq (int irq,
1568 zr->JPEG_missed; 1561 zr->JPEG_missed;
1569 } 1562 }
1570 1563
1571 if (*zr_debug > 2 && zr->frame_num < 6) { 1564 if (zr36067_debug > 2 && zr->frame_num < 6) {
1572 int i; 1565 int i;
1573 printk("%s: seq=%ld stat_com:", 1566 printk("%s: seq=%ld stat_com:",
1574 ZR_DEVNAME(zr), zr->jpg_seq_num); 1567 ZR_DEVNAME(zr), zr->jpg_seq_num);