From c44b1691cce478c2154fbf3195f138f5bf39cdb6 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Tue, 16 Mar 2004 19:28:40 +0000 Subject: [PATCH] Check for capabilities before using them. Reported by Aurelien Jarno. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@2360 7894878c-1315-0410-8ee3-d5d059ff63e0 --- kernel/chips/ds1621.c | 3 ++- kernel/chips/pcf8591.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/kernel/chips/ds1621.c b/kernel/chips/ds1621.c index f0164669..b69cd968 100644 --- a/kernel/chips/ds1621.c +++ b/kernel/chips/ds1621.c @@ -183,7 +183,8 @@ int ds1621_detect(struct i2c_adapter *adapter, int address, #endif if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA | - I2C_FUNC_SMBUS_WORD_DATA)) + I2C_FUNC_SMBUS_WORD_DATA | + I2C_FUNC_SMBUS_WRITE_BYTE)) goto ERROR0; /* OK. For now, we presume we have a valid client. We now create the diff --git a/kernel/chips/pcf8591.c b/kernel/chips/pcf8591.c index 383fa2bf..8e63befa 100644 --- a/kernel/chips/pcf8591.c +++ b/kernel/chips/pcf8591.c @@ -179,7 +179,8 @@ int pcf8591_detect(struct i2c_adapter *adapter, int address, } #endif - if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE)) + if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE + | I2C_FUNC_SMBUS_WRITE_BYTE_DATA)) goto ERROR0; /* OK. For now, we presume we have a valid client. We now create the