[i2c] [PATCH 0/4] i2c: Introduce i2c listeners
Jon Smirl
jonsmirl at gmail.com
Thu Jun 5 16:30:05 CEST 2008
On 6/5/08, Jean Delvare <khali at linux-fr.org> wrote:
> > Doesn't something like this work? (obviously this isn't complete)
> >
> > for (address = start; address <= stop;) {
> > make a new client
> > for (; address <=stop; address++) {
> > client->address = address;
> > res = device_register(&client->dev);
> > if (res != -ENODEV)
> > break;
> > }
> > }
> > delete the extra client
>
>
> You don't seriously propose to scan all addresses on every I2C bus for
> every i2c chip driver that we load, do you? This would be awfully slow
> and dangerous. No way.
This is just a small part of the code, you need to add in all the
other parts from the patch.
Exactly the same addresses would be scanned under each scheme. .My
question is, does the driver need two entry points (detect and probe)
or could only one (probe) be used? I think detect and probe can be the
same function.
With the detect() function it would look somthing like this:
for (address = start; address <= stop;) {
for (; address <=stop; address++) {
do a generic detect
if (driver->detect(address) {
make a new client
client->address = address;
res = device_register(&client->dev);
if (!res)
delete the extra client
}
}
}
--
Jon Smirl
jonsmirl at gmail.com
More information about the i2c
mailing list