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
faea9111
Commit
faea9111
authored
Feb 11, 2003
by
Dave Jones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[WATCHDOG] PNP API conversion.
Done by Adam Belay.
parent
498b9cb8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
42 deletions
+52
-42
drivers/char/watchdog/sc1200wdt.c
drivers/char/watchdog/sc1200wdt.c
+52
-42
No files found.
drivers/char/watchdog/sc1200wdt.c
View file @
faea9111
...
...
@@ -23,6 +23,7 @@
* Add WDIOC_GETBOOTSTATUS and WDIOC_SETOPTIONS ioctls
* Fix CONFIG_WATCHDOG_NOWAYOUT
* 20020530 Joel Becker Add Matt Domsch's nowayout module option
* 20030116 Adam Belay Updated to the latest pnp code
*
*/
...
...
@@ -35,7 +36,7 @@
#include <linux/notifier.h>
#include <linux/reboot.h>
#include <linux/init.h>
#include <linux/
isa
pnp.h>
#include <linux/pnp.h>
#include <linux/pci.h>
#include <asm/semaphore.h>
...
...
@@ -75,9 +76,9 @@ struct semaphore open_sem;
static
char
expect_close
;
spinlock_t
sc1200wdt_lock
;
/* io port access serialisation */
#if defined CONFIG_
ISAPNP || defined CONFIG_ISAPNP_MODULE
#if defined CONFIG_
PNP
static
int
isapnp
=
1
;
static
struct
p
ci
_dev
*
wdt_dev
;
static
struct
p
np
_dev
*
wdt_dev
;
MODULE_PARM
(
isapnp
,
"i"
);
MODULE_PARM_DESC
(
isapnp
,
"When set to 0 driver ISA PnP support will be disabled"
);
...
...
@@ -328,40 +329,49 @@ static int __init sc1200wdt_probe(void)
}
#if defined CONFIG_
ISAPNP || defined CONFIG_ISAPNP_MODULE
#if defined CONFIG_
PNP
static
int
__init
sc1200wdt_isapnp_probe
(
void
)
{
int
ret
;
struct
pnp_device_id
scl200wdt_pnp_devices
[]
=
{
/* National Semiconductor PC87307/PC97307 watchdog component */
{.
id
=
"NSC0800"
,
.
driver_data
=
0
},
{.
id
=
""
}
};
/* The WDT is logical device 8 on the main device */
wdt_dev
=
isapnp_find_dev
(
NULL
,
ISAPNP_VENDOR
(
'N'
,
'S'
,
'C'
),
ISAPNP_FUNCTION
(
0x08
),
NULL
);
if
(
!
wdt_dev
)
return
-
ENODEV
;
static
int
scl200wdt_pnp_probe
(
struct
pnp_dev
*
dev
,
const
struct
pnp_device_id
*
dev_id
)
{
/* this driver only supports one card at a time */
if
(
wdt_dev
||
!
isapnp
)
return
-
EBUSY
;
if
(
wdt_dev
->
prepare
(
wdt_dev
)
<
0
)
{
printk
(
KERN_ERR
PFX
"ISA PnP found device that could not be autoconfigured
\n
"
);
return
-
EAGAIN
;
}
wdt_dev
=
dev
;
io
=
pnp_port_start
(
wdt_dev
,
0
);
io_len
=
pnp_port_len
(
wdt_dev
,
0
);
if
(
!
(
pci_resource_flags
(
wdt_dev
,
0
)
&
IORESOURCE_IO
))
{
printk
(
KERN_ERR
PFX
"
ISA PnP could not find io ports
\n
"
);
return
-
E
NODEV
;
if
(
!
request_region
(
io
,
io_len
,
SC1200_MODULE_NAME
))
{
printk
(
KERN_ERR
PFX
"
Unable to register IO port %#x
\n
"
,
io
);
return
-
E
BUSY
;
}
ret
=
wdt_dev
->
activate
(
wdt_dev
);
if
(
ret
&&
(
ret
!=
-
EBUSY
))
return
-
ENOMEM
;
/* io port resource overriding support? */
io
=
pci_resource_start
(
wdt_dev
,
0
);
io_len
=
pci_resource_len
(
wdt_dev
,
0
);
printk
(
KERN_DEBUG
PFX
"ISA PnP found device at io port %#x/%d
\n
"
,
io
,
io_len
);
printk
(
KERN_INFO
"scl200wdt: PnP device found at io port %#x/%d
\n
"
,
io
,
io_len
);
return
0
;
}
#endif
/* CONFIG_ISAPNP */
static
void
scl200wdt_pnp_remove
(
struct
pnp_dev
*
dev
)
{
if
(
wdt_dev
){
release_region
(
io
,
io_len
);
wdt_dev
=
NULL
;
}
}
static
struct
pnp_driver
scl200wdt_pnp_driver
=
{
.
name
=
"scl200wdt"
,
.
id_table
=
scl200wdt_pnp_devices
,
.
probe
=
scl200wdt_pnp_probe
,
.
remove
=
scl200wdt_pnp_remove
,
};
#endif
/* CONFIG_PNP */
static
int
__init
sc1200wdt_init
(
void
)
...
...
@@ -373,9 +383,9 @@ static int __init sc1200wdt_init(void)
spin_lock_init
(
&
sc1200wdt_lock
);
sema_init
(
&
open_sem
,
1
);
#if defined CONFIG_
ISAPNP || defined CONFIG_ISAPNP_MODULE
#if defined CONFIG_
PNP
if
(
isapnp
)
{
ret
=
sc1200wdt_isapnp_probe
(
);
ret
=
pnp_register_driver
(
&
scl200wdt_pnp_driver
);
if
(
ret
)
goto
out_clean
;
}
...
...
@@ -387,10 +397,15 @@ static int __init sc1200wdt_init(void)
goto
out_clean
;
}
/* now that the user has specified an IO port and we haven't detected
* any devices, disable pnp support */
isapnp
=
0
;
pnp_unregister_driver
(
&
scl200wdt_pnp_driver
);
if
(
!
request_region
(
io
,
io_len
,
SC1200_MODULE_NAME
))
{
printk
(
KERN_ERR
PFX
"Unable to register IO port %#x
\n
"
,
io
);
ret
=
-
EBUSY
;
goto
out_
pnp
;
goto
out_
clean
;
}
ret
=
sc1200wdt_probe
();
...
...
@@ -420,11 +435,6 @@ static int __init sc1200wdt_init(void)
out_io:
release_region
(
io
,
io_len
);
out_pnp:
#if defined CONFIG_ISAPNP || defined CONFIG_ISAPNP_MODULE
if
(
isapnp
&&
wdt_dev
)
wdt_dev
->
deactivate
(
wdt_dev
);
#endif
goto
out_clean
;
}
...
...
@@ -434,11 +444,11 @@ static void __exit sc1200wdt_exit(void)
misc_deregister
(
&
sc1200wdt_miscdev
);
unregister_reboot_notifier
(
&
sc1200wdt_notifier
);
#if defined CONFIG_ISAPNP || defined CONFIG_ISAPNP_MODULE
if
(
isapnp
&&
wdt_dev
)
wdt_dev
->
deactivate
(
wdt_dev
);
#if defined CONFIG_PNP
if
(
isapnp
)
pnp_unregister_driver
(
&
scl200wdt_pnp_driver
);
else
#endif
release_region
(
io
,
io_len
);
}
...
...
@@ -455,7 +465,7 @@ static int __init sc1200wdt_setup(char *str)
if
(
ints
[
0
]
>
1
)
timeout
=
ints
[
2
];
#if defined CONFIG_
ISAPNP || defined CONFIG_ISAPNP_MODULE
#if defined CONFIG_
PNP
if
(
ints
[
0
]
>
2
)
isapnp
=
ints
[
3
];
#endif
...
...
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