Skip to contentSkip to conversation

libsensors: Detect OpenFirmware hwmon

PATCH In review Darrick J. Wong 2 participants 4 messages Mar 31, 2008 – Apr 11, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 libsensors: Detect OpenFirmware hwmon

On a QS22 blade, the BMC containing the (ibmpex) power meters is enumerated via Open Firmware. Check for "of_platform" to handle this case.

Index: lm-sensors-3.0.0/lib/sysfs.c
=================================--- lm-sensors-3.0.0.orig/lib/sysfs.c 2008-03-31 16:08:07.000000000 -0700
+++ lm-sensors-3.0.0/lib/sysfs.c 2008-03-31 16:08:14.000000000 -0700
@@ -532,7 +532,8 @@
entry.chip.bus.type = SENSORS_BUS_TYPE_PCI; entry.chip.bus.nr = 0;
} else

-	if ((!subsys || !strcmp(subsys, "platform"))) {
+	if ((!subsys || !strcmp(subsys, "platform") ||

+ !strcmp(subsys, "of_platform"))) {
/* must be new ISA (platform driver) */
if (sscanf(dev_name, "%*[a-z0-9_].%d", &entry.chip.addr) != 1)
entry.chip.addr = 0;

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

#1 lore raw

Hi Darrick,

Quoted 9 lines · Darrick J. Wong

On a QS22 blade, the BMC containing the (ibmpex) power meters is enumerated via Open Firmware. Check for "of_platform" to handle this case.

Index: lm-sensors-3.0.0/lib/sysfs.c
=================================> --- lm-sensors-3.0.0.orig/lib/sysfs.c 2008-03-31 16:08:07.000000000 -0700
+++ lm-sensors-3.0.0/lib/sysfs.c 2008-03-31 16:08:14.000000000 -0700

Review line 539

Quoted 9 lines
(quoted diff) +2 -1
@@ -532,7 +532,8 @@
 		entry.chip.bus.type = SENSORS_BUS_TYPE_PCI;
 		entry.chip.bus.nr = 0;
 	} else
-	if ((!subsys || !strcmp(subsys, "platform"))) {
+	if ((!subsys || !strcmp(subsys, "platform") ||
+			!strcmp(subsys, "of_platform"))) {
 		/* must be new ISA (platform driver) */
 		if (sscanf(dev_name, "%*[a-z0-9_].%d", &entry.chip.addr) != 1)
 			entry.chip.addr = 0;

We can of course apply this but I am wondering if this is needed in the long run... I seem to recall a discussion about of_platform being soon deprecated and Open Firmware-based devices would just use platform. Ah, here it is:

http://lists.lm-sensors.org/pipermail/i2c/2007-December/002548.html

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 Darrick J. Wong
Quoted 6 lines · Jean Delvare

We can of course apply this but I am wondering if this is needed in the long run... I seem to recall a discussion about of_platform being soon deprecated and Open Firmware-based devices would just use platform. Ah, here it is:

http://lists.lm-sensors.org/pipermail/i2c/2007-December/002548.html

I think it would be useful to pick up of_platform devices even if they get reclassified as regular platform devices because a new libsensors may some day encounter an old kernel.

I, err, committed it to test commit priviledges. Oops. I will pull it out if there exist really strong objections to this code.

(2.6.25-rc8 still has of_platform in it...)

--D

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

#3 lore raw
In reply to Darrick J. Wong
Quoted 9 lines · Darrick J. Wong
Quoted 6 lines · Jean Delvare

We can of course apply this but I am wondering if this is needed in the long run... I seem to recall a discussion about of_platform being soon deprecated and Open Firmware-based devices would just use platform. Ah, here it is:

http://lists.lm-sensors.org/pipermail/i2c/2007-December/002548.html

Quoted 8 lines

I think it would be useful to pick up of_platform devices even if they get reclassified as regular platform devices because a new libsensors may some day encounter an old kernel.

I, err, committed it to test commit priviledges. Oops. I will pull it out if there exist really strong objections to this code.

(2.6.25-rc8 still has of_platform in it...)

It's all OK with me, no worry.

Signature · 6 lines
Jean Delvare

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