Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

parport: fix if-statement empty body warnings

Eliminate warnings by using pr_debug which is the more typical
kernel debugging style and also enable dynamic_debug on these
outputs.

Miscellaneous:

o A few messages were logged at KERN_INFO when enabled, now KERN_DEBUG
o Convert %d/%d to %zd/%zu to avoid compilation warnings

Original-patch-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Link: https://lore.kernel.org/r/20200403134325.11523-1-sudipm.mukherjee@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Joe Perches and committed by
Greg Kroah-Hartman
d98ce9fe af831145

+57 -100
+34 -56
drivers/parport/ieee1284.c
··· 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) ··· 252 258 PARPORT_STATUS_PAPEROUT, 253 259 PARPORT_STATUS_PAPEROUT); 254 260 if (r) 255 - DPRINTK (KERN_INFO "%s: Timeout at event 49\n", 261 + pr_debug("%s: Timeout at event 49\n", 256 262 port->name); 257 263 258 264 parport_data_forward (port); 259 - DPRINTK (KERN_DEBUG "%s: ECP direction: forward\n", 260 - port->name); 265 + pr_debug("%s: ECP direction: forward\n", port->name); 261 266 port->ieee1284.phase = IEEE1284_PH_FWD_IDLE; 262 267 } 263 268 ··· 274 281 /* Event 24: nAck goes low */ 275 282 r = parport_wait_peripheral (port, PARPORT_STATUS_ACK, 0); 276 283 if (r) 277 - DPRINTK (KERN_INFO "%s: Timeout at event 24\n", 278 - port->name); 284 + pr_debug("%s: Timeout at event 24\n", port->name); 279 285 280 286 /* Event 25: Set nAutoFd low */ 281 287 parport_frob_control (port, ··· 286 294 PARPORT_STATUS_ACK, 287 295 PARPORT_STATUS_ACK); 288 296 if (r) 289 - DPRINTK (KERN_INFO "%s: Timeout at event 27\n", 290 - port->name); 297 + pr_debug("%s: Timeout at event 27\n", port->name); 291 298 292 299 /* Event 29: Set nAutoFd high */ 293 300 parport_frob_control (port, PARPORT_CONTROL_AUTOFD, 0); ··· 295 304 port->ieee1284.mode = IEEE1284_MODE_COMPAT; 296 305 port->ieee1284.phase = IEEE1284_PH_FWD_IDLE; 297 306 298 - DPRINTK (KERN_DEBUG "%s: In compatibility (forward idle) mode\n", 299 - port->name); 307 + pr_debug("%s: In compatibility (forward idle) mode\n", port->name); 300 308 } 301 309 #endif /* IEEE1284 support */ 302 310 ··· 396 406 PARPORT_CONTROL_SELECT 397 407 | PARPORT_CONTROL_AUTOFD, 398 408 PARPORT_CONTROL_SELECT); 399 - DPRINTK (KERN_DEBUG 400 - "%s: Peripheral not IEEE1284 compliant (0x%02X)\n", 409 + pr_debug("%s: Peripheral not IEEE1284 compliant (0x%02X)\n", 401 410 port->name, parport_read_status (port)); 402 411 port->ieee1284.phase = IEEE1284_PH_FWD_IDLE; 403 412 return -1; /* Not IEEE1284 compliant */ ··· 419 430 PARPORT_STATUS_ACK, 420 431 PARPORT_STATUS_ACK)) { 421 432 /* This shouldn't really happen with a compliant device. */ 422 - DPRINTK (KERN_DEBUG 423 - "%s: Mode 0x%02x not supported? (0x%02x)\n", 433 + pr_debug("%s: Mode 0x%02x not supported? (0x%02x)\n", 424 434 port->name, mode, port->ops->read_status (port)); 425 435 parport_ieee1284_terminate (port); 426 436 return 1; ··· 430 442 /* xflag should be high for all modes other than nibble (0). */ 431 443 if (mode && !xflag) { 432 444 /* Mode not supported. */ 433 - DPRINTK (KERN_DEBUG "%s: Mode 0x%02x rejected by peripheral\n", 445 + pr_debug("%s: Mode 0x%02x rejected by peripheral\n", 434 446 port->name, mode); 435 447 parport_ieee1284_terminate (port); 436 448 return 1; ··· 451 463 /* Event 52: nAck goes low */ 452 464 if (parport_wait_peripheral (port, PARPORT_STATUS_ACK, 0)) { 453 465 /* This peripheral is _very_ slow. */ 454 - DPRINTK (KERN_DEBUG 455 - "%s: Event 52 didn't happen\n", 456 - port->name); 466 + pr_debug("%s: Event 52 didn't happen\n", port->name); 457 467 parport_ieee1284_terminate (port); 458 468 return 1; 459 469 } ··· 467 481 PARPORT_STATUS_ACK)) { 468 482 /* This shouldn't really happen with a compliant 469 483 * device. */ 470 - DPRINTK (KERN_DEBUG 471 - "%s: Mode 0x%02x not supported? (0x%02x)\n", 484 + pr_debug("%s: Mode 0x%02x not supported? (0x%02x)\n", 472 485 port->name, mode, 473 - port->ops->read_status (port)); 486 + port->ops->read_status(port)); 474 487 parport_ieee1284_terminate (port); 475 488 return 1; 476 489 } ··· 480 495 /* xflag should be high. */ 481 496 if (!xflag) { 482 497 /* Extended mode not supported. */ 483 - DPRINTK (KERN_DEBUG "%s: Extended mode 0x%02x not " 484 - "supported\n", port->name, mode); 498 + pr_debug("%s: Extended mode 0x%02x not supported\n", 499 + port->name, mode); 485 500 parport_ieee1284_terminate (port); 486 501 return 1; 487 502 } ··· 490 505 } 491 506 492 507 /* Mode is supported */ 493 - DPRINTK (KERN_DEBUG "%s: In mode 0x%02x\n", port->name, mode); 508 + pr_debug("%s: In mode 0x%02x\n", port->name, mode); 494 509 port->ieee1284.mode = mode; 495 510 496 511 /* But ECP is special */ ··· 507 522 PARPORT_STATUS_PAPEROUT, 508 523 PARPORT_STATUS_PAPEROUT); 509 524 if (r) { 510 - DPRINTK (KERN_INFO "%s: Timeout at event 31\n", 511 - port->name); 525 + pr_debug("%s: Timeout at event 31\n", port->name); 512 526 } 513 527 514 528 port->ieee1284.phase = IEEE1284_PH_FWD_IDLE; 515 - DPRINTK (KERN_DEBUG "%s: ECP direction: forward\n", 516 - port->name); 529 + pr_debug("%s: ECP direction: forward\n", port->name); 517 530 } else switch (mode) { 518 531 case IEEE1284_MODE_NIBBLE: 519 532 case IEEE1284_MODE_BYTE: ··· 556 573 if (port->ieee1284.phase == IEEE1284_PH_REV_IDLE) { 557 574 /* An interrupt in this phase means that data 558 575 * is now available. */ 559 - DPRINTK (KERN_DEBUG "%s: Data available\n", port->name); 576 + pr_debug("%s: Data available\n", port->name); 560 577 parport_ieee1284_ack_data_avail (port); 561 578 } 562 579 #endif /* IEEE1284 support */ ··· 600 617 parport_negotiate (port, IEEE1284_MODE_COMPAT); 601 618 /* fall through */ 602 619 case IEEE1284_MODE_COMPAT: 603 - DPRINTK (KERN_DEBUG "%s: Using compatibility mode\n", 604 - port->name); 620 + pr_debug("%s: Using compatibility mode\n", port->name); 605 621 fn = port->ops->compat_write_data; 606 622 break; 607 623 608 624 case IEEE1284_MODE_EPP: 609 - DPRINTK (KERN_DEBUG "%s: Using EPP mode\n", port->name); 625 + pr_debug("%s: Using EPP mode\n", port->name); 610 626 if (addr) { 611 627 fn = port->ops->epp_write_addr; 612 628 } else { ··· 613 631 } 614 632 break; 615 633 case IEEE1284_MODE_EPPSWE: 616 - DPRINTK (KERN_DEBUG "%s: Using software-emulated EPP mode\n", 617 - port->name); 634 + pr_debug("%s: Using software-emulated EPP mode\n", port->name); 618 635 if (addr) { 619 636 fn = parport_ieee1284_epp_write_addr; 620 637 } else { ··· 622 641 break; 623 642 case IEEE1284_MODE_ECP: 624 643 case IEEE1284_MODE_ECPRLE: 625 - DPRINTK (KERN_DEBUG "%s: Using ECP mode\n", port->name); 644 + pr_debug("%s: Using ECP mode\n", port->name); 626 645 if (addr) { 627 646 fn = port->ops->ecp_write_addr; 628 647 } else { ··· 631 650 break; 632 651 633 652 case IEEE1284_MODE_ECPSWE: 634 - DPRINTK (KERN_DEBUG "%s: Using software-emulated ECP mode\n", 635 - port->name); 653 + pr_debug("%s: Using software-emulated ECP mode\n", port->name); 636 654 /* The caller has specified that it must be emulated, 637 655 * even if we have ECP hardware! */ 638 656 if (addr) { ··· 642 662 break; 643 663 644 664 default: 645 - DPRINTK (KERN_DEBUG "%s: Unknown mode 0x%02x\n", port->name, 646 - port->ieee1284.mode); 665 + pr_debug("%s: Unknown mode 0x%02x\n", 666 + port->name, port->ieee1284.mode); 647 667 return -ENOSYS; 648 668 } 649 669 650 670 retval = (*fn) (port, buffer, len, 0); 651 - DPRINTK (KERN_DEBUG "%s: wrote %d/%d bytes\n", port->name, retval, len); 671 + pr_debug("%s: wrote %zd/%zu bytes\n", port->name, retval, len); 652 672 return retval; 653 673 #endif /* IEEE1284 support */ 654 674 } ··· 695 715 if ((port->physport->modes & PARPORT_MODE_TRISTATE) && 696 716 !parport_negotiate (port, IEEE1284_MODE_BYTE)) { 697 717 /* got into BYTE mode OK */ 698 - DPRINTK (KERN_DEBUG "%s: Using byte mode\n", port->name); 718 + pr_debug("%s: Using byte mode\n", port->name); 699 719 fn = port->ops->byte_read_data; 700 720 break; 701 721 } ··· 704 724 } 705 725 /* fall through - to NIBBLE */ 706 726 case IEEE1284_MODE_NIBBLE: 707 - DPRINTK (KERN_DEBUG "%s: Using nibble mode\n", port->name); 727 + pr_debug("%s: Using nibble mode\n", port->name); 708 728 fn = port->ops->nibble_read_data; 709 729 break; 710 730 711 731 case IEEE1284_MODE_BYTE: 712 - DPRINTK (KERN_DEBUG "%s: Using byte mode\n", port->name); 732 + pr_debug("%s: Using byte mode\n", port->name); 713 733 fn = port->ops->byte_read_data; 714 734 break; 715 735 716 736 case IEEE1284_MODE_EPP: 717 - DPRINTK (KERN_DEBUG "%s: Using EPP mode\n", port->name); 737 + pr_debug("%s: Using EPP mode\n", port->name); 718 738 if (addr) { 719 739 fn = port->ops->epp_read_addr; 720 740 } else { ··· 722 742 } 723 743 break; 724 744 case IEEE1284_MODE_EPPSWE: 725 - DPRINTK (KERN_DEBUG "%s: Using software-emulated EPP mode\n", 726 - port->name); 745 + pr_debug("%s: Using software-emulated EPP mode\n", port->name); 727 746 if (addr) { 728 747 fn = parport_ieee1284_epp_read_addr; 729 748 } else { ··· 731 752 break; 732 753 case IEEE1284_MODE_ECP: 733 754 case IEEE1284_MODE_ECPRLE: 734 - DPRINTK (KERN_DEBUG "%s: Using ECP mode\n", port->name); 755 + pr_debug("%s: Using ECP mode\n", port->name); 735 756 fn = port->ops->ecp_read_data; 736 757 break; 737 758 738 759 case IEEE1284_MODE_ECPSWE: 739 - DPRINTK (KERN_DEBUG "%s: Using software-emulated ECP mode\n", 740 - port->name); 760 + pr_debug("%s: Using software-emulated ECP mode\n", port->name); 741 761 fn = parport_ieee1284_ecp_read_data; 742 762 break; 743 763 744 764 default: 745 - DPRINTK (KERN_DEBUG "%s: Unknown mode 0x%02x\n", port->name, 746 - port->physport->ieee1284.mode); 765 + pr_debug("%s: Unknown mode 0x%02x\n", 766 + port->name, port->physport->ieee1284.mode); 747 767 return -ENOSYS; 748 768 } 749 769
+23 -44
drivers/parport/ieee1284_ops.c
··· 27 27 #undef DEBUG /* Don't want a garbled console */ 28 28 #endif 29 29 30 - #ifdef DEBUG 31 - #define DPRINTK(stuff...) printk (stuff) 32 - #else 33 - #define DPRINTK(stuff...) 34 - #endif 35 - 36 30 /*** * 37 31 * One-way data transfer functions. * 38 32 * ***/ ··· 109 115 if (signal_pending (current)) 110 116 break; 111 117 112 - DPRINTK (KERN_DEBUG "%s: Timed out\n", port->name); 118 + pr_debug("%s: Timed out\n", port->name); 113 119 break; 114 120 115 121 ready: ··· 172 178 if (parport_wait_peripheral (port, 173 179 PARPORT_STATUS_ACK, 0)) { 174 180 /* Timeout -- no more data? */ 175 - DPRINTK (KERN_DEBUG 176 - "%s: Nibble timeout at event 9 (%d bytes)\n", 177 - port->name, i/2); 181 + pr_debug("%s: Nibble timeout at event 9 (%d bytes)\n", 182 + port->name, i / 2); 178 183 parport_frob_control (port, PARPORT_CONTROL_AUTOFD, 0); 179 184 break; 180 185 } ··· 194 201 PARPORT_STATUS_ACK, 195 202 PARPORT_STATUS_ACK)) { 196 203 /* Timeout -- no more data? */ 197 - DPRINTK (KERN_DEBUG 198 - "%s: Nibble timeout at event 11\n", 204 + pr_debug("%s: Nibble timeout at event 11\n", 199 205 port->name); 200 206 break; 201 207 } ··· 211 219 /* Read the last nibble without checking data avail. */ 212 220 if (parport_read_status (port) & PARPORT_STATUS_ERROR) { 213 221 end_of_data: 214 - DPRINTK (KERN_DEBUG 215 - "%s: No more nibble data (%d bytes)\n", 216 - port->name, i/2); 222 + pr_debug("%s: No more nibble data (%d bytes)\n", 223 + port->name, i / 2); 217 224 218 225 /* Go to reverse idle phase. */ 219 226 parport_frob_control (port, ··· 263 272 /* Timeout -- no more data? */ 264 273 parport_frob_control (port, PARPORT_CONTROL_AUTOFD, 265 274 0); 266 - DPRINTK (KERN_DEBUG "%s: Byte timeout at event 9\n", 267 - port->name); 275 + pr_debug("%s: Byte timeout at event 9\n", port->name); 268 276 break; 269 277 } 270 278 ··· 278 288 PARPORT_STATUS_ACK, 279 289 PARPORT_STATUS_ACK)) { 280 290 /* Timeout -- no more data? */ 281 - DPRINTK (KERN_DEBUG "%s: Byte timeout at event 11\n", 282 - port->name); 291 + pr_debug("%s: Byte timeout at event 11\n", port->name); 283 292 break; 284 293 } 285 294 ··· 296 307 /* Read the last byte without checking data avail. */ 297 308 if (parport_read_status (port) & PARPORT_STATUS_ERROR) { 298 309 end_of_data: 299 - DPRINTK (KERN_DEBUG 300 - "%s: No more byte data (%zd bytes)\n", 310 + pr_debug("%s: No more byte data (%zd bytes)\n", 301 311 port->name, count); 302 312 303 313 /* Go to reverse idle phase. */ ··· 341 353 PARPORT_STATUS_PAPEROUT, 0); 342 354 343 355 if (!retval) { 344 - DPRINTK (KERN_DEBUG "%s: ECP direction: reverse\n", 345 - port->name); 356 + pr_debug("%s: ECP direction: reverse\n", port->name); 346 357 port->ieee1284.phase = IEEE1284_PH_REV_IDLE; 347 358 } else { 348 - DPRINTK (KERN_DEBUG "%s: ECP direction: failed to reverse\n", 349 - port->name); 359 + pr_debug("%s: ECP direction: failed to reverse\n", port->name); 350 360 port->ieee1284.phase = IEEE1284_PH_ECP_DIR_UNKNOWN; 351 361 } 352 362 ··· 370 384 371 385 if (!retval) { 372 386 parport_data_forward (port); 373 - DPRINTK (KERN_DEBUG "%s: ECP direction: forward\n", 374 - port->name); 387 + pr_debug("%s: ECP direction: forward\n", port->name); 375 388 port->ieee1284.phase = IEEE1284_PH_FWD_IDLE; 376 389 } else { 377 - DPRINTK (KERN_DEBUG 378 - "%s: ECP direction: failed to switch forward\n", 390 + pr_debug("%s: ECP direction: failed to switch forward\n", 379 391 port->name); 380 392 port->ieee1284.phase = IEEE1284_PH_ECP_DIR_UNKNOWN; 381 393 } ··· 434 450 } 435 451 436 452 /* Time for Host Transfer Recovery (page 41 of IEEE1284) */ 437 - DPRINTK (KERN_DEBUG "%s: ECP transfer stalled!\n", port->name); 453 + pr_debug("%s: ECP transfer stalled!\n", port->name); 438 454 439 455 parport_frob_control (port, PARPORT_CONTROL_INIT, 440 456 PARPORT_CONTROL_INIT); ··· 450 466 if (!(parport_read_status (port) & PARPORT_STATUS_PAPEROUT)) 451 467 break; 452 468 453 - DPRINTK (KERN_DEBUG "%s: Host transfer recovered\n", 454 - port->name); 469 + pr_debug("%s: Host transfer recovered\n", port->name); 455 470 456 471 if (time_after_eq (jiffies, expire)) break; 457 472 goto try_again; ··· 548 565 command or a normal data byte, don't accept it. */ 549 566 if (command) { 550 567 if (byte & 0x80) { 551 - DPRINTK (KERN_DEBUG "%s: stopping short at " 552 - "channel command (%02x)\n", 568 + pr_debug("%s: stopping short at channel command (%02x)\n", 553 569 port->name, byte); 554 570 goto out; 555 571 } 556 572 else if (port->ieee1284.mode != IEEE1284_MODE_ECPRLE) 557 - DPRINTK (KERN_DEBUG "%s: device illegally " 558 - "using RLE; accepting anyway\n", 573 + pr_debug("%s: device illegally using RLE; accepting anyway\n", 559 574 port->name); 560 575 561 576 rle_count = byte + 1; 562 577 563 578 /* Are we allowed to read that many bytes? */ 564 579 if (rle_count > (len - count)) { 565 - DPRINTK (KERN_DEBUG "%s: leaving %d RLE bytes " 566 - "for next time\n", port->name, 567 - rle_count); 580 + pr_debug("%s: leaving %d RLE bytes for next time\n", 581 + port->name, rle_count); 568 582 break; 569 583 } 570 584 ··· 576 596 PARPORT_STATUS_ACK)) { 577 597 /* It's gone wrong. Return what data we have 578 598 to the caller. */ 579 - DPRINTK (KERN_DEBUG "ECP read timed out at 45\n"); 599 + pr_debug("ECP read timed out at 45\n"); 580 600 581 601 if (command) 582 602 printk (KERN_WARNING ··· 600 620 memset (buf, byte, rle_count); 601 621 buf += rle_count; 602 622 count += rle_count; 603 - DPRINTK (KERN_DEBUG "%s: decompressed to %d bytes\n", 623 + pr_debug("%s: decompressed to %d bytes\n", 604 624 port->name, rle_count); 605 625 } else { 606 626 /* Normal data byte. */ ··· 666 686 } 667 687 668 688 /* Time for Host Transfer Recovery (page 41 of IEEE1284) */ 669 - DPRINTK (KERN_DEBUG "%s: ECP transfer stalled!\n", port->name); 689 + pr_debug("%s: ECP transfer stalled!\n", port->name); 670 690 671 691 parport_frob_control (port, PARPORT_CONTROL_INIT, 672 692 PARPORT_CONTROL_INIT); ··· 682 702 if (!(parport_read_status (port) & PARPORT_STATUS_PAPEROUT)) 683 703 break; 684 704 685 - DPRINTK (KERN_DEBUG "%s: Host transfer recovered\n", 686 - port->name); 705 + pr_debug("%s: Host transfer recovered\n", port->name); 687 706 688 707 if (time_after_eq (jiffies, expire)) break; 689 708 goto try_again;