Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
c692fa0b
Commit
c692fa0b
authored
Jan 10, 2003
by
Dave Jones
Committed by
Dave Jones
Jan 10, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[WATCHDOG] pcwd nowayout fixes from 2.4
parent
b045cc61
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
28 deletions
+40
-28
drivers/char/watchdog/pcwd.c
drivers/char/watchdog/pcwd.c
+40
-28
No files found.
drivers/char/watchdog/pcwd.c
View file @
c692fa0b
...
...
@@ -93,6 +93,7 @@ static int pcwd_ioports[] = { 0x270, 0x350, 0x370, 0x000 };
#define WD_TIMEOUT 4
/* 2 seconds for a timeout */
static
int
timeout_val
=
WD_TIMEOUT
;
static
int
timeout
=
2
;
static
int
expect_close
=
0
;
MODULE_PARM
(
timeout
,
"i"
);
MODULE_PARM_DESC
(
timeout
,
"Watchdog timeout in seconds (default=2)"
);
...
...
@@ -273,7 +274,7 @@ static int pcwd_ioctl(struct inode *inode, struct file *file,
else
cdat
=
inb
(
current_readport
+
1
);
spin_unlock
(
&
io_lock
);
rv
=
0
;
rv
=
WDIOF_MAGICCLOSE
;
if
(
revision
==
PCWD_REVISION_A
)
{
...
...
@@ -402,8 +403,22 @@ static ssize_t pcwd_write(struct file *file, const char *buf, size_t len,
if
(
ppos
!=
&
file
->
f_pos
)
return
-
ESPIPE
;
if
(
len
)
{
if
(
len
)
{
if
(
!
nowayout
)
{
size_t
i
;
/* In case it was set long ago */
expect_close
=
0
;
for
(
i
=
0
;
i
!=
len
;
i
++
)
{
char
c
;
if
(
get_user
(
c
,
buf
+
i
))
return
-
EFAULT
;
if
(
c
==
'V'
)
expect_close
=
1
;
}
}
pcwd_send_heartbeat
();
return
1
;
}
...
...
@@ -412,23 +427,21 @@ static ssize_t pcwd_write(struct file *file, const char *buf, size_t len,
static
int
pcwd_open
(
struct
inode
*
ino
,
struct
file
*
filep
)
{
switch
(
minor
(
ino
->
i_rdev
))
{
switch
(
minor
(
ino
->
i_rdev
))
{
case
WATCHDOG_MINOR
:
if
(
!
atomic_dec_and_test
(
&
open_allowed
)
)
{
if
(
!
atomic_dec_and_test
(
&
open_allowed
)
)
{
atomic_inc
(
&
open_allowed
);
return
-
EBUSY
;
}
MOD_INC_USE_COUNT
;
/* Enable the port */
if
(
revision
==
PCWD_REVISION_C
)
{
if
(
revision
==
PCWD_REVISION_C
)
{
spin_lock
(
&
io_lock
);
outb_p
(
0x00
,
current_readport
+
3
);
spin_unlock
(
&
io_lock
);
}
return
(
0
);
case
TEMP_MINOR
:
return
(
0
);
default:
...
...
@@ -465,9 +478,8 @@ static ssize_t pcwd_read(struct file *file, char *buf, size_t count,
static
int
pcwd_close
(
struct
inode
*
ino
,
struct
file
*
filep
)
{
if
(
minor
(
ino
->
i_rdev
)
==
WATCHDOG_MINOR
)
{
if
(
!
nowayout
)
{
if
(
minor
(
ino
->
i_rdev
)
==
WATCHDOG_MINOR
)
{
if
(
expect_close
)
{
/* Disable the board */
if
(
revision
==
PCWD_REVISION_C
)
{
spin_lock
(
&
io_lock
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment