diff options
author | Stephen Rothwell <sfr@canb.auug.org.au> | 2010-07-30 12:15:08 +1000 |
---|---|---|
committer | Stephen Rothwell <sfr@canb.auug.org.au> | 2010-07-30 12:15:08 +1000 |
commit | 60524731f28e6138caf1aceb82734c2659aa14a5 (patch) | |
tree | 8dc7f227a96f6a1d06031de0c98cb8aee82acb5c | |
parent | aec2cd69f3a40343bae88fedbb0aa19ce30f4d35 (diff) | |
parent | c6ebacc1eb165bd636fac860cb78c6c633285b7b (diff) |
Merge remote branch 'watchdog/master'
-rw-r--r-- | drivers/watchdog/hpwdt.c | 20 | ||||
-rw-r--r-- | drivers/watchdog/s3c2410_wdt.c | 17 | ||||
-rw-r--r-- | drivers/watchdog/sch311x_wdt.c | 4 | ||||
-rw-r--r-- | drivers/watchdog/wdt_pci.c | 15 | ||||
-rw-r--r-- | include/linux/pci_ids.h | 3 |
5 files changed, 31 insertions, 28 deletions
diff --git a/drivers/watchdog/hpwdt.c b/drivers/watchdog/hpwdt.c index 809e7167a624..dbe650e6537d 100644 --- a/drivers/watchdog/hpwdt.c +++ b/drivers/watchdog/hpwdt.c @@ -49,6 +49,10 @@ #define ROM_SIZE 0x10000 #define HPWDT_VERSION "1.1.1" +#define SECS_TO_TICKS(secs) ((secs) * 1000 / 128) +#define TICKS_TO_SECS(ticks) ((ticks) * 128 / 1000) +#define HPWDT_MAX_TIMER TICKS_TO_SECS(65535) + struct bios32_service_dir { u32 signature; u32 entry_point; @@ -420,7 +424,7 @@ static int __devinit detect_cru_service(void) */ static void hpwdt_start(void) { - reload = (soft_margin * 1000) / 128; + reload = SECS_TO_TICKS(soft_margin); iowrite16(reload, hpwdt_timer_reg); iowrite16(0x85, hpwdt_timer_con); } @@ -439,10 +443,14 @@ static void hpwdt_ping(void) iowrite16(reload, hpwdt_timer_reg); } +static int hpwdt_time_left(void) +{ + return TICKS_TO_SECS(ioread16(hpwdt_timer_reg)); +} + static int hpwdt_change_timer(int new_margin) { - /* Arbitrary, can't find the card's limits */ - if (new_margin < 5 || new_margin > 600) { + if (new_margin < 1 || new_margin > HPWDT_MAX_TIMER) { printk(KERN_WARNING "hpwdt: New value passed in is invalid: %d seconds.\n", new_margin); @@ -453,7 +461,7 @@ static int hpwdt_change_timer(int new_margin) printk(KERN_DEBUG "hpwdt: New timer passed in is %d seconds.\n", new_margin); - reload = (soft_margin * 1000) / 128; + reload = SECS_TO_TICKS(soft_margin); return 0; } @@ -580,6 +588,10 @@ static long hpwdt_ioctl(struct file *file, unsigned int cmd, ret = put_user(0, p); break; + case WDIOC_GETTIMELEFT: + ret = put_user(hpwdt_time_left(), p); + break; + case WDIOC_KEEPALIVE: hpwdt_ping(); ret = 0; diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c index 300932580ded..ae53662c29bc 100644 --- a/drivers/watchdog/s3c2410_wdt.c +++ b/drivers/watchdog/s3c2410_wdt.c @@ -532,21 +532,22 @@ static int __devinit s3c2410wdt_probe(struct platform_device *pdev) static int __devexit s3c2410wdt_remove(struct platform_device *dev) { - s3c2410wdt_cpufreq_deregister(); - - release_resource(wdt_mem); - kfree(wdt_mem); - wdt_mem = NULL; + misc_deregister(&s3c2410wdt_miscdev); - free_irq(wdt_irq->start, dev); - wdt_irq = NULL; + s3c2410wdt_cpufreq_deregister(); clk_disable(wdt_clock); clk_put(wdt_clock); wdt_clock = NULL; + free_irq(wdt_irq->start, dev); + wdt_irq = NULL; + iounmap(wdt_base); - misc_deregister(&s3c2410wdt_miscdev); + + release_resource(wdt_mem); + kfree(wdt_mem); + wdt_mem = NULL; return 0; } diff --git a/drivers/watchdog/sch311x_wdt.c b/drivers/watchdog/sch311x_wdt.c index 9c40f48804f5..0461858e07d0 100644 --- a/drivers/watchdog/sch311x_wdt.c +++ b/drivers/watchdog/sch311x_wdt.c @@ -425,6 +425,8 @@ static int __devinit sch311x_wdt_probe(struct platform_device *pdev) val = therm_trip ? 0x06 : 0x04; outb(val, sch311x_wdt_data.runtime_reg + RESGEN); + sch311x_wdt_miscdev.parent = dev; + err = misc_register(&sch311x_wdt_miscdev); if (err != 0) { dev_err(dev, "cannot register miscdev on minor=%d (err=%d)\n", @@ -432,8 +434,6 @@ static int __devinit sch311x_wdt_probe(struct platform_device *pdev) goto exit_release_region3; } - sch311x_wdt_miscdev.parent = dev; - dev_info(dev, "SMSC SCH311x WDT initialized. timeout=%d sec (nowayout=%d)\n", timeout, nowayout); diff --git a/drivers/watchdog/wdt_pci.c b/drivers/watchdog/wdt_pci.c index 7b22e3cdbc81..6130c88fa5ac 100644 --- a/drivers/watchdog/wdt_pci.c +++ b/drivers/watchdog/wdt_pci.c @@ -60,19 +60,6 @@ #define PFX "wdt_pci: " -/* - * Until Access I/O gets their application for a PCI vendor ID approved, - * I don't think that it's appropriate to move these constants into the - * regular pci_ids.h file. -- JPN 2000/01/18 - */ - -#ifndef PCI_VENDOR_ID_ACCESSIO -#define PCI_VENDOR_ID_ACCESSIO 0x494f -#endif -#ifndef PCI_DEVICE_ID_WDG_CSM -#define PCI_DEVICE_ID_WDG_CSM 0x22c0 -#endif - /* We can only use 1 card due to the /dev/watchdog restriction */ static int dev_count; @@ -743,7 +730,7 @@ static void __devexit wdtpci_remove_one(struct pci_dev *pdev) static struct pci_device_id wdtpci_pci_tbl[] = { { .vendor = PCI_VENDOR_ID_ACCESSIO, - .device = PCI_DEVICE_ID_WDG_CSM, + .device = PCI_DEVICE_ID_ACCESSIO_WDG_CSM, .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, }, diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 3bedcc149c84..55fd4ebfa0f8 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h @@ -2369,6 +2369,9 @@ #define PCI_VENDOR_ID_AKS 0x416c #define PCI_DEVICE_ID_AKS_ALADDINCARD 0x0100 +#define PCI_VENDOR_ID_ACCESSIO 0x494f +#define PCI_DEVICE_ID_ACCESSIO_WDG_CSM 0x22c0 + #define PCI_VENDOR_ID_S3 0x5333 #define PCI_DEVICE_ID_S3_TRIO 0x8811 #define PCI_DEVICE_ID_S3_868 0x8880 |