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-02 16:49:51.231863891 +0100
4 +++ linux-2.6.38-rc6/drivers/cbus/retu-wdt.c 2011-03-02 16:53:47.189454637 +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 @@ -175,9 +124,9 @@ static int retu_wdt_release(struct inode
71 struct retu_wdt_dev *wdev = file->private_data;
73 #ifndef CONFIG_WATCHDOG_NOWAYOUT
74 - retu_wdt_ping_enable(retu_wdt);
75 + retu_wdt_ping_enable(wdev);
77 - clear_bit(0, &retu_wdt->users);
78 + clear_bit(0, &wdev->users);
82 @@ -232,18 +181,6 @@ static long retu_wdt_ioctl(struct file *
86 -/* Start kicking retu watchdog until user space starts doing the kicking */
87 -static int __devinit retu_wdt_ping(void)
89 -#ifdef CONFIG_WATCHDOG_NOWAYOUT
90 - retu_modify_counter(RETU_WDT_MAX_TIMER);
92 - retu_wdt_ping_enable(retu_wdt);
98 static const struct file_operations retu_wdt_fops = {
100 .write = retu_wdt_write,
101 @@ -252,8 +189,6 @@ static const struct file_operations retu
102 .release = retu_wdt_release,
105 -/*----------------------------------------------------------------------------*/
107 static int __init retu_wdt_probe(struct platform_device *pdev)
109 struct retu_wdt_dev *wdev;
110 @@ -265,18 +200,6 @@ static int __init retu_wdt_probe(struct
112 wdev->dev = &pdev->dev;
114 - ret = device_create_file(&pdev->dev, &dev_attr_period);
116 - dev_err(&pdev->dev, "Error creating sysfs period\n");
120 - ret = device_create_file(&pdev->dev, &dev_attr_counter);
122 - dev_err(&pdev->dev, "Error creating sysfs counter\n");
126 platform_set_drvdata(pdev, wdev);
128 wdev->retu_wdt_miscdev.parent = &pdev->dev;
129 @@ -286,38 +209,21 @@ static int __init retu_wdt_probe(struct
131 ret = misc_register(&(wdev->retu_wdt_miscdev));
134 + goto err_free_wdev;
136 INIT_DELAYED_WORK(&wdev->ping_work, retu_wdt_ping_work);
138 - /* passed as module parameter? */
139 - ret = retu_modify_counter(counter_param);
140 - if (ret == -EINVAL) {
141 - ret = retu_modify_counter(RETU_WDT_DEFAULT_TIMER);
142 - dev_dbg(&pdev->dev, "Initializing to default value\n");
145 - /* Kick the watchdog for kernel booting to finish */
146 + /* Kick the watchdog for kernel booting to finish.
147 + * If nowayout is not set, we start the ping work. */
148 +#ifdef CONFIG_WATCHDOG_NOWAYOUT
149 retu_modify_counter(RETU_WDT_MAX_TIMER);
151 - ret = retu_wdt_ping();
153 - dev_err(&pdev->dev, "Failed to ping\n");
157 + retu_wdt_ping_enable(retu_wdt);
163 - misc_deregister(&wdev->retu_wdt_miscdev);
166 - device_remove_file(&pdev->dev, &dev_attr_counter);
169 - device_remove_file(&pdev->dev, &dev_attr_period);
176 @@ -329,8 +235,6 @@ static int __devexit retu_wdt_remove(str
178 wdev = platform_get_drvdata(pdev);
179 misc_deregister(&wdev->retu_wdt_miscdev);
180 - device_remove_file(&pdev->dev, &dev_attr_period);
181 - device_remove_file(&pdev->dev, &dev_attr_counter);
182 cancel_delayed_work_sync(&wdev->ping_work);
185 @@ -356,9 +260,7 @@ static void __exit retu_wdt_exit(void)
187 module_init(retu_wdt_init);
188 module_exit(retu_wdt_exit);
189 -module_param(counter_param, int, 0);
191 MODULE_DESCRIPTION("Retu WatchDog");
192 MODULE_AUTHOR("Amit Kucheria");
193 MODULE_LICENSE("GPL");