提交 96e242a5 编写于 作者: S Stefan Richter 提交者: Mauro Carvalho Chehab

V4L/DVB (12583): firedtv: combine some debug logging code

Shrinks source and kernel object size a bit.
Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
上级 15344779
...@@ -103,18 +103,19 @@ struct avc_response_frame { ...@@ -103,18 +103,19 @@ struct avc_response_frame {
static int avc_debug; static int avc_debug;
module_param_named(debug, avc_debug, int, 0644); module_param_named(debug, avc_debug, int, 0644);
MODULE_PARM_DESC(debug, "Verbose logging bitmask (none (default) = 0" MODULE_PARM_DESC(debug, "Verbose logging (none = 0"
", FCP subaction(READ DESCRIPTOR) = " __stringify(AVC_DEBUG_READ_DESCRIPTOR) ", FCP subactions"
", FCP subaction(DSIT) = " __stringify(AVC_DEBUG_DSIT) ": READ DESCRIPTOR = " __stringify(AVC_DEBUG_READ_DESCRIPTOR)
", FCP subaction(REGISTER_REMOTE_CONTROL) = " __stringify(AVC_DEBUG_REGISTER_REMOTE_CONTROL) ", DSIT = " __stringify(AVC_DEBUG_DSIT)
", FCP subaction(LNB CONTROL) = " __stringify(AVC_DEBUG_LNB_CONTROL) ", REGISTER_REMOTE_CONTROL = " __stringify(AVC_DEBUG_REGISTER_REMOTE_CONTROL)
", FCP subaction(TUNE QPSK) = " __stringify(AVC_DEBUG_TUNE_QPSK) ", LNB CONTROL = " __stringify(AVC_DEBUG_LNB_CONTROL)
", FCP subaction(TUNE QPSK2) = " __stringify(AVC_DEBUG_TUNE_QPSK2) ", TUNE QPSK = " __stringify(AVC_DEBUG_TUNE_QPSK)
", FCP subaction(HOST2CA) = " __stringify(AVC_DEBUG_HOST2CA) ", TUNE QPSK2 = " __stringify(AVC_DEBUG_TUNE_QPSK2)
", FCP subaction(CA2HOST) = " __stringify(AVC_DEBUG_CA2HOST) ", HOST2CA = " __stringify(AVC_DEBUG_HOST2CA)
", Application sent PMT = " __stringify(AVC_DEBUG_APPLICATION_PMT) ", CA2HOST = " __stringify(AVC_DEBUG_CA2HOST)
", FCP payloads(for selected subactions) = " __stringify(AVC_DEBUG_FCP_PAYLOADS) "; Application sent PMT = " __stringify(AVC_DEBUG_APPLICATION_PMT)
", or all = -1)"); ", FCP payloads = " __stringify(AVC_DEBUG_FCP_PAYLOADS)
", or a combination, or all = -1)");
static const char *debug_fcp_ctype(unsigned int ctype) static const char *debug_fcp_ctype(unsigned int ctype)
{ {
...@@ -135,71 +136,59 @@ static const char *debug_fcp_opcode(unsigned int opcode, ...@@ -135,71 +136,59 @@ static const char *debug_fcp_opcode(unsigned int opcode,
const u8 *data, int length) const u8 *data, int length)
{ {
switch (opcode) { switch (opcode) {
case AVC_OPCODE_VENDOR: break; case AVC_OPCODE_VENDOR:
case AVC_OPCODE_READ_DESCRIPTOR: return "ReadDescriptor"; break;
case AVC_OPCODE_DSIT: return "DirectSelectInfo.Type"; case AVC_OPCODE_READ_DESCRIPTOR:
case AVC_OPCODE_DSD: return "DirectSelectData"; return avc_debug & AVC_DEBUG_READ_DESCRIPTOR ?
default: return "?"; "ReadDescriptor" : NULL;
} case AVC_OPCODE_DSIT:
return avc_debug & AVC_DEBUG_DSIT ?
if (length < 7 || "DirectSelectInfo.Type" : NULL;
data[3] != SFE_VENDOR_DE_COMPANYID_0 || case AVC_OPCODE_DSD:
data[4] != SFE_VENDOR_DE_COMPANYID_1 || return avc_debug & AVC_DEBUG_DSD ? "DirectSelectData" : NULL;
data[5] != SFE_VENDOR_DE_COMPANYID_2) default:
return "Vendor"; return "Unknown";
switch (data[6]) {
case SFE_VENDOR_OPCODE_REGISTER_REMOTE_CONTROL: return "RegisterRC";
case SFE_VENDOR_OPCODE_LNB_CONTROL: return "LNBControl";
case SFE_VENDOR_OPCODE_TUNE_QPSK: return "TuneQPSK";
case SFE_VENDOR_OPCODE_TUNE_QPSK2: return "TuneQPSK2";
case SFE_VENDOR_OPCODE_HOST2CA: return "Host2CA";
case SFE_VENDOR_OPCODE_CA2HOST: return "CA2Host";
}
return "Vendor";
}
static int debug_fcp_opcode_flag_set(unsigned int opcode,
const u8 *data, int length)
{
switch (opcode) {
case AVC_OPCODE_VENDOR: break;
case AVC_OPCODE_READ_DESCRIPTOR: return avc_debug & AVC_DEBUG_READ_DESCRIPTOR;
case AVC_OPCODE_DSIT: return avc_debug & AVC_DEBUG_DSIT;
case AVC_OPCODE_DSD: return avc_debug & AVC_DEBUG_DSD;
default: return 1;
} }
if (length < 7 || if (length < 7 ||
data[3] != SFE_VENDOR_DE_COMPANYID_0 || data[3] != SFE_VENDOR_DE_COMPANYID_0 ||
data[4] != SFE_VENDOR_DE_COMPANYID_1 || data[4] != SFE_VENDOR_DE_COMPANYID_1 ||
data[5] != SFE_VENDOR_DE_COMPANYID_2) data[5] != SFE_VENDOR_DE_COMPANYID_2)
return 1; return "Vendor/Unknown";
switch (data[6]) { switch (data[6]) {
case SFE_VENDOR_OPCODE_REGISTER_REMOTE_CONTROL: return avc_debug & AVC_DEBUG_REGISTER_REMOTE_CONTROL; case SFE_VENDOR_OPCODE_REGISTER_REMOTE_CONTROL:
case SFE_VENDOR_OPCODE_LNB_CONTROL: return avc_debug & AVC_DEBUG_LNB_CONTROL; return avc_debug & AVC_DEBUG_REGISTER_REMOTE_CONTROL ?
case SFE_VENDOR_OPCODE_TUNE_QPSK: return avc_debug & AVC_DEBUG_TUNE_QPSK; "RegisterRC" : NULL;
case SFE_VENDOR_OPCODE_TUNE_QPSK2: return avc_debug & AVC_DEBUG_TUNE_QPSK2; case SFE_VENDOR_OPCODE_LNB_CONTROL:
case SFE_VENDOR_OPCODE_HOST2CA: return avc_debug & AVC_DEBUG_HOST2CA; return avc_debug & AVC_DEBUG_LNB_CONTROL ? "LNBControl" : NULL;
case SFE_VENDOR_OPCODE_CA2HOST: return avc_debug & AVC_DEBUG_CA2HOST; case SFE_VENDOR_OPCODE_TUNE_QPSK:
return avc_debug & AVC_DEBUG_TUNE_QPSK ? "TuneQPSK" : NULL;
case SFE_VENDOR_OPCODE_TUNE_QPSK2:
return avc_debug & AVC_DEBUG_TUNE_QPSK2 ? "TuneQPSK2" : NULL;
case SFE_VENDOR_OPCODE_HOST2CA:
return avc_debug & AVC_DEBUG_HOST2CA ? "Host2CA" : NULL;
case SFE_VENDOR_OPCODE_CA2HOST:
return avc_debug & AVC_DEBUG_CA2HOST ? "CA2Host" : NULL;
} }
return 1; return "Vendor/Unknown";
} }
static void debug_fcp(const u8 *data, int length) static void debug_fcp(const u8 *data, int length)
{ {
unsigned int subunit_type, subunit_id, op; unsigned int subunit_type, subunit_id, opcode;
const char *prefix = data[0] > 7 ? "FCP <- " : "FCP -> "; const char *op, *prefix;
prefix = data[0] > 7 ? "FCP <- " : "FCP -> ";
subunit_type = data[1] >> 3; subunit_type = data[1] >> 3;
subunit_id = data[1] & 7; subunit_id = data[1] & 7;
op = subunit_type == 0x1e || subunit_id == 5 ? ~0 : data[2]; opcode = subunit_type == 0x1e || subunit_id == 5 ? ~0 : data[2];
if (debug_fcp_opcode_flag_set(op, data, length)) { op = debug_fcp_opcode(opcode, data, length);
if (op) {
printk(KERN_INFO "%ssu=%x.%x l=%d: %-8s - %s\n", printk(KERN_INFO "%ssu=%x.%x l=%d: %-8s - %s\n",
prefix, subunit_type, subunit_id, length, prefix, subunit_type, subunit_id, length,
debug_fcp_ctype(data[0]), debug_fcp_ctype(data[0]), op);
debug_fcp_opcode(op, data, length));
if (avc_debug & AVC_DEBUG_FCP_PAYLOADS) if (avc_debug & AVC_DEBUG_FCP_PAYLOADS)
print_hex_dump(KERN_INFO, prefix, DUMP_PREFIX_NONE, print_hex_dump(KERN_INFO, prefix, DUMP_PREFIX_NONE,
16, 1, data, length, false); 16, 1, data, length, false);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册