Commit a2be8786 authored by Wim Van Sebroeck's avatar Wim Van Sebroeck

[WATCHDOG] pcwd.c private data struct patch

more private data of the card to one struct.
Signed-off-by: default avatarWim Van Sebroeck <wim@iguana.be>
parent f1c3a056
...@@ -73,7 +73,7 @@ ...@@ -73,7 +73,7 @@
#include <asm/io.h> /* For inb/outb/... */ #include <asm/io.h> /* For inb/outb/... */
/* Module and version information */ /* Module and version information */
#define WD_VER "1.16 (06/12/2004)" #define WD_VER "1.16 (03/01/2006)"
#define PFX "pcwd: " #define PFX "pcwd: "
/* /*
...@@ -133,15 +133,17 @@ static int cards_found; ...@@ -133,15 +133,17 @@ static int cards_found;
/* internal variables */ /* internal variables */
static atomic_t open_allowed = ATOMIC_INIT(1); static atomic_t open_allowed = ATOMIC_INIT(1);
static char expect_close; static char expect_close;
static struct timer_list timer;
static unsigned long next_heartbeat;
static int temp_panic; static int temp_panic;
static int revision; /* The card's revision */ static struct { /* this is private data for each ISA-PC watchdog card */
static int supports_temp; /* Wether or not the card has a temperature device */ int revision; /* The card's revision */
static int command_mode; /* Wether or not the card is in command mode */ int supports_temp; /* Wether or not the card has a temperature device */
static int initial_status; /* The card's boot status */ int command_mode; /* Wether or not the card is in command mode */
static int current_readport; /* The cards I/O address */ int boot_status; /* The card's boot status */
static spinlock_t io_lock; int io_addr; /* The cards I/O address */
spinlock_t io_lock; /* the lock for io operations */
struct timer_list timer; /* The timer that pings the watchdog */
unsigned long next_heartbeat; /* the next_heartbeat for the timer */
} pcwd_private;
/* module parameters */ /* module parameters */
#define WATCHDOG_HEARTBEAT 60 /* 60 sec default heartbeat */ #define WATCHDOG_HEARTBEAT 60 /* 60 sec default heartbeat */
...@@ -165,13 +167,13 @@ static int send_isa_command(int cmd) ...@@ -165,13 +167,13 @@ static int send_isa_command(int cmd)
/* The WCMD bit must be 1 and the command is only 4 bits in size */ /* The WCMD bit must be 1 and the command is only 4 bits in size */
control_status = (cmd & 0x0F) | 0x80; control_status = (cmd & 0x0F) | 0x80;
outb_p(control_status, current_readport + 2); outb_p(control_status, pcwd_private.io_addr + 2);
udelay(ISA_COMMAND_TIMEOUT); udelay(ISA_COMMAND_TIMEOUT);
port0 = inb_p(current_readport); port0 = inb_p(pcwd_private.io_addr);
for (i = 0; i < 25; ++i) { for (i = 0; i < 25; ++i) {
last_port0 = port0; last_port0 = port0;
port0 = inb_p(current_readport); port0 = inb_p(pcwd_private.io_addr);
if (port0 == last_port0) if (port0 == last_port0)
break; /* Data is stable */ break; /* Data is stable */
...@@ -187,7 +189,7 @@ static int set_command_mode(void) ...@@ -187,7 +189,7 @@ static int set_command_mode(void)
int i, found=0, count=0; int i, found=0, count=0;
/* Set the card into command mode */ /* Set the card into command mode */
spin_lock(&io_lock); spin_lock(&pcwd_private.io_lock);
while ((!found) && (count < 3)) { while ((!found) && (count < 3)) {
i = send_isa_command(CMD_ISA_IDLE); i = send_isa_command(CMD_ISA_IDLE);
...@@ -195,15 +197,15 @@ static int set_command_mode(void) ...@@ -195,15 +197,15 @@ static int set_command_mode(void)
found = 1; found = 1;
else if (i == 0xF3) { else if (i == 0xF3) {
/* Card does not like what we've done to it */ /* Card does not like what we've done to it */
outb_p(0x00, current_readport + 2); outb_p(0x00, pcwd_private.io_addr + 2);
udelay(1200); /* Spec says wait 1ms */ udelay(1200); /* Spec says wait 1ms */
outb_p(0x00, current_readport + 2); outb_p(0x00, pcwd_private.io_addr + 2);
udelay(ISA_COMMAND_TIMEOUT); udelay(ISA_COMMAND_TIMEOUT);
} }
count++; count++;
} }
spin_unlock(&io_lock); spin_unlock(&pcwd_private.io_lock);
command_mode = found; pcwd_private.command_mode = found;
return(found); return(found);
} }
...@@ -211,12 +213,12 @@ static int set_command_mode(void) ...@@ -211,12 +213,12 @@ static int set_command_mode(void)
static void unset_command_mode(void) static void unset_command_mode(void)
{ {
/* Set the card into normal mode */ /* Set the card into normal mode */
spin_lock(&io_lock); spin_lock(&pcwd_private.io_lock);
outb_p(0x00, current_readport + 2); outb_p(0x00, pcwd_private.io_addr + 2);
udelay(ISA_COMMAND_TIMEOUT); udelay(ISA_COMMAND_TIMEOUT);
spin_unlock(&io_lock); spin_unlock(&pcwd_private.io_lock);
command_mode = 0; pcwd_private.command_mode = 0;
} }
static void pcwd_timer_ping(unsigned long data) static void pcwd_timer_ping(unsigned long data)
...@@ -225,25 +227,25 @@ static void pcwd_timer_ping(unsigned long data) ...@@ -225,25 +227,25 @@ static void pcwd_timer_ping(unsigned long data)
/* If we got a heartbeat pulse within the WDT_INTERVAL /* If we got a heartbeat pulse within the WDT_INTERVAL
* we agree to ping the WDT */ * we agree to ping the WDT */
if(time_before(jiffies, next_heartbeat)) { if(time_before(jiffies, pcwd_private.next_heartbeat)) {
/* Ping the watchdog */ /* Ping the watchdog */
spin_lock(&io_lock); spin_lock(&pcwd_private.io_lock);
if (revision == PCWD_REVISION_A) { if (pcwd_private.revision == PCWD_REVISION_A) {
/* Rev A cards are reset by setting the WD_WDRST bit in register 1 */ /* Rev A cards are reset by setting the WD_WDRST bit in register 1 */
wdrst_stat = inb_p(current_readport); wdrst_stat = inb_p(pcwd_private.io_addr);
wdrst_stat &= 0x0F; wdrst_stat &= 0x0F;
wdrst_stat |= WD_WDRST; wdrst_stat |= WD_WDRST;
outb_p(wdrst_stat, current_readport + 1); outb_p(wdrst_stat, pcwd_private.io_addr + 1);
} else { } else {
/* Re-trigger watchdog by writing to port 0 */ /* Re-trigger watchdog by writing to port 0 */
outb_p(0x00, current_readport); outb_p(0x00, pcwd_private.io_addr);
} }
/* Re-set the timer interval */ /* Re-set the timer interval */
mod_timer(&timer, jiffies + WDT_INTERVAL); mod_timer(&pcwd_private.timer, jiffies + WDT_INTERVAL);
spin_unlock(&io_lock); spin_unlock(&pcwd_private.io_lock);
} else { } else {
printk(KERN_WARNING PFX "Heartbeat lost! Will not ping the watchdog\n"); printk(KERN_WARNING PFX "Heartbeat lost! Will not ping the watchdog\n");
} }
...@@ -253,18 +255,18 @@ static int pcwd_start(void) ...@@ -253,18 +255,18 @@ static int pcwd_start(void)
{ {
int stat_reg; int stat_reg;
next_heartbeat = jiffies + (heartbeat * HZ); pcwd_private.next_heartbeat = jiffies + (heartbeat * HZ);
/* Start the timer */ /* Start the timer */
mod_timer(&timer, jiffies + WDT_INTERVAL); mod_timer(&pcwd_private.timer, jiffies + WDT_INTERVAL);
/* Enable the port */ /* Enable the port */
if (revision == PCWD_REVISION_C) { if (pcwd_private.revision == PCWD_REVISION_C) {
spin_lock(&io_lock); spin_lock(&pcwd_private.io_lock);
outb_p(0x00, current_readport + 3); outb_p(0x00, pcwd_private.io_addr + 3);
udelay(ISA_COMMAND_TIMEOUT); udelay(ISA_COMMAND_TIMEOUT);
stat_reg = inb_p(current_readport + 2); stat_reg = inb_p(pcwd_private.io_addr + 2);
spin_unlock(&io_lock); spin_unlock(&pcwd_private.io_lock);
if (stat_reg & 0x10) { if (stat_reg & 0x10) {
printk(KERN_INFO PFX "Could not start watchdog\n"); printk(KERN_INFO PFX "Could not start watchdog\n");
return -EIO; return -EIO;
...@@ -278,17 +280,17 @@ static int pcwd_stop(void) ...@@ -278,17 +280,17 @@ static int pcwd_stop(void)
int stat_reg; int stat_reg;
/* Stop the timer */ /* Stop the timer */
del_timer(&timer); del_timer(&pcwd_private.timer);
/* Disable the board */ /* Disable the board */
if (revision == PCWD_REVISION_C) { if (pcwd_private.revision == PCWD_REVISION_C) {
spin_lock(&io_lock); spin_lock(&pcwd_private.io_lock);
outb_p(0xA5, current_readport + 3); outb_p(0xA5, pcwd_private.io_addr + 3);
udelay(ISA_COMMAND_TIMEOUT); udelay(ISA_COMMAND_TIMEOUT);
outb_p(0xA5, current_readport + 3); outb_p(0xA5, pcwd_private.io_addr + 3);
udelay(ISA_COMMAND_TIMEOUT); udelay(ISA_COMMAND_TIMEOUT);
stat_reg = inb_p(current_readport + 2); stat_reg = inb_p(pcwd_private.io_addr + 2);
spin_unlock(&io_lock); spin_unlock(&pcwd_private.io_lock);
if ((stat_reg & 0x10) == 0) { if ((stat_reg & 0x10) == 0) {
printk(KERN_INFO PFX "Could not stop watchdog\n"); printk(KERN_INFO PFX "Could not stop watchdog\n");
return -EIO; return -EIO;
...@@ -300,7 +302,7 @@ static int pcwd_stop(void) ...@@ -300,7 +302,7 @@ static int pcwd_stop(void)
static int pcwd_keepalive(void) static int pcwd_keepalive(void)
{ {
/* user land ping */ /* user land ping */
next_heartbeat = jiffies + (heartbeat * HZ); pcwd_private.next_heartbeat = jiffies + (heartbeat * HZ);
return 0; return 0;
} }
...@@ -318,23 +320,23 @@ static int pcwd_get_status(int *status) ...@@ -318,23 +320,23 @@ static int pcwd_get_status(int *status)
int card_status; int card_status;
*status=0; *status=0;
spin_lock(&io_lock); spin_lock(&pcwd_private.io_lock);
if (revision == PCWD_REVISION_A) if (pcwd_private.revision == PCWD_REVISION_A)
/* Rev A cards return status information from /* Rev A cards return status information from
* the base register, which is used for the * the base register, which is used for the
* temperature in other cards. */ * temperature in other cards. */
card_status = inb(current_readport); card_status = inb(pcwd_private.io_addr);
else { else {
/* Rev C cards return card status in the base /* Rev C cards return card status in the base
* address + 1 register. And use different bits * address + 1 register. And use different bits
* to indicate a card initiated reset, and an * to indicate a card initiated reset, and an
* over-temperature condition. And the reboot * over-temperature condition. And the reboot
* status can be reset. */ * status can be reset. */
card_status = inb(current_readport + 1); card_status = inb(pcwd_private.io_addr + 1);
} }
spin_unlock(&io_lock); spin_unlock(&pcwd_private.io_lock);
if (revision == PCWD_REVISION_A) { if (pcwd_private.revision == PCWD_REVISION_A) {
if (card_status & WD_WDRST) if (card_status & WD_WDRST)
*status |= WDIOF_CARDRESET; *status |= WDIOF_CARDRESET;
...@@ -363,10 +365,10 @@ static int pcwd_get_status(int *status) ...@@ -363,10 +365,10 @@ static int pcwd_get_status(int *status)
static int pcwd_clear_status(void) static int pcwd_clear_status(void)
{ {
if (revision == PCWD_REVISION_C) { if (pcwd_private.revision == PCWD_REVISION_C) {
spin_lock(&io_lock); spin_lock(&pcwd_private.io_lock);
outb_p(0x00, current_readport + 1); /* clear reset status */ outb_p(0x00, pcwd_private.io_addr + 1); /* clear reset status */
spin_unlock(&io_lock); spin_unlock(&pcwd_private.io_lock);
} }
return 0; return 0;
} }
...@@ -374,20 +376,20 @@ static int pcwd_clear_status(void) ...@@ -374,20 +376,20 @@ static int pcwd_clear_status(void)
static int pcwd_get_temperature(int *temperature) static int pcwd_get_temperature(int *temperature)
{ {
/* check that port 0 gives temperature info and no command results */ /* check that port 0 gives temperature info and no command results */
if (command_mode) if (pcwd_private.command_mode)
return -1; return -1;
*temperature = 0; *temperature = 0;
if (!supports_temp) if (!pcwd_private.supports_temp)
return -ENODEV; return -ENODEV;
/* /*
* Convert celsius to fahrenheit, since this was * Convert celsius to fahrenheit, since this was
* the decided 'standard' for this return value. * the decided 'standard' for this return value.
*/ */
spin_lock(&io_lock); spin_lock(&pcwd_private.io_lock);
*temperature = ((inb(current_readport)) * 9 / 5) + 32; *temperature = ((inb(pcwd_private.io_addr)) * 9 / 5) + 32;
spin_unlock(&io_lock); spin_unlock(&pcwd_private.io_lock);
return 0; return 0;
} }
...@@ -428,7 +430,7 @@ static int pcwd_ioctl(struct inode *inode, struct file *file, ...@@ -428,7 +430,7 @@ static int pcwd_ioctl(struct inode *inode, struct file *file,
return put_user(status, argp); return put_user(status, argp);
case WDIOC_GETBOOTSTATUS: case WDIOC_GETBOOTSTATUS:
return put_user(initial_status, argp); return put_user(pcwd_private.boot_status, argp);
case WDIOC_GETTEMP: case WDIOC_GETTEMP:
if (pcwd_get_temperature(&temperature)) if (pcwd_get_temperature(&temperature))
...@@ -437,7 +439,7 @@ static int pcwd_ioctl(struct inode *inode, struct file *file, ...@@ -437,7 +439,7 @@ static int pcwd_ioctl(struct inode *inode, struct file *file,
return put_user(temperature, argp); return put_user(temperature, argp);
case WDIOC_SETOPTIONS: case WDIOC_SETOPTIONS:
if (revision == PCWD_REVISION_C) if (pcwd_private.revision == PCWD_REVISION_C)
{ {
if(copy_from_user(&rv, argp, sizeof(int))) if(copy_from_user(&rv, argp, sizeof(int)))
return -EFAULT; return -EFAULT;
...@@ -553,7 +555,7 @@ static ssize_t pcwd_temp_read(struct file *file, char __user *buf, size_t count, ...@@ -553,7 +555,7 @@ static ssize_t pcwd_temp_read(struct file *file, char __user *buf, size_t count,
static int pcwd_temp_open(struct inode *inode, struct file *file) static int pcwd_temp_open(struct inode *inode, struct file *file)
{ {
if (!supports_temp) if (!pcwd_private.supports_temp)
return -ENODEV; return -ENODEV;
return nonseekable_open(inode, file); return nonseekable_open(inode, file);
...@@ -621,21 +623,21 @@ static struct notifier_block pcwd_notifier = { ...@@ -621,21 +623,21 @@ static struct notifier_block pcwd_notifier = {
static inline void get_support(void) static inline void get_support(void)
{ {
if (inb(current_readport) != 0xF0) if (inb(pcwd_private.io_addr) != 0xF0)
supports_temp = 1; pcwd_private.supports_temp = 1;
} }
static inline int get_revision(void) static inline int get_revision(void)
{ {
int r = PCWD_REVISION_C; int r = PCWD_REVISION_C;
spin_lock(&io_lock); spin_lock(&pcwd_private.io_lock);
/* REV A cards use only 2 io ports; test /* REV A cards use only 2 io ports; test
* presumes a floating bus reads as 0xff. */ * presumes a floating bus reads as 0xff. */
if ((inb(current_readport + 2) == 0xFF) || if ((inb(pcwd_private.io_addr + 2) == 0xFF) ||
(inb(current_readport + 3) == 0xFF)) (inb(pcwd_private.io_addr + 3) == 0xFF))
r=PCWD_REVISION_A; r=PCWD_REVISION_A;
spin_unlock(&io_lock); spin_unlock(&pcwd_private.io_lock);
return r; return r;
} }
...@@ -695,32 +697,32 @@ static int __devinit pcwatchdog_init(int base_addr) ...@@ -695,32 +697,32 @@ static int __devinit pcwatchdog_init(int base_addr)
printk(KERN_ERR PFX "No I/O-Address for card detected\n"); printk(KERN_ERR PFX "No I/O-Address for card detected\n");
return -ENODEV; return -ENODEV;
} }
current_readport = base_addr; pcwd_private.io_addr = base_addr;
/* Check card's revision */ /* Check card's revision */
revision = get_revision(); pcwd_private.revision = get_revision();
if (!request_region(current_readport, (revision == PCWD_REVISION_A) ? 2 : 4, "PCWD")) { if (!request_region(pcwd_private.io_addr, (pcwd_private.revision == PCWD_REVISION_A) ? 2 : 4, "PCWD")) {
printk(KERN_ERR PFX "I/O address 0x%04x already in use\n", printk(KERN_ERR PFX "I/O address 0x%04x already in use\n",
current_readport); pcwd_private.io_addr);
current_readport = 0x0000; pcwd_private.io_addr = 0x0000;
return -EIO; return -EIO;
} }
/* Initial variables */ /* Initial variables */
supports_temp = 0; pcwd_private.supports_temp = 0;
temp_panic = 0; temp_panic = 0;
initial_status = 0x0000; pcwd_private.boot_status = 0x0000;
/* get the boot_status */ /* get the boot_status */
pcwd_get_status(&initial_status); pcwd_get_status(&pcwd_private.boot_status);
/* clear the "card caused reboot" flag */ /* clear the "card caused reboot" flag */
pcwd_clear_status(); pcwd_clear_status();
init_timer(&timer); init_timer(&pcwd_private.timer);
timer.function = pcwd_timer_ping; pcwd_private.timer.function = pcwd_timer_ping;
timer.data = 0; pcwd_private.timer.data = 0;
/* Disable the board */ /* Disable the board */
pcwd_stop(); pcwd_stop();
...@@ -729,12 +731,12 @@ static int __devinit pcwatchdog_init(int base_addr) ...@@ -729,12 +731,12 @@ static int __devinit pcwatchdog_init(int base_addr)
get_support(); get_support();
/* Get some extra info from the hardware (in command/debug/diag mode) */ /* Get some extra info from the hardware (in command/debug/diag mode) */
if (revision == PCWD_REVISION_A) if (pcwd_private.revision == PCWD_REVISION_A)
printk(KERN_INFO PFX "ISA-PC Watchdog (REV.A) detected at port 0x%04x\n", current_readport); printk(KERN_INFO PFX "ISA-PC Watchdog (REV.A) detected at port 0x%04x\n", pcwd_private.io_addr);
else if (revision == PCWD_REVISION_C) { else if (pcwd_private.revision == PCWD_REVISION_C) {
firmware = get_firmware(); firmware = get_firmware();
printk(KERN_INFO PFX "ISA-PC Watchdog (REV.C) detected at port 0x%04x (Firmware version: %s)\n", printk(KERN_INFO PFX "ISA-PC Watchdog (REV.C) detected at port 0x%04x (Firmware version: %s)\n",
current_readport, firmware); pcwd_private.io_addr, firmware);
kfree(firmware); kfree(firmware);
option_switches = get_option_switches(); option_switches = get_option_switches();
printk(KERN_INFO PFX "Option switches (0x%02x): Temperature Reset Enable=%s, Power On Delay=%s\n", printk(KERN_INFO PFX "Option switches (0x%02x): Temperature Reset Enable=%s, Power On Delay=%s\n",
...@@ -750,23 +752,23 @@ static int __devinit pcwatchdog_init(int base_addr) ...@@ -750,23 +752,23 @@ static int __devinit pcwatchdog_init(int base_addr)
} else { } else {
/* Should NEVER happen, unless get_revision() fails. */ /* Should NEVER happen, unless get_revision() fails. */
printk(KERN_INFO PFX "Unable to get revision\n"); printk(KERN_INFO PFX "Unable to get revision\n");
release_region(current_readport, (revision == PCWD_REVISION_A) ? 2 : 4); release_region(pcwd_private.io_addr, (pcwd_private.revision == PCWD_REVISION_A) ? 2 : 4);
current_readport = 0x0000; pcwd_private.io_addr = 0x0000;
return -1; return -1;
} }
if (supports_temp) if (pcwd_private.supports_temp)
printk(KERN_INFO PFX "Temperature Option Detected\n"); printk(KERN_INFO PFX "Temperature Option Detected\n");
if (initial_status & WDIOF_CARDRESET) if (pcwd_private.boot_status & WDIOF_CARDRESET)
printk(KERN_INFO PFX "Previous reboot was caused by the card\n"); printk(KERN_INFO PFX "Previous reboot was caused by the card\n");
if (initial_status & WDIOF_OVERHEAT) { if (pcwd_private.boot_status & WDIOF_OVERHEAT) {
printk(KERN_EMERG PFX "Card senses a CPU Overheat. Panicking!\n"); printk(KERN_EMERG PFX "Card senses a CPU Overheat. Panicking!\n");
printk(KERN_EMERG PFX "CPU Overheat\n"); printk(KERN_EMERG PFX "CPU Overheat\n");
} }
if (initial_status == 0) if (pcwd_private.boot_status == 0)
printk(KERN_INFO PFX "No previous trip detected - Cold boot or reset\n"); printk(KERN_INFO PFX "No previous trip detected - Cold boot or reset\n");
/* Check that the heartbeat value is within it's range ; if not reset to the default */ /* Check that the heartbeat value is within it's range ; if not reset to the default */
...@@ -780,19 +782,19 @@ static int __devinit pcwatchdog_init(int base_addr) ...@@ -780,19 +782,19 @@ static int __devinit pcwatchdog_init(int base_addr)
if (ret) { if (ret) {
printk(KERN_ERR PFX "cannot register reboot notifier (err=%d)\n", printk(KERN_ERR PFX "cannot register reboot notifier (err=%d)\n",
ret); ret);
release_region(current_readport, (revision == PCWD_REVISION_A) ? 2 : 4); release_region(pcwd_private.io_addr, (pcwd_private.revision == PCWD_REVISION_A) ? 2 : 4);
current_readport = 0x0000; pcwd_private.io_addr = 0x0000;
return ret; return ret;
} }
if (supports_temp) { if (pcwd_private.supports_temp) {
ret = misc_register(&temp_miscdev); ret = misc_register(&temp_miscdev);
if (ret) { if (ret) {
printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n", printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
TEMP_MINOR, ret); TEMP_MINOR, ret);
unregister_reboot_notifier(&pcwd_notifier); unregister_reboot_notifier(&pcwd_notifier);
release_region(current_readport, (revision == PCWD_REVISION_A) ? 2 : 4); release_region(pcwd_private.io_addr, (pcwd_private.revision == PCWD_REVISION_A) ? 2 : 4);
current_readport = 0x0000; pcwd_private.io_addr = 0x0000;
return ret; return ret;
} }
} }
...@@ -801,11 +803,11 @@ static int __devinit pcwatchdog_init(int base_addr) ...@@ -801,11 +803,11 @@ static int __devinit pcwatchdog_init(int base_addr)
if (ret) { if (ret) {
printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n", printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
WATCHDOG_MINOR, ret); WATCHDOG_MINOR, ret);
if (supports_temp) if (pcwd_private.supports_temp)
misc_deregister(&temp_miscdev); misc_deregister(&temp_miscdev);
unregister_reboot_notifier(&pcwd_notifier); unregister_reboot_notifier(&pcwd_notifier);
release_region(current_readport, (revision == PCWD_REVISION_A) ? 2 : 4); release_region(pcwd_private.io_addr, (pcwd_private.revision == PCWD_REVISION_A) ? 2 : 4);
current_readport = 0x0000; pcwd_private.io_addr = 0x0000;
return ret; return ret;
} }
...@@ -823,11 +825,11 @@ static void __devexit pcwatchdog_exit(void) ...@@ -823,11 +825,11 @@ static void __devexit pcwatchdog_exit(void)
/* Deregister */ /* Deregister */
misc_deregister(&pcwd_miscdev); misc_deregister(&pcwd_miscdev);
if (supports_temp) if (pcwd_private.supports_temp)
misc_deregister(&temp_miscdev); misc_deregister(&temp_miscdev);
unregister_reboot_notifier(&pcwd_notifier); unregister_reboot_notifier(&pcwd_notifier);
release_region(current_readport, (revision == PCWD_REVISION_A) ? 2 : 4); release_region(pcwd_private.io_addr, (pcwd_private.revision == PCWD_REVISION_A) ? 2 : 4);
current_readport = 0x0000; pcwd_private.io_addr = 0x0000;
cards_found--; cards_found--;
} }
...@@ -891,7 +893,7 @@ static int __init pcwd_init_module(void) ...@@ -891,7 +893,7 @@ static int __init pcwd_init_module(void)
{ {
int i, found = 0; int i, found = 0;
spin_lock_init(&io_lock); spin_lock_init(&pcwd_private.io_lock);
for (i = 0; pcwd_ioports[i] != 0; i++) { for (i = 0; pcwd_ioports[i] != 0; i++) {
if (pcwd_checkcard(pcwd_ioports[i])) { if (pcwd_checkcard(pcwd_ioports[i])) {
...@@ -910,7 +912,7 @@ static int __init pcwd_init_module(void) ...@@ -910,7 +912,7 @@ static int __init pcwd_init_module(void)
static void __exit pcwd_cleanup_module(void) static void __exit pcwd_cleanup_module(void)
{ {
if (current_readport) if (pcwd_private.io_addr)
pcwatchdog_exit(); pcwatchdog_exit();
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment