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

Input: i8042 - use pr_<level>, pr_fmt, fix dbg and __FILE__ use

Standardized message logging prefixes.
Removed \n from dbg macro, added \n to each dbg call site.
Removed direct use of __FILE__ from dbg, converted to pr_fmt(fmt)
Added non-debug printf argument verification of dbg calls
Removed "i8042.c" from printks, converted to pr_<level>

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>

authored by

Joe Perches and committed by
Dmitry Torokhov
4eb3c30b b029ffaf

+63 -73
+11 -19
drivers/input/serio/i8042-x86ia64io.h
··· 752 752 #endif 753 753 754 754 if (i8042_nopnp) { 755 - printk(KERN_INFO "i8042: PNP detection disabled\n"); 755 + pr_info("PNP detection disabled\n"); 756 756 return 0; 757 757 } 758 758 ··· 769 769 #if defined(__ia64__) 770 770 return -ENODEV; 771 771 #else 772 - printk(KERN_INFO "PNP: No PS/2 controller found. Probing ports directly.\n"); 772 + pr_info("PNP: No PS/2 controller found. Probing ports directly.\n"); 773 773 return 0; 774 774 #endif 775 775 } ··· 781 781 snprintf(aux_irq_str, sizeof(aux_irq_str), 782 782 "%d", i8042_pnp_aux_irq); 783 783 784 - printk(KERN_INFO "PNP: PS/2 Controller [%s%s%s] at %#x,%#x irq %s%s%s\n", 784 + pr_info("PNP: PS/2 Controller [%s%s%s] at %#x,%#x irq %s%s%s\n", 785 785 i8042_pnp_kbd_name, (i8042_pnp_kbd_devices && i8042_pnp_aux_devices) ? "," : "", 786 786 i8042_pnp_aux_name, 787 787 i8042_pnp_data_reg, i8042_pnp_command_reg, ··· 798 798 if (((i8042_pnp_data_reg & ~0xf) == (i8042_data_reg & ~0xf) && 799 799 i8042_pnp_data_reg != i8042_data_reg) || 800 800 !i8042_pnp_data_reg) { 801 - printk(KERN_WARNING 802 - "PNP: PS/2 controller has invalid data port %#x; " 803 - "using default %#x\n", 801 + pr_warn("PNP: PS/2 controller has invalid data port %#x; using default %#x\n", 804 802 i8042_pnp_data_reg, i8042_data_reg); 805 803 i8042_pnp_data_reg = i8042_data_reg; 806 804 pnp_data_busted = true; ··· 807 809 if (((i8042_pnp_command_reg & ~0xf) == (i8042_command_reg & ~0xf) && 808 810 i8042_pnp_command_reg != i8042_command_reg) || 809 811 !i8042_pnp_command_reg) { 810 - printk(KERN_WARNING 811 - "PNP: PS/2 controller has invalid command port %#x; " 812 - "using default %#x\n", 812 + pr_warn("PNP: PS/2 controller has invalid command port %#x; using default %#x\n", 813 813 i8042_pnp_command_reg, i8042_command_reg); 814 814 i8042_pnp_command_reg = i8042_command_reg; 815 815 pnp_data_busted = true; 816 816 } 817 817 818 818 if (!i8042_nokbd && !i8042_pnp_kbd_irq) { 819 - printk(KERN_WARNING 820 - "PNP: PS/2 controller doesn't have KBD irq; " 821 - "using default %d\n", i8042_kbd_irq); 819 + pr_warn("PNP: PS/2 controller doesn't have KBD irq; using default %d\n", 820 + i8042_kbd_irq); 822 821 i8042_pnp_kbd_irq = i8042_kbd_irq; 823 822 pnp_data_busted = true; 824 823 } 825 824 826 825 if (!i8042_noaux && !i8042_pnp_aux_irq) { 827 826 if (!pnp_data_busted && i8042_pnp_kbd_irq) { 828 - printk(KERN_WARNING 829 - "PNP: PS/2 appears to have AUX port disabled, " 830 - "if this is incorrect please boot with " 831 - "i8042.nopnp\n"); 827 + pr_warn("PNP: PS/2 appears to have AUX port disabled, " 828 + "if this is incorrect please boot with i8042.nopnp\n"); 832 829 i8042_noaux = true; 833 830 } else { 834 - printk(KERN_WARNING 835 - "PNP: PS/2 controller doesn't have AUX irq; " 836 - "using default %d\n", i8042_aux_irq); 831 + pr_warn("PNP: PS/2 controller doesn't have AUX irq; using default %d\n", 832 + i8042_aux_irq); 837 833 i8042_pnp_aux_irq = i8042_aux_irq; 838 834 } 839 835 }
+43 -49
drivers/input/serio/i8042.c
··· 10 10 * the Free Software Foundation. 11 11 */ 12 12 13 + #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 14 + 13 15 #include <linux/types.h> 14 16 #include <linux/delay.h> 15 17 #include <linux/module.h> ··· 227 225 udelay(50); 228 226 data = i8042_read_data(); 229 227 i++; 230 - dbg("%02x <- i8042 (flush, %s)", data, 231 - str & I8042_STR_AUXDATA ? "aux" : "kbd"); 228 + dbg("%02x <- i8042 (flush, %s)\n", 229 + data, str & I8042_STR_AUXDATA ? "aux" : "kbd"); 232 230 } 233 231 234 232 spin_unlock_irqrestore(&i8042_lock, flags); ··· 255 253 if (error) 256 254 return error; 257 255 258 - dbg("%02x -> i8042 (command)", command & 0xff); 256 + dbg("%02x -> i8042 (command)\n", command & 0xff); 259 257 i8042_write_command(command & 0xff); 260 258 261 259 for (i = 0; i < ((command >> 12) & 0xf); i++) { 262 260 error = i8042_wait_write(); 263 261 if (error) 264 262 return error; 265 - dbg("%02x -> i8042 (parameter)", param[i]); 263 + dbg("%02x -> i8042 (parameter)\n", param[i]); 266 264 i8042_write_data(param[i]); 267 265 } 268 266 269 267 for (i = 0; i < ((command >> 8) & 0xf); i++) { 270 268 error = i8042_wait_read(); 271 269 if (error) { 272 - dbg(" -- i8042 (timeout)"); 270 + dbg(" -- i8042 (timeout)\n"); 273 271 return error; 274 272 } 275 273 276 274 if (command == I8042_CMD_AUX_LOOP && 277 275 !(i8042_read_status() & I8042_STR_AUXDATA)) { 278 - dbg(" -- i8042 (auxerr)"); 276 + dbg(" -- i8042 (auxerr)\n"); 279 277 return -1; 280 278 } 281 279 282 280 param[i] = i8042_read_data(); 283 - dbg("%02x <- i8042 (return)", param[i]); 281 + dbg("%02x <- i8042 (return)\n", param[i]); 284 282 } 285 283 286 284 return 0; ··· 311 309 spin_lock_irqsave(&i8042_lock, flags); 312 310 313 311 if (!(retval = i8042_wait_write())) { 314 - dbg("%02x -> i8042 (kbd-data)", c); 312 + dbg("%02x -> i8042 (kbd-data)\n", c); 315 313 i8042_write_data(c); 316 314 } 317 315 ··· 357 355 358 356 i8042_ctr &= ~irq_bit; 359 357 if (i8042_command(&i8042_ctr, I8042_CMD_CTL_WCTR)) 360 - printk(KERN_WARNING 361 - "i8042.c: Can't write CTR while closing %s port.\n", 362 - port_name); 358 + pr_warn("Can't write CTR while closing %s port\n", port_name); 363 359 364 360 udelay(50); 365 361 366 362 i8042_ctr &= ~disable_bit; 367 363 i8042_ctr |= irq_bit; 368 364 if (i8042_command(&i8042_ctr, I8042_CMD_CTL_WCTR)) 369 - printk(KERN_ERR "i8042.c: Can't reactivate %s port.\n", 370 - port_name); 365 + pr_err("Can't reactivate %s port\n", port_name); 371 366 372 367 /* 373 368 * See if there is any data appeared while we were messing with ··· 455 456 str = i8042_read_status(); 456 457 if (unlikely(~str & I8042_STR_OBF)) { 457 458 spin_unlock_irqrestore(&i8042_lock, flags); 458 - if (irq) dbg("Interrupt %d, without any data", irq); 459 + if (irq) 460 + dbg("Interrupt %d, without any data\n", irq); 459 461 ret = 0; 460 462 goto out; 461 463 } ··· 469 469 470 470 dfl = 0; 471 471 if (str & I8042_STR_MUXERR) { 472 - dbg("MUX error, status is %02x, data is %02x", str, data); 472 + dbg("MUX error, status is %02x, data is %02x\n", 473 + str, data); 473 474 /* 474 475 * When MUXERR condition is signalled the data register can only contain 475 476 * 0xfd, 0xfe or 0xff if implementation follows the spec. Unfortunately ··· 513 512 port = &i8042_ports[port_no]; 514 513 serio = port->exists ? port->serio : NULL; 515 514 516 - dbg("%02x <- i8042 (interrupt, %d, %d%s%s)", 515 + dbg("%02x <- i8042 (interrupt, %d, %d%s%s)\n", 517 516 data, port_no, irq, 518 517 dfl & SERIO_PARITY ? ", bad parity" : "", 519 518 dfl & SERIO_TIMEOUT ? ", timeout" : ""); ··· 541 540 if (i8042_command(&i8042_ctr, I8042_CMD_CTL_WCTR)) { 542 541 i8042_ctr &= ~I8042_CTR_KBDINT; 543 542 i8042_ctr |= I8042_CTR_KBDDIS; 544 - printk(KERN_ERR "i8042.c: Failed to enable KBD port.\n"); 543 + pr_err("Failed to enable KBD port\n"); 545 544 return -EIO; 546 545 } 547 546 ··· 560 559 if (i8042_command(&i8042_ctr, I8042_CMD_CTL_WCTR)) { 561 560 i8042_ctr &= ~I8042_CTR_AUXINT; 562 561 i8042_ctr |= I8042_CTR_AUXDIS; 563 - printk(KERN_ERR "i8042.c: Failed to enable AUX port.\n"); 562 + pr_err("Failed to enable AUX port\n"); 564 563 return -EIO; 565 564 } 566 565 ··· 642 641 if (i8042_set_mux_mode(true, &mux_version)) 643 642 return -1; 644 643 645 - printk(KERN_INFO "i8042.c: Detected active multiplexing controller, rev %d.%d.\n", 644 + pr_info("Detected active multiplexing controller, rev %d.%d\n", 646 645 (mux_version >> 4) & 0xf, mux_version & 0xf); 647 646 648 647 /* ··· 652 651 i8042_ctr &= ~I8042_CTR_AUXINT; 653 652 654 653 if (i8042_command(&i8042_ctr, I8042_CMD_CTL_WCTR)) { 655 - printk(KERN_ERR "i8042.c: Failed to disable AUX port, can't use MUX.\n"); 654 + pr_err("Failed to disable AUX port, can't use MUX\n"); 656 655 return -EIO; 657 656 } 658 657 ··· 677 676 str = i8042_read_status(); 678 677 if (str & I8042_STR_OBF) { 679 678 data = i8042_read_data(); 680 - dbg("%02x <- i8042 (aux_test_irq, %s)", 681 - data, str & I8042_STR_AUXDATA ? "aux" : "kbd"); 679 + dbg("%02x <- i8042 (aux_test_irq, %s)\n", 680 + data, str & I8042_STR_AUXDATA ? "aux" : "kbd"); 682 681 if (i8042_irq_being_tested && 683 682 data == 0xa5 && (str & I8042_STR_AUXDATA)) 684 683 complete(&i8042_aux_irq_delivered); ··· 771 770 */ 772 771 773 772 if (i8042_toggle_aux(false)) { 774 - printk(KERN_WARNING "Failed to disable AUX port, but continuing anyway... Is this a SiS?\n"); 775 - printk(KERN_WARNING "If AUX port is really absent please use the 'i8042.noaux' option.\n"); 773 + pr_warn("Failed to disable AUX port, but continuing anyway... Is this a SiS?\n"); 774 + pr_warn("If AUX port is really absent please use the 'i8042.noaux' option\n"); 776 775 } 777 776 778 777 if (i8042_toggle_aux(true)) ··· 820 819 * AUX IRQ was never delivered so we need to flush the controller to 821 820 * get rid of the byte we put there; otherwise keyboard may not work. 822 821 */ 823 - dbg(" -- i8042 (aux irq test timeout)"); 822 + dbg(" -- i8042 (aux irq test timeout)\n"); 824 823 i8042_flush(); 825 824 retval = -1; 826 825 } ··· 846 845 static int i8042_controller_check(void) 847 846 { 848 847 if (i8042_flush() == I8042_BUFFER_SIZE) { 849 - printk(KERN_ERR "i8042.c: No controller found.\n"); 848 + pr_err("No controller found\n"); 850 849 return -ENODEV; 851 850 } 852 851 ··· 865 864 do { 866 865 867 866 if (i8042_command(&param, I8042_CMD_CTL_TEST)) { 868 - printk(KERN_ERR "i8042.c: i8042 controller self test timeout.\n"); 867 + pr_err("i8042 controller self test timeout\n"); 869 868 return -ENODEV; 870 869 } 871 870 872 871 if (param == I8042_RET_CTL_TEST) 873 872 return 0; 874 873 875 - printk(KERN_ERR "i8042.c: i8042 controller selftest failed. (%#x != %#x)\n", 876 - param, I8042_RET_CTL_TEST); 874 + pr_err("i8042 controller selftest failed. (%#x != %#x)\n", 875 + param, I8042_RET_CTL_TEST); 877 876 msleep(50); 878 877 } while (i++ < 5); 879 878 ··· 884 883 * and user will still get a working keyboard. This is especially 885 884 * important on netbooks. On other arches we trust hardware more. 886 885 */ 887 - printk(KERN_INFO 888 - "i8042: giving up on controller selftest, continuing anyway...\n"); 886 + pr_info("giving up on controller selftest, continuing anyway...\n"); 889 887 return 0; 890 888 #else 891 889 return -EIO; ··· 909 909 910 910 do { 911 911 if (n >= 10) { 912 - printk(KERN_ERR 913 - "i8042.c: Unable to get stable CTR read.\n"); 912 + pr_err("Unable to get stable CTR read\n"); 914 913 return -EIO; 915 914 } 916 915 ··· 917 918 udelay(50); 918 919 919 920 if (i8042_command(&ctr[n++ % 2], I8042_CMD_CTL_RCTR)) { 920 - printk(KERN_ERR 921 - "i8042.c: Can't read CTR while initializing i8042.\n"); 921 + pr_err("Can't read CTR while initializing i8042\n"); 922 922 return -EIO; 923 923 } 924 924 ··· 941 943 if (i8042_unlock) 942 944 i8042_ctr |= I8042_CTR_IGNKEYLOCK; 943 945 else 944 - printk(KERN_WARNING "i8042.c: Warning: Keylock active.\n"); 946 + pr_warn("Warning: Keylock active\n"); 945 947 } 946 948 spin_unlock_irqrestore(&i8042_lock, flags); 947 949 ··· 968 970 */ 969 971 970 972 if (i8042_command(&i8042_ctr, I8042_CMD_CTL_WCTR)) { 971 - printk(KERN_ERR "i8042.c: Can't write CTR while initializing i8042.\n"); 973 + pr_err("Can't write CTR while initializing i8042\n"); 972 974 return -EIO; 973 975 } 974 976 ··· 998 1000 i8042_ctr &= ~(I8042_CTR_KBDINT | I8042_CTR_AUXINT); 999 1001 1000 1002 if (i8042_command(&i8042_ctr, I8042_CMD_CTL_WCTR)) 1001 - printk(KERN_WARNING "i8042.c: Can't write CTR while resetting.\n"); 1003 + pr_warn("Can't write CTR while resetting\n"); 1002 1004 1003 1005 /* 1004 1006 * Disable MUX mode if present. ··· 1019 1021 */ 1020 1022 1021 1023 if (i8042_command(&i8042_initial_ctr, I8042_CMD_CTL_WCTR)) 1022 - printk(KERN_WARNING "i8042.c: Can't restore CTR.\n"); 1024 + pr_warn("Can't restore CTR\n"); 1023 1025 } 1024 1026 1025 1027 ··· 1043 1045 led = (state) ? 0x01 | 0x04 : 0; 1044 1046 while (i8042_read_status() & I8042_STR_IBF) 1045 1047 DELAY; 1046 - dbg("%02x -> i8042 (panic blink)", 0xed); 1048 + dbg("%02x -> i8042 (panic blink)\n", 0xed); 1047 1049 i8042_suppress_kbd_ack = 2; 1048 1050 i8042_write_data(0xed); /* set leds */ 1049 1051 DELAY; 1050 1052 while (i8042_read_status() & I8042_STR_IBF) 1051 1053 DELAY; 1052 1054 DELAY; 1053 - dbg("%02x -> i8042 (panic blink)", led); 1055 + dbg("%02x -> i8042 (panic blink)\n", led); 1054 1056 i8042_write_data(led); 1055 1057 DELAY; 1056 1058 return delay; ··· 1066 1068 1067 1069 error = i8042_command(&param, 0x1059); 1068 1070 if (error) 1069 - printk(KERN_WARNING 1070 - "Failed to enable DRITEK extension: %d\n", 1071 - error); 1071 + pr_warn("Failed to enable DRITEK extension: %d\n", error); 1072 1072 } 1073 1073 #endif 1074 1074 ··· 1101 1105 i8042_ctr |= I8042_CTR_AUXDIS | I8042_CTR_KBDDIS; 1102 1106 i8042_ctr &= ~(I8042_CTR_AUXINT | I8042_CTR_KBDINT); 1103 1107 if (i8042_command(&i8042_ctr, I8042_CMD_CTL_WCTR)) { 1104 - printk(KERN_WARNING "i8042: Can't write CTR to resume, retrying...\n"); 1108 + pr_warn("Can't write CTR to resume, retrying...\n"); 1105 1109 msleep(50); 1106 1110 if (i8042_command(&i8042_ctr, I8042_CMD_CTL_WCTR)) { 1107 - printk(KERN_ERR "i8042: CTR write retry failed\n"); 1111 + pr_err("CTR write retry failed\n"); 1108 1112 return -EIO; 1109 1113 } 1110 1114 } ··· 1117 1121 1118 1122 if (i8042_mux_present) { 1119 1123 if (i8042_set_mux_mode(true, NULL) || i8042_enable_mux_ports()) 1120 - printk(KERN_WARNING 1121 - "i8042: failed to resume active multiplexor, " 1122 - "mouse won't work.\n"); 1124 + pr_warn("failed to resume active multiplexor, mouse won't work\n"); 1123 1125 } else if (i8042_ports[I8042_AUX_PORT_NO].serio) 1124 1126 i8042_enable_aux_port(); 1125 1127
+9 -5
drivers/input/serio/i8042.h
··· 89 89 #ifdef DEBUG 90 90 static unsigned long i8042_start_time; 91 91 #define dbg_init() do { i8042_start_time = jiffies; } while (0) 92 - #define dbg(format, arg...) \ 93 - do { \ 92 + #define dbg(format, arg...) \ 93 + do { \ 94 94 if (i8042_debug) \ 95 - printk(KERN_DEBUG __FILE__ ": " format " [%d]\n" , \ 96 - ## arg, (int) (jiffies - i8042_start_time)); \ 95 + printk(KERN_DEBUG KBUILD_MODNAME ": [%d] " format, \ 96 + (int) (jiffies - i8042_start_time), ##arg); \ 97 97 } while (0) 98 98 #else 99 99 #define dbg_init() do { } while (0) 100 - #define dbg(format, arg...) do {} while (0) 100 + #define dbg(format, arg...) \ 101 + do { \ 102 + if (0) \ 103 + printk(KERN_DEBUG pr_fmt(format), ##arg); \ 104 + } while (0) 101 105 #endif 102 106 103 107 #endif /* _I8042_H */