diff options
author | Jean Delvare <khali@linux-fr.org> | 2007-07-17 17:29:41 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-10-09 21:02:57 -0400 |
commit | 18b548ca580838a2cc5813a941e6dab28660bb22 (patch) | |
tree | 58b2a76ff9108c4e458543d1965e02457843757c /drivers/media/video/zoran_card.c | |
parent | 63116febb9233743279a05be510ab8524f5f6242 (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_card.c')
-rw-r--r-- | drivers/media/video/zoran_card.c | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/drivers/media/video/zoran_card.c b/drivers/media/video/zoran_card.c index 73162a3a61d..8e12ff80550 100644 --- a/drivers/media/video/zoran_card.c +++ b/drivers/media/video/zoran_card.c | |||
@@ -145,10 +145,9 @@ module_param(pass_through, int, 0); | |||
145 | MODULE_PARM_DESC(pass_through, | 145 | MODULE_PARM_DESC(pass_through, |
146 | "Pass TV signal through to TV-out when idling"); | 146 | "Pass TV signal through to TV-out when idling"); |
147 | 147 | ||
148 | static int debug = 1; | 148 | int zr36067_debug = 1; |
149 | int *zr_debug = &debug; | 149 | module_param_named(debug, zr36067_debug, int, 0644); |
150 | module_param(debug, int, 0); | 150 | MODULE_PARM_DESC(debug, "Debug level (0-5)"); |
151 | MODULE_PARM_DESC(debug, "Debug level (0-4)"); | ||
152 | 151 | ||
153 | MODULE_DESCRIPTION("Zoran-36057/36067 JPEG codec driver"); | 152 | MODULE_DESCRIPTION("Zoran-36057/36067 JPEG codec driver"); |
154 | MODULE_AUTHOR("Serguei Miridonov"); | 153 | MODULE_AUTHOR("Serguei Miridonov"); |
@@ -161,12 +160,6 @@ static struct pci_device_id zr36067_pci_tbl[] = { | |||
161 | }; | 160 | }; |
162 | MODULE_DEVICE_TABLE(pci, zr36067_pci_tbl); | 161 | MODULE_DEVICE_TABLE(pci, zr36067_pci_tbl); |
163 | 162 | ||
164 | #define dprintk(num, format, args...) \ | ||
165 | do { \ | ||
166 | if (*zr_debug >= num) \ | ||
167 | printk(format, ##args); \ | ||
168 | } while (0) | ||
169 | |||
170 | int zoran_num; /* number of Buzs in use */ | 163 | int zoran_num; /* number of Buzs in use */ |
171 | struct zoran zoran[BUZ_MAX]; | 164 | struct zoran zoran[BUZ_MAX]; |
172 | 165 | ||
@@ -1075,7 +1068,7 @@ test_interrupts (struct zoran *zr) | |||
1075 | if (timeout) { | 1068 | if (timeout) { |
1076 | dprintk(1, ": time spent: %d\n", 1 * HZ - timeout); | 1069 | dprintk(1, ": time spent: %d\n", 1 * HZ - timeout); |
1077 | } | 1070 | } |
1078 | if (*zr_debug > 1) | 1071 | if (zr36067_debug > 1) |
1079 | print_interrupts(zr); | 1072 | print_interrupts(zr); |
1080 | btwrite(icr, ZR36057_ICR); | 1073 | btwrite(icr, ZR36057_ICR); |
1081 | } | 1074 | } |
@@ -1158,7 +1151,7 @@ zr36057_init (struct zoran *zr) | |||
1158 | goto exit_unregister; | 1151 | goto exit_unregister; |
1159 | 1152 | ||
1160 | zoran_init_hardware(zr); | 1153 | zoran_init_hardware(zr); |
1161 | if (*zr_debug > 2) | 1154 | if (zr36067_debug > 2) |
1162 | detect_guest_activity(zr); | 1155 | detect_guest_activity(zr); |
1163 | test_interrupts(zr); | 1156 | test_interrupts(zr); |
1164 | if (!pass_through) { | 1157 | if (!pass_through) { |
@@ -1620,7 +1613,7 @@ init_dc10_cards (void) | |||
1620 | } | 1613 | } |
1621 | 1614 | ||
1622 | /* random nonsense */ | 1615 | /* random nonsense */ |
1623 | dprintk(5, KERN_DEBUG "Jotti is een held!\n"); | 1616 | dprintk(6, KERN_DEBUG "Jotti is een held!\n"); |
1624 | 1617 | ||
1625 | /* some mainboards might not do PCI-PCI data transfer well */ | 1618 | /* some mainboards might not do PCI-PCI data transfer well */ |
1626 | if (pci_pci_problems & (PCIPCI_FAIL|PCIAGP_FAIL|PCIPCI_ALIMAGIK)) { | 1619 | if (pci_pci_problems & (PCIPCI_FAIL|PCIAGP_FAIL|PCIPCI_ALIMAGIK)) { |