Skip to contentSkip to conversation

PATCH:

lm-sensors Applied Hans de Goede 4 participants 21 messages Sep 21, 2007 – Jan 30, 2009

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

Hi All,

Here is a patch adding some text to the sysfs interface documentation on how settings written to sysfs attributes should be handled, focussing mainly on error handling. This version incorperates Jean's latest comments.

Signed-off-by [email protected]

Regards,

Hans

Here is a patch adding some text to the sysfs interface documentation on how settings written to sysfs attributes should be handled, focussing mainly on error handling. This version incorperates Jean's latest comments.

Signed-off-by [email protected]
Documentation/hwmon/sysfs-interface renamed from Documentation.orig/hwmon/sysfs-interface +58 -0
diff -ur linux-2.6.23-rc6.git4/Documentation.orig/hwmon/sysfs-interface linux-2.6.23-rc6.git4/Documentation/hwmon/sysfs-interface
@@ -67,6 +67,10 @@
 alarm (for example, whether a threshold must be met or must be exceeded
 to cause an alarm) is chip-dependent.
 
+When setting values of hwmon sysfs attributes, the string representation of
+the desired value must be written, note that strings which are not a number
+are interpreted as 0! For more on how written strings are interpreted see the
+"sysfs attribute writes interpretation" section at the end of this file.
 
 -------------------------------------------------------------------------
 
@@ -404,3 +408,57 @@
 		0: disable
 		1: enable
 		RW
+
+
+sysfs attribute writes interpretation
+-------------------------------------
+
+hwmon sysfs attributes always contain numbers, so the first thing to do is to
+convert the input to a number, there are 2 ways todo this depending whether
+the number can be negative or not:
+unsigned long u = simple_strtoul(buf, NULL, 10);
+long s = simple_strtol(buf, NULL, 10);
+
+With buf being the buffer with the user input being passed by the kernel.
+Notice that we do not use the second argument of strto[u]l, and thus cannot
+tell when 0 is returned, if this was really 0 or is caused by invalid input.
+This is done deliberately as checking this everywhere would add a lot of
+code to the kernel.
+
+Notice that it is important to always store the converted value in an
+unsigned long or long, so that no wrap around can happen before any further
+checking.
+
+After the input string is converted to an (unsigned) long, the value should be
+checked if its acceptable. Be careful with further conversions on the value
+before checking it for validity, as these conversions could still cause a wrap
+around before the check. For example do not multiply the result, and only
+add/subtract if it has been divided before the add/subtract.
+
+What to do if a value is found to be invalid, depends on the type of the
+sysfs attribute that is being set. If it is a continuous setting like a
+tempX_max or inX_max attribute, then the value should be clamped to its
+limits using SENSORS_LIMIT(value, min_limit, max_limit). If it is not
+continuous like for example a tempX_type, then when an invalid value is
+written, -EINVAL should be returned.
+
+Example1, temp1_max, register is a signed 8 bit value (-128 - 127 degrees):
+--- begin code ---
+long v = simple_strtol(buf, NULL, 10) / 1000;
+SENSORS_LIMIT(v, -128, 127);
+/* write v to register */
+--- end code ---
+
+Example2, fan divider setting, valid values 2, 4 and 8:
+--- begin code ---
+unsigned long v = simple_strtoul(buf, NULL, 10);
+
+switch (v) {
+       case 2: v = 1; break;
+       case 4: v = 2; break;
+       case 8: v = 3; break;
+       default:
+               return -EINVAL;
+}
+/* write v to register */
+--- end code ---

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

Acked-by
#1 lore raw

Hi Hans,

Quoted 5 lines · Hans de Goede

Here is a patch adding some text to the sysfs interface documentation on how settings written to sysfs attributes should be handled, focussing mainly on error handling. This version incorperates Jean's latest comments.

Signed-off-by [email protected]

Thanks for doing this.

Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#2 lore raw
In reply to Hans de Goede

Hi Hans,

Quoted 7 lines · Jean Delvare

Hi Hans,

Quoted 4 lines · Hans de Goede

Here is a patch adding some text to the sysfs interface documentation on how settings written to sysfs attributes should be handled, focussing mainly on error handling. This version incorperates Jean's latest comments.

Quoted 5 lines
Quoted 1 line
Signed-off-by [email protected]

Thanks for doing this.

While reviewing your new fschmd driver, I found some mistakes which also appear in the code examples of this documentation update:

Review

Quoted 3 lines

+--- begin code ---

(quoted diff) +2 -0
+long v = simple_strtol(buf, NULL, 10) / 1000;
+SENSORS_LIMIT(v, -128, 127);

This is a no-op, should be v = ...

Review

Quoted 13 lines
(quoted diff) +12 -0
+/* write v to register */
+--- end code ---
 
+--- begin code ---
+unsigned long v = simple_strtoul(buf, NULL, 10);
+
+switch (v) {
+       case 2: v = 1; break;
+       case 4: v = 2; break;
+       case 8: v = 3; break;
+       default:
+               return -EINVAL;
+}

Indentation doesn't comply with CodingStyle.

Quoted 2 lines

+/* write v to register */
+--- end code ---

Additionally, I think that the examples are a bit difficult to read, one level of indentation would probably be better than the begin/end code markers. Thus, I propose the following incremental patch:

 Documentation/hwmon/sysfs-interface |   30 ++++++++++++++----------------
 1 file changed, 14 insertions(+), 16 deletions(-)
Documentation/hwmon/sysfs-interface +14 -16
@@ -450,22 +450,20 @@ continuous like for example a tempX_type
 written, -EINVAL should be returned.
 
 Example1, temp1_max, register is a signed 8 bit value (-128 - 127 degrees):
---- begin code ---
-long v = simple_strtol(buf, NULL, 10) / 1000;
-SENSORS_LIMIT(v, -128, 127);
-/* write v to register */
---- end code ---
+
+	long v = simple_strtol(buf, NULL, 10) / 1000;
+	v = SENSORS_LIMIT(v, -128, 127);
+	/* write v to register */
 
 Example2, fan divider setting, valid values 2, 4 and 8:
---- begin code ---
-unsigned long v = simple_strtoul(buf, NULL, 10);
 
