提交 1334f329 编写于 作者: A Axel Lin 提交者: Wim Van Sebroeck

watchdog: Use DEFINE_SPINLOCK() for static spinlocks

Rather than just defining static spinlock_t variables and then
initializing them later in init functions, simply define them with
DEFINE_SPINLOCK() and remove the calls to spin_lock_init().
Signed-off-by: NAxel Lin <axel.lin@gmail.com>
Cc: Nicolas Thill <nico@openwrt.org>
Cc: Heiko Ronsdorf <hero@ihg.uni-duisburg.de>
Cc: Rodolfo Giometti <giometti@ascensit.com>
Cc: Andrey Panin <pazke@donpac.ru>
Cc: Guido Guenther <agx@sigxcpu.org>
Cc: Curt E Bruns <curt.e.bruns@intel.com>
Cc: Deepak Saxena <dsaxena@plexity.net>
Cc: Andrew Victor <linux@maxim.org.za>
Cc: George G. Davis <gdavis@mvista.com>
Cc: Sylver Bruneau <sylver.bruneau@googlemail.com>
Signed-off-by: NWim Van Sebroeck <wim@iguana.be>
上级 216f3ad9
...@@ -70,8 +70,8 @@ struct ar7_wdt { ...@@ -70,8 +70,8 @@ struct ar7_wdt {
}; };
static unsigned long wdt_is_open; static unsigned long wdt_is_open;
static spinlock_t wdt_lock;
static unsigned expect_close; static unsigned expect_close;
static DEFINE_SPINLOCK(wdt_lock);
/* XXX currently fixed, allows max margin ~68.72 secs */ /* XXX currently fixed, allows max margin ~68.72 secs */
#define prescale_value 0xffff #define prescale_value 0xffff
...@@ -280,8 +280,6 @@ static int __devinit ar7_wdt_probe(struct platform_device *pdev) ...@@ -280,8 +280,6 @@ static int __devinit ar7_wdt_probe(struct platform_device *pdev)
{ {
int rc; int rc;
spin_lock_init(&wdt_lock);
ar7_regs_wdt = ar7_regs_wdt =
platform_get_resource_byname(pdev, IORESOURCE_MEM, "regs"); platform_get_resource_byname(pdev, IORESOURCE_MEM, "regs");
if (!ar7_regs_wdt) { if (!ar7_regs_wdt) {
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
static int verbose; static int verbose;
static int port = 0x91; static int port = 0x91;
static int ticks = 10000; static int ticks = 10000;
static spinlock_t cpu5wdt_lock; static DEFINE_SPINLOCK(cpu5wdt_lock);
#define PFX "cpu5wdt: " #define PFX "cpu5wdt: "
...@@ -223,7 +223,6 @@ static int __devinit cpu5wdt_init(void) ...@@ -223,7 +223,6 @@ static int __devinit cpu5wdt_init(void)
"port=0x%x, verbose=%i\n", port, verbose); "port=0x%x, verbose=%i\n", port, verbose);
init_completion(&cpu5wdt_device.stop); init_completion(&cpu5wdt_device.stop);
spin_lock_init(&cpu5wdt_lock);
cpu5wdt_device.queue = 0; cpu5wdt_device.queue = 0;
setup_timer(&cpu5wdt_device.timer, cpu5wdt_trigger, 0); setup_timer(&cpu5wdt_device.timer, cpu5wdt_trigger, 0);
cpu5wdt_device.default_ticks = ticks; cpu5wdt_device.default_ticks = ticks;
......
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
static unsigned long eurwdt_is_open; static unsigned long eurwdt_is_open;
static int eurwdt_timeout; static int eurwdt_timeout;
static char eur_expect_close; static char eur_expect_close;
static spinlock_t eurwdt_lock; static DEFINE_SPINLOCK(eurwdt_lock);
/* /*
* You must set these - there is no sane way to probe for this board. * You must set these - there is no sane way to probe for this board.
...@@ -446,8 +446,6 @@ static int __init eurwdt_init(void) ...@@ -446,8 +446,6 @@ static int __init eurwdt_init(void)
goto outreg; goto outreg;
} }
spin_lock_init(&eurwdt_lock);
ret = misc_register(&eurwdt_miscdev); ret = misc_register(&eurwdt_miscdev);
if (ret) { if (ret) {
printk(KERN_ERR "eurwdt: can't misc_register on minor=%d\n", printk(KERN_ERR "eurwdt: can't misc_register on minor=%d\n",
......
...@@ -68,7 +68,7 @@ static char asr_expect_close; ...@@ -68,7 +68,7 @@ static char asr_expect_close;
static unsigned int asr_type, asr_base, asr_length; static unsigned int asr_type, asr_base, asr_length;
static unsigned int asr_read_addr, asr_write_addr; static unsigned int asr_read_addr, asr_write_addr;
static unsigned char asr_toggle_mask, asr_disable_mask; static unsigned char asr_toggle_mask, asr_disable_mask;
static spinlock_t asr_lock; static DEFINE_SPINLOCK(asr_lock);
static void __asr_toggle(void) static void __asr_toggle(void)
{ {
...@@ -386,8 +386,6 @@ static int __init ibmasr_init(void) ...@@ -386,8 +386,6 @@ static int __init ibmasr_init(void)
if (!asr_type) if (!asr_type)
return -ENODEV; return -ENODEV;
spin_lock_init(&asr_lock);
rc = asr_get_base_address(); rc = asr_get_base_address();
if (rc) if (rc)
return rc; return rc;
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#define PFX "indydog: " #define PFX "indydog: "
static unsigned long indydog_alive; static unsigned long indydog_alive;
static spinlock_t indydog_lock; static DEFINE_SPINLOCK(indydog_lock);
#define WATCHDOG_TIMEOUT 30 /* 30 sec default timeout */ #define WATCHDOG_TIMEOUT 30 /* 30 sec default timeout */
...@@ -185,8 +185,6 @@ static int __init watchdog_init(void) ...@@ -185,8 +185,6 @@ static int __init watchdog_init(void)
{ {
int ret; int ret;
spin_lock_init(&indydog_lock);
ret = register_reboot_notifier(&indydog_notifier); ret = register_reboot_notifier(&indydog_notifier);
if (ret) { if (ret) {
printk(KERN_ERR PFX printk(KERN_ERR PFX
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
static int nowayout = WATCHDOG_NOWAYOUT; static int nowayout = WATCHDOG_NOWAYOUT;
static unsigned long wdt_status; static unsigned long wdt_status;
static unsigned long boot_status; static unsigned long boot_status;
static spinlock_t wdt_lock; static DEFINE_SPINLOCK(wdt_lock);
#define WDT_IN_USE 0 #define WDT_IN_USE 0
#define WDT_OK_TO_CLOSE 1 #define WDT_OK_TO_CLOSE 1
...@@ -226,9 +226,6 @@ static int __init iop_wdt_init(void) ...@@ -226,9 +226,6 @@ static int __init iop_wdt_init(void)
{ {
int ret; int ret;
spin_lock_init(&wdt_lock);
/* check if the reset was caused by the watchdog timer */ /* check if the reset was caused by the watchdog timer */
boot_status = (read_rcsr() & IOP_RCSR_WDT) ? WDIOF_CARDRESET : 0; boot_status = (read_rcsr() & IOP_RCSR_WDT) ? WDIOF_CARDRESET : 0;
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
static int nowayout = WATCHDOG_NOWAYOUT; static int nowayout = WATCHDOG_NOWAYOUT;
static unsigned int heartbeat = 60; /* (secs) Default is 1 minute */ static unsigned int heartbeat = 60; /* (secs) Default is 1 minute */
static unsigned long wdt_status; static unsigned long wdt_status;
static spinlock_t wdt_lock; static DEFINE_SPINLOCK(wdt_lock);
#define WDT_IN_USE 0 #define WDT_IN_USE 0
#define WDT_OK_TO_CLOSE 1 #define WDT_OK_TO_CLOSE 1
...@@ -189,7 +189,6 @@ static int __init ixp2000_wdt_init(void) ...@@ -189,7 +189,6 @@ static int __init ixp2000_wdt_init(void)
return -EIO; return -EIO;
} }
wdt_tick_rate = (*IXP2000_T1_CLD * HZ) / 256; wdt_tick_rate = (*IXP2000_T1_CLD * HZ) / 256;
spin_lock_init(&wdt_lock);
return misc_register(&ixp2000_wdt_miscdev); return misc_register(&ixp2000_wdt_miscdev);
} }
......
...@@ -181,7 +181,6 @@ static int __init ixp4xx_wdt_init(void) ...@@ -181,7 +181,6 @@ static int __init ixp4xx_wdt_init(void)
return -ENODEV; return -ENODEV;
} }
spin_lock_init(&wdt_lock);
boot_status = (*IXP4XX_OSST & IXP4XX_OSST_TIMER_WARM_RESET) ? boot_status = (*IXP4XX_OSST & IXP4XX_OSST_TIMER_WARM_RESET) ?
WDIOF_CARDRESET : 0; WDIOF_CARDRESET : 0;
ret = misc_register(&ixp4xx_wdt_miscdev); ret = misc_register(&ixp4xx_wdt_miscdev);
......
...@@ -42,7 +42,7 @@ MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" ...@@ -42,7 +42,7 @@ MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="
static unsigned long ks8695wdt_busy; static unsigned long ks8695wdt_busy;
static spinlock_t ks8695_lock; static DEFINE_SPINLOCK(ks8695_lock);
/* ......................................................................... */ /* ......................................................................... */
...@@ -288,7 +288,6 @@ static struct platform_driver ks8695wdt_driver = { ...@@ -288,7 +288,6 @@ static struct platform_driver ks8695wdt_driver = {
static int __init ks8695_wdt_init(void) static int __init ks8695_wdt_init(void)
{ {
spin_lock_init(&ks8695_lock);
/* Check that the heartbeat value is within range; /* Check that the heartbeat value is within range;
if not reset to the default */ if not reset to the default */
if (ks8695_wdt_settimeout(wdt_time)) { if (ks8695_wdt_settimeout(wdt_time)) {
......
...@@ -55,7 +55,7 @@ module_param(timer_margin, uint, 0); ...@@ -55,7 +55,7 @@ module_param(timer_margin, uint, 0);
MODULE_PARM_DESC(timer_margin, "initial watchdog timeout (in seconds)"); MODULE_PARM_DESC(timer_margin, "initial watchdog timeout (in seconds)");
static unsigned int wdt_trgr_pattern = 0x1234; static unsigned int wdt_trgr_pattern = 0x1234;
static spinlock_t wdt_lock; static DEFINE_SPINLOCK(wdt_lock);
struct omap_wdt_dev { struct omap_wdt_dev {
void __iomem *base; /* physical */ void __iomem *base; /* physical */
...@@ -439,7 +439,6 @@ static struct platform_driver omap_wdt_driver = { ...@@ -439,7 +439,6 @@ static struct platform_driver omap_wdt_driver = {
static int __init omap_wdt_init(void) static int __init omap_wdt_init(void)
{ {
spin_lock_init(&wdt_lock);
return platform_driver_register(&omap_wdt_driver); return platform_driver_register(&omap_wdt_driver);
} }
......
...@@ -41,7 +41,7 @@ static int heartbeat = -1; /* module parameter (seconds) */ ...@@ -41,7 +41,7 @@ static int heartbeat = -1; /* module parameter (seconds) */
static unsigned int wdt_max_duration; /* (seconds) */ static unsigned int wdt_max_duration; /* (seconds) */
static unsigned int wdt_tclk; static unsigned int wdt_tclk;
static unsigned long wdt_status; static unsigned long wdt_status;
static spinlock_t wdt_lock; static DEFINE_SPINLOCK(wdt_lock);
static void orion_wdt_ping(void) static void orion_wdt_ping(void)
{ {
...@@ -296,7 +296,6 @@ static struct platform_driver orion_wdt_driver = { ...@@ -296,7 +296,6 @@ static struct platform_driver orion_wdt_driver = {
static int __init orion_wdt_init(void) static int __init orion_wdt_init(void)
{ {
spin_lock_init(&wdt_lock);
return platform_driver_register(&orion_wdt_driver); return platform_driver_register(&orion_wdt_driver);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册