two kernel modules for the same device address in dts

Tomek The Messenger tomekthemessenger at gmail.com
Tue Apr 7 09:26:06 EDT 2020


Hi
I am trying to design some functionality and I wonder if something like
that is supported in dts and linux:

&i2c1 {
default_device: default_device at 75 {
    compatible = "some-name-never-mind";
     reg = <0x75>;
};
my_device: my_device at 0 {
compatible = "my-device-which-do-only-some-minor-part";
reg = <0x75>;
};
};

You know what I mean, is it possible to declare in dts two kernel modules
for the same device with the same address? I don't want to extend
default_device functionality, I want put my functionality in separate
kernel module. I am currently in the middle of implementation but I wonder
if it has sense. Both kernel modules will have in fact:
probe(struct i2c_client *client, ...), I wonder if probe won't fail. At
least in user space shell "i2cdetect -r 1" returns UU for address 0x75 when
kernel module is loaded. So that is why I suspect probe might fail.

Another story is what in case somebody asks for access to device at the
same time from two kernel modules. I hope function:
i2c_smbus_write_byte_data
has some kind of spinlock, mutexes and just wait till bus is free, but who
knows.:)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20200407/b41bd5b8/attachment.html>


More information about the Kernelnewbies mailing list