SOURCES (LINUX_2_6): linux-2.6-vt1211-sensor.patch - updated to 2....
pluto
pluto at pld-linux.org
Thu Nov 3 01:07:08 CET 2005
Author: pluto Date: Thu Nov 3 00:07:08 2005 GMT
Module: SOURCES Tag: LINUX_2_6
---- Log message:
- updated to 2.6.14-rc1.
---- Files affected:
SOURCES:
linux-2.6-vt1211-sensor.patch (1.1.2.3 -> 1.1.2.4)
---- Diffs:
================================================================
Index: SOURCES/linux-2.6-vt1211-sensor.patch
diff -u SOURCES/linux-2.6-vt1211-sensor.patch:1.1.2.3 SOURCES/linux-2.6-vt1211-sensor.patch:1.1.2.4
--- SOURCES/linux-2.6-vt1211-sensor.patch:1.1.2.3 Fri Sep 2 15:02:26 2005
+++ SOURCES/linux-2.6-vt1211-sensor.patch Thu Nov 3 01:07:02 2005
@@ -1,38 +1,41 @@
-diff -rNu linux-2.6.11.org/drivers/i2c/chips/Kconfig linux-2.6.11/drivers/i2c/chips/Kconfig
---- linux-2.6.11.org/drivers/i2c/chips/Kconfig 2005-03-02 08:38:10.000000000 +0100
-+++ linux-2.6.11/drivers/i2c/chips/Kconfig 2005-03-06 12:39:21.883534592 +0100
-@@ -276,4 +276,16 @@
+diff -Naur linux-2.6.14-rc1.org/drivers/hwmon/Kconfig linux-2.6.14-rc1/drivers/hwmon/Kconfig
+--- linux-2.6.14-rc1.org/drivers/hwmon/Kconfig 2005-09-25 09:00:26.000000000 +0200
++++ linux-2.6.14-rc1/drivers/hwmon/Kconfig 2005-09-25 09:27:45.000000000 +0200
+@@ -350,6 +350,19 @@
This driver can also be built as a module. If so, the module
- will be called max6875.
+ will be called via686a.
+config SENSORS_VT1211
-+ tristate "Via VT1211 SuperIO and HW monitoring chip"
-+ depends on I2C && EXPERIMENTAL && X86 && !64BIT
-+ select I2C_SENSOR
++ tristate "Via VT1211"
++ depends on HWMON && I2C && EXPERIMENTAL
++ select I2C_ISA
++ select HWMON_VID
+ help
-+ If you say yes here you get read-only access to all the sensors
++ If you say yes here you get access to all the sensors
+ accessible via the VT1211 HW monitoring chip (temperature, fan speed,
-+ voltage etc.)
++ voltage etc.). This chip is used on many VIA Mini-ITX boards.
+
+ This driver can also be built as a module. If so, the module
+ will be called vt1211.
+
- endmenu
-diff -rNu linux-2.6.11.org/drivers/i2c/chips/Makefile linux-2.6.11/drivers/i2c/chips/Makefile
---- linux-2.6.11.org/drivers/i2c/chips/Makefile 2005-03-02 08:38:34.000000000 +0100
-+++ linux-2.6.11/drivers/i2c/chips/Makefile 2005-03-06 12:39:21.884534436 +0100
-@@ -11,6 +11,7 @@
- obj-$(CONFIG_SENSORS_PCF8574) += pcf8574.o
- obj-$(CONFIG_SENSORS_PCF8591) += pcf8591.o
- obj-$(CONFIG_SENSORS_RTC8564) += rtc8564.o
+ config SENSORS_W83781D
+ tristate "Winbond W83781D, W83782D, W83783S, W83627HF, Asus AS99127F"
+ depends on HWMON && I2C
+diff -Naur linux-2.6.14-rc1.org/drivers/hwmon/Makefile linux-2.6.14-rc1/drivers/hwmon/Makefile
+--- linux-2.6.14-rc1.org/drivers/hwmon/Makefile 2005-09-25 09:00:26.000000000 +0200
++++ linux-2.6.14-rc1/drivers/hwmon/Makefile 2005-09-25 09:13:15.000000000 +0200
+@@ -40,6 +40,7 @@
+ obj-$(CONFIG_SENSORS_SMSC47B397)+= smsc47b397.o
+ obj-$(CONFIG_SENSORS_SMSC47M1) += smsc47m1.o
+ obj-$(CONFIG_SENSORS_VIA686A) += via686a.o
+obj-$(CONFIG_SENSORS_VT1211) += vt1211.o
- obj-$(CONFIG_ISP1301_OMAP) += isp1301_omap.o
- obj-$(CONFIG_TPS65010) += tps65010.o
+ obj-$(CONFIG_SENSORS_W83627EHF) += w83627ehf.o
+ obj-$(CONFIG_SENSORS_W83L785TS) += w83l785ts.o
-diff -rNu linux-2.6.11.org/drivers/i2c/chips/vt1211.c linux-2.6.11/drivers/i2c/chips/vt1211.c
---- linux-2.6.11.org/drivers/i2c/chips/vt1211.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.11/drivers/i2c/chips/vt1211.c 2005-03-06 12:39:21.886534123 +0100
-@@ -0,0 +1,1185 @@
+diff -Naur linux-2.6.14-rc1.org/drivers/hwmon/vt1211.c linux-2.6.14-rc1/drivers/hwmon/vt1211.c
+--- linux-2.6.14-rc1.org/drivers/hwmon/vt1211.c 1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.14-rc1/drivers/hwmon/vt1211.c 2005-09-25 09:13:15.000000000 +0200
+@@ -0,0 +1,1018 @@
+/*
+ vt1211.c - Part of lm_sensors, Linux kernel modules
+ for hardware monitoring
@@ -57,11 +60,25 @@
+
+ Adapted to Linux 2.6 kernel by Lars Ekman <emil71se at yahoo.com>
+
-+ Updates:
-+ Sun Sep 26 09:14:36 CEST 2004 -
-+ Register conversion optional (disabled by default)
++ Updates (latest first):
++
++ Sun Sep 25 08:55:00 CEST 2005 -
++ Update for 2.6.14-rc1. New i2c handling.
++ Sun Sep 4 08:18:59 CEST 2005 -
++ Update for 2.6.13; new device_attribute added in sys-file init.
++ Sat Mar 19 11:23:36 CET 2005 -
++ Preparations for official release;
++ - Remove all the #ifdef stuff (ALL_SENSORS and no convertion
++ is now default).
++ - Remove normal_xxx_range defines which cause compile warnings.
++ - Remove uch_config initialization in vt1211_init_client
++ (trust the BIOS initialization instead, or use setting in
++ sensors.conf)
+ Tue Oct 5 17:17:01 CEST 2004 -
+ Corrected faulty return value in "show_temp_hyst()".
++ Sun Sep 26 09:14:36 CEST 2004 -
++ Register conversion optional (disabled by default)
++
+*/
+
+/* Supports VIA VT1211 Super I/O sensors via ISA (LPC) accesses only. */
@@ -70,22 +87,13 @@
+#include <linux/init.h>
+#include <linux/slab.h>
+#include <linux/i2c.h>
-+#include <linux/i2c-sensor.h>
-+#include <linux/i2c-vid.h>
++#include <linux/i2c-isa.h>
++#include <linux/hwmon.h>
++#include <linux/hwmon-vid.h>
++#include <linux/err.h>
+#include <asm/io.h>
+
+/*
-+ My first version of this port converted register values to usable
-+ units (milli-volt, milli-degree). This was due to a
-+ missinterpretation of the "Documentation/i2c/sysfs-interface" by me
-+ (L Ekman). The conversion of registers are now optional. It is kept
-+ for compatibility but and should not be used. Defining the
-+ DO_CONVERT macro re-enables the register conversions
-+
-+#define DO_CONVERT
-+ */
-+
-+/*
+ Even if the register values are not converted to uasable units in
+ the driver, the values should still be multiplied with some
+ factor. This factor seems to be 10 for 2.4 versions and 1000 now for
@@ -98,14 +106,6 @@
+#define TEMP_MULTIPLIER 1000
+#define IN_MULTIPLIER 10 /* Or what? */
+
-+/*
-+ If ALL_SENSORS is defined code (and /sys files) for all sensors in
-+ the original vt1211.c are included. If ALL_SENSORS is un-defined only
-+ the ones which seems to be "known" in the example "/etc/sensors.conf"
-+ are included.
-+
-+#define ALL_SENSORS
-+*/
+
+static int force_addr = 0;
+MODULE_PARM(force_addr, "i");
@@ -113,11 +113,9 @@
+ "Initialize the base address of the sensors");
+
+static unsigned short normal_i2c[] = { I2C_CLIENT_END };
-+static unsigned short normal_i2c_range[] = { I2C_CLIENT_END };
-+static unsigned int normal_isa[] = { 0x0000, I2C_CLIENT_ISA_END };
-+static unsigned int normal_isa_range[] = { I2C_CLIENT_ISA_END };
++static int isa_address = 0;
+
-+SENSORS_INSMOD_1(vt1211);
++I2C_CLIENT_INSMOD_1(vt1211);
+
+/* modified from kernel/include/traps.c */
+#define REG 0x2e /* The register to read/write */
@@ -228,12 +226,6 @@
+#define PWM_FROM_REG(val) (val)
+#define PWM_TO_REG(val) SENSORS_LIMIT((val), 0, 255)
+
-+
-+#ifndef DO_CONVERT
-+/*
-+ These macros does NOT try to convert the register values to
-+ milli-degree Celsius.
-+ */
+#define TEMP3_FROM_REG(val) ((val)*TEMP3_MULTIPLIER)
+#define TEMP3_FROM_REG10(val) (((val)*TEMP3_MULTIPLIER)/4)
+#define TEMP3_TO_REG(val) (SENSORS_LIMIT(((val)<0? \
@@ -244,120 +236,6 @@
+#define TEMP_TO_REG(val) (SENSORS_LIMIT(((val)<0? \
+ (((val)-(TEMP_MULTIPLIER/2))/TEMP_MULTIPLIER):\
+ ((val)+(TEMP_MULTIPLIER/2))/TEMP_MULTIPLIER),0,255))
-+#else
-+/*
-+ These macros tries to convert the register values to milli-degree
-+ Celsius. This does not work for all boards, so it should generally
-+ be avoided.
-+
-+
-+ "temp3" is the the CPU temp.
-+ From the example "etc/sensors.conf" for vt1211;
-+
-+ compute temp3 (@ - 65) / 0.9686, (@ * 0.9686) + 65
-+
-+ The 10 bits seems to be fixed point 8.2 bit. Which gives this
-+ formula for "temp3" (val in millidegree Celcius);
-+
-+ val = 1000 * (reg - (65*4)) / 4 / 0.9686 =>
-+ val = 258 * (reg - 260)
-+
-+ or for 8 bit registers;
-+
-+ val = 1032 * (reg - 65)
-+
-+ (BTW: 67596 = 65.5 * 1032)
-+ */
-+#define TEMP3_FROM_REG10(val) (258 * ((int)val - 260))
-+#define TEMP3_FROM_REG(val) (1032 * ((int)val - 65))
-+#define TEMP3_TO_REG(val) (SENSORS_LIMIT(((val + 67596) / 1032),0,255))
-+
-+/*
-+ Others temeratures than "temp3" are thermistor values.
-+ This should be a FP computation including a ln(x) operation
-+ which is be implemented as a lookup table (see "via686a.c").
-+
-+ Here is the formula from "/etc/sensors.conf" ('`' is the ln(x));
-+
-+ (1 / (((1 / 3435) * (` ((253 - @) / (@ - 43)))) + (1 / 298.15))) - 273.15
-+
-+ Based on this a table is computed. The values are in 1/100 degrees
-+ Celsius. Values <44 and >253 gives invalid values in the ln(x).
-+
-+ The "via686a.c" seems much more sophisticated and scientific. I
-+ don't know why. This is just a table from the formula above. Here
-+ is the computation loop;
-+
-+ for (i = 44; i < 253; i++) {
-+ double reg = (double)i;
-+ double temp;
-+ int itemp;
-+ temp = 1 / (
-+ ((1.0/3435.0) * log((253.0 - reg)/(reg-43.0)))
-+ + (1.0 / 298.15)
-+ ) - 273.15;
-+ itemp = temp*100;
-+ table[i] = itemp;
-+ }
-+
-+*/
-+short int const reg2temp[256] = {
-+ /* 0*/ -9999, -9999, -9999, -9999, -9999, -9999, -9999, -9999, -9999, -9999,
-+ /* 10*/ -9999, -9999, -9999, -9999, -9999, -9999, -9999, -9999, -9999, -9999,
-+ /* 20*/ -9999, -9999, -9999, -9999, -9999, -9999, -9999, -9999, -9999, -9999,
-+ /* 30*/ -9999, -9999, -9999, -9999, -9999, -9999, -9999, -9999, -9999, -9999,
-+ /* 40*/ -9999, -9999, -9999, -9999, -6945, -6065, -5512, -5100, -4767, -4487,
-+ /* 50*/ -4243, -4026, -3831, -3652, -3488, -3334, -3191, -3056, -2929, -2807,
-+ /* 60*/ -2692, -2581, -2475, -2373, -2275, -2180, -2088, -1999, -1912, -1828,
-+ /* 70*/ -1746, -1666, -1588, -1512, -1438, -1365, -1293, -1223, -1154, -1086,
-+ /* 80*/ -1020, -954, -890, -826, -764, -702, -641, -581, -521, -462,
-+ /* 90*/ -404, -347, -290, -234, -178, -123, -68, -13, 39, 93,
-+ /*100*/ 146, 199, 251, 303, 355, 406, 457, 508, 558, 609,
-+ /*110*/ 659, 708, 758, 808, 857, 906, 955, 1004, 1052, 1101,
-+ /*120*/ 1149, 1197, 1246, 1294, 1342, 1390, 1438, 1486, 1534, 1582,
-+ /*130*/ 1630, 1677, 1725, 1773, 1821, 1869, 1917, 1965, 2013, 2061,
-+ /*140*/ 2110, 2158, 2206, 2255, 2304, 2352, 2401, 2450, 2499, 2549,
-+ /*150*/ 2598, 2648, 2698, 2748, 2799, 2849, 2900, 2951, 3002, 3054,
-+ /*160*/ 3106, 3158, 3210, 3263, 3316, 3370, 3423, 3478, 3532, 3587,
-+ /*170*/ 3642, 3698, 3754, 3811, 3868, 3926, 3984, 4043, 4102, 4162,
-+ /*180*/ 4223, 4284, 4346, 4408, 4471, 4535, 4600, 4665, 4731, 4798,
-+ /*190*/ 4866, 4935, 5005, 5076, 5147, 5220, 5294, 5369, 5446, 5523,
-+ /*200*/ 5602, 5683, 5764, 5848, 5932, 6019, 6107, 6197, 6289, 6383,
-+ /*210*/ 6479, 6578, 6679, 6782, 6888, 6996, 7108, 7223, 7341, 7463,
-+ /*220*/ 7588, 7718, 7852, 7990, 8134, 8283, 8438, 8600, 8768, 8944,
-+ /*230*/ 9128, 9322, 9526, 9740, 9968, 10209, 10467, 10742, 11038, 11358,
-+ /*240*/ 11706, 12087, 12508, 12976, 13505, 14109, 14812, 15651, 16681, 18004,
-+ /*250*/ 19824, 22636, 28279, 30000, 30000, 30000
-+};
-+#define TEMP_FROM_REG(val) (reg2temp[val]*10)
-+static int TEMP_FROM_REG10(u16 val)
-+{
-+ u16 eightBits = val >> 2;
-+ u16 twoBits = val & 3;
-+ int base, diff;
-+
-+ /* no interpolation for these */
-+ if (twoBits == 0 || eightBits < 44 || eightBits > 251)
-+ return TEMP_FROM_REG(eightBits);
-+
-+ /* do some linear interpolation */
-+ base = TEMP_FROM_REG(eightBits);
-+ diff = TEMP_FROM_REG(eightBits+1) - base;
-+ return base + ((twoBits * diff) >> 2);
-+}
-+static u8 TEMP_TO_REG(int val)
-+{
-+ /* Yes, this is a linear search but this is only used when
-+ * writing tempX_max or tempX_max_hyst, which should be a rare
-+ * operation. So I don't care ... */
-+
-+ unsigned int i = 43;
-+ val /= 10;
-+ while (i < 254 && val > reg2temp[i]) i++;
-+ return i;
-+}
-+#endif /*DO_CONVERT*/
-+
+
+
+/********* FAN RPM CONVERT ********/
@@ -378,6 +256,7 @@
+
+struct vt1211_data {
+ struct i2c_client client;
++ struct class_device *class_dev;
+ struct semaphore lock;
+ enum chips type;
+
@@ -403,6 +282,7 @@
+};
+
+static int vt1211_attach_adapter(struct i2c_adapter *adapter);
++static int vt1211_isa_attach_adapter(struct i2c_adapter *adapter);
+static int vt1211_detach_client(struct i2c_client *client);
+static struct vt1211_data *vt1211_update_device(struct device *dev);
+
@@ -415,6 +295,13 @@
+ .detach_client = vt1211_detach_client,
+};
+
++static struct i2c_driver vt1211_isa_driver = {
++ .owner = THIS_MODULE,
++ .name = "vt1211-isa",
++ .attach_adapter = vt1211_isa_attach_adapter,
++ .detach_client = vt1211_detach_client,
++};
++
+static inline int vt_rdval(struct i2c_client *client, u8 reg)
+{
+ return (inb_p(client->addr + reg));
@@ -430,78 +317,15 @@
+{
+ struct vt1211_data *data = i2c_get_clientdata(client);
+
-+ data->vrm = DEFAULT_VRM;
++ data->vrm = vid_which_vrm();
+ /* set "default" interrupt mode for alarms, which isn't the default */
+ vt1211_write_value(client, VT1211_REG_TEMP1_CONFIG, 0);
+ vt1211_write_value(client, VT1211_REG_TEMP2_CONFIG, 0);
-+
-+ /* Default configuration; temp2, temp4, in2-in6 */
-+ data->uch_config = (data->uch_config & 0x83)|(12 & 0x7c);
-+ vt1211_write_value(client, VT1211_REG_UCH_CONFIG, data->uch_config);
+}
+
-+#ifndef DO_CONVERT
+#define IN_FROM_REG(val,n) ((val)*IN_MULTIPLIER)
+#define IN_TO_REG(val,n) (SENSORS_LIMIT( \
+ (((val)+(IN_MULTIPLIER/2))/IN_MULTIPLIER),0,255))
-+#else
-+
-+/* ----------------------------------------------------------------------
-+ Voltage translation;
-+
-+ This is according to the example /etc/sensors.conf;
-+
-+ compute in2 ((@ * 100) - 3) / (0.5952 * 95.8), (@ * 0.5952 * 0.958) + .03
-+ compute in3 ((@ * 100) - 3) / (0.4167 * 95.8), (@ * 0.4167 * 0.958) + .03
-+ compute in4 ((@ * 100) - 3) / (0.1754 * 95.8), (@ * 0.1754 * 0.958) + .03
-+ compute in5 ((@ * 100) - 3) / (0.6296 * 95.8), (@ * 0.6296 * 0.958) + .03
-+
-+ in2 is labled "VCore1" and should have K = 1.0 (fault in sensors.conf?)
-+
-+ The unit should be millivolt not 1/100's of volts. And to get
-+ better precision in the integer calculations we multiply divisor
-+ and dividend(?) with 8192.
-+
-+ Example;
-+
-+ in2_input = 1000*reg - 30 / (0.5952 * 95.8) =
-+ 8192 * (1000*reg - 30) / 8192 * (0.5952 * 95.8) =
-+ (8192000*reg - 245760) / 467109
-+
-+ No overflow because; (8192000*255) < 2^31
-+
-+ I got these results (EPIA-CL 6000 Mini-ITX);
-+
-+ lm_sensors BIOS
-+ 1.241 1.189 (VCore)
-+ 4.758 4.983
-+ 12.436 12.196
-+ 3.331 3.260
-+
-+*/
-+static int nconstant(int nr)
-+{
-+ switch (nr) {
-+ case 2: return 784794; /* VCore: 8192 * (1.0 * 95.8) */
-+ case 3: return 327023; /* 5.0V: 8192 * (0.4167 * 95.8) */
-+ case 4: return 137653; /* 12V: 8192 * (0.1754 * 95.8) */
-+ case 5: return 494105; /* 3.3V: 8192 * (0.6296 * 95.8) */
-+ default:;
-+ }
-+ return 784794; /* (K = 1.0) */
-+}
-+
-+static int IN_FROM_REG(u8 reg, int nr)
-+{
-+ return ((int)reg*8192000 - 245760) / nconstant(nr);
-+}
-+
-+static u8 IN_TO_REG(int val, int nr)
-+{
-+ int reg = (val * nconstant(nr) + 245760) / 8192000;
-+ return (SENSORS_LIMIT(reg,0,255));
-+}
-+#endif
+
+/* ----------------------------------------------------------------------
+ Temerature file definitions;
@@ -570,25 +394,25 @@
+}
+
+#define show_temp_offset(offset) \
-+static ssize_t show_temp_##offset (struct device *dev, char *buf) \
++static ssize_t show_temp_##offset (struct device *dev, struct device_attribute *attr, char *buf) \
+{ \
+ return show_temp(dev, buf, 0x##offset -1); \
+} \
-+static ssize_t show_temp_over_##offset (struct device *dev, char *buf)\
++static ssize_t show_temp_over_##offset (struct device *dev, struct device_attribute *attr, char *buf)\
+{ \
+ return show_temp_over(dev, buf, 0x##offset -1); \
+} \
+static ssize_t set_temp_over_##offset ( \
-+ struct device *dev, const char *buf, size_t count) \
++ struct device *dev, struct device_attribute *attr, const char *buf, size_t count) \
+{ \
+ return set_temp_over(dev, buf, count, 0x##offset - 1); \
+} \
-+static ssize_t show_temp_hyst_##offset (struct device *dev, char *buf) \
++static ssize_t show_temp_hyst_##offset (struct device *dev, struct device_attribute *attr, char *buf) \
+{ \
+ return show_temp_hyst(dev, buf, 0x##offset -1); \
+} \
+static ssize_t set_temp_hyst_##offset ( \
-+ struct device *dev, const char *buf, size_t count) \
++ struct device *dev, struct device_attribute *attr, const char *buf, size_t count) \
+{ \
+ return set_temp_hyst(dev, buf, count, 0x##offset - 1); \
+} \
@@ -599,28 +423,26 @@
+ show_temp_hyst_##offset, set_temp_hyst_##offset)
+
+
++show_temp_offset(1);
+show_temp_offset(2);
+show_temp_offset(3);
+show_temp_offset(4);
-+#ifdef ALL_SENSORS
-+show_temp_offset(1);
+show_temp_offset(5);
+show_temp_offset(6);
+show_temp_offset(7);
-+#endif
+
+/* ----------------------------------------------------------------------
+ uch_config;
+ */
-+#ifdef ALL_SENSORS
-+static ssize_t show_uch_config(struct device *dev, char *buf)
++
++static ssize_t show_uch_config(struct device *dev, struct device_attribute *attr, char *buf)
+{
+ struct vt1211_data *data = vt1211_update_device(dev);
+ return sprintf(buf, "%d\n", data->uch_config & 0x7c);
+}
+
+static ssize_t set_uch_config(
-+ struct device *dev, const char *buf, size_t count)
++ struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
+{
+ struct i2c_client *client = to_i2c_client(dev);
+ struct vt1211_data *data = vt1211_update_device(dev);
@@ -632,7 +454,7 @@
+
+static DEVICE_ATTR(uch_config, S_IRUGO | S_IWUSR,
+ show_uch_config, set_uch_config);
-+#endif
++
+/* ----------------------------------------------------------------------
+ Fan definitions;
+ */
@@ -721,43 +543,43 @@
+}
+
+#define show_fan_offset(offset) \
-+static ssize_t show_fan_##offset (struct device *dev, char *buf) \
++static ssize_t show_fan_##offset (struct device *dev, struct device_attribute *attr, char *buf) \
+{ \
+ return show_fan(dev, buf, 0x##offset - 1); \
+} \
-+static ssize_t show_fan_min_##offset (struct device *dev, char *buf) \
++static ssize_t show_fan_min_##offset (struct device *dev, struct device_attribute *attr, char *buf) \
+{ \
+ return show_fan_min(dev, buf, 0x##offset - 1); \
+} \
+static ssize_t set_fan_min_##offset ( \
-+ struct device *dev, const char *buf, size_t count) \
++ struct device *dev, struct device_attribute *attr, const char *buf, size_t count) \
+{ \
+ return set_fan_min(dev, buf, count, 0x##offset - 1); \
+} \
-+static ssize_t show_fan_div_##offset (struct device *dev, char *buf) \
++static ssize_t show_fan_div_##offset (struct device *dev, struct device_attribute *attr, char *buf) \
+{ \
+ return show_fan_div(dev, buf, 0x##offset - 1); \
+} \
+static ssize_t set_fan_div_##offset ( \
-+ struct device *dev, const char *buf, size_t count) \
++ struct device *dev, struct device_attribute *attr, const char *buf, size_t count) \
+{ \
+ return set_fan_div(dev, buf, count, 0x##offset - 1); \
+} \
-+static ssize_t show_fan_pwm_##offset (struct device *dev, char *buf) \
++static ssize_t show_fan_pwm_##offset (struct device *dev, struct device_attribute *attr, char *buf) \
+{ \
+ return show_fan_pwm(dev, buf, 0x##offset - 1); \
+} \
+static ssize_t set_fan_pwm_##offset ( \
-+ struct device *dev, const char *buf, size_t count) \
++ struct device *dev, struct device_attribute *attr, const char *buf, size_t count) \
+{ \
+ return set_fan_pwm(dev, buf, count, 0x##offset - 1); \
+} \
-+static ssize_t show_fan_pwm_ctl_##offset (struct device *dev, char *buf)\
++static ssize_t show_fan_pwm_ctl_##offset (struct device *dev, struct device_attribute *attr, char *buf)\
+{ \
+ return show_fan_pwm_ctl(dev, buf, 0x##offset - 1); \
+} \
+static ssize_t set_fan_pwm_ctl_##offset ( \
-+ struct device *dev, const char *buf, size_t count) \
++ struct device *dev, struct device_attribute *attr, const char *buf, size_t count) \
+{ \
+ return set_fan_pwm_ctl(dev, buf, count, 0x##offset - 1); \
+} \
@@ -815,25 +637,25 @@
+}
+
+#define show_in_offset(offset) \
-+static ssize_t show_in_##offset (struct device *dev, char *buf) \
++static ssize_t show_in_##offset (struct device *dev, struct device_attribute *attr, char *buf) \
+{ \
+ return show_in(dev, buf, 0x##offset); \
+} \
-+static ssize_t show_in_min_##offset (struct device *dev, char *buf) \
++static ssize_t show_in_min_##offset (struct device *dev, struct device_attribute *attr, char *buf) \
+{ \
+ return show_in_min(dev, buf, 0x##offset); \
+} \
+static ssize_t set_in_min_##offset ( \
-+ struct device *dev, const char *buf, size_t count) \
++ struct device *dev, struct device_attribute *attr, const char *buf, size_t count) \
+{ \
+ return set_in_min(dev, buf, count, 0x##offset); \
+} \
-+static ssize_t show_in_max_##offset (struct device *dev, char *buf) \
++static ssize_t show_in_max_##offset (struct device *dev, struct device_attribute *attr, char *buf) \
+{ \
+ return show_in_max(dev, buf, 0x##offset); \
+} \
+static ssize_t set_in_max_##offset ( \
-+ struct device *dev, const char *buf, size_t count) \
++ struct device *dev, struct device_attribute *attr, const char *buf, size_t count) \
+{ \
+ return set_in_max(dev, buf, count, 0x##offset); \
+} \
@@ -843,30 +665,28 @@
+static DEVICE_ATTR(in##offset##_max, S_IRUGO | S_IWUSR, \
+ show_in_max_##offset, set_in_max_##offset); \
+
++show_in_offset(0);
++show_in_offset(1);
+show_in_offset(2);
+show_in_offset(3);
+show_in_offset(4);
+show_in_offset(5);
-+#ifdef ALL_SENSORS
-+show_in_offset(0);
-+show_in_offset(1);
+show_in_offset(6);
-+#endif
+
-+static ssize_t show_vid(struct device *dev, char *buf)
++static ssize_t show_vid(struct device *dev, struct device_attribute *attr, char *buf)
+{
+ struct vt1211_data *data = vt1211_update_device(dev);
+ return sprintf(buf, "%d\n", vid_from_reg(data->vid, data->vrm));
+}
+static DEVICE_ATTR(in0_ref, S_IRUGO, show_vid, NULL);
+
-+static ssize_t show_vrm(struct device *dev, char *buf)
++static ssize_t show_vrm(struct device *dev, struct device_attribute *attr, char *buf)
+{
+ struct vt1211_data *data = vt1211_update_device(dev);
+ return sprintf(buf, "%d\n", data->vrm);
+}
+static ssize_t set_vrm(
-+ struct device *dev, const char *buf, size_t count)
++ struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
+{
+ struct i2c_client *client = to_i2c_client(dev);
+ struct vt1211_data *data = i2c_get_clientdata(client);
@@ -880,7 +700,7 @@
+ alarm file definitions;
+*/
+
<<Diff was trimmed, longer than 597 lines>>
---- CVS-web:
http://cvs.pld-linux.org/SOURCES/linux-2.6-vt1211-sensor.patch?r1=1.1.2.3&r2=1.1.2.4&f=u
More information about the pld-cvs-commit
mailing list