-switch (v) {
-       case 2: v = 1; break;
-       case 4: v = 2; break;
-       case 8: v = 3; break;
-       default:
-               return -EINVAL;
-}
-/* write v to register */
---- end code ---
+	unsigned long v = simple_strtoul(buf, NULL, 10);
+
+	switch (v) {
+	case 2: v = 1; break;
+	case 4: v = 2; break;
+	case 8: v = 3; break;
+	default:
+		return -EINVAL;
+	}
+	/* write v to register */
Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
author Acked-by
#3 lore raw
In reply to Hans de Goede
Quoted 15 lines · Jean Delvare

Hi Hans,

Quoted 11 lines · Jean Delvare

Hi Hans,

Quoted 5 lines · Hans de Goede

Here is a patch adding some text to the sysfs interface documentation on how settings written to sysfs attributes should be handled, focussing mainly on error handling. This version incorperates Jean's latest comments.

Signed-off-by [email protected]

Thanks for doing this.

Quoted 9 lines

While reviewing your new fschmd driver, I found some mistakes which also appear in the code examples of this documentation update:

Documentation/hwmon/sysfs-interface line 448

Quoted 3 lines

+--- begin code ---

Documentation/hwmon/sysfs-interface renamed from Documentation.orig/hwmon/sysfs-interface +2 -0
+long v = simple_strtol(buf, NULL, 10) / 1000;
+SENSORS_LIMIT(v, -128, 127);

This is a no-op, should be v = ...

Yes, I already noticed myself, but you beat me to writing a patch, thanks! Notice that this is what happens when you make a function look like a macro by giving it all caps names. Note: I'm not trying to talk my mistake right, just trying to explain how I came to the mistake. Maybe we should rename SENSORS_LIMIT?

Quoted 57 lines

Documentation/hwmon/sysfs-interface line 462

Quoted 13 lines
Documentation/hwmon/sysfs-interface renamed from Documentation.orig/hwmon/sysfs-interface +12 -0
+/* write v to register */
+--- end code ---
 
+--- begin code ---
+unsigned long v = simple_strtoul(buf, NULL, 10);
+
+switch (v) {
+       case 2: v = 1; break;
+       case 4: v = 2; break;
+       case 8: v = 3; break;
+       default:
+               return -EINVAL;
+}

Indentation doesn't comply with CodingStyle.

Quoted 2 lines

+/* write v to register */
+--- end code ---

Additionally, I think that the examples are a bit difficult to read, one level of indentation would probably be better than the begin/end code markers. Thus, I propose the following incremental patch:

 Documentation/hwmon/sysfs-interface |   30 ++++++++++++++----------------
 1 file changed, 14 insertions(+), 16 deletions(-)
Documentation/hwmon/sysfs-interface +4 -16
@@ -450,22 +450,20 @@ continuous like for example a tempX_type
 written, -EINVAL should be returned.
 
 Example1, temp1_max, register is a signed 8 bit value (-128 - 127 degrees):
---- begin code ---
-long v = simple_strtol(buf, NULL, 10) / 1000;
-SENSORS_LIMIT(v, -128, 127);
-/* write v to register */
---- end code ---
+
+	long v = simple_strtol(buf, NULL, 10) / 1000;
+	v = SENSORS_LIMIT(v, -128, 127);
+	/* write v to register */
 
 Example2, fan divider setting, valid values 2, 4 and 8:
---- begin code ---
-unsigned long v = simple_strtoul(buf, NULL, 10);
 
-switch (v) {
-       case 2: v = 1; break;
-       case 4: v = 2; break;
-       case 8: v = 3; break;
-       default:
-               return -EINVAL;
-}
-/* write v to register */
---- end code ---

Documentation/hwmon/sysfs-interface continuous like for example a tempX_type · line 469

Quoted 10 lines
Documentation/hwmon/sysfs-interface +10 -0
+	unsigned long v = simple_strtoul(buf, NULL, 10);
+
+	switch (v) {
+	case 2: v = 1; break;
+	case 4: v = 2; break;
+	case 8: v = 3; break;
+	default:
+		return -EINVAL;
+	}
+	/* write v to register */

I agree with all changes, Mark pleaee apply:

Regards,

Hans

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#4 lore raw
In reply to Hans de Goede

Hi:

Quoted 7 lines · Jean Delvare

Hi Hans,

Quoted 4 lines · Hans de Goede

Here is a patch adding some text to the sysfs interface documentation on how settings written to sysfs attributes should be handled, focussing mainly on error handling. This version incorperates Jean's latest comments.

Quoted 5 lines
Quoted 1 line
Signed-off-by [email protected]

Thanks for doing this.

Applied to hwmon-2.6.git/testing, thanks.

Signature · 8 lines
Mark M. Hoffman
[email protected]


_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#5 lore raw
In reply to Hans de Goede

Hi Jean:

Quoted 7 lines
Quoted 6 lines · Jean Delvare

Additionally, I think that the examples are a bit difficult to read, one level of indentation would probably be better than the begin/end code markers. Thus, I propose the following incremental patch:

 Documentation/hwmon/sysfs-interface |   30 ++++++++++++++----------------
 1 file changed, 14 insertions(+), 16 deletions(-)
Quoted 3 lines · Hans de Goede

I agree with all changes, Mark pleaee apply:

Could you please re-generate this one against the hwmon testing tree and w/ a Signed-off-by?

Thanks & regards,

Signature · 8 lines
Mark M. Hoffman
[email protected]


_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#6 lore raw
In reply to Hans de Goede

Hi Hans,

Quoted 3 lines · Hans de Goede

Notice that this is what happens when you make a function look like a macro by giving it all caps names. Note: I'm not trying to talk my mistake right, just trying to explain how I came to the mistake. Maybe we should rename SENSORS_LIMIT?

David Brownell would agree:
http://lists.lm-sensors.org/pipermail/lm-sensors/2007-September/021304.html

And I do agree, too.

Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#7 lore raw
In reply to Hans de Goede

Hi Mark,

Quoted 3 lines · Mark M. Hoffman

Although, I suppose it would be easier for you and maybe Jean if I just publish a patch series myself. It shouldn't be too hard to script that up; I'll look into it.

I don't need it too much, as I am tracking the hwmon patches myself so my stack and yours are very similar; when I'm missing a patch, I cherry-pick it from git-web.

But I agree that it would be convenient to have the possibility for others to get all the patches as either a single patch or a patch series. For now I have been pointing developers to git-hwmon.patch in Andrew's tree, but it may become quickly out-of-date if Andrew doesn't release a new kernel in a while.

Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#8 lore raw
In reply to Hans de Goede

Hi All,

