* [lm-sensors] [PATCH 3/6] libsensors4: Don't substitute the isa bus
@ 2007-08-15 15:40 Jean Delvare
2007-08-15 16:56 ` [lm-sensors] [PATCH 3/6] libsensors4: Don't substitute the isa Hans de Goede
2007-08-16 7:40 ` Jean Delvare
0 siblings, 2 replies; 3+ messages in thread
From: Jean Delvare @ 2007-08-15 15:40 UTC (permalink / raw)
To: lm-sensors
Don't handle the isa bus in sensors_parse_i2cbus_name(). We really
don't need to, as there is a single ISA bus, there's no need for
substituting anything.
---
lib/data.c | 4 ----
lib/sysfs.c | 10 ++++------
2 files changed, 4 insertions(+), 10 deletions(-)
--- lm-sensors-3.orig/lib/data.c 2007-08-15 12:14:51.000000000 +0200
+++ lm-sensors-3/lib/data.c 2007-08-15 12:14:55.000000000 +0200
@@ -190,10 +190,6 @@ int sensors_parse_i2cbus_name(const char
{
int i;
- if (! strcmp(name,"isa")) {
- *res = SENSORS_CHIP_NAME_BUS_ISA;
- return 0;
- }
if (strncmp(name,"i2c-",4)) {
return -SENSORS_ERR_BUS_NAME;
}
--- lm-sensors-3.orig/lib/sysfs.c 2007-08-15 12:14:51.000000000 +0200
+++ lm-sensors-3/lib/sysfs.c 2007-08-15 12:14:55.000000000 +0200
@@ -374,17 +374,15 @@ int sensors_read_sysfs_bus(void)
(attr = sysfs_get_device_attr(dev, "name"))))
continue;
+ if (sscanf(clsdev->name, "i2c-%d", &entry.number) != 1 ||
+ entry.number = 9191) /* legacy ISA */
+ continue;
+
/* NB: attr->value[attr->len-1] = '\n'; chop that off */
entry.adapter = strndup(attr->value, attr->len - 1);
if (!entry.adapter)
sensors_fatal_error(__FUNCTION__, "out of memory");
- if (!strncmp(entry.adapter, "ISA ", 4)) {
- entry.number = SENSORS_CHIP_NAME_BUS_ISA;
- } else if (sscanf(clsdev->name, "i2c-%d", &entry.number) != 1) {
- continue;
- }
-
sensors_add_proc_bus(&entry);
}
--
Jean Delvare
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [lm-sensors] [PATCH 3/6] libsensors4: Don't substitute the isa
2007-08-15 15:40 [lm-sensors] [PATCH 3/6] libsensors4: Don't substitute the isa bus Jean Delvare
@ 2007-08-15 16:56 ` Hans de Goede
2007-08-16 7:40 ` Jean Delvare
1 sibling, 0 replies; 3+ messages in thread
From: Hans de Goede @ 2007-08-15 16:56 UTC (permalink / raw)
To: lm-sensors
Jean Delvare wrote:
> Don't handle the isa bus in sensors_parse_i2cbus_name(). We really
> don't need to, as there is a single ISA bus, there's no need for
> substituting anything.
>
This one requires deeper knowledge of libsensors then I have.
I can still test it though :)
Regards,
Hans
> ---
> lib/data.c | 4 ----
> lib/sysfs.c | 10 ++++------
> 2 files changed, 4 insertions(+), 10 deletions(-)
>
> --- lm-sensors-3.orig/lib/data.c 2007-08-15 12:14:51.000000000 +0200
> +++ lm-sensors-3/lib/data.c 2007-08-15 12:14:55.000000000 +0200
> @@ -190,10 +190,6 @@ int sensors_parse_i2cbus_name(const char
> {
> int i;
>
> - if (! strcmp(name,"isa")) {
> - *res = SENSORS_CHIP_NAME_BUS_ISA;
> - return 0;
> - }
> if (strncmp(name,"i2c-",4)) {
> return -SENSORS_ERR_BUS_NAME;
> }
> --- lm-sensors-3.orig/lib/sysfs.c 2007-08-15 12:14:51.000000000 +0200
> +++ lm-sensors-3/lib/sysfs.c 2007-08-15 12:14:55.000000000 +0200
> @@ -374,17 +374,15 @@ int sensors_read_sysfs_bus(void)
> (attr = sysfs_get_device_attr(dev, "name"))))
> continue;
>
> + if (sscanf(clsdev->name, "i2c-%d", &entry.number) != 1 ||
> + entry.number = 9191) /* legacy ISA */
> + continue;
> +
> /* NB: attr->value[attr->len-1] = '\n'; chop that off */
> entry.adapter = strndup(attr->value, attr->len - 1);
> if (!entry.adapter)
> sensors_fatal_error(__FUNCTION__, "out of memory");
>
> - if (!strncmp(entry.adapter, "ISA ", 4)) {
> - entry.number = SENSORS_CHIP_NAME_BUS_ISA;
> - } else if (sscanf(clsdev->name, "i2c-%d", &entry.number) != 1) {
> - continue;
> - }
> -
> sensors_add_proc_bus(&entry);
> }
>
>
>
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [lm-sensors] [PATCH 3/6] libsensors4: Don't substitute the isa
2007-08-15 15:40 [lm-sensors] [PATCH 3/6] libsensors4: Don't substitute the isa bus Jean Delvare
2007-08-15 16:56 ` [lm-sensors] [PATCH 3/6] libsensors4: Don't substitute the isa Hans de Goede
@ 2007-08-16 7:40 ` Jean Delvare
1 sibling, 0 replies; 3+ messages in thread
From: Jean Delvare @ 2007-08-16 7:40 UTC (permalink / raw)
To: lm-sensors
Hi Hans,
On Wed, 15 Aug 2007 18:56:36 +0200, Hans de Goede wrote:
> Jean Delvare wrote:
> > Don't handle the isa bus in sensors_parse_i2cbus_name(). We really
> > don't need to, as there is a single ISA bus, there's no need for
> > substituting anything.
>
> This one requires deeper knowledge of libsensors then I have.
Bus substitution is how we addressed the fact that i2c bus numbers can
change across reboots. With bus statements in sensors.conf, you can
give an arbitrary (and persistent) bus number to an i2c bus based on
it's name. After that, whenever you refer to that bus number in the
configuration file (in a chip statement), it will mean that bus, even if
the current bus numbering is different. This mechanism is very useful
when you have similar I2C hardware monitoring chips on different buses
and each needs a specific configuration.
This bus substitution mechanism would also presumably be useful for
other bus types where several buses can exist on the system (w1, spi),
but for ISA, there can really be only one isa bus, so there's no risk
of bus number changing across reboot.
Not too sure about the PCI bus. So far I assumed that there was only
one, but it seems that on big systems there can be several.
As a side note, the i2c bus number substitution is only done for the
configuration file at the moment. If you want to specify a chip name on
sensors' command line, you still must use the bus numbers of the
running system. This should probably be changed. I'll create a ticket
for this.
--
Jean Delvare
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-08-16 7:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-15 15:40 [lm-sensors] [PATCH 3/6] libsensors4: Don't substitute the isa bus Jean Delvare
2007-08-15 16:56 ` [lm-sensors] [PATCH 3/6] libsensors4: Don't substitute the isa Hans de Goede
2007-08-16 7:40 ` Jean Delvare
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.