Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 47447
b: refs/heads/master
c: 42d3611
h: refs/heads/master
i:
  47445: ae5358b
  47443: c6afa2c
  47439: 4304d73
v: v3
  • Loading branch information
Jeff Dike authored and Linus Torvalds committed Feb 11, 2007
1 parent 9718f02 commit 6c7fae8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 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: 4ea21cd9173a0ffa75dc74cc46d08dfc45654f29
refs/heads/master: 42d36115d25725fb551250c8f70602a12aa8dee2
23 changes: 15 additions & 8 deletions trunk/arch/um/drivers/harddog_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,13 @@
#include <linux/reboot.h>
#include <linux/smp_lock.h>
#include <linux/init.h>
#include <linux/spinlock.h>
#include <asm/uaccess.h>
#include "mconsole.h"

MODULE_LICENSE("GPL");

/* Locked by the BKL in harddog_open and harddog_release */
static DEFINE_SPINLOCK(lock);
static int timer_alive;
static int harddog_in_fd = -1;
static int harddog_out_fd = -1;
Expand All @@ -62,12 +63,12 @@ extern int start_watchdog(int *in_fd_ret, int *out_fd_ret, char *sock);

static int harddog_open(struct inode *inode, struct file *file)
{
int err;
int err = -EBUSY;
char *sock = NULL;

lock_kernel();
spin_lock(&lock);
if(timer_alive)
return -EBUSY;
goto err;
#ifdef CONFIG_HARDDOG_NOWAYOUT
__module_get(THIS_MODULE);
#endif
Expand All @@ -76,11 +77,15 @@ static int harddog_open(struct inode *inode, struct file *file)
sock = mconsole_notify_socket();
#endif
err = start_watchdog(&harddog_in_fd, &harddog_out_fd, sock);
if(err) return(err);
if(err)
goto err;

timer_alive = 1;
unlock_kernel();
spin_unlock(&lock);
return nonseekable_open(inode, file);
err:
spin_unlock(&lock);
return err;
}

extern void stop_watchdog(int in_fd, int out_fd);
Expand All @@ -90,14 +95,16 @@ static int harddog_release(struct inode *inode, struct file *file)
/*
* Shut off the timer.
*/
lock_kernel();

spin_lock(&lock);

stop_watchdog(harddog_in_fd, harddog_out_fd);
harddog_in_fd = -1;
harddog_out_fd = -1;

timer_alive=0;
unlock_kernel();
spin_unlock(&lock);

return 0;
}

Expand Down

0 comments on commit 6c7fae8

Please sign in to comment.