1 Index: linux-2.6.38-rc6/drivers/cbus/retu-wdt.c
2 ===================================================================
3 --- linux-2.6.38-rc6.orig/drivers/cbus/retu-wdt.c 2011-03-04 15:45:37.533948567 +0100
4 +++ linux-2.6.38-rc6/drivers/cbus/retu-wdt.c 2011-03-04 15:46:21.312816961 +0100
5 @@ -52,7 +52,6 @@ static DEFINE_MUTEX(retu_wdt_mutex);
7 /* Current period of watchdog */
8 static unsigned int period_val = RETU_WDT_DEFAULT_TIMER;
9 -static int counter_param = RETU_WDT_MAX_TIMER;
13 @@ -109,56 +108,6 @@ static void retu_wdt_ping_work(struct wo
14 retu_wdt_ping_enable(wdev);
17 -static ssize_t retu_wdt_period_show(struct device *dev,
18 - struct device_attribute *attr, char *buf)
20 - /* Show current max counter */
21 - return sprintf(buf, "%u\n", (u16)period_val);
25 - * Note: This inteface is non-standard and likely to disappear!
26 - * Use /dev/watchdog instead, that's the standard.
28 -static ssize_t retu_wdt_period_store(struct device *dev,
29 - struct device_attribute *attr,
30 - const char *buf, size_t count)
32 - unsigned int new_period;
35 -#ifdef CONFIG_WATCHDOG_NOWAYOUT
36 - retu_wdt_ping_disable(retu_wdt);
39 - if (sscanf(buf, "%u", &new_period) != 1) {
40 - printk(KERN_ALERT "retu_wdt_period_store: Invalid input\n");
44 - ret = retu_modify_counter(new_period);
48 - return strnlen(buf, count);
51 -static ssize_t retu_wdt_counter_show(struct device *dev,
52 - struct device_attribute *attr, char *buf)
56 - /* Show current value in watchdog counter */
57 - counter = retu_read_reg(dev, RETU_REG_WATCHDOG);
59 - /* Only the 5 LSB are important */
60 - return snprintf(buf, PAGE_SIZE, "%u\n", (counter & 0x3F));
63 -static DEVICE_ATTR(period, S_IRUGO | S_IWUSR, retu_wdt_period_show, \
64 - retu_wdt_period_store);
65 -static DEVICE_ATTR(counter, S_IRUGO, retu_wdt_counter_show, NULL);
67 static int retu_wdt_open(struct inode *inode, struct file *file)
69 if (test_and_set_bit(0, &retu_wdt->users))
70 @@ -232,18 +181,6 @@ static long retu_wdt_ioctl(struct file *
74 -/* Start kicking retu watchdog until user space starts doing the kicking */
75 -static int __devinit retu_wdt_ping(void)
77 -#ifdef CONFIG_WATCHDOG_NOWAYOUT
78 - retu_modify_counter(RETU_WDT_MAX_TIMER);
80 - retu_wdt_ping_enable(retu_wdt);
86 static const struct file_operations retu_wdt_fops = {
88 .write = retu_wdt_write,
89 @@ -252,8 +189,6 @@ static const struct file_operations retu
90 .release = retu_wdt_release,
93 -/*----------------------------------------------------------------------------*/
95 static int __init retu_wdt_probe(struct platform_device *pdev)
97 struct retu_wdt_dev *wdev;
98 @@ -265,18 +200,6 @@ static int __init retu_wdt_probe(struct
100 wdev->dev = &pdev->dev;
102 - ret = device_create_file(&pdev->dev, &dev_attr_period);
104 - dev_err(&pdev->dev, "Error creating sysfs period\n");
108 - ret = device_create_file(&pdev->dev, &dev_attr_counter);
110 - dev_err(&pdev->dev, "Error creating sysfs counter\n");
114 platform_set_drvdata(pdev, wdev);
116 wdev->retu_wdt_miscdev.parent = &pdev->dev;
117 @@ -286,38 +209,21 @@ static int __init retu_wdt_probe(struct
119 ret = misc_register(&(wdev->retu_wdt_miscdev));
122 + goto err_free_wdev;
124 INIT_DELAYED_WORK(&wdev->ping_work, retu_wdt_ping_work);
126 - /* passed as module parameter? */
127 - ret = retu_modify_counter(counter_param);
128 - if (ret == -EINVAL) {
129 - ret = retu_modify_counter(RETU_WDT_DEFAULT_TIMER);
130 - dev_dbg(&pdev->dev, "Initializing to default value\n");
133 - /* Kick the watchdog for kernel booting to finish */
134 + /* Kick the watchdog for kernel booting to finish.
135 + * If nowayout is not set, we start the ping work. */
136 +#ifdef CONFIG_WATCHDOG_NOWAYOUT
137 retu_modify_counter(RETU_WDT_MAX_TIMER);
139 - ret = retu_wdt_ping();
141 - dev_err(&pdev->dev, "Failed to ping\n");
145 + retu_wdt_ping_enable(retu_wdt);
151 - misc_deregister(&wdev->retu_wdt_miscdev);
154 - device_remove_file(&pdev->dev, &dev_attr_counter);
157 - device_remove_file(&pdev->dev, &dev_attr_period);
164 @@ -329,8 +235,6 @@ static int __devexit retu_wdt_remove(str
166 wdev = platform_get_drvdata(pdev);
167 misc_deregister(&wdev->retu_wdt_miscdev);
168 - device_remove_file(&pdev->dev, &dev_attr_period);
169 - device_remove_file(&pdev->dev, &dev_attr_counter);
170 cancel_delayed_work_sync(&wdev->ping_work);
173 @@ -356,9 +260,7 @@ static void __exit retu_wdt_exit(void)
175 module_init(retu_wdt_init);
176 module_exit(retu_wdt_exit);
177 -module_param(counter_param, int, 0);
179 MODULE_DESCRIPTION("Retu WatchDog");
180 MODULE_AUTHOR("Amit Kucheria");
181 MODULE_LICENSE("GPL");