From a0d41dc880e12f9120fc64b573cb081fe05c9412 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Thu, 15 Feb 2007 11:58:53 +0000 Subject: [PATCH] libsensors: Do not skip i2c adapters with only a class device and no physical device. This change is required to survive the planned struct class_dev removal from future 2.6 kernels. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@4326 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 3 +++ lib/sysfs.c | 5 ++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index db02cb00..dc899adc 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,9 @@ lm_sensors CHANGES file ----------------------- SVN HEAD + Library: Do not skip i2c adapters with only a class device and no + physical device. This change is required to survive the + planned struct class_dev removal from future 2.6 kernels. Man page i2cdetect.8: Scanning range can be restricted Module bmcsensors: Fix debugging messages Module i2c-ali1563: Improve the status messages (2.6 backport) diff --git a/lib/sysfs.c b/lib/sysfs.c index b2d06683..9854d3e9 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -195,13 +195,12 @@ int sensors_read_sysfs_bus(void) struct sysfs_device *dev; struct sysfs_attribute *attr; - if (!(dev = sysfs_get_classdev_device(clsdev))) - continue; /* Get the adapter name from the classdev "name" attribute * (Linux 2.6.20 and later). If it fails, fall back to * the device "name" attribute (for older kernels). */ if (!(attr = sysfs_get_classdev_attr(clsdev, "name")) - && !(attr = sysfs_get_device_attr(dev, "name"))) + && !((dev = sysfs_get_classdev_device(clsdev)) && + (attr = sysfs_get_device_attr(dev, "name")))) continue; /* NB: attr->value[attr->len-1] == '\n'; chop that off */