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
Kirill Smelkov
linux
Commits
6a670cdd
Commit
6a670cdd
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] simplify advwdt_open, and add C99 struct initialisers
parent
97cb93ec
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
31 deletions
+26
-31
drivers/char/watchdog/advantechwdt.c
drivers/char/watchdog/advantechwdt.c
+26
-31
No files found.
drivers/char/watchdog/advantechwdt.c
View file @
6a670cdd
...
...
@@ -157,26 +157,23 @@ advwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
static
int
advwdt_open
(
struct
inode
*
inode
,
struct
file
*
file
)
{
switch
(
minor
(
inode
->
i_rdev
))
{
case
WATCHDOG_MINOR
:
spin_lock
(
&
advwdt_lock
);
if
(
advwdt_is_open
)
{
spin_unlock
(
&
advwdt_lock
);
return
-
EBUSY
;
}
if
(
nowayout
)
{
MOD_INC_USE_COUNT
;
}
/*
* Activate
*/
advwdt_is_open
=
1
;
advwdt_ping
();
if
(
minor
(
inode
->
i_rdev
)
=
WATCHDOG_MINOR
)
{
spin_lock
(
&
advwdt_lock
);
if
(
advwdt_is_open
)
{
spin_unlock
(
&
advwdt_lock
);
return
0
;
default:
return
-
ENODEV
;
return
-
EBUSY
;
}
if
(
nowayout
)
MOD_INC_USE_COUNT
;
/* Activate */
advwdt_is_open
=
1
;
advwdt_ping
();
spin_unlock
(
&
advwdt_lock
);
return
0
;
}
else
{
return
-
ENODEV
;
}
}
...
...
@@ -185,9 +182,9 @@ advwdt_close(struct inode *inode, struct file *file)
{
if
(
minor
(
inode
->
i_rdev
)
==
WATCHDOG_MINOR
)
{
spin_lock
(
&
advwdt_lock
);
if
(
!
nowayout
)
{
if
(
!
nowayout
)
inb_p
(
WDT_STOP
);
}
advwdt_is_open
=
0
;
spin_unlock
(
&
advwdt_lock
);
}
...
...
@@ -202,10 +199,10 @@ static int
advwdt_notify_sys
(
struct
notifier_block
*
this
,
unsigned
long
code
,
void
*
unused
)
{
if
(
code
==
SYS_DOWN
||
code
==
SYS_HALT
)
{
if
(
code
==
SYS_DOWN
||
code
==
SYS_HALT
)
/* Turn the WDT off */
inb_p
(
WDT_STOP
);
}
return
NOTIFY_DONE
;
}
...
...
@@ -223,9 +220,9 @@ static struct file_operations advwdt_fops = {
};
static
struct
miscdevice
advwdt_miscdev
=
{
WATCHDOG_MINOR
,
"watchdog"
,
&
advwdt_fops
.
minor
=
WATCHDOG_MINOR
,
.
name
=
"watchdog"
,
.
fops
=
&
advwdt_fops
};
/*
...
...
@@ -234,9 +231,9 @@ static struct miscdevice advwdt_miscdev = {
*/
static
struct
notifier_block
advwdt_notifier
=
{
advwdt_notify_sys
,
NULL
,
0
.
self
=
advwdt_notify_sys
,
.
next
=
NULL
,
.
priority
=
0
};
static
void
__init
...
...
@@ -290,5 +287,3 @@ module_exit(advwdt_exit);
MODULE_LICENSE
(
"GPL"
);
/* end of advantechwdt.c */
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