From 2c0ca7852a9f77d955b198aaf6f18334baa62744 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sat, 10 Sep 2005 20:27:20 +0000 Subject: [PATCH] Drop Linux-2.6 specific eeprom code, as we no longer support eeproms on 2.6. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@3082 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/proc.c | 56 +++++++++++++----------------------------------------- 1 file changed, 13 insertions(+), 43 deletions(-) diff --git a/lib/proc.c b/lib/proc.c index 13f76eff..2a78993f 100644 --- a/lib/proc.c +++ b/lib/proc.c @@ -17,11 +17,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* for open() */ -#include -#include -#include - #include #include #include @@ -367,14 +362,13 @@ int sensors_get_chip_id(sensors_chip_name name) /* This reads a feature /proc or /sys file. Sysfs uses a one-value-per file system... - except for eeprom, which puts the entire eeprom into one file. */ int sensors_read_proc(sensors_chip_name name, int feature, double *value) { int sysctl_name[4] = { CTL_DEV, DEV_SENSORS }; const sensors_chip_feature *the_feature; int buflen = BUF_LEN; - int mag, eepromoffset, fd, ret=0; + int mag; if(!foundsysfs) if ((sysctl_name[2] = sensors_get_chip_id(name)) < 0) @@ -386,42 +380,18 @@ int sensors_read_proc(sensors_chip_name name, int feature, double *value) FILE *f; strcpy(n, name.busname); strcat(n, "/"); - /* total hack for eeprom */ - if (! strcmp(name.prefix, "eeprom")){ - strcat(n, "eeprom"); - /* we use unbuffered I/O to benefit from eeprom driver - optimization */ - if ((fd = open(n, O_RDONLY)) >= 0) { - eepromoffset = - (the_feature->offset / sizeof(long)) + - (16 * (the_feature->sysctl - EEPROM_SYSCTL1)); - if (lseek(fd, eepromoffset, SEEK_SET) < 0 - || read(fd, &ret, 1) != 1) { - close(fd); - return -SENSORS_ERR_PROC; - } - close(fd); - *value = ret; - return 0; - } else - return -SENSORS_ERR_PROC; - } else { - strcpy(altn, n); - /* use rindex to append sysname to n */ - getsysname(the_feature, rindex(n, '\0'), &mag, rindex(altn, '\0')); - if ((f = fopen(n, "r")) != NULL - || (f = fopen(altn, "r")) != NULL) { - fscanf(f, "%lf", value); - fclose(f); - for (; mag > 0; mag --) - *value /= 10.0; - // fprintf(stderr, "Feature %s value %lf scale %d offset %d\n", - // the_feature->name, *value, - // the_feature->scaling, the_feature->offset); - return 0; - } else - return -SENSORS_ERR_PROC; - } + strcpy(altn, n); + /* use rindex to append sysname to n */ + getsysname(the_feature, rindex(n, '\0'), &mag, rindex(altn, '\0')); + if ((f = fopen(n, "r")) != NULL + || (f = fopen(altn, "r")) != NULL) { + fscanf(f, "%lf", value); + fclose(f); + for (; mag > 0; mag --) + *value /= 10.0; + return 0; + } else + return -SENSORS_ERR_PROC; } else { sysctl_name[3] = the_feature->sysctl; if (sysctl(sysctl_name, 4, buf, &buflen, NULL, 0))