diff options
Diffstat (limited to 'drivers/media/dvb/bt8xx/dst_ca.c')
-rw-r--r-- | drivers/media/dvb/bt8xx/dst_ca.c | 349 |
1 files changed, 126 insertions, 223 deletions
diff --git a/drivers/media/dvb/bt8xx/dst_ca.c b/drivers/media/dvb/bt8xx/dst_ca.c index d781504cc2fa..bfaacd5fc20f 100644 --- a/drivers/media/dvb/bt8xx/dst_ca.c +++ b/drivers/media/dvb/bt8xx/dst_ca.c | |||
@@ -32,7 +32,7 @@ | |||
32 | #include "dst_ca.h" | 32 | #include "dst_ca.h" |
33 | #include "dst_common.h" | 33 | #include "dst_common.h" |
34 | 34 | ||
35 | static unsigned int verbose = 1; | 35 | static unsigned int verbose = 5; |
36 | module_param(verbose, int, 0644); | 36 | module_param(verbose, int, 0644); |
37 | MODULE_PARM_DESC(verbose, "verbose startup messages, default is 1 (yes)"); | 37 | MODULE_PARM_DESC(verbose, "verbose startup messages, default is 1 (yes)"); |
38 | 38 | ||
@@ -295,34 +295,28 @@ static int ca_get_message(struct dst_state *state, struct ca_msg *p_ca_message, | |||
295 | return 0; | 295 | return 0; |
296 | } | 296 | } |
297 | 297 | ||
298 | static int handle_en50221_tag(struct dst_state *state, struct ca_msg *p_ca_message, struct ca_msg *hw_buffer) | 298 | static int handle_dst_tag(struct dst_state *state, struct ca_msg *p_ca_message, struct ca_msg *hw_buffer, u32 length) |
299 | { | 299 | { |
300 | if (state->dst_hw_cap & DST_TYPE_HAS_SESSION) { | 300 | if (state->dst_hw_cap & DST_TYPE_HAS_SESSION) { |
301 | hw_buffer->msg[2] = p_ca_message->msg[1]; /* MSB */ | 301 | hw_buffer->msg[2] = p_ca_message->msg[1]; /* MSB */ |
302 | hw_buffer->msg[3] = p_ca_message->msg[2]; /* LSB */ | 302 | hw_buffer->msg[3] = p_ca_message->msg[2]; /* LSB */ |
303 | } | 303 | } |
304 | else { | 304 | else { |
305 | hw_buffer->msg[0] = (length & 0xff) + 7; | ||
306 | hw_buffer->msg[1] = 0x40; | ||
305 | hw_buffer->msg[2] = 0x03; | 307 | hw_buffer->msg[2] = 0x03; |
306 | hw_buffer->msg[3] = 0x00; | 308 | hw_buffer->msg[3] = 0x00; |
309 | hw_buffer->msg[4] = 0x03; | ||
310 | hw_buffer->msg[5] = length & 0xff; | ||
311 | hw_buffer->msg[6] = 0x00; | ||
307 | } | 312 | } |
308 | return 0; | 313 | return 0; |
309 | } | 314 | } |
310 | 315 | ||
311 | static int debug_8820_buffer(struct ca_msg *hw_buffer) | ||
312 | { | ||
313 | unsigned int i; | ||
314 | |||
315 | dprintk("%s:Debug=[", __FUNCTION__); | ||
316 | for (i = 0; i < (hw_buffer->msg[0] + 1); i++) | ||
317 | dprintk(" %02x", hw_buffer->msg[i]); | ||
318 | dprintk("]\n"); | ||
319 | |||
320 | return 0; | ||
321 | } | ||
322 | 316 | ||
323 | static int write_to_8820(struct dst_state *state, struct ca_msg *hw_buffer, u8 reply) | 317 | static int write_to_8820(struct dst_state *state, struct ca_msg *hw_buffer, u8 length, u8 reply) |
324 | { | 318 | { |
325 | if ((dst_put_ci(state, hw_buffer->msg, (hw_buffer->length + 1), hw_buffer->msg, reply)) < 0) { | 319 | if ((dst_put_ci(state, hw_buffer->msg, length, hw_buffer->msg, reply)) < 0) { |
326 | dprintk("%s: DST-CI Command failed.\n", __FUNCTION__); | 320 | dprintk("%s: DST-CI Command failed.\n", __FUNCTION__); |
327 | dprintk("%s: Resetting DST.\n", __FUNCTION__); | 321 | dprintk("%s: Resetting DST.\n", __FUNCTION__); |
328 | rdc_reset_state(state); | 322 | rdc_reset_state(state); |
@@ -334,234 +328,141 @@ static int write_to_8820(struct dst_state *state, struct ca_msg *hw_buffer, u8 r | |||
334 | return 0; | 328 | return 0; |
335 | } | 329 | } |
336 | 330 | ||
337 | 331 | u32 asn_1_decode(u8 *asn_1_array) | |
338 | static int ca_set_pmt(struct dst_state *state, struct ca_msg *p_ca_message, struct ca_msg *hw_buffer, u8 reply, u8 query) | ||
339 | { | 332 | { |
340 | u32 hw_offset, buf_offset, i, k; | 333 | u8 length_field = 0, word_count = 0, count = 0; |
341 | u32 program_info_length = 0, es_info_length = 0, length = 0, words = 0; | 334 | u32 length = 0; |
342 | u8 found_prog_ca_desc = 0, found_stream_ca_desc = 0, error_condition = 0, hw_buffer_length = 0; | 335 | |
343 | 336 | length_field = asn_1_array[0]; | |
344 | if (verbose > 3) | 337 | dprintk("%s: Length field=[%02x]\n", __FUNCTION__, length_field); |
345 | dprintk("%s, p_ca_message length %d (0x%x)\n", __FUNCTION__,p_ca_message->length,p_ca_message->length ); | 338 | if (length_field < 0x80) { |
346 | 339 | length = length_field & 0x7f; | |
347 | handle_en50221_tag(state, p_ca_message, hw_buffer); /* EN50221 tag */ | 340 | dprintk("%s: Length=[%02x]\n", __FUNCTION__, length); |
348 | 341 | } else { | |
349 | /* Handle the length field (variable) */ | 342 | word_count = length_field & 0x7f; |
350 | if (!(p_ca_message->msg[3] & 0x80)) { /* Length = 1 */ | 343 | for (count = 0; count < word_count; count++) { |
351 | length = p_ca_message->msg[3] & 0x7f; | 344 | length = (length | asn_1_array[count + 1]) << 8; |
352 | words = 0; /* domi's suggestion */ | 345 | dprintk("%s: Length=[%04x]\n", __FUNCTION__, length); |
353 | } | ||
354 | else { /* Length = words */ | ||
355 | words = p_ca_message->msg[3] & 0x7f; | ||
356 | for (i = 0; i < words; i++) { | ||
357 | length = length << 8; | ||
358 | length = length | p_ca_message->msg[4 + i]; | ||
359 | } | 346 | } |
360 | } | 347 | } |
361 | if (verbose > 4) { | 348 | return length; |
362 | dprintk("%s:Length=[%d (0x%x)], Words=[%d]\n", __FUNCTION__, length,length, words); | 349 | } |
363 | |||
364 | /* Debug Input string */ | ||
365 | for (i = 0; i < length; i++) | ||
366 | dprintk(" %02x", p_ca_message->msg[i]); | ||
367 | dprintk("]\n"); | ||
368 | } | ||
369 | |||
370 | hw_offset = 7; | ||
371 | buf_offset = words + 4; | ||
372 | |||
373 | /* Program Header */ | ||
374 | if (verbose > 4) | ||
375 | dprintk("\n%s:Program Header=[", __FUNCTION__); | ||
376 | for (i = 0; i < 6; i++) { | ||
377 | hw_buffer->msg[hw_offset] = p_ca_message->msg[buf_offset]; | ||
378 | if (verbose > 4) | ||
379 | dprintk(" %02x", p_ca_message->msg[buf_offset]); | ||
380 | hw_offset++, buf_offset++, hw_buffer_length++; | ||
381 | } | ||
382 | if (verbose > 4) | ||
383 | dprintk("]\n"); | ||
384 | 350 | ||
385 | program_info_length = 0; | 351 | static int init_buffer(u8 *buffer, u32 length) |
386 | program_info_length = (((program_info_length | p_ca_message->msg[words + 8]) & 0x0f) << 8) | p_ca_message->msg[words + 9]; | 352 | { |
387 | if (verbose > 4) | 353 | u32 i; |
388 | dprintk("%s:Program info Length=[%d][%02x], hw_offset=[%d], buf_offset=[%d] \n", | 354 | for (i = 0; i < length; i++) |
389 | __FUNCTION__, program_info_length, program_info_length, hw_offset, buf_offset); | 355 | buffer[i] = 0; |
390 | 356 | ||
391 | if (program_info_length && (program_info_length < 256)) { /* If program_info_length */ | 357 | return 0; |
392 | hw_buffer->msg[11] = hw_buffer->msg[11] & 0x0f; /* req only 4 bits */ | 358 | } |
393 | hw_buffer->msg[12] = hw_buffer->msg[12] + 1; /* increment! ASIC bug! */ | ||
394 | 359 | ||
395 | if (p_ca_message->msg[buf_offset + 1] == 0x09) { /* Check CA descriptor */ | 360 | static int debug_string(u8 *msg, u32 length, u32 offset) |
396 | found_prog_ca_desc = 1; | 361 | { |
397 | if (verbose > 4) | 362 | u32 i; |
398 | dprintk("%s: Found CA descriptor @ Program level\n", __FUNCTION__); | ||
399 | } | ||
400 | 363 | ||
401 | if (found_prog_ca_desc) { /* Command only if CA descriptor */ | 364 | dprintk(" String=[ "); |
402 | hw_buffer->msg[13] = p_ca_message->msg[buf_offset]; /* CA PMT command ID */ | 365 | for (i = offset; i < length; i++) |
403 | hw_offset++, buf_offset++, hw_buffer_length++; | 366 | dprintk("%02x ", msg[i]); |
404 | } | 367 | dprintk("]\n"); |
405 | 368 | ||
406 | /* Program descriptors */ | 369 | return 0; |
407 | if (verbose > 4) { | 370 | } |
408 | dprintk("%s:**********>buf_offset=[%d], hw_offset=[%d]\n", __FUNCTION__, buf_offset, hw_offset); | ||
409 | dprintk("%s:Program descriptors=[", __FUNCTION__); | ||
410 | } | ||
411 | while (program_info_length && !error_condition) { /* Copy prog descriptors */ | ||
412 | if (program_info_length > p_ca_message->length) { /* Error situation */ | ||
413 | dprintk ("%s:\"WARNING\" Length error, line=[%d], prog_info_length=[%d]\n", | ||
414 | __FUNCTION__, __LINE__, program_info_length); | ||
415 | dprintk("%s:\"WARNING\" Bailing out of possible loop\n", __FUNCTION__); | ||
416 | error_condition = 1; | ||
417 | break; | ||
418 | } | ||
419 | 371 | ||
420 | hw_buffer->msg[hw_offset] = p_ca_message->msg[buf_offset]; | 372 | static int copy_string(u8 *destination, u8 *source, u32 dest_offset, u32 source_offset, u32 length) |
421 | dprintk(" %02x", p_ca_message->msg[buf_offset]); | 373 | { |
422 | hw_offset++, buf_offset++, hw_buffer_length++, program_info_length--; | 374 | u32 i; |
423 | } | 375 | dprintk("%s: Copying [", __FUNCTION__); |
424 | if (verbose > 4) { | 376 | for (i = 0; i < length; i++) { |
425 | dprintk("]\n"); | 377 | destination[i + dest_offset] = source[i + source_offset]; |
426 | dprintk("%s:**********>buf_offset=[%d], hw_offset=[%d]\n", __FUNCTION__, buf_offset, hw_offset); | 378 | dprintk(" %02x", source[i + source_offset]); |
427 | } | ||
428 | if (found_prog_ca_desc) { | ||
429 | if (!reply) { | ||
430 | hw_buffer->msg[13] = 0x01; /* OK descrambling */ | ||
431 | if (verbose > 1) | ||
432 | dprintk("CA PMT Command = OK Descrambling\n"); | ||
433 | } | ||
434 | else { | ||
435 | hw_buffer->msg[13] = 0x02; /* Ok MMI */ | ||
436 | if (verbose > 1) | ||
437 | dprintk("CA PMT Command = Ok MMI\n"); | ||
438 | } | ||
439 | if (query) { | ||
440 | hw_buffer->msg[13] = 0x03; /* Query */ | ||
441 | if (verbose > 1) | ||
442 | dprintk("CA PMT Command = CA PMT query\n"); | ||
443 | } | ||
444 | } | ||
445 | } | ||
446 | else { | ||
447 | hw_buffer->msg[11] = hw_buffer->msg[11] & 0xf0; /* Don't write to ASIC */ | ||
448 | hw_buffer->msg[12] = hw_buffer->msg[12] = 0x00; | ||
449 | } | 379 | } |
450 | if (verbose > 4) | 380 | dprintk("]\n"); |
451 | dprintk("%s:**********>p_ca_message->length=[%d], buf_offset=[%d], hw_offset=[%d]\n", | ||
452 | __FUNCTION__, p_ca_message->length, buf_offset, hw_offset); | ||
453 | |||
454 | while ((buf_offset < p_ca_message->length) && !error_condition) { | ||
455 | /* Bail out in case of an indefinite loop */ | ||
456 | if ((es_info_length > p_ca_message->length) || (buf_offset > p_ca_message->length)) { | ||
457 | dprintk("%s:\"WARNING\" Length error, line=[%d], prog_info_length=[%d], buf_offset=[%d]\n", | ||
458 | __FUNCTION__, __LINE__, program_info_length, buf_offset); | ||
459 | |||
460 | dprintk("%s:\"WARNING\" Bailing out of possible loop\n", __FUNCTION__); | ||
461 | error_condition = 1; | ||
462 | break; | ||
463 | } | ||
464 | |||
465 | /* Stream Header */ | ||
466 | |||
467 | for (k = 0; k < 5; k++) { | ||
468 | hw_buffer->msg[hw_offset + k] = p_ca_message->msg[buf_offset + k]; | ||
469 | } | ||
470 | 381 | ||
471 | es_info_length = 0; | 382 | return i; |
472 | es_info_length = (es_info_length | (p_ca_message->msg[buf_offset + 3] & 0x0f)) << 8 | p_ca_message->msg[buf_offset + 4]; | 383 | } |
473 | 384 | ||
474 | if (verbose > 4) { | 385 | static int modify_4_bits(u8 *message, u32 pos) |
475 | dprintk("\n%s:----->Stream header=[%02x %02x %02x %02x %02x]\n", __FUNCTION__, | 386 | { |
476 | p_ca_message->msg[buf_offset + 0], p_ca_message->msg[buf_offset + 1], | 387 | message[pos] &= 0x0f; |
477 | p_ca_message->msg[buf_offset + 2], p_ca_message->msg[buf_offset + 3], | ||
478 | p_ca_message->msg[buf_offset + 4]); | ||
479 | 388 | ||
480 | dprintk("%s:----->Stream type=[%02x], es length=[%d (0x%x)], Chars=[%02x] [%02x], buf_offset=[%d]\n", __FUNCTION__, | 389 | return 0; |
481 | p_ca_message->msg[buf_offset + 0], es_info_length, es_info_length, | 390 | } |
482 | p_ca_message->msg[buf_offset + 3], p_ca_message->msg[buf_offset + 4], buf_offset); | ||
483 | } | ||
484 | 391 | ||
485 | hw_buffer->msg[hw_offset + 3] &= 0x0f; /* req only 4 bits */ | ||
486 | 392 | ||
487 | if (found_prog_ca_desc) { | ||
488 | hw_buffer->msg[hw_offset + 3] = 0x00; | ||
489 | hw_buffer->msg[hw_offset + 4] = 0x00; | ||
490 | } | ||
491 | 393 | ||
492 | hw_offset += 5, buf_offset += 5, hw_buffer_length += 5; | 394 | static int ca_set_pmt(struct dst_state *state, struct ca_msg *p_ca_message, struct ca_msg *hw_buffer, u8 reply, u8 query) |
395 | { | ||
396 | u32 length = 0, count = 0; | ||
397 | u8 asn_1_words, program_header_length; | ||
398 | u16 program_info_length = 0, es_info_length = 0; | ||
399 | u32 hw_offset = 0, buf_offset = 0, i; | ||
400 | u8 dst_tag_length; | ||
493 | 401 | ||
494 | /* Check for CA descriptor */ | 402 | length = asn_1_decode(&p_ca_message->msg[3]); |
495 | if (p_ca_message->msg[buf_offset + 1] == 0x09) { | 403 | dprintk("%s: CA Message length=[%d]\n", __FUNCTION__, length); |
496 | if (verbose > 4) | 404 | dprintk("%s: ASN.1 ", __FUNCTION__); |
497 | dprintk("%s:Found CA descriptor @ Stream level\n", __FUNCTION__); | 405 | debug_string(&p_ca_message->msg[4], length, 0); // length does not include tag and length |
498 | found_stream_ca_desc = 1; | ||
499 | } | ||
500 | 406 | ||
501 | /* ES descriptors */ | 407 | init_buffer(hw_buffer->msg, length); |
502 | 408 | handle_dst_tag(state, p_ca_message, hw_buffer, length); | |
503 | if (es_info_length && !error_condition && !found_prog_ca_desc && found_stream_ca_desc) { | ||
504 | // if (!ca_pmt_done) { | ||
505 | hw_buffer->msg[hw_offset] = p_ca_message->msg[buf_offset]; /* CA PMT cmd(es) */ | ||
506 | if (verbose > 4) | ||
507 | printk("%s:----->CA PMT Command ID=[%02x]\n", __FUNCTION__, p_ca_message->msg[buf_offset]); | ||
508 | // hw_offset++, buf_offset++, hw_buffer_length++, es_info_length--, ca_pmt_done = 1; | ||
509 | hw_offset++, buf_offset++, hw_buffer_length++, es_info_length--; | ||
510 | // } | ||
511 | if (verbose > 4) | ||
512 | dprintk("%s:----->ES descriptors=[", __FUNCTION__); | ||
513 | |||
514 | while (es_info_length && !error_condition) { /* ES descriptors */ | ||
515 | if ((es_info_length > p_ca_message->length) || (buf_offset > p_ca_message->length)) { | ||
516 | if (verbose > 4) { | ||
517 | dprintk("%s:\"WARNING\" ES Length error, line=[%d], es_info_length=[%d], buf_offset=[%d]\n", | ||
518 | __FUNCTION__, __LINE__, es_info_length, buf_offset); | ||
519 | |||
520 | dprintk("%s:\"WARNING\" Bailing out of possible loop\n", __FUNCTION__); | ||
521 | } | ||
522 | error_condition = 1; | ||
523 | break; | ||
524 | } | ||
525 | 409 | ||
526 | hw_buffer->msg[hw_offset] = p_ca_message->msg[buf_offset]; | 410 | hw_offset = 7; |
527 | if (verbose > 3) | 411 | asn_1_words = 1; // just a hack to test, should compute this one |
528 | dprintk("%02x ", hw_buffer->msg[hw_offset]); | 412 | buf_offset = 3; |
529 | hw_offset++, buf_offset++, hw_buffer_length++, es_info_length--; | 413 | program_header_length = 6; |
530 | } | 414 | dst_tag_length = 7; |
531 | found_stream_ca_desc = 0; /* unset for new streams */ | 415 | |
532 | dprintk("]\n"); | 416 | // debug_twinhan_ca_params(state, p_ca_message, hw_buffer, reply, query, length, hw_offset, buf_offset); |
417 | // dprintk("%s: Program Header(BUF)", __FUNCTION__); | ||
418 | // debug_string(&p_ca_message->msg[4], program_header_length, 0); | ||
419 | // dprintk("%s: Copying Program header\n", __FUNCTION__); | ||
420 | copy_string(hw_buffer->msg, p_ca_message->msg, hw_offset, (buf_offset + asn_1_words), program_header_length); | ||
421 | buf_offset += program_header_length, hw_offset += program_header_length; | ||
422 | modify_4_bits(hw_buffer->msg, (hw_offset - 2)); | ||
423 | if (state->type_flags & DST_TYPE_HAS_INC_COUNT) { // workaround | ||
424 | dprintk("%s: Probably an ASIC bug !!!\n", __FUNCTION__); | ||
425 | debug_string(hw_buffer->msg, (hw_offset + program_header_length), 0); | ||
426 | hw_buffer->msg[hw_offset - 1] += 1; | ||
427 | } | ||
428 | |||
429 | // dprintk("%s: Program Header(HW), Count=[%d]", __FUNCTION__, count); | ||
430 | // debug_string(hw_buffer->msg, hw_offset, 0); | ||
431 | |||
432 | program_info_length = ((program_info_length | (p_ca_message->msg[buf_offset - 1] & 0x0f)) << 8) | p_ca_message->msg[buf_offset]; | ||
433 | dprintk("%s: Program info length=[%02x]\n", __FUNCTION__, program_info_length); | ||
434 | if (program_info_length) { | ||
435 | count = copy_string(hw_buffer->msg, p_ca_message->msg, hw_offset, (buf_offset + 1), (program_info_length + 1) ); // copy next elem, not current | ||
436 | buf_offset += count, hw_offset += count; | ||
437 | // dprintk("%s: Program level ", __FUNCTION__); | ||
438 | // debug_string(hw_buffer->msg, hw_offset, 0); | ||
439 | } | ||
440 | |||
441 | buf_offset += 1;// hw_offset += 1; | ||
442 | for (i = buf_offset; i < length; i++) { | ||
443 | // dprintk("%s: Stream Header ", __FUNCTION__); | ||
444 | count = copy_string(hw_buffer->msg, p_ca_message->msg, hw_offset, buf_offset, 5); | ||
445 | modify_4_bits(hw_buffer->msg, (hw_offset + 3)); | ||
446 | |||
447 | hw_offset += 5, buf_offset += 5, i += 4; | ||
448 | // debug_string(hw_buffer->msg, hw_offset, (hw_offset - 5)); | ||
449 | es_info_length = ((es_info_length | (p_ca_message->msg[buf_offset - 1] & 0x0f)) << 8) | p_ca_message->msg[buf_offset]; | ||
450 | dprintk("%s: ES info length=[%02x]\n", __FUNCTION__, es_info_length); | ||
451 | if (es_info_length) { | ||
452 | // copy descriptors @ STREAM level | ||
453 | dprintk("%s: Descriptors @ STREAM level...!!! \n", __FUNCTION__); | ||
533 | } | 454 | } |
534 | } | ||
535 | |||
536 | /* MCU Magic words */ | ||
537 | |||
538 | hw_buffer_length += 7; | ||
539 | hw_buffer->msg[0] = hw_buffer_length; | ||
540 | hw_buffer->msg[1] = 64; | ||
541 | hw_buffer->msg[4] = 3; | ||
542 | hw_buffer->msg[5] = hw_buffer->msg[0] - 7; | ||
543 | hw_buffer->msg[6] = 0; | ||
544 | |||
545 | 455 | ||
546 | /* Fix length */ | ||
547 | hw_buffer->length = hw_buffer->msg[0]; | ||
548 | |||
549 | put_checksum(&hw_buffer->msg[0], hw_buffer->msg[0]); | ||
550 | /* Do the actual write */ | ||
551 | if (verbose > 4) { | ||
552 | dprintk("%s:======================DEBUGGING================================\n", __FUNCTION__); | ||
553 | dprintk("%s: Actual Length=[%d]\n", __FUNCTION__, hw_buffer_length); | ||
554 | } | 456 | } |
555 | /* Only for debugging! */ | 457 | hw_buffer->msg[length + dst_tag_length] = dst_check_sum(hw_buffer->msg, (length + dst_tag_length)); |
556 | if (verbose > 2) | 458 | // dprintk("%s: Total length=[%d], Checksum=[%02x]\n", __FUNCTION__, (length + dst_tag_length), hw_buffer->msg[length + dst_tag_length]); |
557 | debug_8820_buffer(hw_buffer); | 459 | debug_string(hw_buffer->msg, (length + dst_tag_length + 1), 0); // dst tags also |
558 | if (verbose > 3) | 460 | write_to_8820(state, hw_buffer, (length + dst_tag_length + 1), reply); // checksum |
559 | dprintk("%s: Reply = [%d]\n", __FUNCTION__, reply); | ||
560 | write_to_8820(state, hw_buffer, reply); | ||
561 | 461 | ||
562 | return 0; | 462 | return 0; |
563 | } | 463 | } |
564 | 464 | ||
465 | |||
565 | /* Board supports CA PMT reply ? */ | 466 | /* Board supports CA PMT reply ? */ |
566 | static int dst_check_ca_pmt(struct dst_state *state, struct ca_msg *p_ca_message, struct ca_msg *hw_buffer) | 467 | static int dst_check_ca_pmt(struct dst_state *state, struct ca_msg *p_ca_message, struct ca_msg *hw_buffer) |
567 | { | 468 | { |
@@ -605,7 +506,7 @@ static int ca_send_message(struct dst_state *state, struct ca_msg *p_ca_message, | |||
605 | struct ca_msg *hw_buffer; | 506 | struct ca_msg *hw_buffer; |
606 | 507 | ||
607 | if ((hw_buffer = (struct ca_msg *) kmalloc(sizeof (struct ca_msg), GFP_KERNEL)) == NULL) { | 508 | if ((hw_buffer = (struct ca_msg *) kmalloc(sizeof (struct ca_msg), GFP_KERNEL)) == NULL) { |
608 | printk("%s: Memory allocation failure\n", __FUNCTION__); | 509 | dprintk("%s: Memory allocation failure\n", __FUNCTION__); |
609 | return -ENOMEM; | 510 | return -ENOMEM; |
610 | } | 511 | } |
611 | if (verbose > 3) | 512 | if (verbose > 3) |
@@ -630,8 +531,10 @@ static int ca_send_message(struct dst_state *state, struct ca_msg *p_ca_message, | |||
630 | switch (command) { | 531 | switch (command) { |
631 | case CA_PMT: | 532 | case CA_PMT: |
632 | if (verbose > 3) | 533 | if (verbose > 3) |
534 | // dprintk("Command = SEND_CA_PMT\n"); | ||
633 | dprintk("Command = SEND_CA_PMT\n"); | 535 | dprintk("Command = SEND_CA_PMT\n"); |
634 | if ((ca_set_pmt(state, p_ca_message, hw_buffer, 0, 0)) < 0) { | 536 | // if ((ca_set_pmt(state, p_ca_message, hw_buffer, 0, 0)) < 0) { |
537 | if ((ca_set_pmt(state, p_ca_message, hw_buffer, 0, 0)) < 0) { // code simplification started | ||
635 | dprintk("%s: -->CA_PMT Failed !\n", __FUNCTION__); | 538 | dprintk("%s: -->CA_PMT Failed !\n", __FUNCTION__); |
636 | return -1; | 539 | return -1; |
637 | } | 540 | } |
@@ -664,7 +567,7 @@ static int ca_send_message(struct dst_state *state, struct ca_msg *p_ca_message, | |||
664 | return -1; | 567 | return -1; |
665 | } | 568 | } |
666 | if (verbose > 3) | 569 | if (verbose > 3) |
667 | printk("%s: -->CA_APP_INFO_ENQUIRY Success !\n", __FUNCTION__); | 570 | dprintk("%s: -->CA_APP_INFO_ENQUIRY Success !\n", __FUNCTION__); |
668 | 571 | ||
669 | break; | 572 | break; |
670 | } | 573 | } |
@@ -681,17 +584,17 @@ static int dst_ca_ioctl(struct inode *inode, struct file *file, unsigned int cmd | |||
681 | struct ca_msg *p_ca_message; | 584 | struct ca_msg *p_ca_message; |
682 | 585 | ||
683 | if ((p_ca_message = (struct ca_msg *) kmalloc(sizeof (struct ca_msg), GFP_KERNEL)) == NULL) { | 586 | if ((p_ca_message = (struct ca_msg *) kmalloc(sizeof (struct ca_msg), GFP_KERNEL)) == NULL) { |
684 | printk("%s: Memory allocation failure\n", __FUNCTION__); | 587 | dprintk("%s: Memory allocation failure\n", __FUNCTION__); |
685 | return -ENOMEM; | 588 | return -ENOMEM; |
686 | } | 589 | } |
687 | 590 | ||
688 | if ((p_ca_slot_info = (struct ca_slot_info *) kmalloc(sizeof (struct ca_slot_info), GFP_KERNEL)) == NULL) { | 591 | if ((p_ca_slot_info = (struct ca_slot_info *) kmalloc(sizeof (struct ca_slot_info), GFP_KERNEL)) == NULL) { |
689 | printk("%s: Memory allocation failure\n", __FUNCTION__); | 592 | dprintk("%s: Memory allocation failure\n", __FUNCTION__); |
690 | return -ENOMEM; | 593 | return -ENOMEM; |
691 | } | 594 | } |
692 | 595 | ||
693 | if ((p_ca_caps = (struct ca_caps *) kmalloc(sizeof (struct ca_caps), GFP_KERNEL)) == NULL) { | 596 | if ((p_ca_caps = (struct ca_caps *) kmalloc(sizeof (struct ca_caps), GFP_KERNEL)) == NULL) { |
694 | printk("%s: Memory allocation failure\n", __FUNCTION__); | 597 | dprintk("%s: Memory allocation failure\n", __FUNCTION__); |
695 | return -ENOMEM; | 598 | return -ENOMEM; |
696 | } | 599 | } |
697 | 600 | ||