| .. | .. |
|---|
| 31 | 31 | #undef DEBUG /* Don't want a garbled console */ |
|---|
| 32 | 32 | #endif |
|---|
| 33 | 33 | |
|---|
| 34 | | -#ifdef DEBUG |
|---|
| 35 | | -#define DPRINTK(stuff...) printk (stuff) |
|---|
| 36 | | -#else |
|---|
| 37 | | -#define DPRINTK(stuff...) |
|---|
| 38 | | -#endif |
|---|
| 39 | | - |
|---|
| 40 | 34 | /* Make parport_wait_peripheral wake up. |
|---|
| 41 | 35 | * It will be useful to call this from an interrupt handler. */ |
|---|
| 42 | 36 | static void parport_ieee1284_wakeup (struct parport *port) |
|---|
| .. | .. |
|---|
| 258 | 252 | PARPORT_STATUS_PAPEROUT, |
|---|
| 259 | 253 | PARPORT_STATUS_PAPEROUT); |
|---|
| 260 | 254 | if (r) |
|---|
| 261 | | - DPRINTK (KERN_INFO "%s: Timeout at event 49\n", |
|---|
| 255 | + pr_debug("%s: Timeout at event 49\n", |
|---|
| 262 | 256 | port->name); |
|---|
| 263 | 257 | |
|---|
| 264 | 258 | parport_data_forward (port); |
|---|
| 265 | | - DPRINTK (KERN_DEBUG "%s: ECP direction: forward\n", |
|---|
| 266 | | - port->name); |
|---|
| 259 | + pr_debug("%s: ECP direction: forward\n", port->name); |
|---|
| 267 | 260 | port->ieee1284.phase = IEEE1284_PH_FWD_IDLE; |
|---|
| 268 | 261 | } |
|---|
| 269 | 262 | |
|---|
| 270 | | - /* fall through */ |
|---|
| 263 | + fallthrough; |
|---|
| 271 | 264 | |
|---|
| 272 | 265 | default: |
|---|
| 273 | 266 | /* Terminate from all other modes. */ |
|---|
| .. | .. |
|---|
| 281 | 274 | /* Event 24: nAck goes low */ |
|---|
| 282 | 275 | r = parport_wait_peripheral (port, PARPORT_STATUS_ACK, 0); |
|---|
| 283 | 276 | if (r) |
|---|
| 284 | | - DPRINTK (KERN_INFO "%s: Timeout at event 24\n", |
|---|
| 285 | | - port->name); |
|---|
| 277 | + pr_debug("%s: Timeout at event 24\n", port->name); |
|---|
| 286 | 278 | |
|---|
| 287 | 279 | /* Event 25: Set nAutoFd low */ |
|---|
| 288 | 280 | parport_frob_control (port, |
|---|
| .. | .. |
|---|
| 294 | 286 | PARPORT_STATUS_ACK, |
|---|
| 295 | 287 | PARPORT_STATUS_ACK); |
|---|
| 296 | 288 | if (r) |
|---|
| 297 | | - DPRINTK (KERN_INFO "%s: Timeout at event 27\n", |
|---|
| 298 | | - port->name); |
|---|
| 289 | + pr_debug("%s: Timeout at event 27\n", port->name); |
|---|
| 299 | 290 | |
|---|
| 300 | 291 | /* Event 29: Set nAutoFd high */ |
|---|
| 301 | 292 | parport_frob_control (port, PARPORT_CONTROL_AUTOFD, 0); |
|---|
| .. | .. |
|---|
| 304 | 295 | port->ieee1284.mode = IEEE1284_MODE_COMPAT; |
|---|
| 305 | 296 | port->ieee1284.phase = IEEE1284_PH_FWD_IDLE; |
|---|
| 306 | 297 | |
|---|
| 307 | | - DPRINTK (KERN_DEBUG "%s: In compatibility (forward idle) mode\n", |
|---|
| 308 | | - port->name); |
|---|
| 298 | + pr_debug("%s: In compatibility (forward idle) mode\n", port->name); |
|---|
| 309 | 299 | } |
|---|
| 310 | 300 | #endif /* IEEE1284 support */ |
|---|
| 311 | 301 | |
|---|
| .. | .. |
|---|
| 329 | 319 | #ifndef CONFIG_PARPORT_1284 |
|---|
| 330 | 320 | if (mode == IEEE1284_MODE_COMPAT) |
|---|
| 331 | 321 | return 0; |
|---|
| 332 | | - printk (KERN_ERR "parport: IEEE1284 not supported in this kernel\n"); |
|---|
| 322 | + pr_err("parport: IEEE1284 not supported in this kernel\n"); |
|---|
| 333 | 323 | return -1; |
|---|
| 334 | 324 | #else |
|---|
| 335 | 325 | int m = mode & ~IEEE1284_ADDR; |
|---|
| .. | .. |
|---|
| 406 | 396 | PARPORT_CONTROL_SELECT |
|---|
| 407 | 397 | | PARPORT_CONTROL_AUTOFD, |
|---|
| 408 | 398 | PARPORT_CONTROL_SELECT); |
|---|
| 409 | | - DPRINTK (KERN_DEBUG |
|---|
| 410 | | - "%s: Peripheral not IEEE1284 compliant (0x%02X)\n", |
|---|
| 399 | + pr_debug("%s: Peripheral not IEEE1284 compliant (0x%02X)\n", |
|---|
| 411 | 400 | port->name, parport_read_status (port)); |
|---|
| 412 | 401 | port->ieee1284.phase = IEEE1284_PH_FWD_IDLE; |
|---|
| 413 | 402 | return -1; /* Not IEEE1284 compliant */ |
|---|
| .. | .. |
|---|
| 430 | 419 | PARPORT_STATUS_ACK, |
|---|
| 431 | 420 | PARPORT_STATUS_ACK)) { |
|---|
| 432 | 421 | /* This shouldn't really happen with a compliant device. */ |
|---|
| 433 | | - DPRINTK (KERN_DEBUG |
|---|
| 434 | | - "%s: Mode 0x%02x not supported? (0x%02x)\n", |
|---|
| 422 | + pr_debug("%s: Mode 0x%02x not supported? (0x%02x)\n", |
|---|
| 435 | 423 | port->name, mode, port->ops->read_status (port)); |
|---|
| 436 | 424 | parport_ieee1284_terminate (port); |
|---|
| 437 | 425 | return 1; |
|---|
| .. | .. |
|---|
| 442 | 430 | /* xflag should be high for all modes other than nibble (0). */ |
|---|
| 443 | 431 | if (mode && !xflag) { |
|---|
| 444 | 432 | /* Mode not supported. */ |
|---|
| 445 | | - DPRINTK (KERN_DEBUG "%s: Mode 0x%02x rejected by peripheral\n", |
|---|
| 433 | + pr_debug("%s: Mode 0x%02x rejected by peripheral\n", |
|---|
| 446 | 434 | port->name, mode); |
|---|
| 447 | 435 | parport_ieee1284_terminate (port); |
|---|
| 448 | 436 | return 1; |
|---|
| .. | .. |
|---|
| 463 | 451 | /* Event 52: nAck goes low */ |
|---|
| 464 | 452 | if (parport_wait_peripheral (port, PARPORT_STATUS_ACK, 0)) { |
|---|
| 465 | 453 | /* This peripheral is _very_ slow. */ |
|---|
| 466 | | - DPRINTK (KERN_DEBUG |
|---|
| 467 | | - "%s: Event 52 didn't happen\n", |
|---|
| 468 | | - port->name); |
|---|
| 454 | + pr_debug("%s: Event 52 didn't happen\n", port->name); |
|---|
| 469 | 455 | parport_ieee1284_terminate (port); |
|---|
| 470 | 456 | return 1; |
|---|
| 471 | 457 | } |
|---|
| .. | .. |
|---|
| 481 | 467 | PARPORT_STATUS_ACK)) { |
|---|
| 482 | 468 | /* This shouldn't really happen with a compliant |
|---|
| 483 | 469 | * device. */ |
|---|
| 484 | | - DPRINTK (KERN_DEBUG |
|---|
| 485 | | - "%s: Mode 0x%02x not supported? (0x%02x)\n", |
|---|
| 470 | + pr_debug("%s: Mode 0x%02x not supported? (0x%02x)\n", |
|---|
| 486 | 471 | port->name, mode, |
|---|
| 487 | | - port->ops->read_status (port)); |
|---|
| 472 | + port->ops->read_status(port)); |
|---|
| 488 | 473 | parport_ieee1284_terminate (port); |
|---|
| 489 | 474 | return 1; |
|---|
| 490 | 475 | } |
|---|
| .. | .. |
|---|
| 495 | 480 | /* xflag should be high. */ |
|---|
| 496 | 481 | if (!xflag) { |
|---|
| 497 | 482 | /* Extended mode not supported. */ |
|---|
| 498 | | - DPRINTK (KERN_DEBUG "%s: Extended mode 0x%02x not " |
|---|
| 499 | | - "supported\n", port->name, mode); |
|---|
| 483 | + pr_debug("%s: Extended mode 0x%02x not supported\n", |
|---|
| 484 | + port->name, mode); |
|---|
| 500 | 485 | parport_ieee1284_terminate (port); |
|---|
| 501 | 486 | return 1; |
|---|
| 502 | 487 | } |
|---|
| .. | .. |
|---|
| 505 | 490 | } |
|---|
| 506 | 491 | |
|---|
| 507 | 492 | /* Mode is supported */ |
|---|
| 508 | | - DPRINTK (KERN_DEBUG "%s: In mode 0x%02x\n", port->name, mode); |
|---|
| 493 | + pr_debug("%s: In mode 0x%02x\n", port->name, mode); |
|---|
| 509 | 494 | port->ieee1284.mode = mode; |
|---|
| 510 | 495 | |
|---|
| 511 | 496 | /* But ECP is special */ |
|---|
| .. | .. |
|---|
| 522 | 507 | PARPORT_STATUS_PAPEROUT, |
|---|
| 523 | 508 | PARPORT_STATUS_PAPEROUT); |
|---|
| 524 | 509 | if (r) { |
|---|
| 525 | | - DPRINTK (KERN_INFO "%s: Timeout at event 31\n", |
|---|
| 526 | | - port->name); |
|---|
| 510 | + pr_debug("%s: Timeout at event 31\n", port->name); |
|---|
| 527 | 511 | } |
|---|
| 528 | 512 | |
|---|
| 529 | 513 | port->ieee1284.phase = IEEE1284_PH_FWD_IDLE; |
|---|
| 530 | | - DPRINTK (KERN_DEBUG "%s: ECP direction: forward\n", |
|---|
| 531 | | - port->name); |
|---|
| 514 | + pr_debug("%s: ECP direction: forward\n", port->name); |
|---|
| 532 | 515 | } else switch (mode) { |
|---|
| 533 | 516 | case IEEE1284_MODE_NIBBLE: |
|---|
| 534 | 517 | case IEEE1284_MODE_BYTE: |
|---|
| .. | .. |
|---|
| 573 | 556 | if (port->ieee1284.phase == IEEE1284_PH_REV_IDLE) { |
|---|
| 574 | 557 | /* An interrupt in this phase means that data |
|---|
| 575 | 558 | * is now available. */ |
|---|
| 576 | | - DPRINTK (KERN_DEBUG "%s: Data available\n", port->name); |
|---|
| 559 | + pr_debug("%s: Data available\n", port->name); |
|---|
| 577 | 560 | parport_ieee1284_ack_data_avail (port); |
|---|
| 578 | 561 | } |
|---|
| 579 | 562 | #endif /* IEEE1284 support */ |
|---|
| .. | .. |
|---|
| 615 | 598 | case IEEE1284_MODE_NIBBLE: |
|---|
| 616 | 599 | case IEEE1284_MODE_BYTE: |
|---|
| 617 | 600 | parport_negotiate (port, IEEE1284_MODE_COMPAT); |
|---|
| 618 | | - /* fall through */ |
|---|
| 601 | + fallthrough; |
|---|
| 619 | 602 | case IEEE1284_MODE_COMPAT: |
|---|
| 620 | | - DPRINTK (KERN_DEBUG "%s: Using compatibility mode\n", |
|---|
| 621 | | - port->name); |
|---|
| 603 | + pr_debug("%s: Using compatibility mode\n", port->name); |
|---|
| 622 | 604 | fn = port->ops->compat_write_data; |
|---|
| 623 | 605 | break; |
|---|
| 624 | 606 | |
|---|
| 625 | 607 | case IEEE1284_MODE_EPP: |
|---|
| 626 | | - DPRINTK (KERN_DEBUG "%s: Using EPP mode\n", port->name); |
|---|
| 608 | + pr_debug("%s: Using EPP mode\n", port->name); |
|---|
| 627 | 609 | if (addr) { |
|---|
| 628 | 610 | fn = port->ops->epp_write_addr; |
|---|
| 629 | 611 | } else { |
|---|
| .. | .. |
|---|
| 631 | 613 | } |
|---|
| 632 | 614 | break; |
|---|
| 633 | 615 | case IEEE1284_MODE_EPPSWE: |
|---|
| 634 | | - DPRINTK (KERN_DEBUG "%s: Using software-emulated EPP mode\n", |
|---|
| 635 | | - port->name); |
|---|
| 616 | + pr_debug("%s: Using software-emulated EPP mode\n", port->name); |
|---|
| 636 | 617 | if (addr) { |
|---|
| 637 | 618 | fn = parport_ieee1284_epp_write_addr; |
|---|
| 638 | 619 | } else { |
|---|
| .. | .. |
|---|
| 641 | 622 | break; |
|---|
| 642 | 623 | case IEEE1284_MODE_ECP: |
|---|
| 643 | 624 | case IEEE1284_MODE_ECPRLE: |
|---|
| 644 | | - DPRINTK (KERN_DEBUG "%s: Using ECP mode\n", port->name); |
|---|
| 625 | + pr_debug("%s: Using ECP mode\n", port->name); |
|---|
| 645 | 626 | if (addr) { |
|---|
| 646 | 627 | fn = port->ops->ecp_write_addr; |
|---|
| 647 | 628 | } else { |
|---|
| .. | .. |
|---|
| 650 | 631 | break; |
|---|
| 651 | 632 | |
|---|
| 652 | 633 | case IEEE1284_MODE_ECPSWE: |
|---|
| 653 | | - DPRINTK (KERN_DEBUG "%s: Using software-emulated ECP mode\n", |
|---|
| 654 | | - port->name); |
|---|
| 634 | + pr_debug("%s: Using software-emulated ECP mode\n", port->name); |
|---|
| 655 | 635 | /* The caller has specified that it must be emulated, |
|---|
| 656 | 636 | * even if we have ECP hardware! */ |
|---|
| 657 | 637 | if (addr) { |
|---|
| .. | .. |
|---|
| 662 | 642 | break; |
|---|
| 663 | 643 | |
|---|
| 664 | 644 | default: |
|---|
| 665 | | - DPRINTK (KERN_DEBUG "%s: Unknown mode 0x%02x\n", port->name, |
|---|
| 666 | | - port->ieee1284.mode); |
|---|
| 645 | + pr_debug("%s: Unknown mode 0x%02x\n", |
|---|
| 646 | + port->name, port->ieee1284.mode); |
|---|
| 667 | 647 | return -ENOSYS; |
|---|
| 668 | 648 | } |
|---|
| 669 | 649 | |
|---|
| 670 | 650 | retval = (*fn) (port, buffer, len, 0); |
|---|
| 671 | | - DPRINTK (KERN_DEBUG "%s: wrote %d/%d bytes\n", port->name, retval, len); |
|---|
| 651 | + pr_debug("%s: wrote %zd/%zu bytes\n", port->name, retval, len); |
|---|
| 672 | 652 | return retval; |
|---|
| 673 | 653 | #endif /* IEEE1284 support */ |
|---|
| 674 | 654 | } |
|---|
| .. | .. |
|---|
| 694 | 674 | ssize_t parport_read (struct parport *port, void *buffer, size_t len) |
|---|
| 695 | 675 | { |
|---|
| 696 | 676 | #ifndef CONFIG_PARPORT_1284 |
|---|
| 697 | | - printk (KERN_ERR "parport: IEEE1284 not supported in this kernel\n"); |
|---|
| 677 | + pr_err("parport: IEEE1284 not supported in this kernel\n"); |
|---|
| 698 | 678 | return -ENODEV; |
|---|
| 699 | 679 | #else |
|---|
| 700 | 680 | int mode = port->physport->ieee1284.mode; |
|---|
| .. | .. |
|---|
| 715 | 695 | if ((port->physport->modes & PARPORT_MODE_TRISTATE) && |
|---|
| 716 | 696 | !parport_negotiate (port, IEEE1284_MODE_BYTE)) { |
|---|
| 717 | 697 | /* got into BYTE mode OK */ |
|---|
| 718 | | - DPRINTK (KERN_DEBUG "%s: Using byte mode\n", port->name); |
|---|
| 698 | + pr_debug("%s: Using byte mode\n", port->name); |
|---|
| 719 | 699 | fn = port->ops->byte_read_data; |
|---|
| 720 | 700 | break; |
|---|
| 721 | 701 | } |
|---|
| 722 | 702 | if (parport_negotiate (port, IEEE1284_MODE_NIBBLE)) { |
|---|
| 723 | 703 | return -EIO; |
|---|
| 724 | 704 | } |
|---|
| 725 | | - /* fall through to NIBBLE */ |
|---|
| 705 | + fallthrough; /* to NIBBLE */ |
|---|
| 726 | 706 | case IEEE1284_MODE_NIBBLE: |
|---|
| 727 | | - DPRINTK (KERN_DEBUG "%s: Using nibble mode\n", port->name); |
|---|
| 707 | + pr_debug("%s: Using nibble mode\n", port->name); |
|---|
| 728 | 708 | fn = port->ops->nibble_read_data; |
|---|
| 729 | 709 | break; |
|---|
| 730 | 710 | |
|---|
| 731 | 711 | case IEEE1284_MODE_BYTE: |
|---|
| 732 | | - DPRINTK (KERN_DEBUG "%s: Using byte mode\n", port->name); |
|---|
| 712 | + pr_debug("%s: Using byte mode\n", port->name); |
|---|
| 733 | 713 | fn = port->ops->byte_read_data; |
|---|
| 734 | 714 | break; |
|---|
| 735 | 715 | |
|---|
| 736 | 716 | case IEEE1284_MODE_EPP: |
|---|
| 737 | | - DPRINTK (KERN_DEBUG "%s: Using EPP mode\n", port->name); |
|---|
| 717 | + pr_debug("%s: Using EPP mode\n", port->name); |
|---|
| 738 | 718 | if (addr) { |
|---|
| 739 | 719 | fn = port->ops->epp_read_addr; |
|---|
| 740 | 720 | } else { |
|---|
| .. | .. |
|---|
| 742 | 722 | } |
|---|
| 743 | 723 | break; |
|---|
| 744 | 724 | case IEEE1284_MODE_EPPSWE: |
|---|
| 745 | | - DPRINTK (KERN_DEBUG "%s: Using software-emulated EPP mode\n", |
|---|
| 746 | | - port->name); |
|---|
| 725 | + pr_debug("%s: Using software-emulated EPP mode\n", port->name); |
|---|
| 747 | 726 | if (addr) { |
|---|
| 748 | 727 | fn = parport_ieee1284_epp_read_addr; |
|---|
| 749 | 728 | } else { |
|---|
| .. | .. |
|---|
| 752 | 731 | break; |
|---|
| 753 | 732 | case IEEE1284_MODE_ECP: |
|---|
| 754 | 733 | case IEEE1284_MODE_ECPRLE: |
|---|
| 755 | | - DPRINTK (KERN_DEBUG "%s: Using ECP mode\n", port->name); |
|---|
| 734 | + pr_debug("%s: Using ECP mode\n", port->name); |
|---|
| 756 | 735 | fn = port->ops->ecp_read_data; |
|---|
| 757 | 736 | break; |
|---|
| 758 | 737 | |
|---|
| 759 | 738 | case IEEE1284_MODE_ECPSWE: |
|---|
| 760 | | - DPRINTK (KERN_DEBUG "%s: Using software-emulated ECP mode\n", |
|---|
| 761 | | - port->name); |
|---|
| 739 | + pr_debug("%s: Using software-emulated ECP mode\n", port->name); |
|---|
| 762 | 740 | fn = parport_ieee1284_ecp_read_data; |
|---|
| 763 | 741 | break; |
|---|
| 764 | 742 | |
|---|
| 765 | 743 | default: |
|---|
| 766 | | - DPRINTK (KERN_DEBUG "%s: Unknown mode 0x%02x\n", port->name, |
|---|
| 767 | | - port->physport->ieee1284.mode); |
|---|
| 744 | + pr_debug("%s: Unknown mode 0x%02x\n", |
|---|
| 745 | + port->name, port->physport->ieee1284.mode); |
|---|
| 768 | 746 | return -ENOSYS; |
|---|
| 769 | 747 | } |
|---|
| 770 | 748 | |
|---|