[i2c] I2C Warning on a 405GPr based board with actual 2.6.20-rc5 Kernel

Jean Delvare khali at linux-fr.org
Mon Jan 22 17:54:55 CET 2007


Hi Heiko,

On Fri, 19 Jan 2007 12:48:40 +0100, Heiko Schocher wrote:
> I have a 405Gpr based Board and use the I2C Bus. Today I tried the Linux
> Kernel version 2.6.20-rc5, and get the following Warning:
> 
> i2c /dev entries driver
> IBM IIC driver v2.1
> **WARNING** I2C adapter driver [IBM IIC] forgot to specify physical
> device; fix it!
> ibm-iic0: using standard (100 kHz) mode

Thanks for reporting!

> Hmm.. I solved it with the following patch, but I don t know if this is
> the right way.
> 
> diff --git a/drivers/i2c/busses/i2c-ibm_iic.c b/drivers/i2c/busses/i2c-ibm_iic.c
> index 1898e99..140d7fe 100644
> --- a/drivers/i2c/busses/i2c-ibm_iic.c
> +++ b/drivers/i2c/busses/i2c-ibm_iic.c
> @@ -35,6 +35,7 @@
>  #include <linux/slab.h>
>  #include <linux/init.h>
>  #include <linux/interrupt.h>
> +#include <linux/platform_device.h>
>  #include <asm/irq.h>
>  #include <asm/io.h>
>  #include <linux/i2c.h>
> @@ -737,6 +738,9 @@ static int __devinit iic_probe(struct ocp_device *ocp){
>  	adap->timeout = 1;
>  	adap->retries = 1;
>  
> +	if (adap->dev.parent == NULL) {
> +		adap->dev.parent = &platform_bus;
> +	}
>  	if ((ret = i2c_add_adapter(adap)) != 0){
>  		printk(KERN_CRIT "ibm-iic%d: failed to register i2c adapter\n",
>  			dev->idx);

Err, no, it's not correct, sorry. You're doing exactly what we want to
stop doing in i2c-core, so even if you no longer see the warning, the
driver will still break when we update i2c-core.

Please try the following patch instead, it should keep i2c-core quiet,
and your i2c adapter should even show at the correct location in sysfs:

* * * * *

Properly declare the IBM IIC bus' parent device. Otherwise i2c-core
keeps shouting on us.

Signed-off-by: Jean Delvare <khali at linux-fr.org>
---
 drivers/i2c/busses/i2c-ibm_iic.c |    1 +
 1 file changed, 1 insertion(+)

--- linux-2.6.20-rc5.orig/drivers/i2c/busses/i2c-ibm_iic.c	2007-01-22 17:36:10.000000000 +0100
+++ linux-2.6.20-rc5/drivers/i2c/busses/i2c-ibm_iic.c	2007-01-22 17:37:34.000000000 +0100
@@ -727,6 +727,7 @@ static int __devinit iic_probe(struct oc
 	
 	/* Register it with i2c layer */
 	adap = &dev->adap;
+	adap->dev.parent = &ocp->dev;
 	strcpy(adap->name, "IBM IIC");
 	i2c_set_adapdata(adap, dev);
 	adap->id = I2C_HW_OCP;



-- 
Jean Delvare



More information about the i2c mailing list