Changeset 4337

Show
Ignore:
Timestamp:
03/03/07 16:58:21 (2 years ago)
Author:
khali
Message:

library: Handle the i2c-isa case properly even after the class_dev
removal. In recent kernels we can detect i2c-isa devices by checking
the i2c bus number: i2c-isa always uses 9191 as its bus number.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • lm-sensors/trunk/CHANGES

    r4335 r4337  
    77            planned struct class_dev removal from future 2.6 kernels. 
    88           Add support for the SMSC LPC47M292 fans (prefix smsc47m2) 
     9           Recognize i2c-isa-based devices as such even after class_dev 
     10            is gone 
    911  Man page i2cdetect.8: Scanning range can be restricted 
    1012  Module bmcsensors: Fix debugging messages 
  • lm-sensors/trunk/lib/sysfs.c

    r4326 r4337  
    7676        if (sscanf(dev->name, "%d-%x", &entry.name.bus, &entry.name.addr) == 2) { 
    7777                /* find out if legacy ISA or not */ 
    78                 snprintf(bus_path, sizeof(bus_path), 
     78                if (entry.name.bus == 9191) 
     79                        entry.name.bus = SENSORS_CHIP_NAME_BUS_ISA; 
     80                else { 
     81                        snprintf(bus_path, sizeof(bus_path), 
    7982                                "%s/class/i2c-adapter/i2c-%d/device/name", 
    8083                                sensors_sysfs_mount, entry.name.bus); 
    8184 
    82                 if ((bus_attr = sysfs_open_attribute(bus_path))) { 
    83                         if (sysfs_read_attribute(bus_attr)) 
    84                                 return -SENSORS_ERR_PARSE; 
    85  
    86                         if (bus_attr->value && !strncmp(bus_attr->value, "ISA ", 4)) 
    87                                 entry.name.bus = SENSORS_CHIP_NAME_BUS_ISA; 
    88  
    89                         sysfs_close_attribute(bus_attr); 
     85                        if ((bus_attr = sysfs_open_attribute(bus_path))) { 
     86                                if (sysfs_read_attribute(bus_attr)) 
     87                                        return -SENSORS_ERR_PARSE; 
     88 
     89                                if (bus_attr->value 
     90                                 && !strncmp(bus_attr->value, "ISA ", 4)) 
     91                                        entry.name.bus = SENSORS_CHIP_NAME_BUS_ISA; 
     92 
     93                                sysfs_close_attribute(bus_attr); 
     94                        } 
    9095                } 
    9196        } else if (sscanf(dev->name, "%*[a-z0-9_].%d", &entry.name.addr) == 1) {