From bd63a9d9fc480452d1db9ff158658f214f8cdda2 Mon Sep 17 00:00:00 2001 From: "Mark D. Studebaker" Date: Sat, 9 Jun 2001 00:36:07 +0000 Subject: [PATCH] add check for duplicate subclient addresses and add printk's to report subclient registration failures git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@1127 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 7 +++++-- kernel/chips/w83781d.c | 16 ++++++++++++---- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/CHANGES b/CHANGES index b8b92929..05390f66 100644 --- a/CHANGES +++ b/CHANGES @@ -24,6 +24,7 @@ ask CVS about it: File doc/FAQ: Many, many updates and additions File doc/busses/i2c-sis5595: new File doc/busses/i2c-tsunami: new + File doc/chips/it87: new File doc/chips/via686a: Claim support for 686b. File README.thinkpad: new File sensors.conf.eg: Adjust as99127f in5 (-12V) and temp2 calculations; @@ -37,7 +38,8 @@ ask CVS about it: Add support for maxilife-nba and amd1024; Change from sensors_* to i2c_* globals for new i2c-proc.[ch] Chip Modules (all ISA): Remove #include "i2c-isa.h" - Chip Modules (all): Change from sensors_* to i2c_* globals for new i2c-proc.[ch] + Chip Modules (all): Change from sensors_* to i2c_* globals + for new i2c-proc.[ch] Makefiles: enhance to support Alpha architecture Module adm1021: Fix lm84 and gl523sm support Module adm1024: new @@ -60,7 +62,8 @@ ask CVS about it: Allow force_addr=0xaddr Module via686a: Allow force_addr=0xaddr (for A7V/K7V boards) Module w83781d: Don't reinitialize as99127f chip; this may cause fan/temp - reading changes + reading changes; Add messages for subclient + registration failure Programs i2cdetect, i2cdump: add devfs /dev/i2c/x support Program i2cset: new Program isadump: fix for Alpha arch. compiles diff --git a/kernel/chips/w83781d.c b/kernel/chips/w83781d.c index 67165f02..c4debc80 100644 --- a/kernel/chips/w83781d.c +++ b/kernel/chips/w83781d.c @@ -885,11 +885,17 @@ int w83781d_detect(struct i2c_adapter *adapter, int address, err = -ENOMEM; goto ERROR4; } - val1 = - w83781d_read_value(new_client, - W83781D_REG_I2C_SUBADDR); + val1 = w83781d_read_value(new_client, + W83781D_REG_I2C_SUBADDR); data->lm75[0].addr = 0x48 + (val1 & 0x07); - data->lm75[1].addr = 0x48 + ((val1 >> 4) & 0x07); + if (kind != w83783s) { + data->lm75[1].addr = 0x48 + ((val1 >> 4) & 0x07); + if(data->lm75[0].addr == data->lm75[1].addr) { + printk("w83781d.o: Duplicate addresses 0x%x for subclients.\n", + data->lm75[i].addr); + goto ERROR5; + } + } if (kind == w83781d) client_name = "W83781D subclient"; else if (kind == w83782d) @@ -909,6 +915,8 @@ int w83781d_detect(struct i2c_adapter *adapter, int address, strcpy(data->lm75[i].name, client_name); data->lm75[i].id = w83781d_id++; if ((err = i2c_attach_client(&(data->lm75[i])))) { + printk("w83781d.o: Subclient %d registration at address 0x%x failed.\n", + i, data->lm75[i].addr); if (i == 1) goto ERROR6; else