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

watchdog: sa11x0/pxa: get rid of get_clock_tick_rate

The OS timer rate used for the watchdog can now be fetched from the
standard clock API. This will remove the last user of
get_clock_tick_rate() in both pxa and sa11x0 architectures.

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Russell King <rmk+kernel@armlinux.org.uk>
Acked-by: Wim Van Sebroeck <wim@iguana.be>

+23 -1
+23 -1
drivers/watchdog/sa1100_wdt.c
··· 22 22 23 23 #include <linux/module.h> 24 24 #include <linux/moduleparam.h> 25 + #include <linux/clk.h> 25 26 #include <linux/types.h> 26 27 #include <linux/kernel.h> 27 28 #include <linux/fs.h> ··· 156 155 }; 157 156 158 157 static int margin __initdata = 60; /* (secs) Default is 1 minute */ 158 + static struct clk *clk; 159 159 160 160 static int __init sa1100dog_init(void) 161 161 { 162 162 int ret; 163 163 164 - oscr_freq = get_clock_tick_rate(); 164 + clk = clk_get(NULL, "OSTIMER0"); 165 + if (IS_ERR(clk)) { 166 + pr_err("SA1100/PXA2xx Watchdog Timer: clock not found: %d\n", 167 + (int) PTR_ERR(clk)); 168 + return PTR_ERR(clk); 169 + } 170 + 171 + ret = clk_prepare_enable(clk); 172 + if (ret) { 173 + pr_err("SA1100/PXA2xx Watchdog Timer: clock failed to prepare+enable: %d\n", 174 + ret); 175 + goto err; 176 + } 177 + 178 + oscr_freq = clk_get_rate(clk); 165 179 166 180 /* 167 181 * Read the reset status, and save it for later. If ··· 192 176 pr_info("SA1100/PXA2xx Watchdog Timer: timer margin %d sec\n", 193 177 margin); 194 178 return ret; 179 + err: 180 + clk_disable_unprepare(clk); 181 + clk_put(clk); 182 + return ret; 195 183 } 196 184 197 185 static void __exit sa1100dog_exit(void) 198 186 { 199 187 misc_deregister(&sa1100dog_miscdev); 188 + clk_disable_unprepare(clk); 189 + clk_put(clk); 200 190 } 201 191 202 192 module_init(sa1100dog_init);