sync with upstream version
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
This commit is contained in:
35
compat.h
35
compat.h
@@ -9,16 +9,37 @@
|
|||||||
#ifndef COMPAT_H
|
#ifndef COMPAT_H
|
||||||
#define COMPAT_H
|
#define COMPAT_H
|
||||||
|
|
||||||
#ifndef kstrtol
|
#ifndef request_muxed_region
|
||||||
#define kstrtol strict_strtol
|
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 28)
|
||||||
|
#define request_muxed_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name))
|
||||||
|
#else
|
||||||
|
#define IORESOURCE_MUXED 0x00400000
|
||||||
|
#define request_muxed_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name), IORESOURCE_MUXED)
|
||||||
#endif
|
#endif
|
||||||
#ifndef kstrtoul
|
|
||||||
#define kstrtoul strict_strtoul
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef request_muxed_region
|
/* Red Hat EL5 includes backports of these functions, so we can't redefine
|
||||||
#define request_muxed_region(a, b, c) (true)
|
* our own. */
|
||||||
#define release_region(a, b)
|
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 24)
|
||||||
|
#if !(defined RHEL_MAJOR && RHEL_MAJOR == 5 && RHEL_MINOR >= 5)
|
||||||
|
static inline int strict_strtoul(const char *cp, unsigned int base,
|
||||||
|
unsigned long *res)
|
||||||
|
{
|
||||||
|
*res = simple_strtoul(cp, NULL, base);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int strict_strtol(const char *cp, unsigned int base, long *res)
|
||||||
|
{
|
||||||
|
*res = simple_strtol(cp, NULL, base);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39)
|
||||||
|
#define kstrtoul strict_strtoul
|
||||||
|
#define kstrtol strict_strtol
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* COMPAT_H */
|
#endif /* COMPAT_H */
|
||||||
|
60
it87.c
60
it87.c
@@ -59,39 +59,7 @@
|
|||||||
#include <linux/acpi.h>
|
#include <linux/acpi.h>
|
||||||
#include <linux/io.h>
|
#include <linux/io.h>
|
||||||
#include <linux/version.h>
|
#include <linux/version.h>
|
||||||
|
#include "compat.h"
|
||||||
#ifndef request_muxed_region
|
|
||||||
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 28)
|
|
||||||
#define request_muxed_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name))
|
|
||||||
#else
|
|
||||||
#define IORESOURCE_MUXED 0x00400000
|
|
||||||
#define request_muxed_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name), IORESOURCE_MUXED)
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Red Hat EL5 includes backports of these functions, so we can't redefine
|
|
||||||
* our own. */
|
|
||||||
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 24)
|
|
||||||
#if !(defined RHEL_MAJOR && RHEL_MAJOR == 5 && RHEL_MINOR >= 5)
|
|
||||||
static inline int strict_strtoul(const char *cp, unsigned int base,
|
|
||||||
unsigned long *res)
|
|
||||||
{
|
|
||||||
*res = simple_strtoul(cp, NULL, base);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int strict_strtol(const char *cp, unsigned int base, long *res)
|
|
||||||
{
|
|
||||||
*res = simple_strtol(cp, NULL, base);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39)
|
|
||||||
#define kstrtoul strict_strtoul
|
|
||||||
#define kstrtol strict_strtol
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define DRVNAME "it87"
|
#define DRVNAME "it87"
|
||||||
|
|
||||||
@@ -2087,12 +2055,12 @@ static int __devinit it87_probe(struct platform_device *pdev)
|
|||||||
continue;
|
continue;
|
||||||
err = sysfs_create_group(&dev->kobj, &it87_group_in[i]);
|
err = sysfs_create_group(&dev->kobj, &it87_group_in[i]);
|
||||||
if (err)
|
if (err)
|
||||||
goto ERROR4;
|
goto error;
|
||||||
if (sio_data->beep_pin && it87_attributes_in_beep[i]) {
|
if (sio_data->beep_pin && it87_attributes_in_beep[i]) {
|
||||||
err = sysfs_create_file(&dev->kobj,
|
err = sysfs_create_file(&dev->kobj,
|
||||||
it87_attributes_in_beep[i]);
|
it87_attributes_in_beep[i]);
|
||||||
if (err)
|
if (err)
|
||||||
goto ERROR4;
|
goto error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2101,12 +2069,12 @@ static int __devinit it87_probe(struct platform_device *pdev)
|
|||||||
continue;
|
continue;
|
||||||
err = sysfs_create_group(&dev->kobj, &it87_group_temp[i]);
|
err = sysfs_create_group(&dev->kobj, &it87_group_temp[i]);
|
||||||
if (err)
|
if (err)
|
||||||
goto ERROR4;
|
goto error;
|
||||||
if (sio_data->beep_pin) {
|
if (sio_data->beep_pin) {
|
||||||
err = sysfs_create_file(&dev->kobj,
|
err = sysfs_create_file(&dev->kobj,
|
||||||
it87_attributes_temp_beep[i]);
|
it87_attributes_temp_beep[i]);
|
||||||
if (err)
|
if (err)
|
||||||
goto ERROR4;
|
goto error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2118,13 +2086,13 @@ static int __devinit it87_probe(struct platform_device *pdev)
|
|||||||
continue;
|
continue;
|
||||||
err = sysfs_create_group(&dev->kobj, &fan_group[i]);
|
err = sysfs_create_group(&dev->kobj, &fan_group[i]);
|
||||||
if (err)
|
if (err)
|
||||||
goto ERROR4;
|
goto error;
|
||||||
|
|
||||||
if (sio_data->beep_pin) {
|
if (sio_data->beep_pin) {
|
||||||
err = sysfs_create_file(&dev->kobj,
|
err = sysfs_create_file(&dev->kobj,
|
||||||
it87_attributes_fan_beep[i]);
|
it87_attributes_fan_beep[i]);
|
||||||
if (err)
|
if (err)
|
||||||
goto ERROR4;
|
goto error;
|
||||||
if (!fan_beep_need_rw)
|
if (!fan_beep_need_rw)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -2149,14 +2117,14 @@ static int __devinit it87_probe(struct platform_device *pdev)
|
|||||||
err = sysfs_create_group(&dev->kobj,
|
err = sysfs_create_group(&dev->kobj,
|
||||||
&it87_group_pwm[i]);
|
&it87_group_pwm[i]);
|
||||||
if (err)
|
if (err)
|
||||||
goto ERROR4;
|
goto error;
|
||||||
|
|
||||||
if (!has_old_autopwm(data))
|
if (!has_old_autopwm(data))
|
||||||
continue;
|
continue;
|
||||||
err = sysfs_create_group(&dev->kobj,
|
err = sysfs_create_group(&dev->kobj,
|
||||||
&it87_group_autopwm[i]);
|
&it87_group_autopwm[i]);
|
||||||
if (err)
|
if (err)
|
||||||
goto ERROR4;
|
goto error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2166,7 +2134,7 @@ static int __devinit it87_probe(struct platform_device *pdev)
|
|||||||
data->vid = sio_data->vid_value;
|
data->vid = sio_data->vid_value;
|
||||||
err = sysfs_create_group(&dev->kobj, &it87_group_vid);
|
err = sysfs_create_group(&dev->kobj, &it87_group_vid);
|
||||||
if (err)
|
if (err)
|
||||||
goto ERROR4;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Export labels for internal sensors */
|
/* Export labels for internal sensors */
|
||||||
@@ -2176,18 +2144,18 @@ static int __devinit it87_probe(struct platform_device *pdev)
|
|||||||
err = sysfs_create_file(&dev->kobj,
|
err = sysfs_create_file(&dev->kobj,
|
||||||
it87_attributes_label[i]);
|
it87_attributes_label[i]);
|
||||||
if (err)
|
if (err)
|
||||||
goto ERROR4;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
data->hwmon_dev = hwmon_device_register(dev);
|
data->hwmon_dev = hwmon_device_register(dev);
|
||||||
if (IS_ERR(data->hwmon_dev)) {
|
if (IS_ERR(data->hwmon_dev)) {
|
||||||
err = PTR_ERR(data->hwmon_dev);
|
err = PTR_ERR(data->hwmon_dev);
|
||||||
goto ERROR4;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
ERROR4:
|
error:
|
||||||
it87_remove_files(dev);
|
it87_remove_files(dev);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
@@ -2375,7 +2343,7 @@ static void __devinit it87_init_device(struct platform_device *pdev)
|
|||||||
|
|
||||||
/* Start monitoring */
|
/* Start monitoring */
|
||||||
it87_write_value(data, IT87_REG_CONFIG,
|
it87_write_value(data, IT87_REG_CONFIG,
|
||||||
(it87_read_value(data, IT87_REG_CONFIG) & 0x36)
|
(it87_read_value(data, IT87_REG_CONFIG) & 0x3e)
|
||||||
| (update_vbat ? 0x41 : 0x01));
|
| (update_vbat ? 0x41 : 0x01));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user