libi2c device probing capability
Alexandru-Sever Horin
alex.sever.h at gmail.com
Wed Apr 1 14:31:56 UTC 2015
Hello,
I am currently working on a project which uses I2C devices through libi2c
API.
The problem that I am facing is that this function:
rtems_libi2c_register_drv actually registeres the device before
drvtbl->ops->initialization_entry returns success or failure. This means
that it is impossible to probe a device which might be at 2 different I2C
addreses on different PCB revisions.
For a device driver with no initialization function it should make no
difference, the function call being ignored, and the minor being returned.
If the device driver has a initialization function, it calls it and makes
sure that the return value is 0 before registering the name. If it returns
something different than RTEMS_SUCCESS, it makes sure the driver
registration returns negative error code (so it's not mistaken with minor
number), and does not register the device driver.
I have attached a patch to solve this problem, and bypass device
registration in the filesystem if the initialziation fails.
Please review the changes and merge if you agree.
Thank you,
Alex H.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20150401/364b9cb6/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-libi2c-registration-of-a-device-fails-if-the-device-.patch
Type: text/x-patch
Size: 1915 bytes
Desc: not available
URL: <http://lists.rtems.org/pipermail/devel/attachments/20150401/364b9cb6/attachment-0001.bin>
More information about the devel
mailing list