Skip to contentSkip to conversation

vt8231.c and VRM-VID

lm-sensors Roger Lucas 2 participants 2 messages Nov 8, 2005 – Nov 15, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi Jean,

Sorry to keep sending more patches... When I tried Rudolf's patch for the VRM, I couldn't get the VID to work properly. On investigation, it turned out that this register ALSO does not exist on the VT8231. Whoever ported the original code to the VT8231 didn't check that all the registers ACTUALLY EXISTED on the VT8231 device!!! No comment.

Anyhow, I have now checked that all the registers left do actually exist and that the driver isn't reading garbage from the device. This has resulted in the removal of the PWM controls (as in my mail below) and now also the VID detection as this isn't supported in the chip either.

I also tidied up my code changes for creating the temp/voltage files. Don't know what planet I was on with the original code - it was horrible.

Anyhow, revision 4 is attached. Hopefully this is the last one.

Rudolf's VRM patch works perfectly BTW, and has ended up in this revision 4 code release as it is part of the updated kernel HWMON source I am now working from. I hope that this isn't a problem - I can always remove that section of the patch and send a revised version if it is.

Thanks for all your work in reviewing my code.

- Roger

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Roger Lucas
Sent: 07 November 2005 19:57
To: 'Jean Delvare'
Cc: 'LM Sensors'
Subject: RE: [lm-sensors] RE: vt8231.c

Hi Jean,

Attached is revision 3 of the VT8231 driver. There are a LOT of changes to implement your suggestions. Some of these break compatibility with older vt8231 driver releases as follows:

tempX sequence
Temperatures are now measured temp0,temp1,temp2,etc. This causes the "sensors" user-space program to fail with errors as it expects the older temperature numbering sequence.

