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
6bf07a2d
Commit
6bf07a2d
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] acquirewdt nowayout fixes from 2.4
(plus some CodingStyle reformatting)
parent
3c8ba560
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
34 deletions
+41
-34
drivers/char/watchdog/acquirewdt.c
drivers/char/watchdog/acquirewdt.c
+41
-34
No files found.
drivers/char/watchdog/acquirewdt.c
View file @
6bf07a2d
...
@@ -81,6 +81,20 @@ static ssize_t acq_write(struct file *file, const char *buf, size_t count, loff_
...
@@ -81,6 +81,20 @@ static ssize_t acq_write(struct file *file, const char *buf, size_t count, loff_
if
(
count
)
if
(
count
)
{
{
if
(
!
nowayout
)
{
size_t
i
;
expect_close
=
0
;
for
(
i
=
0
;
i
!=
count
;
i
++
)
{
char
c
;
if
(
get_user
(
c
,
buf
+
i
))
return
-
EFAULT
;
if
(
c
==
'V'
)
expect_close
=
1
;
}
}
acq_ping
();
acq_ping
();
return
1
;
return
1
;
}
}
...
@@ -99,7 +113,7 @@ static int acq_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
...
@@ -99,7 +113,7 @@ static int acq_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
{
{
static
struct
watchdog_info
ident
=
static
struct
watchdog_info
ident
=
{
{
WDIOF_KEEPALIVEPING
,
1
,
"Acquire WDT"
WDIOF_KEEPALIVEPING
|
WDIOF_MAGICCLOSE
,
1
,
"Acquire WDT"
};
};
switch
(
cmd
)
switch
(
cmd
)
...
@@ -126,39 +140,35 @@ static int acq_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
...
@@ -126,39 +140,35 @@ static int acq_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
static
int
acq_open
(
struct
inode
*
inode
,
struct
file
*
file
)
static
int
acq_open
(
struct
inode
*
inode
,
struct
file
*
file
)
{
{
switch
(
minor
(
inode
->
i_rdev
))
if
((
minor
(
inode
->
i_rdev
)
==
WATCHDOG_MINOR
))
{
{
case
WATCHDOG_MINOR
:
spin_lock
(
&
acq_lock
);
spin_lock
(
&
acq_lock
);
if
(
acq_is_open
)
if
(
acq_is_open
)
{
{
spin_unlock
(
&
acq_lock
);
spin_unlock
(
&
acq_lock
);
return
-
EBUSY
;
return
-
EBUSY
;
}
}
if
(
nowayout
)
{
if
(
nowayout
)
MOD_INC_USE_COUNT
;
MOD_INC_USE_COUNT
;
}
/*
* Activate
*/
/* Activate */
acq_is_open
=
1
;
acq_is_open
=
1
;
inb_p
(
WDT_START
);
inb_p
(
WDT_START
);
spin_unlock
(
&
acq_lock
);
spin_unlock
(
&
acq_lock
);
return
0
;
return
0
;
default:
}
else
{
return
-
ENODEV
;
return
-
ENODEV
;
}
}
}
}
static
int
acq_close
(
struct
inode
*
inode
,
struct
file
*
file
)
static
int
acq_close
(
struct
inode
*
inode
,
struct
file
*
file
)
{
{
if
(
minor
(
inode
->
i_rdev
)
==
WATCHDOG_MINOR
)
if
(
minor
(
inode
->
i_rdev
)
==
WATCHDOG_MINOR
)
{
{
spin_lock
(
&
acq_lock
);
spin_lock
(
&
acq_lock
);
if
(
!
nowayout
)
{
if
(
expect_close
)
inb_p
(
WDT_STOP
);
inb_p
(
WDT_STOP
);
}
else
printk
(
KERN_CRIT
"WDT closed unexpectedly. WDT will not stop!
\n
"
);
acq_is_open
=
0
;
acq_is_open
=
0
;
spin_unlock
(
&
acq_lock
);
spin_unlock
(
&
acq_lock
);
}
}
...
@@ -173,10 +183,9 @@ static int acq_notify_sys(struct notifier_block *this, unsigned long code,
...
@@ -173,10 +183,9 @@ static int acq_notify_sys(struct notifier_block *this, unsigned long code,
void
*
unused
)
void
*
unused
)
{
{
if
(
code
==
SYS_DOWN
||
code
==
SYS_HALT
)
if
(
code
==
SYS_DOWN
||
code
==
SYS_HALT
)
{
/* Turn the card off */
/* Turn the card off */
inb_p
(
WDT_STOP
);
inb_p
(
WDT_STOP
);
}
return
NOTIFY_DONE
;
return
NOTIFY_DONE
;
}
}
...
@@ -221,13 +230,11 @@ static int __init acq_init(void)
...
@@ -221,13 +230,11 @@ static int __init acq_init(void)
spin_lock_init
(
&
acq_lock
);
spin_lock_init
(
&
acq_lock
);
if
(
misc_register
(
&
acq_miscdev
))
if
(
misc_register
(
&
acq_miscdev
))
return
-
ENODEV
;
return
-
ENODEV
;
if
(
!
request_region
(
WDT_STOP
,
1
,
"Acquire WDT"
))
if
(
!
request_region
(
WDT_STOP
,
1
,
"Acquire WDT"
))
{
{
misc_deregister
(
&
acq_miscdev
);
misc_deregister
(
&
acq_miscdev
);
return
-
EIO
;
return
-
EIO
;
}
}
if
(
!
request_region
(
WDT_START
,
1
,
"Acquire WDT"
))
if
(
!
request_region
(
WDT_START
,
1
,
"Acquire WDT"
))
{
{
release_region
(
WDT_STOP
,
1
);
release_region
(
WDT_STOP
,
1
);
misc_deregister
(
&
acq_miscdev
);
misc_deregister
(
&
acq_miscdev
);
return
-
EIO
;
return
-
EIO
;
...
...
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