As discussed on the lm-sensors list, using the fixed scaling factors from the fscpos datasheet for the fscher and newer models as wel, was nood a good idea, as the actual scaling factors may be different and can be read from OEM DMI entries.

This patch changes the behaviour of the merged FSC familiy fschmd driver to be the same as the old standalone fscher driver for fscher and newer models, leaving the scaling to userspace.

This also preserves compatibility of existing sensors.conf files.

---

Jean, can you review this please?
Mark, can you send this to Linus for 2.6.24 please, otherwise we will have one official kernel release with different scaling for the voltage inputs of the fschmd compared to the next releases.

And yes I tested my patch this time.

Thanks & Regards,

Hans

As discussed on the lm-sensors list, using the fixed scaling factors from the fscpos datasheet for the fscher and newer models as wel, was nood a good idea, as the actual scaling factors may be different and can be read from OEM DMI entries.

This patch changes the behaviour of the merged FSC familiy fschmd driver to be the same as the old standalone fscher driver for fscher and newer models, leaving the scaling to userspace.

This also preserves compatibility of existing sensors.conf files.

drivers/hwmon/fschmd.c renamed from drivers/hwmon/fschmd.c~ +11 -2
diff -up linux-2.6.24-rc1-git7/drivers/hwmon/fschmd.c~ linux-2.6.24-rc1-git7/drivers/hwmon/fschmd.c
@@ -221,8 +221,17 @@ static ssize_t show_in_value(struct devi
 	int index = to_sensor_dev_attr(devattr)->index;
 	struct fschmd_data *data = fschmd_update_device(dev);
 
-	return sprintf(buf, "%d\n", (data->volt[index] *
-		max_reading[index] + 128) / 255);
+	/* Only use fixed scaling factor for the fscpos and fscscy, the newer
+	   models have the scaling factors stored in the BIOS DMI tables, so
+	   here we use a scale of 10mv / step like the standalone fscher driver
+	   does (did) and let userspace do the real scaling. There is a
+	   userspace utility called fscher-dmi2compute to generate the proper
+	   compute lines from the DMI info for the fscher and newer chips. */
+	if (data->kind == (fscpos - 1) || data->kind == (fscscy - 1))
+		return sprintf(buf, "%d\n", (data->volt[index] *
+			max_reading[index] + 128) / 255);
+	else
+		return sprintf(buf, "%d\n", data->volt[index] * 10);
 }
 
 

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

Acked-by
#9 lore raw
In reply to Hans de Goede
Quoted 17 lines · Hans de Goede

Hi All,

As discussed on the lm-sensors list, using the fixed scaling factors from the fscpos datasheet for the fscher and newer models as wel, was nood a good idea, as the actual scaling factors may be different and can be read from OEM DMI entries.

This patch changes the behaviour of the merged FSC familiy fschmd driver to be the same as the old standalone fscher driver for fscher and newer models, leaving the scaling to userspace.

This also preserves compatibility of existing sensors.conf files.

---

Quoted 7 lines

Jean, can you review this please?
Mark, can you send this to Linus for 2.6.24 please, otherwise we will have one official kernel release with different scaling for the voltage inputs of the fschmd compared to the next releases.

And yes I tested my patch this time.

Assuming that you definitely excluded the possibility to retrieve the DMI data from the kernel and you have additional information about the Heimdall and Heracles also using DMI data for the scaling, then the patch is correct:

Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#10 lore raw
In reply to Hans de Goede

Hi Hans,

Quoted 10 lines · Hans de Goede
Quoted 2 lines · Jean Delvare

Assuming that you definitely excluded the possibility to retrieve the DMI data from the kernel

Definitely is a big word, I've looked at the DMI parser currently in the kernel, tried to come up with a way to get the info there which would be more generic then just being an fschmd specific hack and couldn't. Then I slept a night on it and still couldn't come up with something clean, esp since there are many type 185 entries in the DMI table of FSC machines, of which we need only one.

Please take a look at this completely untested patch. It might need some cleanups before it's ready for submission, but is there any reason why something like this wouldn't do the job?

---
 drivers/firmware/dmi_scan.c |   50 ++++++++++++++++++++++++++++++++++++++++++-
 drivers/hwmon/fschmd.c      |    9 +++++++
 include/linux/dmi.h         |    3 ++
 3 files changed, 61 insertions(+), 1 deletion(-)
drivers/firmware/dmi_scan.c +49 -1
@@ -86,6 +86,50 @@ static int __init dmi_checksum(const u8 
 static char *dmi_ident[DMI_STRING_MAX];
 static LIST_HEAD(dmi_devices);
 int dmi_available;
+static u32 dmi_base;
+static u16 dmi_len;
+static u16 dmi_num;
+
+/* Similar to dmi_table, but for use at a later time */
+int dmi_walk(void (*decode)(const struct dmi_header *))
+{
+	u8 *buf, *data;
+	int i = 0;
+
+	if (!dmi_available)
+		return -1;
+
+	buf = ioremap(dmi_base, dmi_len);
+	if (buf = NULL)
+		return -1;
+
+	data = buf;
+
+	/*
+	 *	Stop when we see all the items the table claimed to have
+	 *	OR we run off the end of the table (also happens)
+	 */
+	while ((i < dmi_num) &&
+	       (data - buf + sizeof(struct dmi_header)) <= dmi_len) {
+		const struct dmi_header *dm = (const struct dmi_header *)data;
+
+		/*
+		 *  We want to know the total length (formated area and strings)
+		 *  before decoding to make sure we won't run off the table in
+		 *  dmi_decode or dmi_string
+		 */
+		data += dm->length;
+		while ((data - buf < dmi_len - 1) && (data[0] || data[1]))
+			data++;
+		if (data - buf < dmi_len - 1)
+			decode(dm);
+		data += 2;
+		i++;
+	}
+	iounmap(buf);
+	return 0;
+}
+EXPORT_SYMBOL_GPL(dmi_walk);
 
 /*
  *	Save a DMI string
@@ -287,8 +331,12 @@ static int __init dmi_present(const char
 			       buf[14] >> 4, buf[14] & 0xF);
 		else
 			printk(KERN_INFO "DMI present.\n");
-		if (dmi_table(base,len, num, dmi_decode) = 0)
+		if (dmi_table(base,len, num, dmi_decode) = 0) {
+			dmi_base = base;
+			dmi_len = len;
+			dmi_num = num;
 			return 0;
+		}
 	}
 	return 1;
 }
drivers/hwmon/fschmd.c +9 -0
@@ -41,6 +41,7 @@
 #include <linux/err.h>
 #include <linux/mutex.h>
 #include <linux/sysfs.h>
+#include <linux/dmi.h>
 
 /* Addresses to scan */
 static unsigned short normal_i2c[] = { 0x73, I2C_CLIENT_END };
@@ -768,8 +769,16 @@ static struct fschmd_data *fschmd_update
 	return data;
 }
 
