> > Own module: Again, undecided. On the one hand it makes for a nice > > encapsulation, on the other hand there is overhead for having another > > module. I am very happy that the core code for slave support is so slim. > > I gave a try to the separate module approach and I have to agree that > it seems overkill given the small amount of code. OK, thanks for trying! > Something like this? Yes, pretty much what I had in mind. One issue, though: > +#if IS_ENABLED(CONFIG_I2C_SLAVE) > enum i2c_slave_event { > I2C_SLAVE_REQ_READ_START, > I2C_SLAVE_REQ_READ_END, > @@ -263,6 +266,7 @@ static inline int i2c_slave_event(struct > { > return client->slave_cb(client, event, val); > } > +#endif This should fail because bus drivers need those enums for their slave backend. Try building i2c-sh_mobile which builds with an x86 toolchain as well. * Either we leave this included, so bus drivers don't need any ifdeffery or * we mandate that bus drivers also use the ifedeffery. Then, we could also mask out the (un)reg_slave callbacks in struct i2c_adapter What do you think?
Attachment:
signature.asc
Description: Digital signature