diff options
| -rw-r--r-- | drivers/watchdog/Kconfig | 2 | ||||
| -rw-r--r-- | drivers/watchdog/geodewdt.c | 40 | ||||
| -rw-r--r-- | kernel/audit_tree.c | 13 |
3 files changed, 28 insertions, 27 deletions
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index da84fd03850f..088f32f29a6e 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig | |||
| @@ -368,7 +368,7 @@ config ALIM7101_WDT | |||
| 368 | 368 | ||
| 369 | config GEODE_WDT | 369 | config GEODE_WDT |
| 370 | tristate "AMD Geode CS5535/CS5536 Watchdog" | 370 | tristate "AMD Geode CS5535/CS5536 Watchdog" |
| 371 | depends on MGEODE_LX | 371 | depends on CS5535_MFGPT |
| 372 | help | 372 | help |
| 373 | This driver enables a watchdog capability built into the | 373 | This driver enables a watchdog capability built into the |
| 374 | CS5535/CS5536 companion chips for the AMD Geode GX and LX | 374 | CS5535/CS5536 companion chips for the AMD Geode GX and LX |
diff --git a/drivers/watchdog/geodewdt.c b/drivers/watchdog/geodewdt.c index 9acf0015a1e7..38252ff828ca 100644 --- a/drivers/watchdog/geodewdt.c +++ b/drivers/watchdog/geodewdt.c | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | /* Watchdog timer for the Geode GX/LX with the CS5535/CS5536 companion chip | 1 | /* Watchdog timer for machines with the CS5535/CS5536 companion chip |
| 2 | * | 2 | * |
| 3 | * Copyright (C) 2006-2007, Advanced Micro Devices, Inc. | 3 | * Copyright (C) 2006-2007, Advanced Micro Devices, Inc. |
| 4 | * Copyright (C) 2009 Andres Salomon <dilinger@collabora.co.uk> | ||
| 4 | * | 5 | * |
| 5 | * This program is free software; you can redistribute it and/or | 6 | * This program is free software; you can redistribute it and/or |
| 6 | * modify it under the terms of the GNU General Public License | 7 | * modify it under the terms of the GNU General Public License |
| @@ -19,7 +20,7 @@ | |||
| 19 | #include <linux/reboot.h> | 20 | #include <linux/reboot.h> |
| 20 | #include <linux/uaccess.h> | 21 | #include <linux/uaccess.h> |
| 21 | 22 | ||
| 22 | #include <asm/geode.h> | 23 | #include <linux/cs5535.h> |
| 23 | 24 | ||
| 24 | #define GEODEWDT_HZ 500 | 25 | #define GEODEWDT_HZ 500 |
| 25 | #define GEODEWDT_SCALE 6 | 26 | #define GEODEWDT_SCALE 6 |
| @@ -46,25 +47,25 @@ MODULE_PARM_DESC(nowayout, | |||
| 46 | 47 | ||
| 47 | static struct platform_device *geodewdt_platform_device; | 48 | static struct platform_device *geodewdt_platform_device; |
| 48 | static unsigned long wdt_flags; | 49 | static unsigned long wdt_flags; |
| 49 | static int wdt_timer; | 50 | static struct cs5535_mfgpt_timer *wdt_timer; |
| 50 | static int safe_close; | 51 | static int safe_close; |
| 51 | 52 | ||
| 52 | static void geodewdt_ping(void) | 53 | static void geodewdt_ping(void) |
| 53 | { | 54 | { |
| 54 | /* Stop the counter */ | 55 | /* Stop the counter */ |
| 55 | geode_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, 0); | 56 | cs5535_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, 0); |
| 56 | 57 | ||
| 57 | /* Reset the counter */ | 58 | /* Reset the counter */ |
| 58 | geode_mfgpt_write(wdt_timer, MFGPT_REG_COUNTER, 0); | 59 | cs5535_mfgpt_write(wdt_timer, MFGPT_REG_COUNTER, 0); |
| 59 | 60 | ||
| 60 | /* Enable the counter */ | 61 | /* Enable the counter */ |
| 61 | geode_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, MFGPT_SETUP_CNTEN); | 62 | cs5535_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, MFGPT_SETUP_CNTEN); |
| 62 | } | 63 | } |
| 63 | 64 | ||
| 64 | static void geodewdt_disable(void) | 65 | static void geodewdt_disable(void) |
| 65 | { | 66 | { |
| 66 | geode_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, 0); | 67 | cs5535_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, 0); |
| 67 | geode_mfgpt_write(wdt_timer, MFGPT_REG_COUNTER, 0); | 68 | cs5535_mfgpt_write(wdt_timer, MFGPT_REG_COUNTER, 0); |
| 68 | } | 69 | } |
| 69 | 70 | ||
| 70 | static int geodewdt_set_heartbeat(int val) | 71 | static int geodewdt_set_heartbeat(int val) |
| @@ -72,10 +73,10 @@ static int geodewdt_set_heartbeat(int val) | |||
| 72 | if (val < 1 || val > GEODEWDT_MAX_SECONDS) | 73 | if (val < 1 || val > GEODEWDT_MAX_SECONDS) |
| 73 | return -EINVAL; | 74 | return -EINVAL; |
| 74 | 75 | ||
| 75 | geode_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, 0); | 76 | cs5535_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, 0); |
| 76 | geode_mfgpt_write(wdt_timer, MFGPT_REG_CMP2, val * GEODEWDT_HZ); | 77 | cs5535_mfgpt_write(wdt_timer, MFGPT_REG_CMP2, val * GEODEWDT_HZ); |
| 77 | geode_mfgpt_write(wdt_timer, MFGPT_REG_COUNTER, 0); | 78 | cs5535_mfgpt_write(wdt_timer, MFGPT_REG_COUNTER, 0); |
| 78 | geode_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, MFGPT_SETUP_CNTEN); | 79 | cs5535_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, MFGPT_SETUP_CNTEN); |
| 79 | 80 | ||
| 80 | timeout = val; | 81 | timeout = val; |
| 81 | return 0; | 82 | return 0; |
| @@ -215,28 +216,25 @@ static struct miscdevice geodewdt_miscdev = { | |||
| 215 | 216 | ||
| 216 | static int __devinit geodewdt_probe(struct platform_device *dev) | 217 | static int __devinit geodewdt_probe(struct platform_device *dev) |
| 217 | { | 218 | { |
| 218 | int ret, timer; | 219 | int ret; |
| 219 | |||
| 220 | timer = geode_mfgpt_alloc_timer(MFGPT_TIMER_ANY, MFGPT_DOMAIN_WORKING); | ||
| 221 | 220 | ||
| 222 | if (timer == -1) { | 221 | wdt_timer = cs5535_mfgpt_alloc_timer(MFGPT_TIMER_ANY, MFGPT_DOMAIN_WORKING); |
| 222 | if (!wdt_timer) { | ||
| 223 | printk(KERN_ERR "geodewdt: No timers were available\n"); | 223 | printk(KERN_ERR "geodewdt: No timers were available\n"); |
| 224 | return -ENODEV; | 224 | return -ENODEV; |
| 225 | } | 225 | } |
| 226 | 226 | ||
| 227 | wdt_timer = timer; | ||
| 228 | |||
| 229 | /* Set up the timer */ | 227 | /* Set up the timer */ |
| 230 | 228 | ||
| 231 | geode_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, | 229 | cs5535_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, |
| 232 | GEODEWDT_SCALE | (3 << 8)); | 230 | GEODEWDT_SCALE | (3 << 8)); |
| 233 | 231 | ||
| 234 | /* Set up comparator 2 to reset when the event fires */ | 232 | /* Set up comparator 2 to reset when the event fires */ |
| 235 | geode_mfgpt_toggle_event(wdt_timer, MFGPT_CMP2, MFGPT_EVENT_RESET, 1); | 233 | cs5535_mfgpt_toggle_event(wdt_timer, MFGPT_CMP2, MFGPT_EVENT_RESET, 1); |
| 236 | 234 | ||
| 237 | /* Set up the initial timeout */ | 235 | /* Set up the initial timeout */ |
| 238 | 236 | ||
| 239 | geode_mfgpt_write(wdt_timer, MFGPT_REG_CMP2, | 237 | cs5535_mfgpt_write(wdt_timer, MFGPT_REG_CMP2, |
| 240 | timeout * GEODEWDT_HZ); | 238 | timeout * GEODEWDT_HZ); |
| 241 | 239 | ||
| 242 | ret = misc_register(&geodewdt_miscdev); | 240 | ret = misc_register(&geodewdt_miscdev); |
diff --git a/kernel/audit_tree.c b/kernel/audit_tree.c index 2451dc6f3282..4b05bd9479db 100644 --- a/kernel/audit_tree.c +++ b/kernel/audit_tree.c | |||
| @@ -277,7 +277,7 @@ static void untag_chunk(struct node *p) | |||
| 277 | owner->root = NULL; | 277 | owner->root = NULL; |
| 278 | } | 278 | } |
| 279 | 279 | ||
| 280 | for (i = j = 0; i < size; i++, j++) { | 280 | for (i = j = 0; j <= size; i++, j++) { |
| 281 | struct audit_tree *s; | 281 | struct audit_tree *s; |
| 282 | if (&chunk->owners[j] == p) { | 282 | if (&chunk->owners[j] == p) { |
| 283 | list_del_init(&p->list); | 283 | list_del_init(&p->list); |
| @@ -290,7 +290,7 @@ static void untag_chunk(struct node *p) | |||
| 290 | if (!s) /* result of earlier fallback */ | 290 | if (!s) /* result of earlier fallback */ |
| 291 | continue; | 291 | continue; |
| 292 | get_tree(s); | 292 | get_tree(s); |
| 293 | list_replace_init(&chunk->owners[i].list, &new->owners[j].list); | 293 | list_replace_init(&chunk->owners[j].list, &new->owners[i].list); |
| 294 | } | 294 | } |
| 295 | 295 | ||
| 296 | list_replace_rcu(&chunk->hash, &new->hash); | 296 | list_replace_rcu(&chunk->hash, &new->hash); |
| @@ -373,15 +373,17 @@ static int tag_chunk(struct inode *inode, struct audit_tree *tree) | |||
| 373 | for (n = 0; n < old->count; n++) { | 373 | for (n = 0; n < old->count; n++) { |
| 374 | if (old->owners[n].owner == tree) { | 374 | if (old->owners[n].owner == tree) { |
| 375 | spin_unlock(&hash_lock); | 375 | spin_unlock(&hash_lock); |
| 376 | put_inotify_watch(watch); | 376 | put_inotify_watch(&old->watch); |
| 377 | return 0; | 377 | return 0; |
| 378 | } | 378 | } |
| 379 | } | 379 | } |
| 380 | spin_unlock(&hash_lock); | 380 | spin_unlock(&hash_lock); |
| 381 | 381 | ||
| 382 | chunk = alloc_chunk(old->count + 1); | 382 | chunk = alloc_chunk(old->count + 1); |
| 383 | if (!chunk) | 383 | if (!chunk) { |
| 384 | put_inotify_watch(&old->watch); | ||
| 384 | return -ENOMEM; | 385 | return -ENOMEM; |
| 386 | } | ||
| 385 | 387 | ||
| 386 | mutex_lock(&inode->inotify_mutex); | 388 | mutex_lock(&inode->inotify_mutex); |
| 387 | if (inotify_clone_watch(&old->watch, &chunk->watch) < 0) { | 389 | if (inotify_clone_watch(&old->watch, &chunk->watch) < 0) { |
| @@ -425,7 +427,8 @@ static int tag_chunk(struct inode *inode, struct audit_tree *tree) | |||
| 425 | spin_unlock(&hash_lock); | 427 | spin_unlock(&hash_lock); |
| 426 | inotify_evict_watch(&old->watch); | 428 | inotify_evict_watch(&old->watch); |
| 427 | mutex_unlock(&inode->inotify_mutex); | 429 | mutex_unlock(&inode->inotify_mutex); |
| 428 | put_inotify_watch(&old->watch); | 430 | put_inotify_watch(&old->watch); /* pair to inotify_find_watch */ |
| 431 | put_inotify_watch(&old->watch); /* and kill it */ | ||
| 429 | return 0; | 432 | return 0; |
| 430 | } | 433 | } |
| 431 | 434 | ||