+static void __init fschmd_get_dmi_data(const struct dmi_header *h)
+{
+	if (h->type = 185) {
+		/* Do stuff */
+	}
+}
+
 static int __init fschmd_init(void)
 {
+	dmi_walk(fschmd_get_dmi_data);
 	return i2c_add_driver(&fschmd_driver);
 }
 
include/linux/dmi.h +3 -0
@@ -78,6 +78,7 @@ extern const struct dmi_device * dmi_fin
 extern void dmi_scan_machine(void);
 extern int dmi_get_year(int field);
 extern int dmi_name_in_vendors(const char *str);
+extern int dmi_walk(void (*decode)(const struct dmi_header *));
 
 #else
 
@@ -87,6 +88,8 @@ static inline const struct dmi_device * 
 	const struct dmi_device *from) { return NULL; }
 static inline int dmi_get_year(int year) { return 0; }
 static inline int dmi_name_in_vendors(const char *s) { return 0; }
+static inline int dmi_walk(void (*decode)(const struct dmi_header *))
+	{ return -1; }
 
 #endif
 
Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#11 lore raw
In reply to Hans de Goede
Quoted 13 lines · Jean Delvare

Hi Hans,

Quoted 9 lines · Hans de Goede
Quoted 2 lines · Jean Delvare

Assuming that you definitely excluded the possibility to retrieve the DMI data from the kernel

Definitely is a big word, I've looked at the DMI parser currently in the kernel, tried to come up with a way to get the info there which would be more generic then just being an fschmd specific hack and couldn't. Then I slept a night on it and still couldn't come up with something clean, esp since there are many type 185 entries in the DMI table of FSC machines, of which we need only one.

Quoted 4 lines

Please take a look at this completely untested patch. It might need some cleanups before it's ready for submission, but is there any reason why something like this wouldn't do the job?

Good work Jean, yes that should do the job, I stared myself blind at adding a clean way to store the data for later retrieval to the existing __init parser, your way indeed will work and is much more generic.

I'll compile a kernel with the dmi_scan.c and dmi.h parts patched in and then start working on integrating this into fschmd.c

Question, what do we do if the dmi data doesn't get found, use some defaults I guess?

Mark,

