阻止I2C设备被配置为从设备两次

时间:2015-12-22 16:37:11

标签: linux kernel driver i2c slave

我一直在使用Wolfram Sang的I2C Slave代码将linux(设计软件)设备驱动程序配置为I2C从设备。 它一直在努力,但我考虑以下'错误':我想知道I2C设备没有被配置为从设备两次。所以当有人尝试时,我让i2c_slave_register返回-EBUSY。但是,这并不妨碍I2C内核注册客户端!

i2c-slave-eeprom 0-1063: probe
i2c_designware ffc04000.i2c: adapter already configured as slave
i2c-slave-eeprom 0-1063: i2c_slave_register: adapter returned error -16
i2c-slave-eeprom: probe of 0-1063 failed with error -16
i2c i2c-0: client [slave-24c02] registered with bus id 0-1063
i2c i2c-0: new_device: Instantiated device slave-24c02 at 0x63

我发现这个问题是由于real_probe和driver_probe_device(dd.c)的实现造成的。即使发生错误,这两个函数也会返回0! 这似乎是一个特定的选择(例如,参见https://lkml.org/lkml/2006/10/17/72)......但是,我应该如何阻止核心注册此客户端? (或者我不应该?)

0 个答案:

没有答案