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

[PATCH] consolidate CONFIG_WATCHDOG_NOWAYOUT handling

Attached patch removes #ifdef CONFIG_WATCHDOG_NOWAYOUT mess duplicated in
almost every watchdog driver and replaces it with common define in
linux/watchdog.h.

Signed-off-by: Andrey Panin <pazke@donpac.ru>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

Andrey Panin and committed by
Linus Torvalds
4bfdf378 7657e20e

+41 -179
+1 -5
drivers/char/ipmi/ipmi_watchdog.c
··· 131 131 #define WDIOC_GET_PRETIMEOUT _IOW(WATCHDOG_IOCTL_BASE, 22, int) 132 132 #endif 133 133 134 - #ifdef CONFIG_WATCHDOG_NOWAYOUT 135 - static int nowayout = 1; 136 - #else 137 - static int nowayout; 138 - #endif 134 + static int nowayout = WATCHDOG_NOWAYOUT; 139 135 140 136 static ipmi_user_t watchdog_user = NULL; 141 137
+1 -6
drivers/char/watchdog/acquirewdt.c
··· 82 82 module_param(wdt_start, int, 0); 83 83 MODULE_PARM_DESC(wdt_start, "Acquire WDT 'start' io port (default 0x443)"); 84 84 85 - #ifdef CONFIG_WATCHDOG_NOWAYOUT 86 - static int nowayout = 1; 87 - #else 88 - static int nowayout = 0; 89 - #endif 90 - 85 + static int nowayout = WATCHDOG_NOWAYOUT; 91 86 module_param(nowayout, int, 0); 92 87 MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)"); 93 88
+1 -6
drivers/char/watchdog/advantechwdt.c
··· 73 73 module_param(timeout, int, 0); 74 74 MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. 1<= timeout <=63, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) "."); 75 75 76 - #ifdef CONFIG_WATCHDOG_NOWAYOUT 77 - static int nowayout = 1; 78 - #else 79 - static int nowayout = 0; 80 - #endif 81 - 76 + static int nowayout = WATCHDOG_NOWAYOUT; 82 77 module_param(nowayout, int, 0); 83 78 MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)"); 84 79
+1 -6
drivers/char/watchdog/alim1535_wdt.c
··· 38 38 module_param(timeout, int, 0); 39 39 MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. (0<timeout<18000, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) ")"); 40 40 41 - #ifdef CONFIG_WATCHDOG_NOWAYOUT 42 - static int nowayout = 1; 43 - #else 44 - static int nowayout = 0; 45 - #endif 46 - 41 + static int nowayout = WATCHDOG_NOWAYOUT; 47 42 module_param(nowayout, int, 0); 48 43 MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)"); 49 44
+1 -6
drivers/char/watchdog/alim7101_wdt.c
··· 75 75 static char wdt_expect_close; 76 76 static struct pci_dev *alim7101_pmu; 77 77 78 - #ifdef CONFIG_WATCHDOG_NOWAYOUT 79 - static int nowayout = 1; 80 - #else 81 - static int nowayout = 0; 82 - #endif 83 - 78 + static int nowayout = WATCHDOG_NOWAYOUT; 84 79 module_param(nowayout, int, 0); 85 80 MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)"); 86 81
+1 -6
drivers/char/watchdog/eurotechwdt.c
··· 72 72 73 73 #define WDT_TIMEOUT 60 /* 1 minute */ 74 74 75 - #ifdef CONFIG_WATCHDOG_NOWAYOUT 76 - static int nowayout = 1; 77 - #else 78 - static int nowayout = 0; 79 - #endif 80 - 75 + static int nowayout = WATCHDOG_NOWAYOUT; 81 76 module_param(nowayout, int, 0); 82 77 MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)"); 83 78
+1 -6
drivers/char/watchdog/i8xx_tco.c
··· 105 105 module_param(heartbeat, int, 0); 106 106 MODULE_PARM_DESC(heartbeat, "Watchdog heartbeat in seconds. (2<heartbeat<39, default=" __MODULE_STRING(WATCHDOG_HEARTBEAT) ")"); 107 107 108 - #ifdef CONFIG_WATCHDOG_NOWAYOUT 109 - static int nowayout = 1; 110 - #else 111 - static int nowayout = 0; 112 - #endif 113 - 108 + static int nowayout = WATCHDOG_NOWAYOUT; 114 109 module_param(nowayout, int, 0); 115 110 MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)"); 116 111
+1 -6
drivers/char/watchdog/ib700wdt.c
··· 117 117 118 118 static int wd_margin = WD_TIMO; 119 119 120 - #ifdef CONFIG_WATCHDOG_NOWAYOUT 121 - static int nowayout = 1; 122 - #else 123 - static int nowayout = 0; 124 - #endif 125 - 120 + static int nowayout = WATCHDOG_NOWAYOUT; 126 121 module_param(nowayout, int, 0); 127 122 MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)"); 128 123
+1 -6
drivers/char/watchdog/indydog.c
··· 29 29 #define PFX "indydog: " 30 30 static int indydog_alive; 31 31 32 - #ifdef CONFIG_WATCHDOG_NOWAYOUT 33 - static int nowayout = 1; 34 - #else 35 - static int nowayout = 0; 36 - #endif 37 - 38 32 #define WATCHDOG_TIMEOUT 30 /* 30 sec default timeout */ 39 33 34 + static int nowayout = WATCHDOG_NOWAYOUT; 40 35 module_param(nowayout, int, 0); 41 36 MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)"); 42 37
+1 -5
drivers/char/watchdog/ixp2000_wdt.c
··· 30 30 #include <asm/hardware.h> 31 31 #include <asm/uaccess.h> 32 32 33 - #ifdef CONFIG_WATCHDOG_NOWAYOUT 34 - static int nowayout = 1; 35 - #else 36 - static int nowayout = 0; 37 - #endif 33 + static int nowayout = WATCHDOG_NOWAYOUT; 38 34 static unsigned int heartbeat = 60; /* (secs) Default is 1 minute */ 39 35 static unsigned long wdt_status; 40 36
+1 -5
drivers/char/watchdog/ixp4xx_wdt.c
··· 27 27 #include <asm/hardware.h> 28 28 #include <asm/uaccess.h> 29 29 30 - #ifdef CONFIG_WATCHDOG_NOWAYOUT 31 - static int nowayout = 1; 32 - #else 33 - static int nowayout = 0; 34 - #endif 30 + static int nowayout = WATCHDOG_NOWAYOUT; 35 31 static int heartbeat = 60; /* (secs) Default is 1 minute */ 36 32 static unsigned long wdt_status; 37 33 static unsigned long boot_status;
+1 -6
drivers/char/watchdog/machzwd.c
··· 94 94 MODULE_LICENSE("GPL"); 95 95 MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); 96 96 97 - #ifdef CONFIG_WATCHDOG_NOWAYOUT 98 - static int nowayout = 1; 99 - #else 100 - static int nowayout = 0; 101 - #endif 102 - 97 + static int nowayout = WATCHDOG_NOWAYOUT; 103 98 module_param(nowayout, int, 0); 104 99 MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)"); 105 100
+1 -6
drivers/char/watchdog/mixcomwd.c
··· 62 62 static struct timer_list mixcomwd_timer = TIMER_INITIALIZER(NULL, 0, 0); 63 63 static char expect_close; 64 64 65 - #ifdef CONFIG_WATCHDOG_NOWAYOUT 66 - static int nowayout = 1; 67 - #else 68 - static int nowayout = 0; 69 - #endif 70 - 65 + static int nowayout = WATCHDOG_NOWAYOUT; 71 66 module_param(nowayout, int, 0); 72 67 MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)"); 73 68
+1 -6
drivers/char/watchdog/pcwd.c
··· 146 146 module_param(heartbeat, int, 0); 147 147 MODULE_PARM_DESC(heartbeat, "Watchdog heartbeat in seconds. (2<=heartbeat<=7200, default=" __MODULE_STRING(WATCHDOG_HEARTBEAT) ")"); 148 148 149 - #ifdef CONFIG_WATCHDOG_NOWAYOUT 150 - static int nowayout = 1; 151 - #else 152 - static int nowayout = 0; 153 - #endif 154 - 149 + static int nowayout = WATCHDOG_NOWAYOUT; 155 150 module_param(nowayout, int, 0); 156 151 MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)"); 157 152
+1 -6
drivers/char/watchdog/pcwd_pci.c
··· 103 103 module_param(heartbeat, int, 0); 104 104 MODULE_PARM_DESC(heartbeat, "Watchdog heartbeat in seconds. (0<heartbeat<65536, default=" __MODULE_STRING(WATCHDOG_HEARTBEAT) ")"); 105 105 106 - #ifdef CONFIG_WATCHDOG_NOWAYOUT 107 - static int nowayout = 1; 108 - #else 109 - static int nowayout = 0; 110 - #endif 111 - 106 + static int nowayout = WATCHDOG_NOWAYOUT; 112 107 module_param(nowayout, int, 0); 113 108 MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)"); 114 109
+1 -6
drivers/char/watchdog/pcwd_usb.c
··· 79 79 module_param(heartbeat, int, 0); 80 80 MODULE_PARM_DESC(heartbeat, "Watchdog heartbeat in seconds. (0<heartbeat<65536, default=" __MODULE_STRING(WATCHDOG_HEARTBEAT) ")"); 81 81 82 - #ifdef CONFIG_WATCHDOG_NOWAYOUT 83 - static int nowayout = 1; 84 - #else 85 - static int nowayout = 0; 86 - #endif 87 - 82 + static int nowayout = WATCHDOG_NOWAYOUT; 88 83 module_param(nowayout, int, 0); 89 84 MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)"); 90 85
+1 -6
drivers/char/watchdog/s3c2410_wdt.c
··· 62 62 #define CONFIG_S3C2410_WATCHDOG_ATBOOT (0) 63 63 #define CONFIG_S3C2410_WATCHDOG_DEFAULT_TIME (15) 64 64 65 - #ifdef CONFIG_WATCHDOG_NOWAYOUT 66 - static int nowayout = 1; 67 - #else 68 - static int nowayout = 0; 69 - #endif 70 - 65 + static int nowayout = WATCHDOG_NOWAYOUT; 71 66 static int tmr_margin = CONFIG_S3C2410_WATCHDOG_DEFAULT_TIME; 72 67 static int tmr_atboot = CONFIG_S3C2410_WATCHDOG_ATBOOT; 73 68 static int soft_noboot = 0;
+1 -5
drivers/char/watchdog/sa1100_wdt.c
··· 42 42 static int expect_close; 43 43 static int pre_margin; 44 44 static int boot_status; 45 - #ifdef CONFIG_WATCHDOG_NOWAYOUT 46 - static int nowayout = 1; 47 - #else 48 - static int nowayout = 0; 49 - #endif 45 + static int nowayout = WATCHDOG_NOWAYOUT; 50 46 51 47 /* 52 48 * Allow only one person to hold it open
+1 -6
drivers/char/watchdog/sbc60xxwdt.c
··· 98 98 module_param(timeout, int, 0); 99 99 MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. (1<=timeout<=3600, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) ")"); 100 100 101 - #ifdef CONFIG_WATCHDOG_NOWAYOUT 102 - static int nowayout = 1; 103 - #else 104 - static int nowayout = 0; 105 - #endif 106 - 101 + static int nowayout = WATCHDOG_NOWAYOUT; 107 102 module_param(nowayout, int, 0); 108 103 MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)"); 109 104
+1 -6
drivers/char/watchdog/sc1200wdt.c
··· 91 91 module_param(timeout, int, 0); 92 92 MODULE_PARM_DESC(timeout, "range is 0-255 minutes, default is 1"); 93 93 94 - #ifdef CONFIG_WATCHDOG_NOWAYOUT 95 - static int nowayout = 1; 96 - #else 97 - static int nowayout = 0; 98 - #endif 99 - 94 + static int nowayout = WATCHDOG_NOWAYOUT; 100 95 module_param(nowayout, int, 0); 101 96 MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)"); 102 97
+1 -6
drivers/char/watchdog/sc520_wdt.c
··· 94 94 module_param(timeout, int, 0); 95 95 MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. (1<=timeout<=3600, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) ")"); 96 96 97 - #ifdef CONFIG_WATCHDOG_NOWAYOUT 98 - static int nowayout = 1; 99 - #else 100 - static int nowayout = 0; 101 - #endif 102 - 97 + static int nowayout = WATCHDOG_NOWAYOUT; 103 98 module_param(nowayout, int, 0); 104 99 MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)"); 105 100
+1 -5
drivers/char/watchdog/scx200_wdt.c
··· 39 39 MODULE_LICENSE("GPL"); 40 40 MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); 41 41 42 - #ifndef CONFIG_WATCHDOG_NOWAYOUT 43 - #define CONFIG_WATCHDOG_NOWAYOUT 0 44 - #endif 45 - 46 42 static int margin = 60; /* in seconds */ 47 43 module_param(margin, int, 0); 48 44 MODULE_PARM_DESC(margin, "Watchdog margin in seconds"); 49 45 50 - static int nowayout = CONFIG_WATCHDOG_NOWAYOUT; 46 + static int nowayout = WATCHDOG_NOWAYOUT; 51 47 module_param(nowayout, int, 0); 52 48 MODULE_PARM_DESC(nowayout, "Disable watchdog shutdown on close"); 53 49
+1 -5
drivers/char/watchdog/shwdt.c
··· 75 75 #define WATCHDOG_HEARTBEAT 30 /* 30 sec default heartbeat */ 76 76 static int heartbeat = WATCHDOG_HEARTBEAT; /* in seconds */ 77 77 78 - #ifdef CONFIG_WATCHDOG_NOWAYOUT 79 - static int nowayout = 1; 80 - #else 81 - static int nowayout = 0; 82 - #endif 78 + static int nowayout = WATCHDOG_NOWAYOUT; 83 79 84 80 /** 85 81 * sh_wdt_start - Start the Watchdog
+1 -6
drivers/char/watchdog/softdog.c
··· 56 56 module_param(soft_margin, int, 0); 57 57 MODULE_PARM_DESC(soft_margin, "Watchdog soft_margin in seconds. (0<soft_margin<65536, default=" __MODULE_STRING(TIMER_MARGIN) ")"); 58 58 59 - #ifdef CONFIG_WATCHDOG_NOWAYOUT 60 - static int nowayout = 1; 61 - #else 62 - static int nowayout = 0; 63 - #endif 64 - 59 + static int nowayout = WATCHDOG_NOWAYOUT; 65 60 module_param(nowayout, int, 0); 66 61 MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)"); 67 62
+1 -6
drivers/char/watchdog/w83627hf_wdt.c
··· 54 54 module_param(timeout, int, 0); 55 55 MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. 1<= timeout <=63, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) "."); 56 56 57 - #ifdef CONFIG_WATCHDOG_NOWAYOUT 58 - static int nowayout = 1; 59 - #else 60 - static int nowayout = 0; 61 - #endif 62 - 57 + static int nowayout = WATCHDOG_NOWAYOUT; 63 58 module_param(nowayout, int, 0); 64 59 MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)"); 65 60
+1 -6
drivers/char/watchdog/w83877f_wdt.c
··· 85 85 MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. (1<=timeout<=3600, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) ")"); 86 86 87 87 88 - #ifdef CONFIG_WATCHDOG_NOWAYOUT 89 - static int nowayout = 1; 90 - #else 91 - static int nowayout = 0; 92 - #endif 93 - 88 + static int nowayout = WATCHDOG_NOWAYOUT; 94 89 module_param(nowayout, int, 0); 95 90 MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)"); 96 91
+1 -6
drivers/char/watchdog/wafer5823wdt.c
··· 63 63 module_param(timeout, int, 0); 64 64 MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. 1<= timeout <=255, default=" __MODULE_STRING(WD_TIMO) "."); 65 65 66 - #ifdef CONFIG_WATCHDOG_NOWAYOUT 67 - static int nowayout = 1; 68 - #else 69 - static int nowayout = 0; 70 - #endif 71 - 66 + static int nowayout = WATCHDOG_NOWAYOUT; 72 67 module_param(nowayout, int, 0); 73 68 MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)"); 74 69
+1 -6
drivers/char/watchdog/wdt.c
··· 63 63 module_param(heartbeat, int, 0); 64 64 MODULE_PARM_DESC(heartbeat, "Watchdog heartbeat in seconds. (0<heartbeat<65536, default=" __MODULE_STRING(WD_TIMO) ")"); 65 65 66 - #ifdef CONFIG_WATCHDOG_NOWAYOUT 67 - static int nowayout = 1; 68 - #else 69 - static int nowayout = 0; 70 - #endif 71 - 66 + static int nowayout = WATCHDOG_NOWAYOUT; 72 67 module_param(nowayout, int, 0); 73 68 MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)"); 74 69
+1 -6
drivers/char/watchdog/wdt977.c
··· 53 53 module_param(testmode, int, 0); 54 54 MODULE_PARM_DESC(testmode,"Watchdog testmode (1 = no reboot), default=0"); 55 55 56 - #ifdef CONFIG_WATCHDOG_NOWAYOUT 57 - static int nowayout = 1; 58 - #else 59 - static int nowayout = 0; 60 - #endif 61 - 56 + static int nowayout = WATCHDOG_NOWAYOUT; 62 57 module_param(nowayout, int, 0); 63 58 MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)"); 64 59
+1 -6
drivers/char/watchdog/wdt_pci.c
··· 89 89 module_param(heartbeat, int, 0); 90 90 MODULE_PARM_DESC(heartbeat, "Watchdog heartbeat in seconds. (0<heartbeat<65536, default=" __MODULE_STRING(WD_TIMO) ")"); 91 91 92 - #ifdef CONFIG_WATCHDOG_NOWAYOUT 93 - static int nowayout = 1; 94 - #else 95 - static int nowayout = 0; 96 - #endif 97 - 92 + static int nowayout = WATCHDOG_NOWAYOUT; 98 93 module_param(nowayout, int, 0); 99 94 MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)"); 100 95
+1 -5
drivers/s390/char/vmwatchdog.c
··· 23 23 static char vmwdt_cmd[MAX_CMDLEN] = "IPL"; 24 24 static int vmwdt_conceal; 25 25 26 - #ifdef CONFIG_WATCHDOG_NOWAYOUT 27 - static int vmwdt_nowayout = 1; 28 - #else 29 - static int vmwdt_nowayout = 0; 30 - #endif 26 + static int vmwdt_nowayout = WATCHDOG_NOWAYOUT; 31 27 32 28 MODULE_LICENSE("GPL"); 33 29 MODULE_AUTHOR("Arnd Bergmann <arndb@de.ibm.com>");
+10
include/linux/watchdog.h
··· 47 47 #define WDIOS_ENABLECARD 0x0002 /* Turn on the watchdog timer */ 48 48 #define WDIOS_TEMPPANIC 0x0004 /* Kernel panic on temperature trip */ 49 49 50 + #ifdef __KERNEL__ 51 + 52 + #ifdef CONFIG_WATCHDOG_NOWAYOUT 53 + #define WATCHDOG_NOWAYOUT 1 54 + #else 55 + #define WATCHDOG_NOWAYOUT 0 56 + #endif 57 + 58 + #endif /* __KERNEL__ */ 59 + 50 60 #endif /* ifndef _LINUX_WATCHDOG_H */