tempX scaling
Given that we have no idea what the temperature curves for a device are, the driver now returns the 10-bit value directly from the register. Older versions of the driver multiplied the register value by 2.5 (reason unknown as it DEFINITELY didn't scale it to degrees Centigrade, Fahrenheit or Kelvin). Older temperature scaling calculations are now completely wrong.

inX scaling
The driver now scales the measurement to mV. Inputs such as the 3.3v internal reference are now completely correct. Inputs such as IN0-IN5 which report an external pin now return the value at the pin. SENSORS.CONF still has to scale these to compensate for external divider chains (if, for example, the 12v rail is being measured).

tempX/inX presence
The driver only generates measurements for inputs that are genuinely measured (according to the CONFIG register). This causes the "sensors" program to fail as it expects to see all the tempX and inX sources available, even if you add "ignore xxx" to the sensors.conf file. IMHO this is a bug in the "sensors" program, as "ignore xxx" should cause it to fully ignore that parameter, not still generate warnings if the parameter doesn't exist.

PWM controls
The VT8231 doesn't have any PWM controls. All the code that was in the driver was erroneous and has been removed (I suspect it was legacy from some other driver used as the base for an earlier port).

If the newer vt8231 driver is accepted into the kernel tree, would you like me to go through v2.9.2 of lm_sensors and try to see what can be done to resolve the compatibilities issues with this newer vt8231 driver?

As far as the web site for the sensors.conf file is concerned, I have no time to do this in the near-term. If I get some spare time in the future, and no-one has done it by then, I will look into it further.

Best regards,

Roger

-----Original Message-----
From: Jean Delvare [mailto:[email protected]]
Sent: 07 November 2005 09:24
To: [email protected]
Cc: Knut Petersen; LM Sensors
Subject: RE: [lm-sensors] RE: vt8231.c

Hi Roger,

Quoted 12 lines · Roger Lucas

One question I have is regarding the "1 mV" calibration, and this returns me to a general comment/question with the LM-Sensors system:

The LM-Sensors system appears to be based on what the sensors chips are on the motherboard, rather than what the motherboard is. From the "probe and find out what I have" concept, this is reasonable, but it does cause a LOT of problems for users who are less educated. Many of the sensors devices are wired up in different ways on different motherboards, with (for example) a voltage input being used for a 12v rail monitor on one motherboard and a 5v rail monitor on another. The motherboard manufacturer is completely at liberty to wire a device in any way they choose.

Completely true.

Quoted 6 lines

This therefore makes a sensors.conf file really a motherboard-specific rather than a device specific file. If you use the configuration file according to the device that you have, rather than the motherboard that you have, then you run a very high risk of reporting nonsense to a user, or (arguably worse) reporting information that looks correct but is actually wrong.

True again.

Keep in mind that the folks originally running the project were passionates with good electronics knowledge. Back then, most users also had the same profile. This explains a number of technical choices which turned out not to be suitable for average users. In a way, the project is the victim of its own success. It is also victim of the increase of the number of hardware monitoring chips and the exponential growth of the number of motherboard, each with its own specifics.

We're trying to fix these issues as time permits (e.g. the drivers do no more set arbitrary limits, and they tend not to reset chips anymore) but there's still a lot left to do.

Quoted 7 lines

Following this through, when you request that the driver report the voltage detected in mV, I am _hoping_ that you are asking for the voltage at the pin of the device, rather than the voltage that the device happens to be ultimately connected to on this particular motherboard? Reporting the voltage at the device pin is the only consistent behaviour that I can see for a motherboard-independent device driver.

Yes, of course. Drivers are written for chips. All the rest belongs to userspace (libsensors or whatever).

Quoted 3 lines

If the above makes sense, then would there be any interest in building some kind of database of known good sensors.conf files for specific motherboards?

There have been 472 people complaining of the lack of such a database already. A dozen of these said they would build one. Two of these actually did. One is already dead, one is available at
http://lm-sensors-db.berlios.de/ but doesn't actually work.

We rejected the idea that we would include the configuration files one by one in the lm_sensors project as people send them, because it would be too much work. An external, web-based system where people could post and retrieve their configuration files would be prefered. But we are still in need of one which would work.

It might be discussed what to do with the sensors.conf.eg file. It started as a small file when there were only a couple supported chips, and motherboard manufacturers were following the chip maker's recommendations on wiring. Now the file is quite large, and has lots of conditionals (expressed as comments) to try and help users to get a working configuration file. according to their hardware. I agree that it isn't suitable for the average user.

Maybe we should stop installing this file to /etc/sensors.conf automatically. As you say, It's probably better not to have a configuration file than to have a bad one. However, this still a good base for people to start tinkering, so we probably can't get rid of it unless we actually have a database with configuration files for the most popular boards.

Quoted 6 lines

I would suggest that the output of "LSHW" or a similar utility is used to obtain unique identifying details for the motherboard, and then this used to determine the appropriate motherboard conf file. A simple web page with known motherboards on it and their associated .conf would be a very good start. New motherboards could then be added by people with their matching .conf file.

We would probably use the DMI fields for board identification (using dmidecode, which is more standard than lshw I think). However, the difficult part is to gather the data. What you call "a simple web page" won't work. We want something the average user can freely contribute to, with a minimum maintenance workload from us. Briefly:

* Any user can add a configuration file. He/she must pick from a list of motherboard makers, or add one if his/her aint in the list. Then he/she types the name of his/her motherboard and uploads his file. Ideally we would do a brief content check to make sure nobody uploads crap.

* Any user can update (overwrite) a configuration file. We probably need to backup older files just in case though.

* We need an administration interface to fix about anything (manufacturer or board name, broken configuration statements) and even delete files if needed.

* Users should have the possibility to alert us if they think something is wrong.

* Not sure how to deal with duplicates. We probably want one single configuration file per board, but it might be hard to enforce.

Note that there still is a problem with the fact that not all users of the same board will use the same fans, so fan limits (and, to some extent, temperature limits) depend on the user. The configuration files are still templates. If we want to ultimately install them automatically, we will probably need to enforce the fact that configuration files should not set limits for fans and temperatures, nor ignore statements for fans. These configuration files should essentially contain label and compute statements.

This ain't simple, else this would have been done already. But if you want to work on this (preferably *after* we are done with the vt8231 port ;)) you're very welcome.

--
Jean Delvare
-------------- next part --------------

drivers/hwmon/Kconfig +12 -0
diff -Naur reference/drivers/hwmon/Kconfig linux-2.6.14/drivers/hwmon/Kconfig
@@ -350,6 +350,18 @@
 	  This driver can also be built as a module.  If so, the module
 	  will be called via686a.
 
+config SENSORS_VT8231
+	tristate "VT8231"
+	depends on HWMON && I2C && PCI && EXPERIMENTAL
+	select HWMON_VID
+	select I2C_ISA
+	help
+	  If you say yes here then you get support for the integrated sensors
+	  in the VIA VT8231 device.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called vt8231.
+
 config SENSORS_W83781D
 	tristate "Winbond W83781D, W83782D, W83783S, W83627HF, Asus AS99127F"
 	depends on HWMON && I2C
drivers/hwmon/Makefile +1 -0
diff -Naur reference/drivers/hwmon/Makefile linux-2.6.14/drivers/hwmon/Makefile
@@ -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_VT8231)	+= vt8231.o
 obj-$(CONFIG_SENSORS_W83627EHF)	+= w83627ehf.o
 obj-$(CONFIG_SENSORS_W83L785TS)	+= w83l785ts.o
 
