On Tue, Apr 15, 2014 at 01:54:02PM +0200, Boris BREZILLON wrote: > On 15/04/2014 12:09, Mark Brown wrote:
> > OK, so if this a realistic issue then it seems like it's better to > > implement three different buses - there is not really any common code > > between the various paths. > Okay, I'll create 4 different busses (one for each access type). > BTW, should I keep these implementations in the same source file > (regmap-smbus.c) ? > And, should I keep one method to register an smbus regmap or should I > provide one method per access type and get rid of the > regmap_smbus_transfer_type enum ? Do something that looks tasteful in implementation. > > This would also mean that you avoid having > > gather write when it can't be implemented. > Correct me if I'm wrong, but they all support gather write. Everything except for the block transfers is writing one register at a time, actually looking again everything that can only write one register at a time ought not to be implementing the buffer based stuff at all and should instead be hooked into reg_read() and reg_write() - it's not able to implement the API properly in any of the cases, it's unpacking the buffer which the upper level code already supports. > > The code is also not validating the lengths for two byte values. > I'm not sure I get this one. > Do you mean I should check that val_size is a 2 byte multiple ? > If this is what you meant, then I should also check it for block transfers. Yes.
signature.asc
Description: Digital signature