Hi

I'm working on a proof-of-concept device which contains several chips connected 
to the same adapter (/dev/ic2-0) on the I2C bus. Some of these have 
kernel-space drivers (e.g. GPIO Expander) and some don't. For the ones that 
don't I've opted to use the method described in the kernel 
Documentation/i2c/dev-interface document. This works great and does all I need 
for now. This is the general procedure I'm following as outlined in kernel - 
Documentation/i2c/dev-interface. 

- open /dev/i2c-N
- Set the chip's address by calling ioctl(file, I2C_SLAVE, address)
- interact with the chip using read/write or smb calls, etc.
- close the file when done

I'm assuming that a kernel space chip driver like our gpio expander (pca953x.c) 
also uses the same adapter driver as my user-space application since that 
expander chip is on the same bus. My question is, what happens if a kernel 
driver is using the bus at the same time my user-mode application is? Even if 
the user space app. may not be running when the chip driver runs, the adapter 
has an address written into it via the ioctl() call, I noted above. Can 
unpredictable results occur in this scenario? I think I could protect against 
it by writing a thread to serialize accesses to the I2C bus, but that only 
works if my entire application is running inside one process. I'm hoping 
someone on the list might be able to advise. 

Regards,

Rory
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to