drivers/hwmon/hwmon-vid.c +38 -22

124 lines not on this page · raw message

drivers/hwmon/vt8231.c +806 -0

806 lines not on this page · raw message

#1 lore raw

Hi Roger,

Once again, sorry for the delay. Hopefully we're not too far from a version of the vt8231 driver which would be acceptable for integration into Linux 2.6.

Quoted 7 lines

Sorry to keep sending more patches... When I tried Rudolf's patch for the VRM, I couldn't get the VID to work properly. On investigation, it turned out that this register ALSO does not exist on the VT8231. Whoever ported the original code to the VT8231 didn't check that all the registers ACTUALLY EXISTED on the VT8231 device!!! No comment.

Quoted 5 lines

Anyhow, I have now checked that all the registers left do actually exist and that the driver isn't reading garbage from the device. This has resulted in the removal of the PWM controls (as in my mail below) and now also the VID detection as this isn't supported in the chip either.

I share your feelings. Once again I'd like Mark to comment on this. If these registers really do not exist, then we should drop support from the Linux 2.4 driver and libsensors as well. I'm guessing that the dead code is simply a legacy from vt1211.c, but I don't have a datasheet for the VT1211 chip so I can't really tell. Does anyone have a datasheet?

Quoted 3 lines

I also tidied up my code changes for creating the temp/voltage files. Don't know what planet I was on with the original code - it was horrible.

I didn't remember it was, but well, that was long ago ;)

Quoted 1 line

Anyhow, revision 4 is attached. Hopefully this is the last one.

It's not, but you always need to hope :)

Quoted 5 lines

Rudolf's VRM patch works perfectly BTW, and has ended up in this revision 4 code release as it is part of the updated kernel HWMON source I am now working from. I hope that this isn't a problem - I can always remove that section of the patch and send a revised version if it is.

When you submit a patch for review, it is ALWAYS to your advantage that the patch is as small as possible, because people are likely to be short on time *cough* so you better don't frighten them. And the cleaner the patch, the higher the review probability.

You should consider using quilt [1] or a similar tool to handle your patches. It would solve this issue, would help you get rid of trailing whitespace, and would also let you add diffstat output to the patch file, which is very convenient for the reviewer.

[1] http://savannah.nongnu.org/projects/quilt

To the code itself now...

First of all: there isn't much left from Mark's original code in the new driver. Aaron and you did the work. You should just credit Mark for writing the Linux 2.4 driver in the first place, but make it clearer that Aaron and you wrote this one driver. In particular, you could set youself as the MODULE_AUTHOR.

Side question, would you accept to become the maintainer for the Linux 2.6 version of the vt8231 driver once it is in?

I'm not detailing on the fact that temp0 cannot be used, I've said it before already.

Quoted 3 lines

The default value for the input channel configuration is used (Reg 0x4A=0x07) which sets the selected inputs marked with '*' below if multiple options are possible:

I'm not sure I agree with the "default value" here. Do you refer to the power-up default value for this register? What you should really trust is the value the driver will read from this register. This gives the BIOS a chance to setup the chip properly according to the hardware setup. Looks like this is what the driver does, but this comment could be clearer about that.

Quoted 9 lines

/* ins numbered 0-5 */
/* fans numbered 1-2 */
#define VT8231_REG_FAN_MIN(nr) (0x3a + (nr))
#define VT8231_REG_FAN(nr) (0x28 + (nr))