Please drop the hwmon-fschmd-fscher-and-newer-no-fixed-scaling.patch from your queue (for now, might need to introduce it later if this won't work, but thats unlikely).

Thanks & Regards,

Hans

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#12 lore raw
In reply to Hans de Goede
Quoted 6 lines · Hans de Goede

Good work Jean, yes that should do the job, I stared myself blind at adding a clean way to store the data for later retrieval to the existing __init parser, your way indeed will work and is much more generic.

I'll compile a kernel with the dmi_scan.c and dmi.h parts patched in and then start working on integrating this into fschmd.c

Here's an updated version of my patch, with no code duplication this time. This should be easier to get this accepted upstream. To make the code even smaller, dmi_table() could be merged into dmi_present() but that's about it.

Quoted 2 lines

Question, what do we do if the dmi data doesn't get found, use some defaults I guess?

Don't export the voltage values at all? I'd rather not export anything than silently export values which may not be correct. But hopefully it will never happen so it doesn't really matter what we decide here.

* * * * *

Subject: dmi: Let drivers walk the DMI table

Let drivers walk the DMI table for their own needs. Some drivers need data stored in OEM-specific DMI records for proper operation.

---
 drivers/firmware/dmi_scan.c |   59 +++++++++++++++++++++++++++++++++----------
 include/linux/dmi.h         |    3 ++
 2 files changed, 49 insertions(+), 13 deletions(-)
drivers/firmware/dmi_scan.c +46 -13
@@ -36,18 +36,12 @@ static char * __init dmi_string(const st
  *	We have to be cautious here. We have seen BIOSes with DMI pointers
  *	pointing to completely the wrong place for example
  */
-static int __init dmi_table(u32 base, int len, int num,
-			    void (*decode)(const struct dmi_header *))
+static void __dmi_table(u8 *buf, int len, int num,
+			void (*decode)(const struct dmi_header *))
 {
-	u8 *buf, *data;
+	u8 *data = buf;
 	int i = 0;
 
-	buf = dmi_ioremap(base, len);
-	if (buf = NULL)
-		return -1;
-
-	data = buf;
-
 	/*
 	 *	Stop when we see all the items the table claimed to have
 	 *	OR we run off the end of the table (also happens)
@@ -68,6 +62,19 @@ static int __init dmi_table(u32 base, in
 		data += 2;
 		i++;
 	}
+}
+
+static int __init dmi_table(u32 base, int len, int num,
+			    void (*decode)(const struct dmi_header *))
+{
+	u8 *buf;
+
+	buf = dmi_ioremap(base, len);
+	if (buf = NULL)
+		return -1;
+
+	__dmi_table(buf, len, num, decode);
+
 	dmi_iounmap(buf, len);
 	return 0;
 }
@@ -86,6 +93,9 @@ static int __init dmi_checksum(const u8 
 static char *dmi_ident[DMI_STRING_MAX];
 static LIST_HEAD(dmi_devices);
 int dmi_available;
+static u32 dmi_base;
+static u16 dmi_len;
+static u16 dmi_num;
 
 /*
  *	Save a DMI string
@@ -273,9 +283,9 @@ static int __init dmi_present(const char
 
 	memcpy_fromio(buf, p, 15);
 	if ((memcmp(buf, "_DMI_", 5) = 0) && dmi_checksum(buf)) {
-		u16 num = (buf[13] << 8) | buf[12];
-		u16 len = (buf[7] << 8) | buf[6];
-		u32 base = (buf[11] << 24) | (buf[10] << 16) |
+		dmi_num = (buf[13] << 8) | buf[12];
+		dmi_len = (buf[7] << 8) | buf[6];
+		dmi_base = (buf[11] << 24) | (buf[10] << 16) |
 			(buf[9] << 8) | buf[8];
 
 		/*
@@ -287,7 +297,7 @@ static int __init dmi_present(const char
 			       buf[14] >> 4, buf[14] & 0xF);
 		else
 			printk(KERN_INFO "DMI present.\n");
-		if (dmi_table(base,len, num, dmi_decode) = 0)
+		if (dmi_table(dmi_base, dmi_len, dmi_num, dmi_decode) = 0)
 			return 0;
 	}
 	return 1;
@@ -470,3 +480,26 @@ int dmi_get_year(int field)
 	return year;
 }
 
+/**
+ *	dmi_walk - Walk the DMI table and get called back for every record
+ *	@decode: Callback function
+ *
+ *	Returns -1 when the DMI table can't be reached, 0 on success.
+ */
+int dmi_walk(void (*decode)(const struct dmi_header *))
+{
+	u8 *buf;
+
+	if (!dmi_available)
+		return -1;
+
+	buf = ioremap(dmi_base, dmi_len);
+	if (buf = NULL)
+		return -1;
+
+	__dmi_table(buf, dmi_len, dmi_num, decode);
+
+	iounmap(buf);
+	return 0;
+}
+EXPORT_SYMBOL_GPL(dmi_walk);
include/linux/dmi.h +3 -0
@@ -78,6 +78,7 @@ extern const struct dmi_device * dmi_fin
 extern void dmi_scan_machine(void);
 extern int dmi_get_year(int field);
 extern int dmi_name_in_vendors(const char *str);
+extern int dmi_walk(void (*decode)(const struct dmi_header *));
 
 #else
 
@@ -87,6 +88,8 @@ static inline const struct dmi_device * 
 	const struct dmi_device *from) { return NULL; }
 static inline int dmi_get_year(int year) { return 0; }
 static inline int dmi_name_in_vendors(const char *s) { return 0; }
+static inline int dmi_walk(void (*decode)(const struct dmi_header *))
+	{ return -1; }
 
 #endif
 
Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#13 lore raw
In reply to Hans de Goede
Quoted 5 lines · Jean Delvare
Quoted 4 lines · Hans de Goede

Good work Jean, yes that should do the job, I stared myself blind at adding a clean way to store the data for later retrieval to the existing __init parser, your way indeed will work and is much more generic.

Quoted 8 lines
Quoted 2 lines

I'll compile a kernel with the dmi_scan.c and dmi.h parts patched in and then start working on integrating this into fschmd.c

Here's an updated version of my patch, with no code duplication this time. This should be easier to get this accepted upstream. To make the code even smaller, dmi_table() could be merged into dmi_present() but that's about it.

Looks good, I found inconsistency though, in essence the dmi_table() and dmi_walk() are the same, (except for dmi_ioremap versus ioremap ofcourse) but for one you just use the base, len and number of items stored in global variables, while for the other you pass those same global variables through parameters, for consistency sake I think you should to both the same.

Quoted 7 lines
Quoted 2 lines

Question, what do we do if the dmi data doesn't get found, use some defaults I guess?

Don't export the voltage values at all? I'd rather not export anything than silently export values which may not be correct. But hopefully it will never happen so it doesn't really matter what we decide here.

I would rather just printk a warning and use some sane defaults in this scenario. We must definetively alert the user, that I agree with. The problem with a printk is ofcourse that it will hardly be noticed.

Regards,

Hans

Quoted 128 lines

* * * * *

Subject: dmi: Let drivers walk the DMI table

Let drivers walk the DMI table for their own needs. Some drivers need data stored in OEM-specific DMI records for proper operation.

---
 drivers/firmware/dmi_scan.c |   59 +++++++++++++++++++++++++++++++++----------
 include/linux/dmi.h         |    3 ++
 2 files changed, 49 insertions(+), 13 deletions(-)
drivers/firmware/dmi_scan.c +46 -13
@@ -36,18 +36,12 @@ static char * __init dmi_string(const st
  *	We have to be cautious here. We have seen BIOSes with DMI pointers
  *	pointing to completely the wrong place for example
  */
-static int __init dmi_table(u32 base, int len, int num,
-			    void (*decode)(const struct dmi_header *))
+static void __dmi_table(u8 *buf, int len, int num,
+			void (*decode)(const struct dmi_header *))
 {
-	u8 *buf, *data;
+	u8 *data = buf;
 	int i = 0;
 
-	buf = dmi_ioremap(base, len);
-	if (buf = NULL)
-		return -1;
-
-	data = buf;
-
 	/*
 	 *	Stop when we see all the items the table claimed to have
 	 *	OR we run off the end of the table (also happens)
@@ -68,6 +62,19 @@ static int __init dmi_table(u32 base, in
 		data += 2;
 		i++;
 	}
+}
+
+static int __init dmi_table(u32 base, int len, int num,
+			    void (*decode)(const struct dmi_header *))
+{
+	u8 *buf;
+
+	buf = dmi_ioremap(base, len);
+	if (buf = NULL)
+		return -1;
+
+	__dmi_table(buf, len, num, decode);
+
 	dmi_iounmap(buf, len);
 	return 0;
 }
@@ -86,6 +93,9 @@ static int __init dmi_checksum(const u8 
 static char *dmi_ident[DMI_STRING_MAX];
 static LIST_HEAD(dmi_devices);
 int dmi_available;
+static u32 dmi_base;
+static u16 dmi_len;
+static u16 dmi_num;
 
 /*
  *	Save a DMI string
@@ -273,9 +283,9 @@ static int __init dmi_present(const char
 
 	memcpy_fromio(buf, p, 15);
 	if ((memcmp(buf, "_DMI_", 5) = 0) && dmi_checksum(buf)) {
-		u16 num = (buf[13] << 8) | buf[12];
-		u16 len = (buf[7] << 8) | buf[6];
-		u32 base = (buf[11] << 24) | (buf[10] << 16) |
+		dmi_num = (buf[13] << 8) | buf[12];
+		dmi_len = (buf[7] << 8) | buf[6];
+		dmi_base = (buf[11] << 24) | (buf[10] << 16) |
 			(buf[9] << 8) | buf[8];
 
 		/*
@@ -287,7 +297,7 @@ static int __init dmi_present(const char
 			       buf[14] >> 4, buf[14] & 0xF);
 		else
 			printk(KERN_INFO "DMI present.\n");
-		if (dmi_table(base,len, num, dmi_decode) = 0)
+		if (dmi_table(dmi_base, dmi_len, dmi_num, dmi_decode) = 0)
 			return 0;
 	}
 	return 1;
@@ -470,3 +480,26 @@ int dmi_get_year(int field)
 	return year;
 }
 
+/**
+ *	dmi_walk - Walk the DMI table and get called back for every record
+ *	@decode: Callback function
+ *
+ *	Returns -1 when the DMI table can't be reached, 0 on success.
+ */
+int dmi_walk(void (*decode)(const struct dmi_header *))
+{
+	u8 *buf;
+
+	if (!dmi_available)
+		return -1;
+
+	buf = ioremap(dmi_base, dmi_len);
+	if (buf = NULL)
+		return -1;
+
+	__dmi_table(buf, dmi_len, dmi_num, decode);
+
+	iounmap(buf);
+	return 0;
+}
+EXPORT_SYMBOL_GPL(dmi_walk);
include/linux/dmi.h +1 -0
@@ -78,6 +78,7 @@ extern const struct dmi_device * dmi_fin
 extern void dmi_scan_machine(void);
 extern int dmi_get_year(int field);
 extern int dmi_name_in_vendors(const char *str);
+extern int dmi_walk(void (*decode)(const struct dmi_header *));
 
 #else
 

include/linux/dmi.h static inline const struct dmi_device * · line 95

Quoted 8 lines
include/linux/dmi.h +2 -0
@@ -87,6 +88,8 @@ static inline const struct dmi_device * 
 	const struct dmi_device *from) { return NULL; }
 static inline int dmi_get_year(int year) { return 0; }
 static inline int dmi_name_in_vendors(const char *s) { return 0; }
+static inline int dmi_walk(void (*decode)(const struct dmi_header *))
+	{ return -1; }
 
 #endif
 

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#14 lore raw
In reply to Hans de Goede

Hi Hans,

Quoted 14 lines · Hans de Goede
Quoted 5 lines · Jean Delvare
Quoted 4 lines · Hans de Goede

Good work Jean, yes that should do the job, I stared myself blind at adding a clean way to store the data for later retrieval to the existing __init parser, your way indeed will work and is much more generic.

Quoted 7 lines
Quoted 2 lines

I'll compile a kernel with the dmi_scan.c and dmi.h parts patched in and then start working on integrating this into fschmd.c

Here's an updated version of my patch, with no code duplication this time. This should be easier to get this accepted upstream. To make the code even smaller, dmi_table() could be merged into dmi_present() but that's about it.

Quoted 5 lines

Looks good, I found inconsistency though, in essence the dmi_table() and dmi_walk() are the same, (except for dmi_ioremap versus ioremap ofcourse) but for one you just use the base, len and number of items stored in global variables, while for the other you pass those same global variables through parameters, for consistency sake I think you should to both the same.

That's an asymmetry rather than an inconsistency. There are two reasons for it, firstly I avoid using global variables when I don't have to, secondly this happened to make the patch smaller. It is of course possible to use the global variables dmi_base, dmi_len and dmi_num in dmi_table() rather than passing them as parameters; doing so makes the binary code slightly smaller. I'm attaching a version of the patch that does this, together with function renames to make it look better. If you like this one, I could send it upstream for review and comments.

Quoted 11 lines
Quoted 7 lines
Quoted 2 lines

Question, what do we do if the dmi data doesn't get found, use some defaults I guess?

Don't export the voltage values at all? I'd rather not export anything than silently export values which may not be correct. But hopefully it will never happen so it doesn't really matter what we decide here.

I would rather just printk a warning and use some sane defaults in this scenario. We must definetively alert the user, that I agree with. The problem with a printk is ofcourse that it will hardly be noticed.

That's my worry as well. But that's your driver, you'll do the support for it so it's really up to you how you want to handle this unlikely situation.

* * * * *

Subject: dmi: Let drivers walk the DMI table

Let drivers walk the DMI table for their own needs. Some drivers need data stored in OEM-specific DMI records for proper operation.

---
 drivers/firmware/dmi_scan.c |   61 +++++++++++++++++++++++++++++++++----------
 include/linux/dmi.h         |    3 ++
 2 files changed, 50 insertions(+), 14 deletions(-)
drivers/firmware/dmi_scan.c +47 -14
@@ -36,18 +36,12 @@ static char * __init dmi_string(const st
  *	We have to be cautious here. We have seen BIOSes with DMI pointers
  *	pointing to completely the wrong place for example
  */
-static int __init dmi_table(u32 base, int len, int num,
-			    void (*decode)(const struct dmi_header *))
+static void dmi_table(u8 *buf, int len, int num,
+		      void (*decode)(const struct dmi_header *))
 {
-	u8 *buf, *data;
+	u8 *data = buf;
 	int i = 0;
 
-	buf = dmi_ioremap(base, len);
-	if (buf = NULL)
-		return -1;
-
-	data = buf;
-
 	/*
 	 *	Stop when we see all the items the table claimed to have
 	 *	OR we run off the end of the table (also happens)
@@ -68,7 +62,23 @@ static int __init dmi_table(u32 base, in
 		data += 2;
 		i++;
 	}
-	dmi_iounmap(buf, len);
+}
+
+static u32 dmi_base;
+static u16 dmi_len;
+static u16 dmi_num;
+
+static int __init dmi_walk_early(void (*decode)(const struct dmi_header *))
+{
+	u8 *buf;
+
+	buf = dmi_ioremap(dmi_base, dmi_len);
+	if (buf = NULL)
+		return -1;
+
+	dmi_table(buf, dmi_len, dmi_num, decode);
+
+	dmi_iounmap(buf, dmi_len);
 	return 0;
 }
 
@@ -273,9 +283,9 @@ static int __init dmi_present(const char
 
 	memcpy_fromio(buf, p, 15);
 	if ((memcmp(buf, "_DMI_", 5) = 0) && dmi_checksum(buf)) {
-		u16 num = (buf[13] << 8) | buf[12];
-		u16 len = (buf[7] << 8) | buf[6];
-		u32 base = (buf[11] << 24) | (buf[10] << 16) |
+		dmi_num = (buf[13] << 8) | buf[12];
+		dmi_len = (buf[7] << 8) | buf[6];
+		dmi_base = (buf[11] << 24) | (buf[10] << 16) |
 			(buf[9] << 8) | buf[8];
 
 		/*
@@ -287,7 +297,7 @@ static int __init dmi_present(const char
 			       buf[14] >> 4, buf[14] & 0xF);
 		else
 			printk(KERN_INFO "DMI present.\n");
-		if (dmi_table(base,len, num, dmi_decode) = 0)
+		if (dmi_walk_early(dmi_decode) = 0)
 			return 0;
 	}
 	return 1;
@@ -470,3 +480,26 @@ int dmi_get_year(int field)
 	return year;
 }
 
+/**
+ *	dmi_walk - Walk the DMI table and get called back for every record
+ *	@decode: Callback function
+ *
+ *	Returns -1 when the DMI table can't be reached, 0 on success.
+ */
+int dmi_walk(void (*decode)(const struct dmi_header *))
+{
+	u8 *buf;
+
+	if (!dmi_available)
+		return -1;
+
+	buf = ioremap(dmi_base, dmi_len);
+	if (buf = NULL)
+		return -1;
+
+	dmi_table(buf, dmi_len, dmi_num, decode);
+
+	iounmap(buf);
+	return 0;
+}
+EXPORT_SYMBOL_GPL(dmi_walk);
include/linux/dmi.h +3 -0
@@ -78,6 +78,7 @@ extern const struct dmi_device * dmi_fin
 extern void dmi_scan_machine(void);
 extern int dmi_get_year(int field);
 extern int dmi_name_in_vendors(const char *str);
+extern int dmi_walk(void (*decode)(const struct dmi_header *));
 
 #else
 
@@ -87,6 +88,8 @@ static inline const struct dmi_device * 
 	const struct dmi_device *from) { return NULL; }
 static inline int dmi_get_year(int year) { return 0; }
 static inline int dmi_name_in_vendors(const char *s) { return 0; }
+static inline int dmi_walk(void (*decode)(const struct dmi_header *))
+	{ return -1; }
 
 #endif
 
Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#15 lore raw
In reply to Hans de Goede
Quoted 21 lines · Jean Delvare

Hi Hans,

Quoted 12 lines · Hans de Goede
Quoted 11 lines · Jean Delvare
Quoted 6 lines · Hans de Goede

Good work Jean, yes that should do the job, I stared myself blind at adding a clean way to store the data for later retrieval to the existing __init parser, your way indeed will work and is much more generic.

I'll compile a kernel with the dmi_scan.c and dmi.h parts patched in and then start working on integrating this into fschmd.c

Here's an updated version of my patch, with no code duplication this time. This should be easier to get this accepted upstream. To make the code even smaller, dmi_table() could be merged into dmi_present() but that's about it.

Quoted 5 lines

Looks good, I found inconsistency though, in essence the dmi_table() and dmi_walk() are the same, (except for dmi_ioremap versus ioremap ofcourse) but for one you just use the base, len and number of items stored in global variables, while for the other you pass those same global variables through parameters, for consistency sake I think you should to both the same.

Quoted 9 lines

That's an asymmetry rather than an inconsistency. There are two reasons for it, firstly I avoid using global variables when I don't have to, secondly this happened to make the patch smaller. It is of course possible to use the global variables dmi_base, dmi_len and dmi_num in dmi_table() rather than passing them as parameters; doing so makes the binary code slightly smaller. I'm attaching a version of the patch that does this, together with function renames to make it look better. If you like this one, I could send it upstream for review and comments.

I like this one, you may want to wait with sending it upstream till I've actually tested if it solves the problem at hand though.

I'm currently rather busy at work, so this may take a week or so.

Regards,

Hans

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#16 lore raw
In reply to Hans de Goede

Hi Jean et all,

I finally found / made some time to try out using your below patch in the fschmd driver. Your patch works as advertised, I'll send a mail with a patch to the fschmd driver using its functionality right after this mail. I guess this is 2.6.25 material and that we should queue both patches for 2.6.25.

Thank & Regards,

hans

Quoted 121 lines · Jean Delvare

Subject: dmi: Let drivers walk the DMI table

Let drivers walk the DMI table for their own needs. Some drivers need data stored in OEM-specific DMI records for proper operation.

---
 drivers/firmware/dmi_scan.c |   61 +++++++++++++++++++++++++++++++++----------
 include/linux/dmi.h         |    3 ++
 2 files changed, 50 insertions(+), 14 deletions(-)
drivers/firmware/dmi_scan.c +47 -14
@@ -36,18 +36,12 @@ static char * __init dmi_string(const st
  *	We have to be cautious here. We have seen BIOSes with DMI pointers
  *	pointing to completely the wrong place for example
  */
-static int __init dmi_table(u32 base, int len, int num,
-			    void (*decode)(const struct dmi_header *))
+static void dmi_table(u8 *buf, int len, int num,
+		      void (*decode)(const struct dmi_header *))
 {
-	u8 *buf, *data;
+	u8 *data = buf;
 	int i = 0;
 
-	buf = dmi_ioremap(base, len);
-	if (buf = NULL)
-		return -1;
-
-	data = buf;
-
 	/*
 	 *	Stop when we see all the items the table claimed to have
 	 *	OR we run off the end of the table (also happens)
@@ -68,7 +62,23 @@ static int __init dmi_table(u32 base, in
 		data += 2;
 		i++;
 	}
-	dmi_iounmap(buf, len);
+}
+
+static u32 dmi_base;
+static u16 dmi_len;
+static u16 dmi_num;
+
+static int __init dmi_walk_early(void (*decode)(const struct dmi_header *))
+{
+	u8 *buf;
+
+	buf = dmi_ioremap(dmi_base, dmi_len);
+	if (buf = NULL)
+		return -1;
+
+	dmi_table(buf, dmi_len, dmi_num, decode);
+
+	dmi_iounmap(buf, dmi_len);
 	return 0;
 }
 
@@ -273,9 +283,9 @@ static int __init dmi_present(const char
 
 	memcpy_fromio(buf, p, 15);
 	if ((memcmp(buf, "_DMI_", 5) = 0) && dmi_checksum(buf)) {
-		u16 num = (buf[13] << 8) | buf[12];
-		u16 len = (buf[7] << 8) | buf[6];
-		u32 base = (buf[11] << 24) | (buf[10] << 16) |
+		dmi_num = (buf[13] << 8) | buf[12];
+		dmi_len = (buf[7] << 8) | buf[6];
+		dmi_base = (buf[11] << 24) | (buf[10] << 16) |
 			(buf[9] << 8) | buf[8];
 
 		/*
@@ -287,7 +297,7 @@ static int __init dmi_present(const char
 			       buf[14] >> 4, buf[14] & 0xF);
 		else
 			printk(KERN_INFO "DMI present.\n");
-		if (dmi_table(base,len, num, dmi_decode) = 0)
+		if (dmi_walk_early(dmi_decode) = 0)
 			return 0;
 	}
 	return 1;
@@ -470,3 +480,26 @@ int dmi_get_year(int field)
 	return year;
 }
 
+/**
+ *	dmi_walk - Walk the DMI table and get called back for every record
+ *	@decode: Callback function
+ *
+ *	Returns -1 when the DMI table can't be reached, 0 on success.
+ */
+int dmi_walk(void (*decode)(const struct dmi_header *))
+{
+	u8 *buf;
+
+	if (!dmi_available)
+		return -1;
+
+	buf = ioremap(dmi_base, dmi_len);
+	if (buf = NULL)
+		return -1;
+
+	dmi_table(buf, dmi_len, dmi_num, decode);
+
+	iounmap(buf);
+	return 0;
+}
+EXPORT_SYMBOL_GPL(dmi_walk);
include/linux/dmi.h +1 -0
@@ -78,6 +78,7 @@ extern const struct dmi_device * dmi_fin
 extern void dmi_scan_machine(void);
 extern int dmi_get_year(int field);
 extern int dmi_name_in_vendors(const char *str);
+extern int dmi_walk(void (*decode)(const struct dmi_header *));
 
 #else
 

include/linux/dmi.h static inline const struct dmi_device * · line 95

Quoted 8 lines
include/linux/dmi.h +2 -0
@@ -87,6 +88,8 @@ static inline const struct dmi_device * 
 	const struct dmi_device *from) { return NULL; }
 static inline int dmi_get_year(int year) { return 0; }
 static inline int dmi_name_in_vendors(const char *s) { return 0; }
+static inline int dmi_walk(void (*decode)(const struct dmi_header *))
+	{ return -1; }
 
 #endif
 

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#17 lore raw
In reply to Hans de Goede

Hi Hans,

Quoted 4 lines · Hans de Goede

I finally found / made some time to try out using your below patch in the fschmd driver. Your patch works as advertised, I'll send a mail with a patch to the fschmd driver using its functionality right after this mail. I guess this is 2.6.25 material and that we should queue both patches for 2.6.25.

OK, great. I agree that this is 2.6.25 material

My patch is not hwmon-specific so even if it is easier to push it through Mark's hwmon tree, I'd like to know what other developers think about it; I'll post it to LKML for comments later today.

Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#18 lore raw
In reply to Hans de Goede

Hi All,

As promised, this patch adds support for the watchdog part found in _all_ supported FSC sensor chips. Once this patch is in we can deprecate the old fscpos and fscher drivers.

Regards,

Hans

This patch adds support for the watchdog part found in _all_ supported FSC sensor chips.

drivers/hwmon/Kconfig renamed from drivers/hwmon/Kconfig.orig +3 -2
diff -up vanilla-2.6.26-rc8/drivers/hwmon/Kconfig.orig vanilla-2.6.26-rc8/drivers/hwmon/Kconfig
@@ -292,10 +292,11 @@ config SENSORS_FSCHMD
 	depends on X86 && I2C && EXPERIMENTAL
 	help
 	  If you say yes here you get support for various Fujitsu Siemens
-	  Computers sensor chips.
+	  Computers sensor chips, including support for the integrated
+	  watchdog.
 
 	  This is a new merged driver for FSC sensor chips which is intended
-	  as a replacment for the fscpos, fscscy and fscher drivers and adds
+	  as a replacement for the fscpos, fscscy and fscher drivers and adds
 	  support for several other FCS sensor chips.
 
 	  This driver can also be built as a module.  If so, the module
drivers/hwmon/fschmd.c renamed from drivers/hwmon/fschmd.c.orig +390 -19

524 lines not on this page · raw message

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#19 lore raw
In reply to Hans de Goede

Hi Jean,

<Trying to win the competition for the patch with the longest name :) >

This patch fixes a number of cases where things were not properly cleaned up when acpi_check_resource_conflict() returned an error, causing oopses such as the one reported here:
https://bugzilla.redhat.com/show_bug.cgi?id=483208

Regards,

Hans

This patch fixes a number of cases where things were not properly cleaned up when acpi_check_resource_conflict() returned an error, causing oopses such as the one reported here:
https://bugzilla.redhat.com/show_bug.cgi?id=483208

drivers/hwmon/f71882fg.c renamed from drivers/hwmon/f71882fg.c~ +1 -1
diff -up linux-2.6.28.x86_64/drivers/hwmon/f71882fg.c~ linux-2.6.28.x86_64/drivers/hwmon/f71882fg.c
@@ -1932,7 +1932,7 @@ static int __init f71882fg_device_add(un
 	res.name = f71882fg_pdev->name;
 	err = acpi_check_resource_conflict(&res);
 	if (err)
-		return err;
+		goto exit_device_put;
 
 	err = platform_device_add_resources(f71882fg_pdev, &res, 1);
 	if (err) {
drivers/hwmon/vt1211.c renamed from drivers/hwmon/vt1211.c~ +1 -1
diff -up linux-2.6.28.x86_64/drivers/hwmon/vt1211.c~ linux-2.6.28.x86_64/drivers/hwmon/vt1211.c
@@ -1262,7 +1262,7 @@ static int __init vt1211_device_add(unsi
 	res.name = pdev->name;
 	err = acpi_check_resource_conflict(&res);
 	if (err)
-		goto EXIT;
+		goto EXIT_DEV_PUT;
 
 	err = platform_device_add_resources(pdev, &res, 1);
 	if (err) {
drivers/hwmon/w83627ehf.c renamed from drivers/hwmon/w83627ehf.c~ +1 -1
diff -up linux-2.6.28.x86_64/drivers/hwmon/w83627ehf.c~ linux-2.6.28.x86_64/drivers/hwmon/w83627ehf.c
@@ -1548,7 +1548,7 @@ static int __init sensors_w83627ehf_init
 
 	err = acpi_check_resource_conflict(&res);
 	if (err)
-		goto exit;
+		goto exit_device_put;
 
 	err = platform_device_add_resources(pdev, &res, 1);
 	if (err) {

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

Applied
#20 lore raw
In reply to Hans de Goede
Quoted 10 lines · Hans de Goede

Hi Jean,

<Trying to win the competition for the patch with the longest name :) >

This patch fixes a number of cases where things were not properly cleaned up when acpi_check_resource_conflict() returned an error, causing oopses such as the one reported here:
https://bugzilla.redhat.com/show_bug.cgi?idH3208

Applied, thanks.

Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors