MODULE_PARM_DESC(pass_through,
                 "Pass TV signal through to TV-out when idling");
 
-static int debug = 1;
-int *zr_debug = &debug;
-module_param(debug, int, 0);
-MODULE_PARM_DESC(debug, "Debug level (0-4)");
+int zr36067_debug = 1;
+module_param_named(debug, zr36067_debug, int, 0644);
+MODULE_PARM_DESC(debug, "Debug level (0-5)");
 
 MODULE_DESCRIPTION("Zoran-36057/36067 JPEG codec driver");
 MODULE_AUTHOR("Serguei Miridonov");
 };
 MODULE_DEVICE_TABLE(pci, zr36067_pci_tbl);
 
-#define dprintk(num, format, args...) \
-       do { \
-               if (*zr_debug >= num) \
-                       printk(format, ##args); \
-       } while (0)
-
 int zoran_num;                 /* number of Buzs in use */
 struct zoran zoran[BUZ_MAX];
 
        if (timeout) {
                dprintk(1, ": time spent: %d\n", 1 * HZ - timeout);
        }
-       if (*zr_debug > 1)
+       if (zr36067_debug > 1)
                print_interrupts(zr);
        btwrite(icr, ZR36057_ICR);
 }
                goto exit_unregister;
 
        zoran_init_hardware(zr);
-       if (*zr_debug > 2)
+       if (zr36067_debug > 2)
                detect_guest_activity(zr);
        test_interrupts(zr);
        if (!pass_through) {
        }
 
        /* random nonsense */
-       dprintk(5, KERN_DEBUG "Jotti is een held!\n");
+       dprintk(6, KERN_DEBUG "Jotti is een held!\n");
 
        /* some mainboards might not do PCI-PCI data transfer well */
        if (pci_pci_problems & (PCIPCI_FAIL|PCIAGP_FAIL|PCIPCI_ALIMAGIK)) {
 
 #ifndef __ZORAN_CARD_H__
 #define __ZORAN_CARD_H__
 
+extern int zr36067_debug;
+
+#define dprintk(num, format, args...) \
+       do { \
+               if (zr36067_debug >= num) \
+                       printk(format, ##args); \
+       } while (0)
+
 /* Anybody who uses more than four? */
 #define BUZ_MAX 4
 extern int zoran_num;
 
 #include "videocodec.h"
 #include "zoran.h"
 #include "zoran_device.h"
+#include "zoran_card.h"
 
 #define IRQ_MASK ( ZR36057_ISR_GIRQ0 | \
                   ZR36057_ISR_GIRQ1 | \
 
 extern const struct zoran_format zoran_formats[];
 
-extern int *zr_debug;
-
-#define dprintk(num, format, args...) \
-       do { \
-               if (*zr_debug >= num) \
-                       printk(format, ##args); \
-       } while (0)
-
 static int lml33dpath = 0;     /* 1 will use digital path in capture
                                 * mode instead of analog. It can be
                                 * used for picture adjustments using
 static void
 dump_guests (struct zoran *zr)
 {
-       if (*zr_debug > 2) {
+       if (zr36067_debug > 2) {
                int i, guest[8];
 
                for (i = 1; i < 8; i++) {       // Don't read jpeg codec here
                zr->num_errors++;
 
                /* Report error */
-               if (*zr_debug > 1 && zr->num_errors <= 8) {
+               if (zr36067_debug > 1 && zr->num_errors <= 8) {
                        long frame;
                        frame =
                            zr->jpg_pend[zr->jpg_dma_tail & BUZ_MASK_FRAME];
 
                        if (zr->codec_mode == BUZ_MODE_MOTION_DECOMPRESS ||
                            zr->codec_mode == BUZ_MODE_MOTION_COMPRESS) {
-                               if (*zr_debug > 1 &&
+                               if (zr36067_debug > 1 &&
                                    (!zr->frame_num || zr->JPEG_error)) {
                                        printk(KERN_INFO
                                               "%s: first frame ready: state=0x%08x odd_even=%d field_per_buff=%d delay=%d\n",
                                                    zr->JPEG_missed;
                                }
 
-                               if (*zr_debug > 2 && zr->frame_num < 6) {
+                               if (zr36067_debug > 2 && zr->frame_num < 6) {
                                        int i;
                                        printk("%s: seq=%ld stat_com:",
                                               ZR_DEVNAME(zr), zr->jpg_seq_num);
 
 // RJ: Test only - want to test BUZ_USE_HIMEM even when CONFIG_BIGPHYS_AREA is defined
 
 
-extern int *zr_debug;
-
-#define dprintk(num, format, args...) \
-       do { \
-               if (*zr_debug >= num) \
-                       printk(format, ##args); \
-       } while (0)
-
 extern int v4l_nbufs;
 extern int v4l_bufsize;
 extern int jpg_nbufs;
                frame = zr->jpg_pend[zr->jpg_que_tail & BUZ_MASK_FRAME];
 
        /* buffer should now be in BUZ_STATE_DONE */
-       if (*zr_debug > 0)
-               if (zr->jpg_buffers.buffer[frame].state != BUZ_STATE_DONE)
-                       dprintk(2,
-                               KERN_ERR
-                               "%s: jpg_sync() - internal state error\n",
-                               ZR_DEVNAME(zr));
+       if (zr->jpg_buffers.buffer[frame].state != BUZ_STATE_DONE)
+               dprintk(2,
+                       KERN_ERR "%s: jpg_sync() - internal state error\n",
+                       ZR_DEVNAME(zr));
 
        *bs = zr->jpg_buffers.buffer[frame].bs;
        bs->frame = frame;
                /* disable interrupts */
                btand(~ZR36057_ICR_IntPinEn, ZR36057_ICR);
 
-               if (*zr_debug > 1)
+               if (zr36067_debug > 1)
                        print_interrupts(zr);
 
                /* Overlay off */
 
 #include "videocodec.h"
 #include "zoran.h"
 #include "zoran_procfs.h"
-
-extern int *zr_debug;
-
-#define dprintk(num, format, args...) \
-       do { \
-               if (*zr_debug >= num) \
-                       printk(format, ##args); \
-       } while (0)
+#include "zoran_card.h"
 
 #ifdef CONFIG_PROC_FS
 struct procfs_params_zr36067 {