static const u8 regtemp[] = { 0x1f, 0x21, 0x22, 0x23, 0x24, 0x25 };
static const u8 regtempmax[] = { 0x39, 0x3d, 0x2b, 0x2d, 0x2f, 0x31 }; static const u8 regtempmin[] = { 0x3a, 0x3e, 0x2c, 0x2e, 0x30, 0x32 };

Quoted 7 lines

static const u8 regvolt[] = { 0x21, 0x22, 0x23, 0x24, 0x25, 0x26 };
static const u8 regvoltmax[] = { 0x3d, 0x2b, 0x2d, 0x2f, 0x31, 0x33 }; static const u8 regvoltmin[] = { 0x3e, 0x2c, 0x2e, 0x30, 0x32, 0x34 };

/* temps numbered 0-5 */
#define VT8231_REG_TEMP_LOW01 0x49
#define VT8231_REG_TEMP_LOW25 0x4d

Can you please reorder it all so that the comments will properly preceed the register definitions they refer to? Also, the fan macros are weirdly misaligned.

Quoted 10 lines

/* temps 0-5 */

#define ISTEMP(i, ch_config) ((i) < 0 ? 0 : \
			      (i) = 0 ? 1 : \
			      (i) > 5 ? 0 : \
			      ((ch_config) >> ((i)+1)) & 0x01)
/* voltages 0-6 */
#define ISVOLT(i, ch_config) ((i) < 0 ? 0 : \
			      (i) > 5 ? 0 : \
			      (i) = 5 ? 1 : \
			      !(((ch_config) >> ((i)+2)) & 0x01))

The "< 0" and "> 5" tests shouldn't be needed, right? Don't have these macros handle values they should never be called with please. You're not preventing bugs from happening by doing so, but will make them harder to track.

Also, isn't it rather voltages 0-_5_?

Quoted 5 lines
/* NB  The values returned here are NOT temperatures.  The calibration curves
**     for the thermistor curves are board-specific and must go in the
**     sensors.conf file.  Temperature sensors 0 and 1 are ten bits, whilst
**     temperature sensors 2-5 are eight bits, so we scale all the values to be
**     equivalent to ten bits for consistency.

This doesn't seem to match the code. Isn't VT8231_REG_TEMP_LOW25 supposed to contain the 2 lower bits of temperature channels 2-5?

Quoted 2 lines

** TEMP_TO_REG() sets the hardware comparisons and these are all use the 8
** MSBs so we apply scaling in the macro to compensate.

Rephrase please.

Quoted 2 lines

*/
#define TEMP_TO_REG(val) (SENSORS_LIMIT((val)>>2, 0, 255))

Doesn't look right to me. I'd expect something like:

#define TEMP_TO_REG(val) SENSORS_LIMIT(((val) + 500) / 1000, 0, 255)

Note that you can safely drop the outermost pair of parentheses here.

I'm also quite surprised that you have a single conversion macro for the thermistor-based and the diode-based channels.

Quoted 1 line

#define IN_TO_REG(val) (SENSORS_LIMIT((val), 0, 255))

This doesn't make much sense. Please include all the conversion factors into the macro. If you don't want to or cannot, just discard this macro and call SENSORS_LIMIT directly.

Quoted 2 lines

/* But this chip saturates back at 0, not at 255 like all the other chips.
So, 0 means 0 RPM */

Please drop the meaningless "but".

Quoted 8 lines

static inline u8 FAN_TO_REG(long rpm, int div)

{
	if (rpm = 0)
		return 0;
	return SENSORS_LIMIT((1310720 + rpm * div / 2) / (rpm * div), 1, 255);
}

#define FAN_FROM_REG(val, div) ((val)=0?0:1310720/((val)*(div)))

Isn't it a bit odd to round in one direction but truncate in the other? Quite frankly I wouldn't bother rounding at all. Due to the way the measurement is done, the values we manipulate are already truncated anyway.

Quoted 1 line
	u16 temp[6];		/* Register value 10 bit */

Please say in the comment if the 10 bits are aligned on the left or right.

Quoted 1 line
	u8 vrm;

