Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 178010
b: refs/heads/master
c: ecd5907
h: refs/heads/master
v: v3
  • Loading branch information
Linus Torvalds committed Dec 19, 2009
1 parent 4663482 commit a33dde1
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 28 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1d802e24774c94ec7bdb12b6515226f3341533c1
refs/heads/master: ecd5907a200b18aeddac68b8c734b8ad4c931205
2 changes: 1 addition & 1 deletion trunk/drivers/watchdog/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ config ALIM7101_WDT

config GEODE_WDT
tristate "AMD Geode CS5535/CS5536 Watchdog"
depends on MGEODE_LX
depends on CS5535_MFGPT
help
This driver enables a watchdog capability built into the
CS5535/CS5536 companion chips for the AMD Geode GX and LX
Expand Down
40 changes: 19 additions & 21 deletions trunk/drivers/watchdog/geodewdt.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* Watchdog timer for the Geode GX/LX with the CS5535/CS5536 companion chip
/* Watchdog timer for machines with the CS5535/CS5536 companion chip
*
* Copyright (C) 2006-2007, Advanced Micro Devices, Inc.
* Copyright (C) 2009 Andres Salomon <dilinger@collabora.co.uk>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
Expand All @@ -19,7 +20,7 @@
#include <linux/reboot.h>
#include <linux/uaccess.h>

#include <asm/geode.h>
#include <linux/cs5535.h>

#define GEODEWDT_HZ 500
#define GEODEWDT_SCALE 6
Expand All @@ -46,36 +47,36 @@ MODULE_PARM_DESC(nowayout,

static struct platform_device *geodewdt_platform_device;
static unsigned long wdt_flags;
static int wdt_timer;
static struct cs5535_mfgpt_timer *wdt_timer;
static int safe_close;

static void geodewdt_ping(void)
{
/* Stop the counter */
geode_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, 0);
cs5535_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, 0);

/* Reset the counter */
geode_mfgpt_write(wdt_timer, MFGPT_REG_COUNTER, 0);
cs5535_mfgpt_write(wdt_timer, MFGPT_REG_COUNTER, 0);

/* Enable the counter */
geode_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, MFGPT_SETUP_CNTEN);
cs5535_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, MFGPT_SETUP_CNTEN);
}

static void geodewdt_disable(void)
{
geode_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, 0);
geode_mfgpt_write(wdt_timer, MFGPT_REG_COUNTER, 0);
cs5535_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, 0);
cs5535_mfgpt_write(wdt_timer, MFGPT_REG_COUNTER, 0);
}

static int geodewdt_set_heartbeat(int val)
{
if (val < 1 || val > GEODEWDT_MAX_SECONDS)
return -EINVAL;

geode_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, 0);
geode_mfgpt_write(wdt_timer, MFGPT_REG_CMP2, val * GEODEWDT_HZ);
geode_mfgpt_write(wdt_timer, MFGPT_REG_COUNTER, 0);
geode_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, MFGPT_SETUP_CNTEN);
cs5535_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, 0);
cs5535_mfgpt_write(wdt_timer, MFGPT_REG_CMP2, val * GEODEWDT_HZ);
cs5535_mfgpt_write(wdt_timer, MFGPT_REG_COUNTER, 0);
cs5535_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, MFGPT_SETUP_CNTEN);

timeout = val;
return 0;
Expand Down Expand Up @@ -215,28 +216,25 @@ static struct miscdevice geodewdt_miscdev = {

static int __devinit geodewdt_probe(struct platform_device *dev)
{
int ret, timer;

timer = geode_mfgpt_alloc_timer(MFGPT_TIMER_ANY, MFGPT_DOMAIN_WORKING);
int ret;

if (timer == -1) {
wdt_timer = cs5535_mfgpt_alloc_timer(MFGPT_TIMER_ANY, MFGPT_DOMAIN_WORKING);
if (!wdt_timer) {
printk(KERN_ERR "geodewdt: No timers were available\n");
return -ENODEV;
}

wdt_timer = timer;

/* Set up the timer */

geode_mfgpt_write(wdt_timer, MFGPT_REG_SETUP,
cs5535_mfgpt_write(wdt_timer, MFGPT_REG_SETUP,
GEODEWDT_SCALE | (3 << 8));

/* Set up comparator 2 to reset when the event fires */
geode_mfgpt_toggle_event(wdt_timer, MFGPT_CMP2, MFGPT_EVENT_RESET, 1);
cs5535_mfgpt_toggle_event(wdt_timer, MFGPT_CMP2, MFGPT_EVENT_RESET, 1);

/* Set up the initial timeout */

geode_mfgpt_write(wdt_timer, MFGPT_REG_CMP2,
cs5535_mfgpt_write(wdt_timer, MFGPT_REG_CMP2,
timeout * GEODEWDT_HZ);

ret = misc_register(&geodewdt_miscdev);
Expand Down
13 changes: 8 additions & 5 deletions trunk/kernel/audit_tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ static void untag_chunk(struct node *p)
owner->root = NULL;
}

for (i = j = 0; i < size; i++, j++) {
for (i = j = 0; j <= size; i++, j++) {
struct audit_tree *s;
if (&chunk->owners[j] == p) {
list_del_init(&p->list);
Expand All @@ -290,7 +290,7 @@ static void untag_chunk(struct node *p)
if (!s) /* result of earlier fallback */
continue;
get_tree(s);
list_replace_init(&chunk->owners[i].list, &new->owners[j].list);
list_replace_init(&chunk->owners[j].list, &new->owners[i].list);
}

list_replace_rcu(&chunk->hash, &new->hash);
Expand Down Expand Up @@ -373,15 +373,17 @@ static int tag_chunk(struct inode *inode, struct audit_tree *tree)
for (n = 0; n < old->count; n++) {
if (old->owners[n].owner == tree) {
spin_unlock(&hash_lock);
put_inotify_watch(watch);
put_inotify_watch(&old->watch);
return 0;
}
}
spin_unlock(&hash_lock);

chunk = alloc_chunk(old->count + 1);
if (!chunk)
if (!chunk) {
put_inotify_watch(&old->watch);
return -ENOMEM;
}

mutex_lock(&inode->inotify_mutex);
if (inotify_clone_watch(&old->watch, &chunk->watch) < 0) {
Expand Down Expand Up @@ -425,7 +427,8 @@ static int tag_chunk(struct inode *inode, struct audit_tree *tree)
spin_unlock(&hash_lock);
inotify_evict_watch(&old->watch);
mutex_unlock(&inode->inotify_mutex);
put_inotify_watch(&old->watch);
put_inotify_watch(&old->watch); /* pair to inotify_find_watch */
put_inotify_watch(&old->watch); /* and kill it */
return 0;
}

Expand Down

0 comments on commit a33dde1

Please sign in to comment.