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
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
Show 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,25 +157,22 @@ advwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
...
@@ -157,25 +157,22 @@ advwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
static
int
static
int
advwdt_open
(
struct
inode
*
inode
,
struct
file
*
file
)
advwdt_open
(
struct
inode
*
inode
,
struct
file
*
file
)
{
{
switch
(
minor
(
inode
->
i_rdev
))
{
if
(
minor
(
inode
->
i_rdev
)
=
WATCHDOG_MINOR
)
{
case
WATCHDOG_MINOR
:
spin_lock
(
&
advwdt_lock
);
spin_lock
(
&
advwdt_lock
);
if
(
advwdt_is_open
)
{
if
(
advwdt_is_open
)
{
spin_unlock
(
&
advwdt_lock
);
spin_unlock
(
&
advwdt_lock
);
return
-
EBUSY
;
return
-
EBUSY
;
}
}
if
(
nowayout
)
{
if
(
nowayout
)
MOD_INC_USE_COUNT
;
MOD_INC_USE_COUNT
;
}
/*
* Activate
*/
/* Activate */
advwdt_is_open
=
1
;
advwdt_is_open
=
1
;
advwdt_ping
();
advwdt_ping
();
spin_unlock
(
&
advwdt_lock
);
spin_unlock
(
&
advwdt_lock
);
return
0
;
return
0
;
default:
}
else
{
return
-
ENODEV
;
return
-
ENODEV
;
}
}
}
}
...
@@ -185,9 +182,9 @@ advwdt_close(struct inode *inode, struct file *file)
...
@@ -185,9 +182,9 @@ advwdt_close(struct inode *inode, struct file *file)
{
{
if
(
minor
(
inode
->
i_rdev
)
==
WATCHDOG_MINOR
)
{
if
(
minor
(
inode
->
i_rdev
)
==
WATCHDOG_MINOR
)
{
spin_lock
(
&
advwdt_lock
);
spin_lock
(
&
advwdt_lock
);
if
(
!
nowayout
)
{
if
(
!
nowayout
)
inb_p
(
WDT_STOP
);
inb_p
(
WDT_STOP
);
}
advwdt_is_open
=
0
;
advwdt_is_open
=
0
;
spin_unlock
(
&
advwdt_lock
);
spin_unlock
(
&
advwdt_lock
);
}
}
...
@@ -202,10 +199,10 @@ static int
...
@@ -202,10 +199,10 @@ static int
advwdt_notify_sys
(
struct
notifier_block
*
this
,
unsigned
long
code
,
advwdt_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 WDT off */
/* Turn the WDT off */
inb_p
(
WDT_STOP
);
inb_p
(
WDT_STOP
);
}
return
NOTIFY_DONE
;
return
NOTIFY_DONE
;
}
}
...
@@ -223,9 +220,9 @@ static struct file_operations advwdt_fops = {
...
@@ -223,9 +220,9 @@ static struct file_operations advwdt_fops = {
};
};
static
struct
miscdevice
advwdt_miscdev
=
{
static
struct
miscdevice
advwdt_miscdev
=
{
WATCHDOG_MINOR
,
.
minor
=
WATCHDOG_MINOR
,
"watchdog"
,
.
name
=
"watchdog"
,
&
advwdt_fops
.
fops
=
&
advwdt_fops
};
};
/*
/*
...
@@ -234,9 +231,9 @@ static struct miscdevice advwdt_miscdev = {
...
@@ -234,9 +231,9 @@ static struct miscdevice advwdt_miscdev = {
*/
*/
static
struct
notifier_block
advwdt_notifier
=
{
static
struct
notifier_block
advwdt_notifier
=
{
advwdt_notify_sys
,
.
self
=
advwdt_notify_sys
,
NULL
,
.
next
=
NULL
,
0
.
priority
=
0
};
};
static
void
__init
static
void
__init
...
@@ -290,5 +287,3 @@ module_exit(advwdt_exit);
...
@@ -290,5 +287,3 @@ module_exit(advwdt_exit);
MODULE_LICENSE
(
"GPL"
);
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