diff options
author | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2009-08-01 07:05:16 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-09-12 11:19:38 -0400 |
commit | 96e242a594961d40c9b2be3f16d6d83e2091c8e7 (patch) | |
tree | d5187d1a13ae58d4a32a217e4a0bb576ddd53185 /drivers/media/dvb | |
parent | 15344779b28f8ba12d769a4aa62d48c9ea1f4ce5 (diff) |
V4L/DVB (12583): firedtv: combine some debug logging code
Shrinks source and kernel object size a bit.
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb')
-rw-r--r-- | drivers/media/dvb/firewire/firedtv-avc.c | 109 |
1 files changed, 49 insertions, 60 deletions
diff --git a/drivers/media/dvb/firewire/firedtv-avc.c b/drivers/media/dvb/firewire/firedtv-avc.c index 570bea0dd177..d1b67fe0f011 100644 --- a/drivers/media/dvb/firewire/firedtv-avc.c +++ b/drivers/media/dvb/firewire/firedtv-avc.c | |||
@@ -103,18 +103,19 @@ struct avc_response_frame { | |||
103 | 103 | ||
104 | static int avc_debug; | 104 | static int avc_debug; |
105 | module_param_named(debug, avc_debug, int, 0644); | 105 | module_param_named(debug, avc_debug, int, 0644); |
106 | MODULE_PARM_DESC(debug, "Verbose logging bitmask (none (default) = 0" | 106 | MODULE_PARM_DESC(debug, "Verbose logging (none = 0" |
107 | ", FCP subaction(READ DESCRIPTOR) = " __stringify(AVC_DEBUG_READ_DESCRIPTOR) | 107 | ", FCP subactions" |
108 | ", FCP subaction(DSIT) = " __stringify(AVC_DEBUG_DSIT) | 108 | ": READ DESCRIPTOR = " __stringify(AVC_DEBUG_READ_DESCRIPTOR) |
109 | ", FCP subaction(REGISTER_REMOTE_CONTROL) = " __stringify(AVC_DEBUG_REGISTER_REMOTE_CONTROL) | 109 | ", DSIT = " __stringify(AVC_DEBUG_DSIT) |
110 | ", FCP subaction(LNB CONTROL) = " __stringify(AVC_DEBUG_LNB_CONTROL) | 110 | ", REGISTER_REMOTE_CONTROL = " __stringify(AVC_DEBUG_REGISTER_REMOTE_CONTROL) |
111 | ", FCP subaction(TUNE QPSK) = " __stringify(AVC_DEBUG_TUNE_QPSK) | 111 | ", LNB CONTROL = " __stringify(AVC_DEBUG_LNB_CONTROL) |
112 | ", FCP subaction(TUNE QPSK2) = " __stringify(AVC_DEBUG_TUNE_QPSK2) | 112 | ", TUNE QPSK = " __stringify(AVC_DEBUG_TUNE_QPSK) |
113 | ", FCP subaction(HOST2CA) = " __stringify(AVC_DEBUG_HOST2CA) | 113 | ", TUNE QPSK2 = " __stringify(AVC_DEBUG_TUNE_QPSK2) |
114 | ", FCP subaction(CA2HOST) = " __stringify(AVC_DEBUG_CA2HOST) | 114 | ", HOST2CA = " __stringify(AVC_DEBUG_HOST2CA) |
115 | ", Application sent PMT = " __stringify(AVC_DEBUG_APPLICATION_PMT) | 115 | ", CA2HOST = " __stringify(AVC_DEBUG_CA2HOST) |
116 | ", FCP payloads(for selected subactions) = " __stringify(AVC_DEBUG_FCP_PAYLOADS) | 116 | "; Application sent PMT = " __stringify(AVC_DEBUG_APPLICATION_PMT) |
117 | ", or all = -1)"); | 117 | ", FCP payloads = " __stringify(AVC_DEBUG_FCP_PAYLOADS) |
118 | ", or a combination, or all = -1)"); | ||
118 | 119 | ||
119 | static const char *debug_fcp_ctype(unsigned int ctype) | 120 | static const char *debug_fcp_ctype(unsigned int ctype) |
120 | { | 121 | { |
@@ -135,71 +136,59 @@ static const char *debug_fcp_opcode(unsigned int opcode, | |||
135 | const u8 *data, int length) | 136 | const u8 *data, int length) |
136 | { | 137 | { |
137 | switch (opcode) { | 138 | switch (opcode) { |
138 | case AVC_OPCODE_VENDOR: break; | 139 | case AVC_OPCODE_VENDOR: |
139 | case AVC_OPCODE_READ_DESCRIPTOR: return "ReadDescriptor"; | 140 | break; |
140 | case AVC_OPCODE_DSIT: return "DirectSelectInfo.Type"; | 141 | case AVC_OPCODE_READ_DESCRIPTOR: |
141 | case AVC_OPCODE_DSD: return "DirectSelectData"; | 142 | return avc_debug & AVC_DEBUG_READ_DESCRIPTOR ? |
142 | default: return "?"; | 143 | "ReadDescriptor" : NULL; |
143 | } | 144 | case AVC_OPCODE_DSIT: |
144 | 145 | return avc_debug & AVC_DEBUG_DSIT ? | |
145 | if (length < 7 || | 146 | "DirectSelectInfo.Type" : NULL; |
146 | data[3] != SFE_VENDOR_DE_COMPANYID_0 || | 147 | case AVC_OPCODE_DSD: |
147 | data[4] != SFE_VENDOR_DE_COMPANYID_1 || | 148 | return avc_debug & AVC_DEBUG_DSD ? "DirectSelectData" : NULL; |
148 | data[5] != SFE_VENDOR_DE_COMPANYID_2) | 149 | default: |
149 | return "Vendor"; | 150 | return "Unknown"; |
150 | |||
151 | switch (data[6]) { | ||
152 | case SFE_VENDOR_OPCODE_REGISTER_REMOTE_CONTROL: return "RegisterRC"; | ||
153 | case SFE_VENDOR_OPCODE_LNB_CONTROL: return "LNBControl"; | ||
154 | case SFE_VENDOR_OPCODE_TUNE_QPSK: return "TuneQPSK"; | ||
155 | case SFE_VENDOR_OPCODE_TUNE_QPSK2: return "TuneQPSK2"; | ||
156 | case SFE_VENDOR_OPCODE_HOST2CA: return "Host2CA"; | ||
157 | case SFE_VENDOR_OPCODE_CA2HOST: return "CA2Host"; | ||
158 | } | ||
159 | return "Vendor"; | ||
160 | } | ||
161 | |||
162 | static int debug_fcp_opcode_flag_set(unsigned int opcode, | ||
163 | const u8 *data, int length) | ||
164 | { | ||
165 | switch (opcode) { | ||
166 | case AVC_OPCODE_VENDOR: break; | ||
167 | case AVC_OPCODE_READ_DESCRIPTOR: return avc_debug & AVC_DEBUG_READ_DESCRIPTOR; | ||
168 | case AVC_OPCODE_DSIT: return avc_debug & AVC_DEBUG_DSIT; | ||
169 | case AVC_OPCODE_DSD: return avc_debug & AVC_DEBUG_DSD; | ||
170 | default: return 1; | ||
171 | } | 151 | } |
172 | 152 | ||
173 | if (length < 7 || | 153 | if (length < 7 || |
174 | data[3] != SFE_VENDOR_DE_COMPANYID_0 || | 154 | data[3] != SFE_VENDOR_DE_COMPANYID_0 || |
175 | data[4] != SFE_VENDOR_DE_COMPANYID_1 || | 155 | data[4] != SFE_VENDOR_DE_COMPANYID_1 || |
176 | data[5] != SFE_VENDOR_DE_COMPANYID_2) | 156 | data[5] != SFE_VENDOR_DE_COMPANYID_2) |
177 | return 1; | 157 | return "Vendor/Unknown"; |
178 | 158 | ||
179 | switch (data[6]) { | 159 | switch (data[6]) { |
180 | case SFE_VENDOR_OPCODE_REGISTER_REMOTE_CONTROL: return avc_debug & AVC_DEBUG_REGISTER_REMOTE_CONTROL; | 160 | case SFE_VENDOR_OPCODE_REGISTER_REMOTE_CONTROL: |
181 | case SFE_VENDOR_OPCODE_LNB_CONTROL: return avc_debug & AVC_DEBUG_LNB_CONTROL; | 161 | return avc_debug & AVC_DEBUG_REGISTER_REMOTE_CONTROL ? |
182 | case SFE_VENDOR_OPCODE_TUNE_QPSK: return avc_debug & AVC_DEBUG_TUNE_QPSK; | 162 | "RegisterRC" : NULL; |
183 | case SFE_VENDOR_OPCODE_TUNE_QPSK2: return avc_debug & AVC_DEBUG_TUNE_QPSK2; | 163 | case SFE_VENDOR_OPCODE_LNB_CONTROL: |
184 | case SFE_VENDOR_OPCODE_HOST2CA: return avc_debug & AVC_DEBUG_HOST2CA; | 164 | return avc_debug & AVC_DEBUG_LNB_CONTROL ? "LNBControl" : NULL; |
185 | case SFE_VENDOR_OPCODE_CA2HOST: return avc_debug & AVC_DEBUG_CA2HOST; | 165 | case SFE_VENDOR_OPCODE_TUNE_QPSK: |
166 | return avc_debug & AVC_DEBUG_TUNE_QPSK ? "TuneQPSK" : NULL; | ||
167 | case SFE_VENDOR_OPCODE_TUNE_QPSK2: | ||
168 | return avc_debug & AVC_DEBUG_TUNE_QPSK2 ? "TuneQPSK2" : NULL; | ||
169 | case SFE_VENDOR_OPCODE_HOST2CA: | ||
170 | return avc_debug & AVC_DEBUG_HOST2CA ? "Host2CA" : NULL; | ||
171 | case SFE_VENDOR_OPCODE_CA2HOST: | ||
172 | return avc_debug & AVC_DEBUG_CA2HOST ? "CA2Host" : NULL; | ||
186 | } | 173 | } |
187 | return 1; | 174 | return "Vendor/Unknown"; |
188 | } | 175 | } |
189 | 176 | ||
190 | static void debug_fcp(const u8 *data, int length) | 177 | static void debug_fcp(const u8 *data, int length) |
191 | { | 178 | { |
192 | unsigned int subunit_type, subunit_id, op; | 179 | unsigned int subunit_type, subunit_id, opcode; |
193 | const char *prefix = data[0] > 7 ? "FCP <- " : "FCP -> "; | 180 | const char *op, *prefix; |
194 | 181 | ||
182 | prefix = data[0] > 7 ? "FCP <- " : "FCP -> "; | ||
195 | subunit_type = data[1] >> 3; | 183 | subunit_type = data[1] >> 3; |
196 | subunit_id = data[1] & 7; | 184 | subunit_id = data[1] & 7; |
197 | op = subunit_type == 0x1e || subunit_id == 5 ? ~0 : data[2]; | 185 | opcode = subunit_type == 0x1e || subunit_id == 5 ? ~0 : data[2]; |
198 | if (debug_fcp_opcode_flag_set(op, data, length)) { | 186 | op = debug_fcp_opcode(opcode, data, length); |
187 | |||
188 | if (op) { | ||
199 | printk(KERN_INFO "%ssu=%x.%x l=%d: %-8s - %s\n", | 189 | printk(KERN_INFO "%ssu=%x.%x l=%d: %-8s - %s\n", |
200 | prefix, subunit_type, subunit_id, length, | 190 | prefix, subunit_type, subunit_id, length, |
201 | debug_fcp_ctype(data[0]), | 191 | debug_fcp_ctype(data[0]), op); |
202 | debug_fcp_opcode(op, data, length)); | ||
203 | if (avc_debug & AVC_DEBUG_FCP_PAYLOADS) | 192 | if (avc_debug & AVC_DEBUG_FCP_PAYLOADS) |
204 | print_hex_dump(KERN_INFO, prefix, DUMP_PREFIX_NONE, | 193 | print_hex_dump(KERN_INFO, prefix, DUMP_PREFIX_NONE, |
205 | 16, 1, data, length, false); | 194 | 16, 1, data, length, false); |