From: Jean Delvare Date: Tue, 16 Oct 2007 08:28:18 +0000 (-0700) Subject: rtc-pcf8583: Check for i2c adapter functionality X-Git-Tag: v2.6.24-rc1~966 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c018664c51aca418e16bc83f75257c68250fb052;p=linux-2.6 rtc-pcf8583: Check for i2c adapter functionality Not all i2c adapters support I2C-level messaging. Check that the adapter does before probing for a PCF8583 chip, as the driver makes use of i2c_transfer and i2c_master_send. Signed-off-by: Jean Delvare Signed-off-by: Alessandro Zummo Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/rtc/rtc-pcf8583.c b/drivers/rtc/rtc-pcf8583.c index d48b033745..556d0e7da3 100644 --- a/drivers/rtc/rtc-pcf8583.c +++ b/drivers/rtc/rtc-pcf8583.c @@ -332,6 +332,9 @@ static int pcf8583_probe(struct i2c_adapter *adap, int addr, int kind) } }; + if (!i2c_check_functionality(adap, I2C_FUNC_I2C)) + return 0; + pcf = kzalloc(sizeof(*pcf), GFP_KERNEL); if (!pcf) return -ENOMEM;