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