Isn't it supposed to be gone? I see may references remaining in the code. vrm is useless for a chip without VID inputs!

Quoted 1 line
	u8 uch_config;

You only use this one as a local variable each time, so you don't have to make is a member of this structure. But see below.

Quoted 5 lines

static int vt8231_detect(struct i2c_adapter *adapter); static int vt8231_detach_client(struct i2c_client *client); (...)
static struct vt8231_data *vt8231_update_device(struct device *dev); static void vt8231_init_client(struct i2c_client *client);

You could group all forward declarations together.

Quoted 5 lines

static ssize_t show_in(struct device *dev, struct device_attribute *attr,
char *buf)

{
	struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);
	int nr = sensor_attr->index;

I see you are now using dynamic callbacks. This is great :)

Quoted 2 lines
	switch(nr)
	{

Iirk. Watch your coding style. Space between "switch" and the opening parenthesis. Opening curly brace goes at the end of the line.

I will not notify the same coding style error again, as it would be quite boring to read, but please check the whole file when I tell you about any coding style issue. Same holds for a number of other comments, BTW.

Quoted 2 lines
		case 5: // in5 is scaled to 3.3v internally
			// No floating point so 1/(0.0958*0.6296 ~= 1657/100 

No C++ style comments please. Capital V for Volt. Missing closing parenthesis too.

Quoted 2 lines
			return sprintf(buf, "%d\n", 
				(int)(((data->in[nr] - 3) * 1657) / 100));

Useless cast?

I would write it:
(data->in[nr] - 3) * 10000 / (958 * 20 / 54)
This is way easier to check against the datasheet. I think the compiler will handle the arithmetics anyway so the final code is just as fast.

Quoted 6 lines
		default:
			// No floating point so 1/(0.0958 ~= 1044/100 
			return sprintf(buf, "%d\n", 
				(int)(((data->in[nr] - 3) * 1044) / 100));
	};
}

Ditto. Also, it is obvious to me that you should have two seperate sysfs callbacks, one for in5 and one for the other ins. Do not abuse the dynamic sysfs callback mechanism.

You have an unneeded semi-colon at the end of the switch statement, please clear it. Also note that it is common to omit the extra indentation for case labels, so as to keep the intentation depth to a minimum.

Quoted 9 lines

#define show_in_offset(offset) \

static SENSOR_DEVICE_ATTR(in##offset##_input, S_IRUGO,		\
		show_in, NULL, offset);

#define limit_in_offset(offset) \

static SENSOR_DEVICE_ATTR(in##offset##_min, S_IRUGO | S_IWUSR,	\
		show_in_min, set_in_min, offset);		\
static SENSOR_DEVICE_ATTR(in##offset##_max, S_IRUGO | S_IWUSR,	\
		show_in_max, set_in_max, offset);

These macros shouldn't have a trailing semi-colon, as the caller will add one. Also, why did you define two separate macros? You're calling them in pairs anyway.

Quoted 1 line

/* 3 temperatures */

Not really. I'd say "Up to 6 temperatures".

Quoted 8 lines

static ssize_t show_temp(struct device *dev, struct device_attribute *attr,
char *buf)

{
	struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);
	int nr = sensor_attr->index;
	struct vt8231_data *data = vt8231_update_device(dev);
	return sprintf(buf, "%d\n",  data->temp[nr]);
}

That would be data->temp[nr] * 250, at least for the diode-based one. The thermistor-based would need some extra computation I think.

Quoted 2 lines
	vt8231_write_value(client, regtempmin[nr],
			data->temp_min[nr]);

Fits on a single line.

Quoted 10 lines
struct strDeviceAttrTable cfgInfoTemp[] = {
	CFG_INFO_TEMP(0),
	CFG_INFO_TEMP(1),
	CFG_INFO_TEMP(2),
	CFG_INFO_TEMP(3),
	CFG_INFO_TEMP(4),
	CFG_INFO_TEMP(5),
	{ .id = -1 }
};
Quoted 9 lines
struct strDeviceAttrTable cfgInfoVolt[] = {
	CFG_INFO_VOLT(0),
	CFG_INFO_VOLT(1),
	CFG_INFO_VOLT(2),
	CFG_INFO_VOLT(3),
	CFG_INFO_VOLT(4),
	CFG_INFO_VOLT(5),
	{ .id = -1 }
};

