fschmd.c (b65b34895437915f411882dd40d704eb0863ffb0) fschmd.c (55929332c92e5d34d65a8f784604c92677ea3e15)
1/* fschmd.c
2 *
3 * Copyright (C) 2007 - 2009 Hans de Goede <hdegoede@redhat.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.

--- 24 unchanged lines hidden (view full) ---

33
34#include <linux/module.h>
35#include <linux/init.h>
36#include <linux/slab.h>
37#include <linux/jiffies.h>
38#include <linux/i2c.h>
39#include <linux/hwmon.h>
40#include <linux/hwmon-sysfs.h>
1/* fschmd.c
2 *
3 * Copyright (C) 2007 - 2009 Hans de Goede <hdegoede@redhat.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.

--- 24 unchanged lines hidden (view full) ---

33
34#include <linux/module.h>
35#include <linux/init.h>
36#include <linux/slab.h>
37#include <linux/jiffies.h>
38#include <linux/i2c.h>
39#include <linux/hwmon.h>
40#include <linux/hwmon-sysfs.h>
41#include <linux/smp_lock.h>
41#include <linux/err.h>
42#include <linux/mutex.h>
43#include <linux/sysfs.h>
44#include <linux/dmi.h>
45#include <linux/fs.h>
46#include <linux/watchdog.h>
47#include <linux/miscdevice.h>
48#include <linux/uaccess.h>

--- 793 unchanged lines hidden (view full) ---

842 }
843 ret = watchdog_trigger(data);
844 if (ret < 0)
845 return ret;
846 }
847 return count;
848}
849
42#include <linux/err.h>
43#include <linux/mutex.h>
44#include <linux/sysfs.h>
45#include <linux/dmi.h>
46#include <linux/fs.h>
47#include <linux/watchdog.h>
48#include <linux/miscdevice.h>
49#include <linux/uaccess.h>

--- 793 unchanged lines hidden (view full) ---

843 }
844 ret = watchdog_trigger(data);
845 if (ret < 0)
846 return ret;
847 }
848 return count;
849}
850
850static int watchdog_ioctl(struct inode *inode, struct file *filp,
851 unsigned int cmd, unsigned long arg)
851static long watchdog_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
852{
853 static struct watchdog_info ident = {
854 .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT |
855 WDIOF_CARDRESET,
856 .identity = "FSC watchdog"
857 };
858 int i, ret = 0;
859 struct fschmd_data *data = filp->private_data;
860
852{
853 static struct watchdog_info ident = {
854 .options = WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT |
855 WDIOF_CARDRESET,
856 .identity = "FSC watchdog"
857 };
858 int i, ret = 0;
859 struct fschmd_data *data = filp->private_data;
860
861 lock_kernel();
861 switch (cmd) {
862 case WDIOC_GETSUPPORT:
863 ident.firmware_version = data->revision;
864 if (!nowayout)
865 ident.options |= WDIOF_MAGICCLOSE;
866 if (copy_to_user((void __user *)arg, &ident, sizeof(ident)))
867 ret = -EFAULT;
868 break;

--- 40 unchanged lines hidden (view full) ---

909 ret = watchdog_trigger(data);
910 else
911 ret = -EINVAL;
912
913 break;
914 default:
915 ret = -ENOTTY;
916 }
862 switch (cmd) {
863 case WDIOC_GETSUPPORT:
864 ident.firmware_version = data->revision;
865 if (!nowayout)
866 ident.options |= WDIOF_MAGICCLOSE;
867 if (copy_to_user((void __user *)arg, &ident, sizeof(ident)))
868 ret = -EFAULT;
869 break;

--- 40 unchanged lines hidden (view full) ---

910 ret = watchdog_trigger(data);
911 else
912 ret = -EINVAL;
913
914 break;
915 default:
916 ret = -ENOTTY;
917 }
917
918 unlock_kernel();
918 return ret;
919}
920
921static const struct file_operations watchdog_fops = {
922 .owner = THIS_MODULE,
923 .llseek = no_llseek,
924 .open = watchdog_open,
925 .release = watchdog_release,
926 .write = watchdog_write,
919 return ret;
920}
921
922static const struct file_operations watchdog_fops = {
923 .owner = THIS_MODULE,
924 .llseek = no_llseek,
925 .open = watchdog_open,
926 .release = watchdog_release,
927 .write = watchdog_write,
927 .ioctl = watchdog_ioctl,
928 .unlocked_ioctl = watchdog_ioctl,
928};
929
930
931/*
932 * Detect, register, unregister and update device functions
933 */
934
935/* DMI decode routine to read voltage scaling factors from special DMI tables,

--- 400 unchanged lines hidden ---
929};
930
931
932/*
933 * Detect, register, unregister and update device functions
934 */
935
936/* DMI decode routine to read voltage scaling factors from special DMI tables,

--- 400 unchanged lines hidden ---