Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 243380
b: refs/heads/master
c: 90d241e
h: refs/heads/master
v: v3
  • Loading branch information
Yinghai Lu authored and Wim Van Sebroeck committed Mar 29, 2011
1 parent cbd88c5 commit 0c72595
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f712eacf02ecfbf4f1686addb8c569841549b0b7
refs/heads/master: 90d241edd13bdeef70f264b569f7e150bf23621e
16 changes: 14 additions & 2 deletions trunk/drivers/watchdog/sp5100_tco.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#define PFX TCO_MODULE_NAME ": "

/* internal variables */
static u32 tcobase_phys;
static void __iomem *tcobase;
static unsigned int pm_iobase;
static DEFINE_SPINLOCK(tco_lock); /* Guards the hardware */
Expand Down Expand Up @@ -305,10 +306,18 @@ static unsigned char __devinit sp5100_tco_setupdevice(void)
/* Low three bits of BASE0 are reserved. */
val = val << 8 | (inb(SP5100_IO_PM_DATA_REG) & 0xf8);

if (!request_mem_region_exclusive(val, SP5100_WDT_MEM_MAP_SIZE,
"SP5100 TCO")) {
printk(KERN_ERR PFX "mmio address 0x%04x already in use\n",
val);
goto unreg_region;
}
tcobase_phys = val;

tcobase = ioremap(val, SP5100_WDT_MEM_MAP_SIZE);
if (tcobase == 0) {
printk(KERN_ERR PFX "failed to get tcobase address\n");
goto unreg_region;
goto unreg_mem_region;
}

/* Enable watchdog decode bit */
Expand Down Expand Up @@ -346,7 +355,8 @@ static unsigned char __devinit sp5100_tco_setupdevice(void)
/* Done */
return 1;

iounmap(tcobase);
unreg_mem_region:
release_mem_region(tcobase_phys, SP5100_WDT_MEM_MAP_SIZE);
unreg_region:
release_region(pm_iobase, SP5100_PM_IOPORTS_SIZE);
exit:
Expand Down Expand Up @@ -401,6 +411,7 @@ static int __devinit sp5100_tco_init(struct platform_device *dev)

exit:
iounmap(tcobase);
release_mem_region(tcobase_phys, SP5100_WDT_MEM_MAP_SIZE);
release_region(pm_iobase, SP5100_PM_IOPORTS_SIZE);
return ret;
}
Expand All @@ -414,6 +425,7 @@ static void __devexit sp5100_tco_cleanup(void)
/* Deregister */
misc_deregister(&sp5100_tco_miscdev);
iounmap(tcobase);
release_mem_region(tcobase_phys, SP5100_WDT_MEM_MAP_SIZE);
release_region(pm_iobase, SP5100_PM_IOPORTS_SIZE);
}

Expand Down

0 comments on commit 0c72595

Please sign in to comment.