| 1 | --- a/drivers/cbus/retu-wdt.c |
| 2 | +++ b/drivers/cbus/retu-wdt.c |
| 3 | @@ -52,7 +52,6 @@ static DEFINE_MUTEX(retu_wdt_mutex); |
| 4 | |
| 5 | /* Current period of watchdog */ |
| 6 | static unsigned int period_val = RETU_WDT_DEFAULT_TIMER; |
| 7 | -static int counter_param = RETU_WDT_MAX_TIMER; |
| 8 | |
| 9 | struct retu_wdt_dev { |
| 10 | struct device *dev; |
| 11 | @@ -109,56 +108,6 @@ static void retu_wdt_ping_work(struct wo |
| 12 | retu_wdt_ping_enable(wdev); |
| 13 | } |
| 14 | |
| 15 | -static ssize_t retu_wdt_period_show(struct device *dev, |
| 16 | - struct device_attribute *attr, char *buf) |
| 17 | -{ |
| 18 | - /* Show current max counter */ |
| 19 | - return sprintf(buf, "%u\n", (u16)period_val); |
| 20 | -} |
| 21 | - |
| 22 | -/* |
| 23 | - * Note: This inteface is non-standard and likely to disappear! |
| 24 | - * Use /dev/watchdog instead, that's the standard. |
| 25 | - */ |
| 26 | -static ssize_t retu_wdt_period_store(struct device *dev, |
| 27 | - struct device_attribute *attr, |
| 28 | - const char *buf, size_t count) |
| 29 | -{ |
| 30 | - unsigned int new_period; |
| 31 | - int ret; |
| 32 | - |
| 33 | -#ifdef CONFIG_WATCHDOG_NOWAYOUT |
| 34 | - retu_wdt_ping_disable(retu_wdt); |
| 35 | -#endif |
| 36 | - |
| 37 | - if (sscanf(buf, "%u", &new_period) != 1) { |
| 38 | - printk(KERN_ALERT "retu_wdt_period_store: Invalid input\n"); |
| 39 | - return -EINVAL; |
| 40 | - } |
| 41 | - |
| 42 | - ret = retu_modify_counter(new_period); |
| 43 | - if (ret < 0) |
| 44 | - return ret; |
| 45 | - |
| 46 | - return strnlen(buf, count); |
| 47 | -} |
| 48 | - |
| 49 | -static ssize_t retu_wdt_counter_show(struct device *dev, |
| 50 | - struct device_attribute *attr, char *buf) |
| 51 | -{ |
| 52 | - u16 counter; |
| 53 | - |
| 54 | - /* Show current value in watchdog counter */ |
| 55 | - counter = retu_read_reg(dev, RETU_REG_WATCHDOG); |
| 56 | - |
| 57 | - /* Only the 5 LSB are important */ |
| 58 | - return snprintf(buf, PAGE_SIZE, "%u\n", (counter & 0x3F)); |
| 59 | -} |
| 60 | - |
| 61 | -static DEVICE_ATTR(period, S_IRUGO | S_IWUSR, retu_wdt_period_show, \ |
| 62 | - retu_wdt_period_store); |
| 63 | -static DEVICE_ATTR(counter, S_IRUGO, retu_wdt_counter_show, NULL); |
| 64 | - |
| 65 | static int retu_wdt_open(struct inode *inode, struct file *file) |
| 66 | { |
| 67 | if (test_and_set_bit(0, &retu_wdt->users)) |
| 68 | @@ -232,18 +181,6 @@ static long retu_wdt_ioctl(struct file * |
| 69 | return 0; |
| 70 | } |
| 71 | |
| 72 | -/* Start kicking retu watchdog until user space starts doing the kicking */ |
| 73 | -static int __devinit retu_wdt_ping(void) |
| 74 | -{ |
| 75 | -#ifdef CONFIG_WATCHDOG_NOWAYOUT |
| 76 | - retu_modify_counter(RETU_WDT_MAX_TIMER); |
| 77 | -#else |
| 78 | - retu_wdt_ping_enable(retu_wdt); |
| 79 | -#endif |
| 80 | - |
| 81 | - return 0; |
| 82 | -} |
| 83 | - |
| 84 | static const struct file_operations retu_wdt_fops = { |
| 85 | .owner = THIS_MODULE, |
| 86 | .write = retu_wdt_write, |
| 87 | @@ -252,8 +189,6 @@ static const struct file_operations retu |
| 88 | .release = retu_wdt_release, |
| 89 | }; |
| 90 | |
| 91 | -/*----------------------------------------------------------------------------*/ |
| 92 | - |
| 93 | static int __init retu_wdt_probe(struct platform_device *pdev) |
| 94 | { |
| 95 | struct retu_wdt_dev *wdev; |
| 96 | @@ -265,18 +200,6 @@ static int __init retu_wdt_probe(struct |
| 97 | |
| 98 | wdev->dev = &pdev->dev; |
| 99 | |
| 100 | - ret = device_create_file(&pdev->dev, &dev_attr_period); |
| 101 | - if (ret) { |
| 102 | - dev_err(&pdev->dev, "Error creating sysfs period\n"); |
| 103 | - goto free1; |
| 104 | - } |
| 105 | - |
| 106 | - ret = device_create_file(&pdev->dev, &dev_attr_counter); |
| 107 | - if (ret) { |
| 108 | - dev_err(&pdev->dev, "Error creating sysfs counter\n"); |
| 109 | - goto free2; |
| 110 | - } |
| 111 | - |
| 112 | platform_set_drvdata(pdev, wdev); |
| 113 | retu_wdt = wdev; |
| 114 | wdev->retu_wdt_miscdev.parent = &pdev->dev; |
| 115 | @@ -286,38 +209,21 @@ static int __init retu_wdt_probe(struct |
| 116 | |
| 117 | ret = misc_register(&(wdev->retu_wdt_miscdev)); |
| 118 | if (ret) |
| 119 | - goto free3; |
| 120 | + goto err_free_wdev; |
| 121 | |
| 122 | INIT_DELAYED_WORK(&wdev->ping_work, retu_wdt_ping_work); |
| 123 | |
| 124 | - /* passed as module parameter? */ |
| 125 | - ret = retu_modify_counter(counter_param); |
| 126 | - if (ret == -EINVAL) { |
| 127 | - ret = retu_modify_counter(RETU_WDT_DEFAULT_TIMER); |
| 128 | - dev_dbg(&pdev->dev, "Initializing to default value\n"); |
| 129 | - } |
| 130 | - |
| 131 | - /* Kick the watchdog for kernel booting to finish */ |
| 132 | + /* Kick the watchdog for kernel booting to finish. |
| 133 | + * If nowayout is not set, we start the ping work. */ |
| 134 | +#ifdef CONFIG_WATCHDOG_NOWAYOUT |
| 135 | retu_modify_counter(RETU_WDT_MAX_TIMER); |
| 136 | - |
| 137 | - ret = retu_wdt_ping(); |
| 138 | - if (ret < 0) { |
| 139 | - dev_err(&pdev->dev, "Failed to ping\n"); |
| 140 | - goto free4; |
| 141 | - } |
| 142 | +#else |
| 143 | + retu_wdt_ping_enable(retu_wdt); |
| 144 | +#endif |
| 145 | |
| 146 | return 0; |
| 147 | |
| 148 | -free4: |
| 149 | - misc_deregister(&wdev->retu_wdt_miscdev); |
| 150 | - |
| 151 | -free3: |
| 152 | - device_remove_file(&pdev->dev, &dev_attr_counter); |
| 153 | - |
| 154 | -free2: |
| 155 | - device_remove_file(&pdev->dev, &dev_attr_period); |
| 156 | - |
| 157 | -free1: |
| 158 | +err_free_wdev: |
| 159 | kfree(wdev); |
| 160 | |
| 161 | return ret; |
| 162 | @@ -329,8 +235,6 @@ static int __devexit retu_wdt_remove(str |
| 163 | |
| 164 | wdev = platform_get_drvdata(pdev); |
| 165 | misc_deregister(&wdev->retu_wdt_miscdev); |
| 166 | - device_remove_file(&pdev->dev, &dev_attr_period); |
| 167 | - device_remove_file(&pdev->dev, &dev_attr_counter); |
| 168 | cancel_delayed_work_sync(&wdev->ping_work); |
| 169 | kfree(wdev); |
| 170 | |
| 171 | @@ -356,9 +260,7 @@ static void __exit retu_wdt_exit(void) |
| 172 | |
| 173 | module_init(retu_wdt_init); |
| 174 | module_exit(retu_wdt_exit); |
| 175 | -module_param(counter_param, int, 0); |
| 176 | |
| 177 | MODULE_DESCRIPTION("Retu WatchDog"); |
| 178 | MODULE_AUTHOR("Amit Kucheria"); |
| 179 | MODULE_LICENSE("GPL"); |
| 180 | - |
| 181 | |