fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / drivers / char / watchdog / ixp4xx_wdt.c
index 7949365..5864bb8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * drivers/watchdog/ixp4xx_wdt.c
+ * drivers/char/watchdog/ixp4xx_wdt.c
  *
  * Watchdog driver for Intel IXP4xx network processors
  *
@@ -13,7 +13,6 @@
  * warranty of any kind, whether express or implied.
  */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/moduleparam.h>
 #include <linux/types.h>
 #include <linux/miscdevice.h>
 #include <linux/watchdog.h>
 #include <linux/init.h>
+#include <linux/bitops.h>
 
 #include <asm/hardware.h>
-#include <asm/bitops.h>
 #include <asm/uaccess.h>
 
-#ifdef CONFIG_WATCHDOG_NOWAYOUT
-static int nowayout = 1;
-#else
-static int nowayout = 0;
-#endif
+static int nowayout = WATCHDOG_NOWAYOUT;
 static int heartbeat = 60;     /* (secs) Default is 1 minute */
 static unsigned long wdt_status;
 static unsigned long boot_status;
@@ -69,16 +64,12 @@ ixp4xx_wdt_open(struct inode *inode, struct file *file)
 
        wdt_enable();
 
-       return 0;
+       return nonseekable_open(inode, file);
 }
 
 static ssize_t
 ixp4xx_wdt_write(struct file *file, const char *data, size_t len, loff_t *ppos)
 {
-       /* Can't seek (pwrite) on this device  */
-       if (ppos != &file->f_pos)
-               return -ESPIPE;
-
        if (len) {
                if (!nowayout) {
                        size_t i;
@@ -111,7 +102,7 @@ static int
 ixp4xx_wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
                        unsigned long arg)
 {
-       int ret = -ENOIOCTLCMD;
+       int ret = -ENOTTY;
        int time;
 
        switch (cmd) {
@@ -160,7 +151,7 @@ ixp4xx_wdt_release(struct inode *inode, struct file *file)
        if (test_bit(WDT_OK_TO_CLOSE, &wdt_status)) {
                wdt_disable();
        } else {
-               printk(KERN_CRIT "WATCHDOG: Device closed unexpectdly - "
+               printk(KERN_CRIT "WATCHDOG: Device closed unexpectedly - "
                                        "timer will not stop\n");
        }
 
@@ -171,9 +162,10 @@ ixp4xx_wdt_release(struct inode *inode, struct file *file)
 }
 
 
-static struct file_operations ixp4xx_wdt_fops =
+static const struct file_operations ixp4xx_wdt_fops =
 {
        .owner          = THIS_MODULE,
+       .llseek         = no_llseek,
        .write          = ixp4xx_wdt_write,
        .ioctl          = ixp4xx_wdt_ioctl,
        .open           = ixp4xx_wdt_open,
@@ -183,7 +175,7 @@ static struct file_operations ixp4xx_wdt_fops =
 static struct miscdevice ixp4xx_wdt_miscdev =
 {
        .minor          = WATCHDOG_MINOR,
-       .name           = "IXP4xx Watchdog",
+       .name           = "watchdog",
        .fops           = &ixp4xx_wdt_fops,
 };
 
@@ -193,8 +185,8 @@ static int __init ixp4xx_wdt_init(void)
        unsigned long processor_id;
 
        asm("mrc p15, 0, %0, cr0, cr0, 0;" : "=r"(processor_id) :);
-       if (!(processor_id & 0xf)) {
-               printk("IXP4XXX Watchdog: Rev. A0 CPU detected - "
+       if (!(processor_id & 0xf) && !cpu_is_ixp46x()) {
+               printk("IXP4XXX Watchdog: Rev. A0 IXP42x CPU detected - "
                        "watchdog disabled\n");
 
                return -ENODEV;
@@ -219,7 +211,7 @@ static void __exit ixp4xx_wdt_exit(void)
 module_init(ixp4xx_wdt_init);
 module_exit(ixp4xx_wdt_exit);
 
-MODULE_AUTHOR("Deepak Saxena <dsaxena@plexity.net">);
+MODULE_AUTHOR("Deepak Saxena <dsaxena@plexity.net>");
 MODULE_DESCRIPTION("IXP4xx Network Processor Watchdog");
 
 module_param(heartbeat, int, 0);