These should be defined static.

Another general note: the kernel developers usually avoid mixedCaseVarNames. This is C, not Java.

Quoted 3 lines
	return sprintf(buf, "%d\n",
		FAN_FROM_REG(data->fan_min[nr],
			DIV_FROM_REG(data->fan_div[nr])));

Fits in one less line.

Quoted 14 lines

static ssize_t set_fan_min(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)

{
	struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);
	int nr = sensor_attr->index - 1;
	struct i2c_client *client = to_i2c_client(dev);
	struct vt8231_data *data = i2c_get_clientdata(client);
	int val = simple_strtoul(buf, NULL, 10);
	down(&data->update_lock);
	data->fan_min[nr] = FAN_TO_REG(val, DIV_FROM_REG(data->fan_div[nr]));
	vt8231_write_value(client, VT8231_REG_FAN_MIN(nr+1), data->fan_min[nr]);
	up(&data->update_lock);
	return count;
}

Starts being quite dense... Maybe you could add a blank line before down()? It would also be more efficient to have the "- 1" offset at the sysfs file creation rather than in the callback.

Quoted 2 lines
	down(&data->update_lock);
	int old = vt8231_read_value(client, VT8231_REG_FANDIV);

Variable declarations must precede any code. The register read doesn't need to happen with the lock held anyway.

Quoted 2 lines
			dev_err(&client->dev, "fan_div value %ld not "
			      "supported. Choose one of 1, 2, 4 or 8!\n", val);

Indentation.

It's considered good practice that the fan min limit is preserved when the fan clock divider changes. Most drivers in Linux 2.6 now do.

Quoted 1 line

/**** VRM and VID *****/

This part can go away entirely.

Quoted 8 lines
static struct i2c_driver vt8231_driver = {
	.owner		= THIS_MODULE,
	.name		= "vt8231",
	.id		= I2C_DRIVERID_VT8231,
	.flags		= I2C_DF_NOTIFY,
	.attach_adapter	= vt8231_detect,
	.detach_client	= vt8231_detach_client,
};

You don't need I2C_DF_NOTIFY for ISA drivers no more. You don't need no .id either.

Quoted 1 line
	{ PCI_DEVICE( PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8231_4) },

No space after opening parenthesis.

Quoted 4 lines
	if (force_addr)
		isa_address = force_addr & 0xFF00;

	if (force_addr) {

You could merge both tests.

Quoted 2 lines
	/* Reserve the ISA region */
	if (!request_region(isa_address, VT8231_EXTENT, vt8231_pci_driver.name)) {

Line too long.

Quoted 1 line
	data->valid = 0;

I don't think you actually need to initialize this one, as kzalloc did it already.

Quoted 5 lines
	for(i=0; cfgInfoTemp[i].id >= 0; i++)
	{
		struct strDeviceAttrTable *pEntry = &cfgInfoTemp[i];
		if ( ISTEMP(pEntry->id, data->uch_config) )
		{

Horrible coding style. Please fix.

Quoted 3 lines
	if ((err = i2c_detach_client(client))) {
		return err;
	}

You could drop the curly braces.

Quoted 4 lines
	if (time_after(jiffies, data->last_updated + HZ + HZ / 2)
	    || !data->valid) {
		data->uch_config = vt8231_read_value(client,
						VT8231_REG_UCH_CONFIG);

On second thought, what's the point in reading it over and over? You only created the sysfs files corresonding to the initial configuration, so if this configuration register was to change, the driver would silently break anyway.

It's probably more efficient, and not less safe, to keep and trust the original reading.

Quoted 6 lines
		for (i = 1; i < 3; i++) {
			data->fan[i - 1] = vt8231_read_value(client,
						VT8231_REG_FAN(i));
			data->fan_min[i - 1] = vt8231_read_value(client,
						VT8231_REG_FAN_MIN(i));
		}

You should be able to get rid of the offsets by defining the macros differently.

Quoted 3 lines

module_init(sm_vt8231_init);
module_exit(sm_vt8231_exit);

No blank line at end of file please.

Pfew, done it :)

Thanks,

Signature · 1 line
Jean Delvare