Ben Dooks wrote: > On Sun, Jan 24, 2010 at 06:33:20PM +0100, Richard R?jfors wrote: >> >>>> + >>>> +#define XIIC_MSB_OFFSET 0 >>>> +#define XIIC_REG_OFFSET (0x100+XIIC_MSB_OFFSET) >>> givevn you're running everything through indirect read/write calls, >>> how about doing it in there? >> Could do, bad thing is that it would add in an addition during runtime >> rather than having the C preprocessor doing it. >> >> I think I would like to leave it as is. >> >> What do you think? > > Compilers aren't that stupid nowadays, they can generally sort this > thing out at compile time, esepcially with inline code. Try it and > see what happens... If a constant value needs to be added to the sum of two input parameters of a function, I don's see any option for the compiler but add it runtime. >>>> + >>>> + /* add in known devices to the bus */ >>>> + for (i = 0; i < pdata->num_devices; i++) >>>> + i2c_new_device(&i2c->adap, pdata->devices + i); >>> wouldn't i2c_register_board_info() do the job for you too? >> No actually not, we had a discussion about this like 6-9 months ago, >> when I posted the similar solution as a patch to ocores. Problem is that >> we don't know the bus number in advance and in theory several boards >> containing the I2C bus could in theory show up. >> I would like to see the same solution here. > > Sorry, you've just registered the bus so should now know the number? Ahh, you mean to call i2c_register_board_info in here after the i2c_add_adapter call? The boardinfo list is only checked when adding the adapter. Adding the boardinfo afterwards has no effect. A second problem would be that every time we probe we would append the same boardinfo again... (the device could be removed and come back). We can not do the register_board_info before adding the adapter because then we don't know the bus number. --Richard -- To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html