i2c-core error messages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Kai,

On 2006-03-06, Kai Svahn wrote:
> > Which version of the i2c-core.c file are you referring to, please? The
> > file Linux 2.6.16-rc5 has an i2c_probe function which properly returns
> > errors.
>
> I have rc5 and I found a problem here
> static int i2c_probe_address(struct i2c_adapter *adapter, int addr,
>         int kind, int (*found_proc) (struct i2c_adapter *,int, int)

Ah, so it was function i2c_probe_address, not i2c_probe.

> ---line 664---
> if (kind < 0) {
> 	if (i2c_smbus_xfer(adapter, addr, 0, 0, 0,
> 		          I2C_SMBUS_QUICK, NULL) < 0)
> 		return 0;
> }
> ---
> Shouldn't it be something like, or have I misunderstood something here?
> 
> if (kind < 0) {
> 	if ((err = (i2c_smbus_xfer(adapter, addr, 0, 0, 0,
> 	                           I2C_SMBUS_QUICK, NULL)) < 0)
> 		return err;
> }

No, we return 0 on purpose.

Each driver lists the possible addresses for the device(s) it supports.
More often than not, only one of these addresses will hold a real chip
on a given system (unless the same chip is used several times in a given
design.) Other address probes are expected to fail, so this is not an
error.

The real problem here is that the design of our probing mechanism is not
suitable for every design. When you know where your chip is, it's a bit
frustrating that you have to let the i2c-core probe and find out by
itself, especially when it makes it harder to detect errors.

A new explicit attach method is being worked on (for quite some time
now...) which should hopefully help in this type of situation. A
preliminary patch can be seen here:
http://khali.linux-fr.org/devel/i2c/linux-2.6/i2c-probe-04-explicit-attach.patch
But I need some real life uses to make sure it's properly designed. I
wanted to experiment on the zoran media/video driver, but didn't quite
find the time to do that yet.

Thanks,
--
Jean Delvare




[Index of Archives]     [Linux Kernel]     [Linux Hardware Monitoring]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux